/**
 * Evo Academy — Layout CSS
 * TopBar, page containers, sidebar, responsividade
 */

/* ===== THEME LOGO SWITCHING ===== */
body.dark .logo-light-only { display: none !important; }
body.light .logo-dark-only { display: none !important; }
/* Fallback: if only dark logo exists, show it in both themes */
body.light .logo-dark-only:only-of-type { display: inline !important; }

/* Logo icon (reduced): hidden on desktop when full logo exists, shown on mobile */
.topbar-logo-icon-img { display: none; }

/* ===== PAGE CONTAINER ===== */
.page-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

/* ===== TOPBAR ===== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(5, 8, 15, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
body.light .topbar {
    background: rgba(240, 244, 248, 0.85);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.topbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}
.topbar-logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 14px;
}
.topbar-logo-text {
    font-weight: 700;
    font-size: 16px;
}

.topbar-center {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Ranking button */
.topbar-ranking-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    background: var(--yellow-glow);
    border: 1px solid rgba(234, 179, 8, 0.25);
    color: var(--yellow);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
}
.topbar-ranking-btn:hover {
    background: rgba(234, 179, 8, 0.18);
}

/* Admin button */
.topbar-admin-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    background: var(--accent-glow);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: var(--accent-light);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
}
.topbar-admin-btn:hover {
    background: rgba(34, 197, 94, 0.18);
}

/* Theme toggle */
.theme-toggle {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.2s;
}
.theme-toggle:hover {
    color: var(--text);
    border-color: var(--border-light);
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}
.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== SECTION ===== */
.section {
    margin-bottom: 32px;
}
.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}
.section-subtitle {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: -12px;
    margin-bottom: 16px;
}

/* ===== ADMIN SIDEBAR (Fases 2-5, mas definido para consistência) ===== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}
.admin-sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.admin-main {
    flex: 1;
    padding: 32px;
    min-width: 0;
    overflow-y: auto;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 98;
}

/* Sidebar tab hover */
.sidebar-tab:hover {
    background: var(--bg-surface) !important;
    color: var(--text) !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .page-container {
        padding: 16px;
    }

    .topbar {
        padding: 10px 16px;
    }
    .topbar-logo-text {
        display: none;
    }
    .topbar-logo-icon-img { display: inline !important; }
    body.dark .topbar-logo-icon-img.logo-light-only { display: none !important; }
    body.light .topbar-logo-icon-img.logo-dark-only { display: none !important; }
    .topbar-ranking-btn span {
        display: none;
    }
    .topbar-admin-btn span {
        display: none;
    }

    /* Grids */
    .admin-stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }
    .grid-2 {
        grid-template-columns: 1fr !important;
    }
    .grid-3 {
        grid-template-columns: 1fr !important;
    }
    .grid-4 {
        grid-template-columns: 1fr 1fr !important;
    }
    .stats-grid-2 {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Visibility */
    .hide-mobile {
        display: none !important;
    }
    .hide-desktop {
        display: block !important;
    }

    /* Admin */
    .admin-sidebar {
        display: none !important;
    }
    .admin-sidebar.mobile-open {
        display: flex !important;
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 99;
        animation: slideIn 0.2s ease-out;
    }
    .admin-main {
        padding: 16px !important;
    }

    /* Modal */
    .modal-inner {
        width: 95% !important;
        padding: 20px !important;
        max-height: 90vh !important;
    }

    /* Podium */
    .podium-container {
        gap: 8px !important;
    }
    .podium-container > div {
        min-width: 0 !important;
    }
}

@media (max-width: 480px) {
    .grid-4 {
        grid-template-columns: 1fr !important;
    }
}

@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
}
