:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a25;
    --bg-card-hover: #1f1f2e;
    --bg-input: #0f0f17;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-soft: rgba(99, 102, 241, 0.1);
    --green: #10b981;
    --green-soft: rgba(16, 185, 129, 0.1);
    --red: #ef4444;
    --red-soft: rgba(239, 68, 68, 0.1);
    --yellow: #f59e0b;
    --text: #e2e8f0;
    --text-secondary: #b0b8c8;
    --text-muted: #6b7280;
    --border: #1e1e2e;
    --border-hover: #2d2d42;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ── Header ── */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.nav { display: flex; align-items: center; gap: 8px; }

.nav a {
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav a:hover {
    color: var(--text);
    background: var(--accent-soft);
}

.nav a.active {
    color: var(--accent);
    background: var(--accent-soft);
}

/* ── Hero ── */
.hero {
    text-align: center;
    padding: 80px 0 20px;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.15rem;
    max-width: 500px;
    margin: 0 auto;
}

/* ── Stats Bar ── */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 32px 0;
    margin-bottom: 20px;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

/* ── Search ── */
.search-section {
    max-width: 600px;
    margin: 0 auto 48px;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* ── Category Grid ── */
.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 48px;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    transition: var(--transition);
    color: var(--text);
    display: block;
}

.category-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    color: var(--text);
}

.category-icon {
    width: 44px;
    height: 44px;
    background: var(--accent-soft);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-bottom: 16px;
}

.category-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.category-card .desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.category-count {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

/* ── Software List ── */
.software-list { margin: 24px 0; }

.software-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 12px;
    transition: var(--transition);
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.software-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.software-thumb {
    width: 80px;
    height: 80px;
    background: var(--accent-soft);
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    overflow: hidden;
}

.software-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.software-body { flex: 1; min-width: 0; }

.software-body h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.software-body h3 a {
    color: var(--text);
}

.software-body h3 a:hover {
    color: var(--accent);
}

.software-short-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.software-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.software-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.software-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

.download-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: right;
}

/* ── Software Detail Page ── */
.detail-header {
    padding: 40px 0 24px;
}

.detail-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.detail-short-desc {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
    margin: 24px 0;
}

.detail-main { min-width: 0; }

.detail-sidebar {
    position: sticky;
    top: 88px;
    align-self: start;
}

.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

.sidebar-card h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.sidebar-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.sidebar-row:last-child { border-bottom: none; }

.sidebar-row .label { color: var(--text-muted); }
.sidebar-row .value { color: var(--text); font-weight: 500; }

.description-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
}

.description-box h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.description-box .content {
    color: var(--text-secondary);
    line-height: 1.8;
}

.changelog-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}

.changelog-box h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.changelog-box .content {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 0.92rem;
}

.screenshot-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
}

.screenshot-box h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.screenshot-box img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.88rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: white;
    white-space: nowrap;
    line-height: 1.4;
}

.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); color: white; }

.btn-green { background: var(--green); }
.btn-green:hover { background: #059669; color: white; }

.btn-red { background: var(--red); }
.btn-red:hover { background: #dc2626; color: white; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.btn-lg { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; }

/* ── Breadcrumb ── */
.breadcrumb {
    padding: 20px 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { opacity: 0.4; }

/* ── Page Header ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

/* ── Forms ── */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 640px;
    margin: 32px auto;
}

.form-card h2 {
    font-size: 1.3rem;
    margin-bottom: 24px;
    font-weight: 700;
}

.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group textarea { min-height: 140px; resize: vertical; }

.form-group .hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Alerts ── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: var(--green-soft);
    border: 1px solid var(--green);
    color: var(--green);
}

.alert-error {
    background: var(--red-soft);
    border: 1px solid var(--red);
    color: var(--red);
}

/* ── Admin Table ── */
.table-wrap {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.admin-table th {
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    background: var(--bg-secondary);
}

.admin-table tr:last-child td { border-bottom: none; }

.admin-table tr:hover td {
    background: rgba(99, 102, 241, 0.03);
}

/* ── Search Results ── */
.results-info {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.no-results h2 {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ── Badge ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-green { background: var(--green-soft); color: var(--green); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

/* ── Footer ── */
.footer {
    text-align: center;
    padding: 40px 0;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 80px;
    font-size: 0.85rem;
}

.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--text); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .detail-sidebar {
        position: static;
    }
    .software-card {
        flex-direction: column;
    }
    .software-actions {
        flex-direction: row;
        align-items: center;
    }
    .hero h1 { font-size: 2rem; }
    .stats-bar { gap: 24px; }
    .stat-number { font-size: 1.4rem; }
    .header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 0;
        gap: 8px;
    }
    .nav { flex-wrap: wrap; }
}