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

:root {
    /* Sidebar - Escura */
    --sidebar-bg: linear-gradient(180deg, #0c1222 0%, #111827 100%);
    --sidebar-text: #9ca3af;
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --sidebar-active-bg: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --sidebar-active-text: #ffffff;
    --sidebar-border: rgba(255, 255, 255, 0.06);
    
    /* Body - Claro */
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    
    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    /* Accent Colors */
    --primary: #3b82f6;
    --primary-light: #eff6ff;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;
    --cyan: #06b6d4;
    --cyan-light: #ecfeff;
    --orange: #f97316;
    --orange-light: #fff7ed;
}

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

body {
    background: var(--body-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR - ESCURA
   ============================================ */
.sidebar {
    background: var(--sidebar-bg);
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-border);
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.sidebar-logo .logo-text {
    font-weight: 700;
    font-size: 1.25rem;
    color: #fff;
    letter-spacing: -0.5px;
}

/* Botão fechar sidebar (mobile) */
.sidebar-close {
    display: none;
    position: absolute;
    top: 1.25rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sidebar-close:hover {
    background: rgba(255,255,255,0.2);
}

.sidebar-menu {
    padding: 1rem 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-section {
    padding: 0 0.75rem;
    margin-bottom: 0.25rem;
}

.sidebar-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    border-radius: 8px;
    transition: all 0.15s ease;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
}

.nav-link:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.nav-link i {
    font-size: 1.1rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.85;
}

.nav-link.active i {
    opacity: 1;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: #6b7280;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   SIDEBAR OVERLAY (mobile)
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 1040;
    backdrop-filter: blur(2px);
}

/* ============================================
   MAIN WRAPPER - CLARO
   ============================================ */
.main-wrapper {
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--body-bg);
}

/* ============================================
   HEADER - BRANCO
   ============================================ */
.top-header {
    background: var(--card-bg);
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--card-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Botão hamburguer - escondido por padrão */
.sidebar-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: var(--body-bg);
    color: var(--text-secondary);
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--body-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.user-details {
    line-height: 1.3;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--body-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-logout:hover {
    background: var(--danger-light);
    border-color: #fecaca;
    color: var(--danger);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
main {
    padding: 1.5rem;
    flex: 1;
}

/* ============================================
   CARDS - BRANCO
   ============================================ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.card-body {
    padding: 1.25rem;
}

/* ============================================
   METRIC CARDS
   ============================================ */
.metric-card {
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.metric-card.blue::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.metric-card.green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.metric-card.purple::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.metric-card.cyan::before { background: linear-gradient(90deg, #06b6d4, #22d3ee); }
.metric-card.orange::before { background: linear-gradient(90deg, #f97316, #fb923c); }

.metric-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.metric-icon.blue { background: var(--primary-light); color: var(--primary); }
.metric-icon.green { background: var(--success-light); color: var(--success); }
.metric-icon.purple { background: var(--purple-light); color: var(--purple); }
.metric-icon.cyan { background: var(--cyan-light); color: var(--cyan); }
.metric-icon.orange { background: var(--orange-light); color: var(--orange); }

.metric-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}

.metric-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: 20px;
}

.metric-trend.up {
    background: var(--success-light);
    color: #059669;
}

.metric-trend.down {
    background: var(--danger-light);
    color: var(--danger);
}

.metric-trend.neutral {
    background: var(--purple-light);
    color: var(--purple);
}

/* ============================================
   ACTION CARDS
   ============================================ */
.action-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    height: 100%;
    transition: all 0.2s ease;
}

.action-card:hover {
    color: inherit;
}

.action-card:hover .action-icon {
    transform: scale(1.05);
}

.action-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.action-icon.blue {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.action-icon.green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.action-icon.purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.action-icon.cyan {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.action-icon.orange {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.action-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
}

.action-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ============================================
   CHART CARDS
   ============================================ */
.chart-card {
    padding: 1.25rem;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-title i {
    color: var(--primary);
}

.chart-container {
    height: 260px;
    position: relative;
}

/* ============================================
   TABLES
   ============================================ */
.table-card {
    overflow: hidden;
}

.table-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-title i {
    color: var(--primary);
}

.table {
    margin: 0;
}

.table thead th {
    background: var(--body-bg);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--card-border);
    border-top: none;
}

.table tbody td {
    padding: 0.875rem 1.25rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--card-border);
    vertical-align: middle;
    font-size: 0.875rem;
}

.table tbody tr:hover {
    background: var(--body-bg);
}

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

/* ============================================
   BADGES
   ============================================ */
.badge-status {
    padding: 0.3125rem 0.625rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-active {
    background: var(--success-light);
    color: #059669;
}

.badge-inactive {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-pending {
    background: var(--warning-light);
    color: #b45309;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    border-radius: 8px;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    color: #fff;
}

.btn-secondary {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--body-bg);
    color: var(--text-primary);
    border-color: #cbd5e1;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: none;
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

/* ============================================
   FORMS
   ============================================ */
.form-control, .form-select {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.625rem 0.875rem;
    border-radius: 8px;
    transition: all 0.15s ease;
}

.form-control:focus, .form-select:focus {
    background: var(--card-bg);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
}

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

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.input-group-text {
    background: var(--body-bg);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    border: none;
    border-radius: 10px;
    padding: 0.875rem 1rem;
    font-weight: 500;
}

.alert-success {
    background: var(--success-light);
    color: #065f46;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
    border-left: 4px solid var(--warning);
}

/* ============================================
   AUTH PAGES
   ============================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    position: relative;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 30% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
}

.auth-card .card {
    padding: 2rem;
    background: var(--card-bg);
    border: none;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.auth-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-logo .logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35);
    margin-bottom: 1rem;
}

.auth-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.auth-logo p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================
   SCROLLBAR
   ============================================ */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-gradient {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stagger animations */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media (max-width: 991.98px) {
    /* Sidebar escondido por padrão no mobile */
    .sidebar {
        transform: translateX(-100%);
    }
    
    /* Quando sidebar está aberto */
    body.sidebar-open .sidebar {
        transform: translateX(0);
    }
    
    /* Mostrar botão fechar no sidebar */
    .sidebar-close {
        display: flex;
    }
    
    /* Mostrar botão hamburguer */
    .sidebar-toggle {
        display: flex;
    }
    
    /* Main wrapper ocupa 100% */
    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }
    
    /* Overlay visível quando sidebar aberto */
    body.sidebar-open .sidebar-overlay {
        display: block;
    }
    
    /* Header ajustes mobile */
    .top-header {
        padding: 0 1rem;
        height: 60px;
    }
    
    .page-title {
        font-size: 1.125rem;
    }
    
    /* User info mais compacto */
    .user-info {
        padding: 0.375rem 0.5rem;
    }
    
    .user-details {
        display: none;
    }
    
    .btn-logout {
        padding: 0.375rem 0.625rem;
    }
    
    .btn-logout span {
        display: none;
    }
    
    /* Main content ajustes */
    main {
        padding: 1rem;
    }
    
    /* Cards ajustes */
    .card-body {
        padding: 1rem;
    }
    
    .metric-value {
        font-size: 1.5rem;
    }
    
    .action-icon {
        width: 44px;
        height: 44px;
        font-size: 1.125rem;
    }
}

/* Tablets */
@media (min-width: 768px) and (max-width: 991.98px) {
    .user-details {
        display: block;
    }
    
    .btn-logout span {
        display: inline;
    }
}

/* Celulares pequenos */
@media (max-width: 575.98px) {
    .top-header {
        gap: 0.5rem;
    }
    
    .user-profile {
        gap: 0.5rem;
    }
    
    .page-title {
        font-size: 1rem;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .metric-card .card-body {
        padding: 0.875rem;
    }
    
    .metric-value {
        font-size: 1.375rem;
    }
    
    .metric-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}
