/* GitOky Store — Dark theme */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0d1117;
    --bg-card: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --green: #238636;
    --green-hover: #2ea043;
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar is handled by /static/common.css (gk-header) */

/* ── Main ── */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
    flex: 1;
    width: 100%;
}

/* ── Store Header (Search + Tabs) ── */
.store-header { margin-bottom: 24px; }
.search-form {
    display: flex; gap: 8px; margin-bottom: 16px;
}
.search-input {
    flex: 1; padding: 10px 14px; font-size: 14px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text); outline: none;
}
.search-input:focus { border-color: var(--accent); }
.search-btn {
    padding: 10px 20px; font-size: 14px;
    background: var(--green); border: none; border-radius: 6px;
    color: #fff; cursor: pointer; font-weight: 600;
}
.search-btn:hover { background: var(--green-hover); }

.category-tabs { display: flex; gap: 8px; overflow-x: auto; }
.cat-tab {
    padding: 6px 14px; font-size: 13px; font-weight: 500;
    border-radius: 20px; border: 1px solid var(--border);
    color: var(--text-muted); white-space: nowrap;
}
.cat-tab:hover { color: var(--text); border-color: var(--text-muted); text-decoration: none; }
.cat-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Carousel ── */
.carousel {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 32px;
    height: 280px;
    background: var(--bg-card);
}
.carousel-track {
    display: flex;
    height: 100%;
    transition: transform .5s cubic-bezier(.4,0,.2,1);
}
.carousel-slide {
    min-width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.carousel-img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.carousel-placeholder {
    font-size: 80px;
    color: var(--text-muted);
    opacity: .3;
}
.carousel-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0,0,0,.8));
    color: #fff;
}
.carousel-overlay h3 { font-size: 20px; margin-bottom: 4px; }
.carousel-overlay span { font-size: 13px; opacity: .8; }
.carousel-prev, .carousel-next {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px;
    border-radius: 50%; border: 1px solid rgba(255,255,255,.3);
    background: rgba(0,0,0,.5); color: #fff;
    font-size: 18px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.carousel-prev { left: 12px; }
.carousel-next { right: 12px; }
.carousel-dots {
    position: absolute; bottom: 12px; left: 50%;
    transform: translateX(-50%);
    display: flex; gap: 6px;
}
.carousel-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,.4);
    cursor: pointer;
}
.carousel-dot.active { background: #fff; }

/* ── Sections ── */
.store-section { margin-bottom: 32px; }
.section-title {
    font-size: 18px; font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

/* ── App Grid ── */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .15s, box-shadow .15s;
    color: var(--text);
}
.app-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.4);
    text-decoration: none;
}
.app-card-thumb {
    height: 140px;
    background: #1c2128;
    display: flex; align-items: center; justify-content: center;
    position: relative;
    overflow: hidden;
}
.app-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.app-card-emoji { font-size: 48px; opacity: .4; }
.app-card-body { padding: 12px; }
.app-card-title {
    font-size: 14px; font-weight: 600;
    margin-bottom: 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-card-meta {
    font-size: 12px; color: var(--text-muted);
    display: flex; gap: 8px;
}
.draft-badge {
    position: absolute; top: 8px; right: 8px;
    padding: 2px 8px; font-size: 11px;
    background: #da3633; color: #fff;
    border-radius: 4px; font-weight: 600;
}

/* ── Detail page ── */
.back-link {
    display: inline-block; margin-bottom: 16px;
    font-size: 14px; color: var(--text-muted);
}
.detail-header {
    display: flex; gap: 24px; margin-bottom: 24px;
}
.detail-thumb {
    width: 200px; height: 200px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.detail-thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-thumb-placeholder { font-size: 64px; opacity: .3; }
.detail-info { flex: 1; }
.detail-title { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.detail-author { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-stats { font-size: 13px; color: var(--text-muted); display: flex; gap: 12px; }
.detail-badge {
    padding: 2px 8px; font-size: 12px;
    border: 1px solid var(--border); border-radius: 12px;
}
.detail-section { margin-bottom: 24px; }
.detail-section h2 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.detail-desc { font-size: 14px; color: var(--text-muted); line-height: 1.7; }
.detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tag {
    padding: 3px 10px; font-size: 12px;
    background: #1c2128; border: 1px solid var(--border);
    border-radius: 12px; color: var(--text-muted);
}
.detail-fork-info {
    font-size: 13px; color: var(--text-muted);
    margin-bottom: 16px; font-style: italic;
}
.preview-frame-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 400px;
}
.preview-frame { width: 100%; height: 600px; border: none; background: #fff; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 7px 14px; font-size: 13px;
    border-radius: 6px; border: 1px solid var(--border);
    cursor: pointer; color: var(--text); background: #21262d;
    font-weight: 500;
}
.btn:hover { background: #30363d; text-decoration: none; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-hover); }
.btn-vote.active { border-color: var(--accent); color: var(--accent); }

/* ── Comments ── */
.comment-sort { display: flex; gap: 8px; margin-bottom: 12px; }
.sort-btn {
    padding: 4px 12px; font-size: 12px;
    border-radius: 4px; border: 1px solid var(--border);
    background: transparent; color: var(--text-muted); cursor: pointer;
}
.sort-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.comment-form { margin-bottom: 20px; }
.comment-form textarea {
    width: 100%; padding: 10px; font-size: 14px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text);
    resize: vertical; min-height: 80px;
}
.comment-form-actions { margin-top: 8px; text-align: right; }

.comment {
    padding: 12px 0;
    border-bottom: 1px solid #21262d;
}
.comment.reply { padding-left: 24px; border-bottom: none; }
.comment-header { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.comment-author { font-size: 13px; font-weight: 600; }
.comment-time { font-size: 12px; color: var(--text-muted); }
.comment-content { font-size: 14px; margin-bottom: 6px; }
.comment-actions { display: flex; gap: 8px; }
.comment-actions button {
    font-size: 12px; padding: 2px 8px;
    background: none; border: 1px solid var(--border);
    border-radius: 4px; color: var(--text-muted); cursor: pointer;
}
.comment-actions button:hover { color: var(--text); }
.comment-replies { margin-top: 8px; }
.login-prompt { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }

/* ── My Page ── */
.my-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.my-header h1 { font-size: 24px; }
.my-filters { display: flex; gap: 8px; margin-bottom: 20px; }
.filter-btn {
    padding: 6px 14px; font-size: 13px;
    border-radius: 6px; border: 1px solid var(--border);
    background: transparent; color: var(--text-muted); cursor: pointer;
}
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.empty-state { text-align: center; padding: 60px 20px; grid-column: 1/-1; }
.empty-state p { color: var(--text-muted); margin-bottom: 16px; }
.empty-msg { color: var(--text-muted); grid-column: 1/-1; text-align: center; padding: 40px; }
.explore-section { padding-top: 8px; border-top: 1px solid var(--border); }
.infinite-status { padding: 28px 0 8px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* Footer is handled by /static/common.css (gk-footer) */

/* ── Mobile ── */
@media (max-width: 768px) {
    .main-content { padding: 16px 12px; }
    .detail-header { flex-direction: column; }
    .detail-thumb { width: 100%; height: 200px; }
    .carousel { height: 200px; }
    .app-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* ── Scrollbar ── */
* { scrollbar-width: thin; scrollbar-color: #484f58 #161b22; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #161b22; }
::-webkit-scrollbar-thumb { background: #484f58; border-radius: 3px; }
