/* ═══════════════════════════════════════════════════════════════════════════
   Demo Apps — Main Stylesheet
   Theme: Dark-accent tech directory with bold typography
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
    --bg-primary:    #0a0a0f;
    --bg-secondary:  #111118;
    --bg-card:       #16161f;
    --bg-card-hover: #1c1c28;
    --border:        rgba(255,255,255,0.07);
    --border-hover:  rgba(99,102,241,0.4);

    --text-primary:  #f0f0f8;
    --text-secondary:#9898b8;
    --text-muted:    #5a5a78;

    --accent:        #6366f1;
    --accent-glow:   rgba(99,102,241,0.25);
    --accent-2:      #06b6d4;
    --accent-3:      #f59e0b;

    --gradient:      linear-gradient(135deg, #6366f1, #06b6d4);
    --gradient-text: linear-gradient(135deg, #6366f1 0%, #06b6d4 50%, #a855f7 100%);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-card: 0 2px 20px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05);
    --shadow-hover: 0 8px 40px rgba(99,102,241,0.2), 0 0 0 1px rgba(99,102,241,0.2);

    --font-display: 'Syne', sans-serif;
    --font-body:    'Space Grotesk', sans-serif;

    --nav-height: 68px;
}

/* ── Base Reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Typography ────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
}

.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Navbar ────────────────────────────────────────────────────────────────── */
#mainNav {
    background: rgba(10,10,15,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    height: var(--nav-height);
    z-index: 1000;
    transition: background 0.3s;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.brand-icon {
    width: 34px;
    height: 34px;
    background: var(--gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 20px var(--accent-glow);
}

.brand-icon svg { width: 18px; height: 18px; stroke-width: 2.5; }

.brand-text {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.brand-accent { color: var(--accent); }

.nav-link {
    color: var(--text-secondary) !important;
    font-size: 0.88rem;
    font-weight: 500;
    padding: 6px 12px !important;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary) !important;
    background: rgba(255,255,255,0.06);
}

.btn-admin {
    background: var(--accent);
    color: white;
    border: none;
    font-size: 0.82rem;
    font-weight: 600;
    gap: 5px;
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
}

.btn-admin svg { width: 14px; height: 14px; }

/* ── Hero Section ──────────────────────────────────────────────────────────── */
.hero-section {
    position: relative;
    padding: 100px 0 80px;
    overflow: hidden;
}

.hero-bg-pattern {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(99,102,241,0.18) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 80% 80%, rgba(6,182,212,0.1) 0%, transparent 50%);
    pointer-events: none;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: var(--gradient);
    opacity: 0.4;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 760px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(99,102,241,0.12);
    border: 1px solid rgba(99,102,241,0.3);
    border-radius: 999px;
    padding: 6px 18px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 24px;
}

.hero-badge svg { width: 14px; height: 14px; }

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 6vw, 4rem);
    font-weight: 800;
    letter-spacing: -2px;
    color: var(--text-primary);
    margin-bottom: 20px;
    line-height: 1.05;
}

.hero-subtitle {
    font-size: 1.08rem;
    color: var(--text-secondary);
    max-width: 540px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

/* ── Search Bar ────────────────────────────────────────────────────────────── */
.hero-search { margin-bottom: 40px; }

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 560px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 4px 4px 4px 20px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.search-icon {
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-right: 10px;
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 10px 0;
}

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

.search-btn {
    background: var(--gradient);
    border: none;
    color: white;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.88rem;
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    white-space: nowrap;
}

.search-btn:hover { opacity: 0.9; transform: scale(1.02); }

/* ── Hero Stats ────────────────────────────────────────────────────────────── */
.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.stat-item { text-align: center; }
.stat-number {
    display: block;
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.stat-divider { width: 1px; height: 36px; background: var(--border); }

/* ── Filter Section ────────────────────────────────────────────────────────── */
.filter-section {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    position: sticky;
    top: var(--nav-height);
    z-index: 100;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.filter-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.filter-label svg { width: 12px; height: 12px; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 6px; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.18s;
    cursor: pointer;
}

.pill:hover {
    color: var(--text-primary);
    border-color: rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
}

.pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.type-pill.active { background: var(--pill-color); border-color: var(--pill-color); color: white; }
.type-pill:hover:not(.active) { border-color: var(--pill-color); color: var(--pill-color); }

/* ── Apps Grid ─────────────────────────────────────────────────────────────── */
.apps-section { padding: 50px 0 80px; }

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.results-count { color: var(--text-secondary); font-size: 0.9rem; margin: 0; }
.results-count strong { color: var(--text-primary); }

.clear-filters {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--accent);
    font-size: 0.85rem;
    text-decoration: none;
}
.clear-filters svg { width: 14px; height: 14px; }

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 22px;
}

/* ── App Card ──────────────────────────────────────────────────────────────── */
.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: var(--shadow-card);
    position: relative;
    animation: fadeInUp 0.4s ease both;
}

.app-card:hover {
    border-color: rgba(99,102,241,0.35);
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
    background: var(--bg-card-hover);
}

.app-card.featured {
    border-color: rgba(245,158,11,0.3);
}

.app-card.featured::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.featured-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
}

.featured-badge svg { width: 11px; height: 11px; }

.card-thumb {
    width: 100%;
    height: 180px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}

.card-thumb img {
    display: block;
    max-width: 100%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.app-card:hover .card-thumb img {
    display: block;
    max-width: 100%; transform: scale(1.05); }

.card-category {
    position: absolute;
    bottom: 10px;
    left: 12px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    color: var(--accent-2);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.card-body-inner {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.card-name {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    flex: 1;
}

.card-types {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    color: var(--badge-color);
    border: 1px solid var(--badge-color);
    background: color-mix(in srgb, var(--badge-color) 10%, transparent);
}

.type-badge svg { width: 11px; height: 11px; }

.card-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: gap 0.2s;
}

.card-cta:hover { color: var(--accent-2); gap: 9px; }
.card-cta svg { width: 14px; height: 14px; }

/* ── Empty State ───────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: var(--text-muted);
}

.empty-icon svg { width: 32px; height: 32px; }
.empty-state h3 { font-size: 1.3rem; color: var(--text-primary); margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; }

/* ── Footer ────────────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 60px 0 30px;
    margin-top: auto;
}

.footer-inner {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 48px;
    margin-bottom: 40px;
}

.footer-brand .brand-text { font-size: 1.1rem; font-family: var(--font-display); font-weight: 800; }
.footer-tagline { font-size: 0.85rem; color: var(--text-muted); max-width: 240px; margin-top: 12px; }

.footer-links h6 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-muted); margin-bottom: 14px; }
.footer-links ul { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: var(--text-secondary); text-decoration: none; font-size: 0.88rem; transition: color 0.2s; }
.footer-links a:hover { color: var(--accent); }

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary {
    background: var(--gradient);
    border: none;
    font-family: var(--font-body);
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 10px 22px;
    transition: opacity 0.2s, transform 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary svg { width: 15px; height: 15px; }

.btn-outline-primary { border-color: var(--accent); color: var(--accent); background: transparent; border-radius: var(--radius-sm); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.btn-outline-primary:hover { background: var(--accent); color: white; }
.btn-outline-primary svg { width: 14px; height: 14px; }
.btn-outline-secondary { border-color: var(--border); color: var(--text-secondary); background: transparent; border-radius: var(--radius-sm); font-size: 0.82rem; }
.btn-outline-secondary:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }

/* ── Login Page ────────────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99,102,241,0.15), transparent 60%),
        var(--bg-primary);
    padding: 40px 20px;
}

.login-wrapper {
    width: 100%;
    max-width: 440px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(99,102,241,0.1);
}

.login-header { text-align: center; margin-bottom: 30px; }
.brand-link { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; margin-bottom: 20px; }
.login-header h1 { font-size: 1.6rem; margin-bottom: 6px; }
.login-header p { color: var(--text-secondary); font-size: 0.88rem; }

.login-form { display: flex; flex-direction: column; gap: 16px; }

.form-group-fancy label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.form-group-fancy label svg { width: 13px; height: 13px; }

.form-control {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: var(--font-body);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    background: var(--bg-secondary);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    color: var(--text-primary);
    outline: none;
}

.form-control::placeholder { color: var(--text-muted); }

.form-check-fancy { display: flex; align-items: center; gap: 8px; }
.form-check-fancy .form-check-input {
    background-color: var(--bg-secondary);
    border-color: var(--border);
    width: 16px; height: 16px;
}
.form-check-fancy .form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-label { font-size: 0.85rem; color: var(--text-secondary); }

.btn-login { padding: 13px; font-size: 0.95rem; border-radius: var(--radius-md); }

.login-back { text-align: center; margin-top: 20px; }
.login-back a { color: var(--text-muted); font-size: 0.85rem; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }
.login-back a:hover { color: var(--accent); }
.login-back svg { width: 14px; height: 14px; }

/* ── Admin Layout ──────────────────────────────────────────────────────────── */
.admin-wrapper {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - var(--nav-height));
}

.admin-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    position: sticky;
    top: var(--nav-height);
    height: calc(100vh - var(--nav-height));
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 0 20px 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.sidebar-header h5 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
}
.sidebar-header svg { width: 14px; height: 14px; }

.sidebar-nav { flex: 1; padding: 0 12px; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.18s;
    margin-bottom: 2px;
    cursor: pointer;
}

.sidebar-link svg { width: 16px; height: 16px; }
.sidebar-link:hover, .sidebar-link.active {
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
}
.sidebar-link.active { color: var(--accent); background: rgba(99,102,241,0.1); }
.sidebar-link hr { margin: 8px 0; border-color: var(--border); }

.sidebar-stats {
    padding: 16px 20px 0;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    margin-top: auto;
}
.stat-mini { text-align: center; }
.stat-mini span { display: block; font-size: 1.2rem; font-weight: 700; color: var(--accent); font-family: var(--font-display); }
.stat-mini { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }

.admin-main {
    background: var(--bg-primary);
    padding: 32px;
    min-height: calc(100vh - var(--nav-height));
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.admin-page-title {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}
.admin-page-title svg { width: 22px; height: 22px; color: var(--accent); }

.admin-tab { display: none; }
.admin-tab.active { display: block; }

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    overflow: hidden;
}

.admin-card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-card-header h4 {
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text-primary);
}
.admin-card-header h4 svg { width: 16px; height: 16px; color: var(--accent); }

.admin-form { padding: 22px; }

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-bottom: 6px;
}

.form-select {
    background-color: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
    font-family: var(--font-body);
    border-radius: var(--radius-sm);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%239898b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
.form-select:focus { background-color: var(--bg-secondary); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); color: var(--text-primary); }

.types-checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.type-check-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
    user-select: none;
}

.type-check-label svg { width: 13px; height: 13px; }
.type-check-label input { display: none; }

.type-check-label:hover { border-color: var(--tc-color); color: var(--tc-color); }
.type-check-label:has(input:checked) {
    background: color-mix(in srgb, var(--tc-color) 15%, transparent);
    border-color: var(--tc-color);
    color: var(--tc-color);
    font-weight: 600;
}

/* Admin Table */
.table-responsive { overflow-x: auto; }

.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-primary);
    --bs-table-hover-bg: transparent;
    --bs-table-hover-color: var(--text-primary);
}

.admin-table thead th {
    padding: 12px 16px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border) !important;
    white-space: nowrap;
}

.admin-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border) !important;
    vertical-align: middle;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: background 0.15s, color 0.15s;
}

.admin-table tbody tr:hover td {
    background: rgba(99,102,241,0.08) !important;
    color: var(--accent) !important;
}

.admin-table tbody tr:hover td strong,
.admin-table tbody tr:hover td small,
.admin-table tbody tr:hover td code {
    color: inherit;
}

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

.admin-thumb {
    width: 48px;
    height: 36px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
}

/* Alerts */
.alert {
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 500;
}
.alert-success { background: rgba(34,197,94,0.1); color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }
.alert-danger  { background: rgba(239,68,68,0.1);  color: #f87171; border: 1px solid rgba(239,68,68,0.2); }

.form-switch .form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--accent-glow); border-color: var(--accent); }

/* ── Admin Search ──────────────────────────────────────────────────────────── */
#adminSearch {
    max-width: 200px;
    font-size: 0.82rem;
    padding: 6px 12px;
}

/* ── Animations ────────────────────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.app-card:nth-child(1)  { animation-delay: 0.03s; }
.app-card:nth-child(2)  { animation-delay: 0.06s; }
.app-card:nth-child(3)  { animation-delay: 0.09s; }
.app-card:nth-child(4)  { animation-delay: 0.12s; }
.app-card:nth-child(5)  { animation-delay: 0.15s; }
.app-card:nth-child(6)  { animation-delay: 0.18s; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
    .admin-wrapper { grid-template-columns: 1fr; }
    .admin-sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 12px; }
    .sidebar-header, .sidebar-stats { display: none; }
    .sidebar-nav { display: flex; gap: 4px; flex: 0; white-space: nowrap; padding: 0; }
    .sidebar-link { padding: 7px 12px; white-space: nowrap; }
    .admin-main { padding: 20px; }
    .footer-inner { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 767px) {
    .hero-section { padding: 70px 0 50px; }
    .hero-title { letter-spacing: -1px; }
    .hero-stats { gap: 16px; }
    .filter-section { position: static; }
    .filter-bar { flex-direction: column; }
    .apps-grid { grid-template-columns: 1fr; }
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ── Placeholder SVG ───────────────────────────────────────────────────────── */
/* Handled in PHP thumbnailUrl() */

/* ── Bootstrap Overrides ───────────────────────────────────────────────────── */
.navbar-toggler { border-color: var(--border); }
.navbar-toggler-icon { filter: invert(0.6); }
.navbar-collapse { padding-top: 8px; }
@media (max-width: 991px) { .navbar-nav { padding: 8px 0; } }

.badge { font-family: var(--font-body); }

/* ── SMTP Guide Cards ──────────────────────────────────────────────────────── */
.smtp-info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(99,102,241,0.08);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.6;
    margin-bottom: 8px;
}
.smtp-info-box svg { width: 18px; height: 18px; color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.smtp-info-box strong { color: var(--text-primary); }
.smtp-info-box code { background: rgba(255,255,255,0.07); padding: 1px 6px; border-radius: 4px; font-size: 0.82rem; color: var(--accent-2); }

.smtp-guide-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
}
.smtp-guide-card h6 {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.88rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}
.smtp-guide-card h6 svg { width: 14px; height: 14px; color: var(--accent); }
.smtp-guide-card ul { margin: 0; padding-left: 18px; }
.smtp-guide-card li { color: var(--text-secondary); font-size: 0.82rem; margin-bottom: 5px; }
.smtp-guide-card code { background: rgba(255,255,255,0.07); padding: 1px 5px; border-radius: 4px; color: var(--accent-2); font-size: 0.78rem; }

/* ── User nav items ────────────────────────────────────────────────────────── */
.nav-user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-user-name svg { width: 14px; height: 14px; }
.btn-register {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    text-decoration: none;
    transition: all 0.18s;
}
.btn-register:hover { border-color: var(--accent); color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   LIGHT THEME — overrides all :root variables when [data-theme="light"]
   ═══════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] {
    --bg-primary:    #f0f2f8;
    --bg-secondary:  #e8eaf2;
    --bg-card:       #ffffff;
    --bg-card-hover: #f5f6fc;
    --border:        rgba(0,0,0,0.09);
    --border-hover:  rgba(99,102,241,0.35);

    --text-primary:  #0f0f1a;
    --text-secondary:#4a4a6a;
    --text-muted:    #9898b8;

    --accent:        #6366f1;
    --accent-glow:   rgba(99,102,241,0.15);
    --accent-2:      #0891b2;
    --accent-3:      #d97706;

    --shadow-card: 0 2px 12px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.05);
    --shadow-hover: 0 8px 32px rgba(99,102,241,0.15), 0 0 0 1px rgba(99,102,241,0.2);
}

/* Navbar in light mode */
[data-theme="light"] #mainNav {
    background: rgba(240,242,248,0.92) !important;
    border-bottom-color: rgba(0,0,0,0.08);
}

/* Cards in light mode */
[data-theme="light"] .app-card { box-shadow: var(--shadow-card); }

/* Admin table rows in light mode */
[data-theme="light"] .admin-table tbody td { background: #fff; color: #0f0f1a; }
[data-theme="light"] .admin-table thead th { background: #f0f2f8 !important; }
[data-theme="light"] .admin-table tbody tr:hover td {
    background: rgba(99,102,241,0.06) !important;
    color: var(--accent) !important;
}

/* Admin sidebar in light mode */
[data-theme="light"] .admin-sidebar { background: #e8eaf2; }
[data-theme="light"] .admin-card    { background: #fff; }
[data-theme="light"] .admin-main    { background: #f0f2f8; }

/* Form controls in light mode */
[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
    background-color: #fff !important;
    border-color: rgba(0,0,0,0.15) !important;
    color: #0f0f1a !important;
}
[data-theme="light"] .form-control:focus,
[data-theme="light"] .form-select:focus {
    background-color: #fff !important;
    border-color: var(--accent) !important;
    color: #0f0f1a !important;
}
[data-theme="light"] .form-control::placeholder { color: #9898b8; }

/* Hero in light mode */
[data-theme="light"] .hero-section { background: #f0f2f8; }
[data-theme="light"] .hero-bg-pattern {
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(99,102,241,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 80% 80%, rgba(6,182,212,0.07) 0%, transparent 50%);
}

/* Filter section in light mode */
[data-theme="light"] .filter-section { background: #e8eaf2; }
[data-theme="light"] .pill { background: rgba(0,0,0,0.04); color: #4a4a6a; }
[data-theme="light"] .pill:hover { background: rgba(0,0,0,0.07); color: #0f0f1a; }

/* Footer in light mode */
[data-theme="light"] .site-footer { background: #e8eaf2; }

/* Search in light mode */
[data-theme="light"] .search-wrapper {
    background: #fff;
    border-color: rgba(0,0,0,0.12);
}
[data-theme="light"] .search-input { color: #0f0f1a; }
[data-theme="light"] .search-input::placeholder { color: #9898b8; }

/* Login card in light mode */
[data-theme="light"] .login-page   { background: #f0f2f8; }
[data-theme="light"] .login-card   { background: #fff; box-shadow: 0 8px 40px rgba(0,0,0,0.1); }

/* Alerts in light mode */
[data-theme="light"] .alert-success { background: rgba(34,197,94,0.08);  color: #166534; border-color: rgba(34,197,94,0.25); }
[data-theme="light"] .alert-danger  { background: rgba(239,68,68,0.08);  color: #991b1b; border-color: rgba(239,68,68,0.2); }

/* Scrollbar in light mode */
[data-theme="light"] ::-webkit-scrollbar-track { background: #e8eaf2; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); }

/* ── Theme Toggle Button ──────────────────────────────────────────────────── */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}
.theme-toggle svg { width: 16px; height: 16px; }

/* Show correct icon based on current theme */
[data-theme="dark"]  .theme-icon-light { display: none; }
[data-theme="dark"]  .theme-icon-dark  { display: flex; }
[data-theme="light"] .theme-icon-dark  { display: none; }
[data-theme="light"] .theme-icon-light { display: flex; }

/* Smooth theme transition on all elements */
body, body * {
    transition:
        background-color 0.25s ease,
        border-color 0.25s ease,
        color 0.2s ease,
        box-shadow 0.25s ease;
}
/* Prevent transition on icons (causes flicker) */
svg, i, img { transition: none !important; }

/* ── Light theme card fixes ─────────────────────────────────────────────────── */
[data-theme="light"] .app-card {
    background: #ffffff;
    border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .app-card:hover {
    background: #f8f9ff;
    border-color: rgba(99,102,241,0.3);
}
[data-theme="light"] .card-thumb {
    background: linear-gradient(135deg, #e8eaf2, #d8daea);
}
[data-theme="light"] .card-name  { color: #0f0f1a; }
[data-theme="light"] .card-desc  { color: #4a4a6a; }
[data-theme="light"] .type-badge {
    background: color-mix(in srgb, var(--badge-color) 8%, transparent);
}
[data-theme="light"] .featured-badge {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: #fff;
}
[data-theme="light"] .card-category {
    background: rgba(255,255,255,0.85);
    color: var(--accent);
}

/* Lock overlay for non-signed-in users */
.card-cta-locked {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s;
}
.card-cta-locked:hover { color: var(--accent); }
.card-cta-locked svg  { width: 14px; height: 14px; }

/* ── Sign-in notice bar ──────────────────────────────────────────────────────── */
.signin-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(99,102,241,0.08);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    margin-bottom: 24px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}
.signin-notice svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }
.signin-notice a   { color: var(--accent); font-weight: 600; text-decoration: none; }
.signin-notice a:hover { text-decoration: underline; }

[data-theme="light"] .signin-notice { background: rgba(99,102,241,0.06); }

/* ── Login centering — works with shared navbar header ───────────────────── */
.login-page .login-wrapper {
    display: block;
    width: 100%;
    max-width: 460px;
    margin: 40px auto;
    padding: 0 16px;
}

/* ── Light theme card backgrounds ───────────────────────────────────────────*/
[data-theme="light"] .app-card { background:#fff; border-color:rgba(0,0,0,.08); }
[data-theme="light"] .app-card:hover { background:#f8f9ff; }
[data-theme="light"] .card-thumb { background:linear-gradient(135deg,#e8eaf2,#d8daea); }
[data-theme="light"] .card-name  { color:#0f0f1a; }
[data-theme="light"] .card-desc  { color:#4a4a6a; }

/* ── Analytics ───────────────────────────────────────────────────────────── */
.analytics-kpi-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:16px; margin-bottom:24px; }
.kpi-card { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius-lg); padding:20px; display:flex; align-items:center; gap:16px; }
.kpi-icon { width:48px; height:48px; border-radius:var(--radius-md); background:color-mix(in srgb,var(--kpi-color) 15%,transparent); display:flex; align-items:center; justify-content:center; color:var(--kpi-color); flex-shrink:0; }
.kpi-icon svg { width:22px; height:22px; }
.kpi-value { font-family:var(--font-display); font-size:1.8rem; font-weight:800; color:var(--text-primary); line-height:1; }
.kpi-label { font-size:.82rem; font-weight:600; color:var(--text-secondary); margin-top:4px; }
.analytics-two-col { display:grid; grid-template-columns:1fr 1fr; gap:20px; margin-bottom:20px; }
.analytics-range-pills { display:flex; gap:6px; flex-wrap:wrap; }
.analytics-empty { color:var(--text-muted); font-size:.88rem; text-align:center; padding:32px 20px; margin:0; }
@media (max-width:900px) { .analytics-two-col { grid-template-columns:1fr; } }
[data-theme="light"] .kpi-card { background:#fff; }

/* ── App detail modal ────────────────────────────────────────────────────── */
.app-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.app-modal-overlay.open { display: flex; }

.app-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    max-width: 620px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    animation: modalIn 0.22s ease;
}
@keyframes modalIn {
    from { opacity:0; transform:scale(.95) translateY(10px); }
    to   { opacity:1; transform:scale(1) translateY(0); }
}
.app-modal-img {
    width: 100%;
    height: 260px;
    object-fit: cover;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    display: block;
}
.app-modal-body { padding: 28px; }
.app-modal-title { font-family:var(--font-display); font-size:1.4rem; font-weight:800; color:var(--text-primary); margin:0 0 10px; }
.app-modal-desc  { color:var(--text-secondary); line-height:1.7; font-size:.95rem; margin:0 0 20px; }
.app-modal-types { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:24px; }
.app-modal-close {
    position: absolute;
    top: 16px; right: 16px;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 1.2rem; line-height: 1;
    transition: all 0.15s;
}
.app-modal-close:hover { background:var(--accent); color:#fff; border-color:var(--accent); }
.app-modal-wrapper { position: relative; }
.card-thumb { cursor: pointer; }
[data-theme="light"] .app-modal { background:#fff; }
