/* ============================================
   LAYOUT — Dashboard de Tráfego
   ============================================ */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ---- App Shell ---- */
.app-container {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--gradient-sidebar);
    border-right: 1px solid var(--border-primary);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: width var(--transition-base), transform var(--transition-base);
    overflow: hidden;
}

.sidebar-header {
    padding: var(--space-4) var(--space-4);
    border-bottom: 1px solid var(--border-primary);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 72px;
    justify-content: space-between;
}

.sidebar-logo {
    font-size: var(--font-size-xl);
    font-weight: 800;
    background: var(--gradient-hero);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.sidebar-collapse-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-collapse-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Collapsed sidebar */
.sidebar.collapsed {
    width: 68px;
}

.sidebar.collapsed .sidebar-logo {
    opacity: 0;
    width: 0;
}

.sidebar.collapsed .sidebar-collapse-btn svg {
    transform: rotate(180deg);
}

.sidebar.collapsed .nav-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: var(--space-3);
}

.sidebar.collapsed .nav-item .nav-icon {
    margin: 0;
}

.sidebar.collapsed+.sidebar-overlay+.main-content,
.sidebar.collapsed~.main-content {
    margin-left: 68px;
}

/* Tooltip on collapsed sidebar hover */
.sidebar.collapsed .nav-item {
    position: relative;
}

.sidebar.collapsed .nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    border: 1px solid var(--border-primary);
    z-index: 200;
}

.sidebar.collapsed .nav-item:hover::after {
    opacity: 1;
}

/* Footer in collapsed state */
.sidebar.collapsed .sidebar-footer {
    padding: var(--space-3);
    align-items: center;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-footer span {
    display: none;
}

/* Esconde o account switcher e o texto do cliente no modo colapsado */
.sidebar.collapsed #sidebar-account-switcher {
    display: none !important;
}

.sidebar.collapsed .sidebar-footer [style*="flex:1"],
.sidebar.collapsed .sidebar-footer [style*="flex: 1"] {
    display: none !important;
}

/* Centraliza o container do avatar no footer colapsado */
.sidebar.collapsed .sidebar-footer > div:first-child {
    padding: 10px;
    justify-content: center;
}

/* Divider in collapsed state */
.sidebar.collapsed .sidebar-divider {
    margin: var(--space-2) var(--space-3) !important;
}

/* Sidebar header collapsed */
.sidebar.collapsed .sidebar-header {
    padding: var(--space-3);
    justify-content: center;
}

/* Smooth transitions for all sidebar children */
.sidebar .nav-label {
    transition: opacity 0.25s ease, width 0.25s ease;
}

.sidebar .sidebar-footer {
    transition: padding 0.3s ease;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
    overflow-y: auto;
}

.nav-group {
    display: flex;
    flex-direction: column;
    margin-bottom: var(--space-3);
    transition: margin var(--transition-base);
}

.nav-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding: var(--space-2) 0;
    margin-bottom: var(--space-1);
    color: var(--text-tertiary);
    transition: color var(--transition-fast);
}

.nav-group-header:hover {
    color: var(--text-primary);
}

.nav-group-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: inherit;
    letter-spacing: 0.08em;
    padding: 0 var(--space-3);
    pointer-events: none;
}

.nav-group-chevron {
    width: 12px;
    height: 12px;
    margin-right: var(--space-3);
    transition: transform var(--transition-base);
    color: inherit;
    pointer-events: none;
}

.nav-group-content {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height var(--transition-base), opacity var(--transition-base);
    display: flex;
    flex-direction: column;
}

.nav-group.expanded .nav-group-content {
    max-height: 400px; /* Altura suficiente para os links */
    opacity: 1;
}

.nav-group.expanded .nav-group-chevron {
    transform: rotate(90deg);
}

/* Modo colapsado: oculta o header e força a exibição direta dos ícones */
.sidebar.collapsed .nav-group {
    margin-bottom: var(--space-2);
}

.sidebar.collapsed .nav-group-header {
    display: none !important;
}

.sidebar.collapsed .nav-group-content {
    max-height: none !important;
    opacity: 1 !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-size-xs);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 1px;
    position: relative;
    overflow: hidden;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

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

.nav-item.active {
    background: rgba(124, 58, 237, 0.15);
    color: var(--primary-300);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary-400);
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-label {
    white-space: nowrap;
    overflow: hidden;
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-base);
    overflow-x: hidden;
}

/* ============================================
   HOME MODE — tela inicial sem sidebar/header
   ============================================ */
body.home-mode .sidebar {
    transform: translateX(-100%);
    pointer-events: none;
}

body.home-mode .main-content {
    margin-left: 0 !important;
}

body.home-mode .top-header {
    display: none;
}

body.home-mode #section-inicio {
    min-height: 100vh;
    padding: 0;
}

body.home-mode .page-content {
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Transição suave ao sair do home mode */
.sidebar {
    transition: width var(--transition-base), transform var(--transition-base);
}


/* ---- Header ---- */
.top-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border-bottom: 1px solid var(--border-primary);
    padding: var(--space-3) var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: var(--header-height);
}

.light-mode .top-header {
    background: rgba(248, 250, 252, 0.85);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    overflow: hidden;
    min-width: 0;
    flex: 1;
}

.header-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ---- Filter Bar ---- */
.filters-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.filter-label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    padding: 8px 32px 8px 14px;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-family: var(--font-family);
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    min-width: 140px;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8fa3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

.filter-select:hover {
    border-color: var(--border-secondary);
    background-color: rgba(255, 255, 255, 0.06);
}

.filter-select:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.filter-select option {
    background: #1a1a2e;
    color: var(--text-primary);
    padding: 10px 14px;
    font-weight: 500;
}

.filter-select option:checked {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.4), rgba(124, 58, 237, 0.2));
    color: #fff;
}

.filter-select option:hover {
    background: rgba(124, 58, 237, 0.15);
}

.light-mode .filter-select {
    background-color: #f1f5f9;
    border-color: #d1d5db;
    color: #1e293b;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.light-mode .filter-select:hover {
    background-color: #e2e8f0;
    border-color: #94a3b8;
}

.light-mode .filter-select:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}

.light-mode .filter-select option {
    background: #f8fafc;
    color: #1e293b;
}

.light-mode .filter-select option:checked {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2), rgba(124, 58, 237, 0.1));
    color: #1e293b;
}

/* ---- Client Selector (highlighted) ---- */
.filter-select-client {
    min-width: 180px;
    font-weight: 600;
    border-color: rgba(124, 58, 237, 0.4);
    background-color: rgba(124, 58, 237, 0.06);
}

.filter-select-client:hover {
    border-color: var(--primary-400);
    background-color: rgba(124, 58, 237, 0.12);
}

.filter-select-client:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.light-mode .filter-select-client {
    border-color: rgba(124, 58, 237, 0.3);
    background-color: rgba(124, 58, 237, 0.05);
}

/* ---- Filter Divider ---- */
.filter-divider {
    width: 1px;
    height: 24px;
    background: var(--border-primary);
    margin: 0 var(--space-1);
    flex-shrink: 0;
}

/* ---- Botão Atualizar (aparece ao detectar mudança pendente) ---- */
.btn-apply-filters {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--primary-500);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;

    /* Oculto por padrão — colapsa sem ocupar espaço */
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    padding-left: 0;
    padding-right: 0;
    pointer-events: none;
    transition:
        max-width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.25s ease,
        padding 0.3s ease,
        box-shadow 0.25s ease;
}

.btn-apply-filters.visible {
    max-width: 160px;
    opacity: 1;
    padding: 7px 14px;
    pointer-events: auto;
    box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.5);
    animation: btn-pulse 2s 0.35s ease-out infinite;
}

.btn-apply-filters:hover {
    background: var(--primary-400);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.45);
    animation: none;
}

.btn-apply-filters:active {
    transform: scale(0.97);
}

.btn-apply-filters svg {
    flex-shrink: 0;
}

@keyframes btn-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.55);
    }

    70% {
        box-shadow: 0 0 0 7px rgba(124, 58, 237, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(124, 58, 237, 0);
    }
}

.light-mode .btn-apply-filters {
    background: var(--primary-500);
    color: #fff;
}


/* ============================================
   CUSTOM SELECT — Redesign Premium
   ============================================ */

.custom-select {
    position: relative;
    display: inline-block;
    min-width: 140px;
}

.custom-select-client {
    min-width: 140px;
    max-width: 280px;
}

/* Sidebar account switcher — versão compacta */
.custom-select[data-for="sidebar-adaccount-select"] {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.custom-select[data-for="sidebar-adaccount-select"] .custom-select-trigger {
    padding: 6px 10px;
    font-size: 11px;
    min-height: 30px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border-color: rgba(124,58,237,0.2);
    color: var(--text-secondary);
    font-weight: 500;
}

.custom-select[data-for="sidebar-adaccount-select"] .custom-select-trigger:hover {
    background: rgba(124,58,237,0.1);
    border-color: rgba(124,58,237,0.4);
    color: var(--text-primary);
}

.custom-select[data-for="sidebar-adaccount-select"].open .custom-select-trigger {
    background: rgba(124,58,237,0.12);
    border-color: var(--primary-400);
    box-shadow: 0 0 0 2px rgba(124,58,237,0.2);
}

.custom-select[data-for="sidebar-adaccount-select"] .custom-select-value {
    max-width: 120px;
    font-size: 11px;
}

.custom-select[data-for="sidebar-adaccount-select"] .custom-select-arrow {
    width: 10px;
    height: 10px;
}


/* ── Trigger (botão visível) ── */
.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    white-space: nowrap;
    user-select: none;
    min-height: 36px;
}

.custom-select-trigger:hover {
    border-color: var(--border-secondary);
    background: rgba(255,255,255,0.05);
}

.custom-select.open .custom-select-trigger {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.18);
    background: rgba(124,58,237,0.07);
}

/* Cliente destacado */
.custom-select-client .custom-select-trigger {
    font-weight: 700;
    border-color: rgba(124,58,237,0.5);
    background: rgba(124,58,237,0.08);
    color: var(--primary-300);
}

.custom-select-client .custom-select-trigger:hover {
    border-color: var(--primary-400);
    background: rgba(124,58,237,0.14);
}

.custom-select-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    max-width: 220px;
}

.custom-select-arrow {
    flex-shrink: 0;
    color: var(--text-tertiary);
    transition: transform 0.25s ease;
    opacity: 0.7;
}

.custom-select.open .custom-select-arrow {
    transform: rotate(180deg);
    opacity: 1;
    color: var(--primary-400);
}

/* ── Dropdown Panel ── */
.custom-select-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: max(100%, 260px);
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    /* Fundo com blur premium */
    background: rgba(13, 13, 26, 0.97);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    /* Borda com glow sutil */
    border: 1px solid rgba(124,58,237,0.25);
    border-radius: 14px;
    box-shadow:
        0 20px 60px rgba(0,0,0,0.6),
        0 0 0 1px rgba(255,255,255,0.04) inset,
        0 0 30px rgba(124,58,237,0.08);
    z-index: 9999;
    transition: max-height 0.3s cubic-bezier(.4,0,.2,1), opacity 0.2s ease;
    pointer-events: none;
}

.custom-select.open .custom-select-panel {
    max-height: 380px;
    opacity: 1;
    overflow: auto;
    pointer-events: auto;
}

/* Painel abre para cima quando perto do fundo */
.custom-select.open-up .custom-select-panel {
    top: auto;
    bottom: calc(100% + 8px);
}


/* ── Search ── */
.custom-select-search-wrap {
    padding: 10px 10px 6px;
    position: sticky;
    top: 0;
    background: rgba(13,13,26,0.97);
    z-index: 1;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.custom-select-search {
    width: 100%;
    padding: 8px 12px 8px 34px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 12px;
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    /* Ícone de busca embutido */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b8fa3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cpath d='m21 21-4.35-4.35'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
    background-size: 14px;
}

.custom-select-search:focus {
    border-color: var(--primary-400);
    background-color: rgba(124,58,237,0.06);
}

.custom-select-search::placeholder {
    color: var(--text-muted);
    font-size: 11px;
}

/* ── Header do painel (label) ── */
.custom-select-panel-header {
    padding: 10px 14px 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: .08em;
}

/* ── Options ── */
.custom-select-options {
    padding: 6px;
}

.custom-select-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.1s;
    user-select: none;
    position: relative;
}

.custom-select-option:hover {
    background: rgba(124,58,237,0.12);
    color: var(--text-primary);
    transform: translateX(2px);
}

.custom-select-option.selected {
    background: linear-gradient(135deg, rgba(124,58,237,0.2), rgba(59,130,246,0.1));
    color: var(--primary-300);
    font-weight: 600;
    border: 1px solid rgba(124,58,237,0.2);
}

.custom-select-option.selected:hover {
    transform: none;
}

/* Avatar/iniciais no item */
.custom-select-option-avatar {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: linear-gradient(135deg, rgba(124,58,237,0.4), rgba(59,130,246,0.4));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}

.custom-select-option-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    font-size: 13px;
}

.custom-select-check {
    flex-shrink: 0;
    color: var(--primary-400);
    margin-left: auto;
}

/* ── Scrollbar ── */
.custom-select-panel::-webkit-scrollbar { width: 4px; }
.custom-select-panel::-webkit-scrollbar-track { background: transparent; }
.custom-select-panel::-webkit-scrollbar-thumb {
    background: rgba(124,58,237,0.35);
    border-radius: 999px;
}

/* ── Light Mode ── */
.light-mode .custom-select-trigger {
    background: #f1f5f9;
    border-color: #d1d5db;
    color: #1e293b;
}

.light-mode .custom-select-trigger:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.light-mode .custom-select-client .custom-select-trigger {
    border-color: rgba(124,58,237,0.3);
    background: rgba(124,58,237,0.05);
}

.light-mode .custom-select-panel {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(124, 58, 237, 0.15);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(0, 0, 0, 0.04) inset;
}

.light-mode .custom-select-search-wrap {
    background: rgba(255, 255, 255, 0.98);
}

.light-mode .custom-select-search {
    background: #f1f5f9;
    border-color: #d1d5db;
    color: #1e293b;
}

.light-mode .custom-select-option {
    color: #475569;
}

.light-mode .custom-select-option:hover {
    background: rgba(124, 58, 237, 0.08);
    color: #1e293b;
}

.light-mode .custom-select-option.selected {
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary-500);
}

/* ---- Page Content ---- */
.page-content {
    padding: var(--space-5);
    max-width: 1400px;
    margin: 0 auto;
}

/* ---- Section ---- */
.dashboard-section {
    display: none;
}

.dashboard-section.active {
    display: block;
}

/* ---- Page Title ---- */
.section-title {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.section-title .icon {
    font-size: var(--font-size-3xl);
}

/* ---- Grid Systems ---- */
.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: var(--space-4);
}

.grid-1 {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
}

/* ---- Utility ---- */
.mt-4 {
    margin-top: var(--space-4);
}

.mt-6 {
    margin-top: var(--space-6);
}

.mt-8 {
    margin-top: var(--space-8);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-6 {
    margin-bottom: var(--space-6);
}

.mb-8 {
    margin-bottom: var(--space-8);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-6 {
    gap: var(--space-6);
}

.text-center {
    text-align: center;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.flex-wrap {
    flex-wrap: wrap;
}

.hidden {
    display: none !important;
}

/* ---- Hamburger Button ---- */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
}

.hamburger-btn:hover {
    background: var(--bg-card-hover);
}

.hamburger-btn svg {
    width: 24px;
    height: 24px;
}

/* ---- Overlay ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

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

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

    .main-content {
        margin-left: 0;
    }

    .hamburger-btn {
        display: flex;
    }

    .page-content {
        padding: var(--space-4);
    }

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

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

    .top-header {
        padding: var(--space-3) var(--space-4);
    }

    .filters-bar {
        display: none;
    }

    .filters-bar.open {
        display: flex;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-secondary);
        padding: var(--space-4);
        border-bottom: 1px solid var(--border-primary);
        flex-direction: column;
        align-items: stretch;
    }
}

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

    html {
        font-size: 14px;
    }
}

/* ---- Share Report Button ---- */
.btn-share-report {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(236, 72, 153, 0.1));
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: var(--radius-md);
    color: var(--primary-300);
    font-size: var(--font-size-xs);
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-share-report:hover {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(236, 72, 153, 0.15));
    border-color: var(--primary-400);
    box-shadow: 0 0 16px rgba(124, 58, 237, 0.2);
    transform: translateY(-1px);
}

.btn-share-report svg {
    flex-shrink: 0;
}

/* ---- Share Modal ---- */
.share-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.share-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.share-modal {
    background: rgba(18, 18, 30, 0.98);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 20px;
    padding: 28px;
    width: 90%;
    max-width: 560px;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s ease;
}

.share-modal-overlay.active .share-modal {
    transform: scale(1) translateY(0);
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.share-modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.share-modal-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.15s ease;
}

.share-modal-close:hover {
    color: var(--text-primary);
}

.share-modal-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.share-modal-link-row {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.share-modal-input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: var(--font-family);
    outline: none;
}

.share-modal-input:focus {
    border-color: var(--primary-400);
}

.share-modal-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--primary-500);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.share-modal-copy:hover {
    background: var(--primary-400);
}

.share-modal-note {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Light mode share adjustments */
.light-mode .share-modal {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(124, 58, 237, 0.15);
}

.light-mode .share-modal-input {
    background: #f1f5f9;
    border-color: #d1d5db;
    color: #1e293b;
}

.light-mode .btn-share-report {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.2);
    color: var(--primary-500);
}