/* ==================== DIGITALTV PREMIUM — DESIGN SYSTEM ==================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #090B12;
    --bg-card: #151925;
    --bg-input: #1C2033;
    --bg-surface: #111520;
    --primary: #EF233C;
    --primary-hover: #FF4055;
    --primary-glow: rgba(239,35,60,0.15);
    --text: #F8FAFC;
    --text-muted: #94A3B8;
    --text-dim: #64748B;
    --border: #252B3A;
    --border-light: #2E3650;
    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.4);
    --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
}

[data-theme="light"] {
    --bg: #F1F5F9;
    --bg-card: #FFFFFF;
    --bg-input: #F8FAFC;
    --bg-surface: #E2E8F0;
    --text: #0F172A;
    --text-muted: #64748B;
    --text-dim: #94A3B8;
    --border: #E2E8F0;
    --border-light: #CBD5E1;
    --shadow: 0 4px 24px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
}

/* ==================== RESET ==================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; }
button { font-family: inherit; }

/* ==================== LAYOUT ==================== */
.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }

/* ==================== HEADER ==================== */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    height: 64px;
}
.site-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}
.site-logo img { height: 36px; width: auto; border-radius: 8px; }
.site-logo h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}
.site-logo h1 .brand-accent { color: var(--primary); }

.header-center {
    display: flex;
    align-items: center;
    gap: 4px;
}
.header-center a {
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    white-space: nowrap;
}
.header-center a:hover { color: var(--text); background: var(--primary-glow); }
.header-center a.active { color: var(--primary); background: var(--primary-glow); }

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Theme Toggle */
.theme-toggle {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 1.1rem;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-light); background: var(--bg-input); }

.header-admin-link {
    display: flex; align-items: center; gap: 6px;
    font-size: .8rem; font-weight: 600;
    padding: 8px 16px;
    background: var(--primary);
    color: #fff !important;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.header-admin-link:hover { background: var(--primary-hover); color: #fff !important; transform: translateY(-1px); }

/* Mobile menu */
.mobile-toggle {
    display: none;
    width: 40px; height: 40px;
    align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    cursor: pointer;
    font-size: 1.3rem;
}

/* ==================== HERO ==================== */
.hero {
    text-align: center;
    overflow-x: clip;
    padding: 56px 24px 32px;
    position: relative;
}
.hero::before {
    content: '';
    position: absolute;
    top: 0; left: 50%; transform: translateX(-50%);
    width: min(600px, 100%); height: 400px;
    background: radial-gradient(ellipse, var(--primary-glow) 0%, transparent 70%);
    pointer-events: none;
    opacity: .5;
}
.hero h2 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    position: relative;
}
.hero h2 .text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, #FF6B7A 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 540px;
    margin: 0 auto 32px;
    position: relative;
}

/* ==================== SEARCH ==================== */
.search-container {
    position: relative;
    max-width: 560px;
    margin: 0 auto 20px;
}
.search-container .search-icon {
    position: absolute;
    left: 16px; top: 50%; transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}
.search-container input {
    width: 100%;
    padding: 14px 48px 14px 48px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition);
}
.search-container input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.search-container input::placeholder { color: var(--text-dim); }
.search-clear {
    position: absolute;
    right: 16px; top: 50%; transform: translateY(-50%);
    background: none; border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.1rem;
    display: none;
    padding: 4px;
}
.search-clear.show { display: block; }

/* App counter */
.app-counter {
    text-align: center;
    color: var(--text-dim);
    font-size: .85rem;
    margin-bottom: 8px;
}
.app-counter strong { color: var(--text-muted); font-weight: 600; }

/* ==================== CATEGORIES FILTER ==================== */
.categories-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 40px;
    position: relative;
}
.cat-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    color: var(--text-muted);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.cat-btn:hover { color: var(--text); border-color: var(--border-light); background: var(--bg-input); }
.cat-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ==================== APPS GRID ==================== */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    padding-bottom: 48px;
}

/* ==================== APP CARD ==================== */
.app-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    display: flex;
    flex-direction: column;
    animation: slideUp .4s ease both;
}
.app-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px -12px rgba(0,0,0,.55), 0 0 0 1px rgba(239,35,60,.25);
    border-color: rgba(239,35,60,.35);
}

/* Banner com a imagem do app */
.app-card-banner {
    position: relative;
    height: 168px;
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(239,35,60,.16) 0%, transparent 60%),
        linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-card) 100%);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    cursor: pointer;
}
.app-card-banner-bg {
    position: absolute; inset: -20px;
    background-size: cover; background-position: center;
    filter: blur(40px) saturate(1.2);
    opacity: .15;
    transform: scale(1.1);
}
.app-card-banner img {
    position: relative;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    transition: transform .4s ease;
    -webkit-mask-image: radial-gradient(ellipse 72% 72% at 50% 50%, #000 62%, transparent 100%);
            mask-image: radial-gradient(ellipse 72% 72% at 50% 50%, #000 62%, transparent 100%);
}
.app-card:hover .app-card-banner img { transform: scale(1.05); }
.app-card-banner .app-card-icon-placeholder { position: relative; }
.app-card-badges {
    position: absolute; top: 12px; left: 12px; right: 12px;
    display: flex; justify-content: space-between; align-items: flex-start;
    pointer-events: none;
}
.badge-version {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: .72rem; font-weight: 600;
    padding: 4px 10px; border-radius: 50px;
    background: rgba(9,11,18,.72);
    color: #F8FAFC;
    border: 1px solid rgba(255,255,255,.08);
    backdrop-filter: blur(6px);
}
.badge-destaque {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: .7rem; font-weight: 700;
    padding: 4px 10px; border-radius: 50px;
    background: linear-gradient(135deg, #F59E0B, #F97316);
    color: #111;
    letter-spacing: .3px;
}

.app-card-icon-placeholder {
    width: 72px; height: 72px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--bg-input), var(--border));
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: var(--text-dim);
}

.app-card-body {
    padding: 18px 20px 0;
    display: flex; flex-direction: column; gap: 10px;
    flex: 1;
}
.app-card-title {
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.app-card-title h3 {
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    cursor: pointer;
}
.app-card-title h3:hover { color: var(--primary); }
.app-card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.app-card-tags:empty { display: none; }
.tag {
    display: inline-flex; align-items: center;
    font-size: .7rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 6px;
    letter-spacing: .3px;
}
.tag-version { background: var(--primary-glow); color: var(--primary); }
.tag-category { background: rgba(59,130,246,0.12); color: #60A5FA; }
.tag-compat { background: rgba(34,197,94,0.12); color: #4ADE80; }
.tag-destaque { background: rgba(245,158,11,0.15); color: var(--warning); }

.app-card-desc {
    color: var(--text-muted);
    font-size: .84rem;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
}
.app-card-stats span {
    font-size: .78rem;
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.app-card-stats strong { color: var(--text-muted); font-weight: 600; }

/* Códigos (NTDown / Downloader) */
.app-card-codes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 4px;
}
.code-tile {
    position: relative;
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 10px 40px 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: inherit;
    transition: border-color var(--transition), background var(--transition);
    width: 100%;
}
.code-tile:hover { border-color: rgba(239,35,60,.45); background: rgba(239,35,60,.05); }
.code-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.code-tile-label {
    font-size: .64rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: .08em;
}
.code-tile-value {
    font-family: 'JetBrains Mono', ui-monospace, 'Fira Code', monospace;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: .04em;
    max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.code-tile-icon {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    color: var(--text-dim);
    transition: all var(--transition);
}
.code-tile:hover .code-tile-icon { color: var(--primary); background: var(--primary-glow); }
.code-tile.copied { border-color: var(--success); background: rgba(34,197,94,.08); }
.code-tile.copied .code-tile-icon { color: var(--success); background: rgba(34,197,94,.12); }
.code-tile.copied .code-tile-label { color: var(--success); }

.app-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 16px 20px 20px;
    margin-top: auto;
}
.app-card-actions .btn { justify-content: center; font-size: .85rem; padding: 10px 14px; }
.app-card-actions .btn:only-child { grid-column: 1 / -1; }

/* Legacy (app.php / compat) */
.card-code-row { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: var(--radius-sm); padding: 6px 10px; }
.card-code-label { font-size: .7rem; font-weight: 600; color: var(--text-dim); min-width: 80px; text-transform: uppercase; }
.card-code-value { flex: 1; font-family: 'JetBrains Mono', monospace; font-size: .78rem; color: var(--primary); }
.copy-btn-sm {
    background: none; border: 1px solid var(--border); color: var(--text-muted);
    cursor: pointer; font-size: .78rem; padding: 4px 8px; border-radius: 6px;
    transition: all var(--transition); white-space: nowrap; font-family: inherit;
}
.copy-btn-sm:hover { background: var(--primary-glow); color: var(--primary); border-color: var(--primary); }
.copy-btn-sm.copied { background: rgba(34,197,94,0.1); color: var(--success); border-color: var(--success); }

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: .875rem;
    font-weight: 600;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
    font-family: inherit;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(239,35,60,0.3);
}
.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-xs { padding: 4px 10px; font-size: .75rem; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-secondary {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-secondary:hover { background: var(--border); color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16A34A; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; color: #fff; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon {
    width: 36px; height: 36px;
    padding: 0; justify-content: center;
    border-radius: var(--radius-sm);
}

/* ==================== MODAL ==================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn .2s ease;
}
.modal-overlay.show { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp .3s cubic-bezier(0.4,0,0.2,1);
}
.modal-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 28px 28px 0;
}
.modal-app-icon {
    width: 96px; height: 96px;
    border-radius: var(--radius);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
}
.modal-app-info { flex: 1; min-width: 0; }
.modal-app-info h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; }
.modal-close {
    position: absolute;
    top: 20px; right: 20px;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition);
}
.modal-close:hover { color: var(--text); border-color: var(--text-muted); }
.modal-body { padding: 24px 28px 28px; }
.modal-section { margin-bottom: 24px; }
.modal-section:last-child { margin-bottom: 0; }
.modal-section h4 {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 12px;
}

/* ==================== CODE BOX ==================== */
.code-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
}
.code-box code {
    flex: 1;
    font-family: 'JetBrains Mono', ui-monospace, 'Fira Code', monospace;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--text);
    word-break: break-all;
}
.copy-btn {
    padding: 8px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: .8rem;
    font-weight: 600;
    transition: all var(--transition);
    white-space: nowrap;
    font-family: inherit;
}
.copy-btn:hover { background: var(--primary-hover); }
.copy-btn.copied { background: var(--success); }

/* ==================== DOWNLOAD SECTION ==================== */
.download-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}
.download-section h3 {
    margin-bottom: 16px; font-size: 1.1rem;
    display: flex; align-items: center; gap: 8px;
    font-weight: 700;
}
.download-methods { display: flex; flex-direction: column; gap: 12px; }
.download-method {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}
.download-method h4 { font-size: .9rem; margin-bottom: 6px; color: var(--primary); font-weight: 600; }
.download-method p { font-size: .82rem; color: var(--text-muted); margin-bottom: 10px; }

/* Share */
.share-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.share-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-size: .82rem; font-weight: 600; color: #fff;
    transition: all var(--transition);
}
.share-btn:hover { opacity: .9; color: #fff; transform: translateY(-1px); }
.share-whatsapp { background: #25D366; }
.share-telegram { background: #0088cc; }

/* ==================== APP DETAIL PAGE ==================== */
.app-detail { max-width: 800px; margin: 32px auto; padding: 0 24px; }
.app-detail-header {
    display: flex; gap: 24px; align-items: flex-start;
    margin-bottom: 32px;
}
.app-detail-img {
    width: 160px; height: 160px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
    background: var(--bg-input);
}
.app-detail-info { flex: 1; min-width: 220px; }
.app-detail-info h1 { font-size: 1.8rem; font-weight: 800; margin-bottom: 10px; }
.app-detail-info .meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

/* ==================== STATS ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.stat-icon-apps { background: var(--primary-glow); }
.stat-icon-active { background: rgba(34,197,94,0.1); }
.stat-icon-downloads { background: rgba(59,130,246,0.1); }
.stat-icon-categories { background: rgba(245,158,11,0.1); }
.stat-content {}
.stat-number { font-size: 1.8rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { color: var(--text-muted); font-size: .82rem; margin-top: 4px; }

/* ==================== TABLES ==================== */
.table-responsive { overflow-x: auto; }
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}
.admin-table th, .admin-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.admin-table th {
    background: var(--bg-surface);
    color: var(--text-dim);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.admin-table td { font-size: .875rem; }
.admin-table tr:hover { background: var(--bg-input); }
.admin-table td .actions { display: flex; gap: 6px; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .3px;
}
.badge-success { background: rgba(34,197,94,0.1); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.1); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.badge-info { background: rgba(59,130,246,0.1); color: var(--info); }

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: .82rem;
    color: var(--text-muted);
    font-weight: 600;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: .9rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.form-control::placeholder { color: var(--text-dim); }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { appearance: auto; }
input[type="file"].form-control { padding: 8px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: .78rem; color: var(--text-dim); margin-top: 4px; }

/* ==================== ALERTS ==================== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: .875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-success { background: rgba(34,197,94,0.1); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.alert-danger { background: rgba(239,68,68,0.1); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.alert-info { background: rgba(59,130,246,0.1); color: var(--info); border: 1px solid rgba(59,130,246,0.2); }
.alert-warning { background: rgba(245,158,11,0.1); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }

/* ==================== TOAST ==================== */
.toast-container {
    position: fixed;
    top: 80px; right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: .85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    animation: slideInRight .3s ease, fadeOut .3s ease 2.5s forwards;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toast-success { border-left: 3px solid var(--success); color: var(--success); }

/* ==================== LOGIN ==================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}
.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.login-box h1 {
    text-align: center;
    margin-bottom: 8px;
    font-size: 1.5rem;
    font-weight: 800;
}

/* ==================== FOOTER ==================== */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 32px 0;
    text-align: center;
    color: var(--text-dim);
    font-size: .82rem;
    margin-top: 64px;
}

/* ==================== SKELETON LOADING ==================== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--border) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}
.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    height: 280px;
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-muted);
}
.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    display: block;
    opacity: .4;
}
.empty-state h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: .9rem; }

/* ==================== ADMIN SIDEBAR LAYOUT ==================== */
.admin-layout {
    display: flex;
    min-height: calc(100vh - 64px);
}
.admin-sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    flex-shrink: 0;
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    overflow-y: auto;
}
.admin-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 12px;
}
.admin-sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    text-decoration: none;
}
.admin-sidebar-nav a:hover { color: var(--text); background: var(--bg-input); }
.admin-sidebar-nav a.active { color: var(--primary); background: var(--primary-glow); font-weight: 600; }
.admin-sidebar-nav .nav-divider { height: 1px; background: var(--border); margin: 12px 16px; }

.admin-content {
    flex: 1;
    padding: 32px;
    min-width: 0;
}
.admin-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}
.admin-page-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
}

/* ==================== CHART ==================== */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}
.chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.chart-header h3 { font-size: 1rem; font-weight: 700; }

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes skeleton-pulse { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .admin-sidebar { display: none; }
    .admin-content { padding: 24px 16px; }
}

@media (max-width: 768px) {
    .hero { padding: 40px 16px 24px; }
    .hero h2 { font-size: 1.8rem; }
    .header-center { display: none; }
    .mobile-toggle { display: flex; }
    .apps-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .app-detail-header { flex-direction: column; align-items: center; text-align: center; }
    .app-detail-img { width: 120px; height: 120px; }
    .form-row { grid-template-columns: 1fr; }
    .modal { max-height: 95vh; }
    .modal-header { padding: 20px 20px 0; }
    .modal-body { padding: 20px; }
    .modal-app-icon { width: 72px; height: 72px; }
}

@media (max-width: 480px) {
    .apps-grid { grid-template-columns: 1fr; }
    .hero h2 { font-size: 1.5rem; }
    .stat-card { padding: 16px; }
    .stat-number { font-size: 1.4rem; }
    .container { padding: 0 16px; }
}

/* ==================== MOBILE NAV DRAWER ==================== */
.mobile-nav {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.6);
}
.mobile-nav.show { display: block; }
.mobile-nav-panel {
    position: absolute;
    right: 0; top: 0;
    width: 280px;
    height: 100%;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    padding: 24px;
    animation: slideFromRight .25s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mobile-nav-panel a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition);
}
.mobile-nav-panel a:hover { color: var(--text); background: var(--bg-input); }
.mobile-nav-close {
    align-self: flex-end;
    background: none; border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    margin-bottom: 16px;
}
@keyframes slideFromRight { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* ==================== ADMIN: ATUALIZAR SISTEMA ==================== */
/* (kept inline in atualizar_sistema.php for modularity) */

/* ==================== CARD RESPONSIVE ==================== */
@media (max-width: 768px) {
    .app-card-banner { height: 150px; }
    .header-right .header-admin-link,
    .header-right .btn-outline { display: none; }
    .site-logo h1 { font-size: 1rem; }
}
@media (max-width: 480px) {
    .app-card-banner { height: 140px; }
    .app-card-body { padding: 16px 16px 0; }
    .app-card-actions { padding: 14px 16px 16px; }
    .code-tile-value { font-size: 1rem; }
}
/* Android TV / controle remoto: foco visível */
.app-card-actions .btn:focus-visible,
.cat-btn:focus-visible,
.app-card-title h3:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Banner sempre escuro: as artes dos apps são feitas para fundo escuro */
[data-theme="light"] .app-card-banner {
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(239,35,60,.18) 0%, transparent 60%),
        linear-gradient(180deg, #151925 0%, #0F121B 100%);
    border-bottom-color: #252B3A;
}
