/* --- CSS PADRÃO (Baseado no Dashboard Arquitetura) --- */

/* Fonte principal: Nexa (usar como font-family: 'Nexa', sans-serif no sistema de produção) */
/* Fallback: Nunito (Google Fonts — visualmente similar ao Nexa) */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@200;300;400;600;700;800&display=swap');

:root {
    --primary: #00AFEF;
    --primary-light: #E0F7FF;
    --primary-dark: #0091CC;
    --secondary: #000000;
    --bg-light: #F3F4F6;
    --bg-subtle: #F8F9FA;
    --grey-med: #9CA3AF;
    --surface: #FFFFFF;
    --border-color: #e5e7eb;

    /* New Variables */
    --text-white: #FFFFFF;
    --text-grey: #6b7280;
    --text-grey-light: #9ca3af;
    --text-grey-dark: #4b5563;
    --text-black: #000000;
    --danger-bg: #fee2e2;
    --danger-text: #b91c1c;
    --warning-bg: #fff7ed;
    --warning-text: #c2410c;
    --success-bg: #f0fdf4;
    --success-text: #15803d;
    --info-bg: #E0F7FF;
    --info-text: #0091CC;
    --border-light: #d1d5db;

    --header-height: 72px;
    --sidebar-width: 260px;
}

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

body {
    /* Nexa como fonte principal; Nunito como fallback confiável */
    font-family: 'Nexa', 'Nunito', sans-serif;
    background-color: var(--bg-light);
    color: var(--secondary);
    height: 100vh;
    height: 100svh;
    max-height: 100svh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Header Padronizado */
.app-header {
    height: var(--header-height);
    background-color: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 50;
    /* Increased z-index */
    flex-shrink: 0;
    position: sticky;
    /* Make sticky */
    top: 0;
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-container {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 42px;
    width: auto;
    display: block;
}

/* Layout */
.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: transform 0.3s ease;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 24px;
    color: var(--text-grey-dark);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    border-right: 3px solid transparent;
    cursor: pointer;
}

.nav-item:hover {
    background-color: var(--bg-light);
    color: var(--primary);
}

.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
    border-right-color: var(--primary);
}

.nav-icon {
    width: 20px;
    font-size: 16px;
    text-align: center;
    margin-right: 12px;
}

.sidebar-section-title {
    padding: 0 24px;
    margin-top: 24px;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--grey-med);
    text-transform: uppercase;
}

/* Main Content */
.main-content {
    flex: 1;
    background-color: var(--bg-light);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.content-wrapper {
    padding: 32px;
    flex: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-black);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

/* Dashboard Grid específico */
.grid-dashboard {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.stat-icon-bg {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
}

.blue-bg {
    background: var(--info-bg);
    color: var(--primary);
}


/* Footer Padronizado */
.app-footer {
    background-color: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 12px 32px;
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}

.footer-tech {
    display: flex;
    gap: 10px;
    color: var(--text-grey-light);
}

/* Common Utilities */
.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: none;
}

/* Responsividade Básica */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: var(--header-height);
        /* Below header */
        height: calc(100vh - var(--header-height));
        height: calc(100svh - var(--header-height));
        /* Full height minus header */
        transform: translateX(-100%);
        box-shadow: 4px 0 8px rgba(0, 0, 0, 0.1);
        width: 260px;
        z-index: 40;
        /* Higher than overlay (30) but below header (50) */
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-toggle {
        display: block;
        margin-right: 10px;
    }

    .grid-dashboard {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    position: fixed;
    top: var(--header-height);
    /* Below header */
    left: 0;
    width: 100%;
    height: calc(100vh - var(--header-height));
    height: calc(100svh - var(--header-height));
    background: rgba(0, 0, 0, 0.5);
    z-index: 30;
    /* Below sidebar (40) */
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

@media (max-width: 640px) {
    :root {
        --header-height: 64px;
    }

    .header-logo {
        height: 32px;
    }

    .header-left .logo-text {
        font-size: 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .content-wrapper {
        padding: 20px;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .app-footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        padding: 30px;
    }

}

/* Profile Dropdown Styles */
.profile-trigger {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    position: relative;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.profile-trigger:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    display: none;
    flex-direction: column;
    z-index: 50;
    overflow: hidden;
}

.profile-dropdown.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--secondary);
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s;
    text-decoration: none;
}

.dropdown-item:hover {
    background-color: var(--bg-light);
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 0;
}

.text-danger {
    color: #ef4444;
}

.text-danger:hover {
    background-color: #fef2f2;
    color: #dc2626;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}