/* ===================================================================
   PORTAL CLIENTE UNIPREMIUM - ENHANCED STYLES
   Mobile-First Responsive Design with Modern UI Elements
   UPDATED: 2025-09-16 - Gradiente Azul para Vermelho Claro
   =================================================================== */

:root {
    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    
    /* Colors - Enhanced palette */
    --primary-color: #021aa3;
    --secondary-color: #ad1707;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color) 75%, var(--secondary-color) 100%);
    --gradient-success: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    --gradient-warning: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
    --gradient-danger: linear-gradient(135deg, #dc3545 0%, #e83e8c 100%);
    --gradient-info: linear-gradient(135deg, #17a2b8 0%, #6f42c1 100%);
    
    /* Sidebar colors */
    --sidebar-bg: var(--gradient-primary);
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active: rgba(255, 255, 255, 0.15);
    
    /* Shadows */
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --shadow-custom: 0 0.5rem 2rem rgba(102, 126, 234, 0.15);
    
    /* Transitions */
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease-in-out;
    --transition-slow: 0.5s ease-in-out;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    background: linear-gradient(135deg, #f5f6fa 0%, #e8eef5 100%);
    color: var(--dark-color);
    line-height: 1.6;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===================================================================
   SIDEBAR STYLES
   =================================================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: white;
    z-index: 1050;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
}

.sidebar.show {
    left: 0;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-nav {
    padding: 1rem 0;
    height: calc(100vh - 120px);
    overflow-y: auto;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1.5rem;
    margin: 0.25rem 1rem;
    border-radius: 0.5rem;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    text-decoration: none;
    border: none;
}

.sidebar .nav-link:hover {
    color: white;
    background: var(--sidebar-hover);
    transform: translateX(5px);
}

.sidebar .nav-link.active {
    color: white;
    background: var(--sidebar-active);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar .nav-link i {
    font-size: 1.125rem;
    width: 1.5rem;
    margin-right: 0.75rem;
    text-align: center;
}

.sidebar .nav-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Mobile Sidebar Toggle */
.sidebar-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1051;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* ===================================================================
   MAIN CONTENT STYLES
   =================================================================== */

.main-content {
    min-height: 100vh;
    transition: all 0.3s ease;
}

.main-header {
    background: white;
    padding: 1rem 0;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1040;
}

.content-body {
    padding: 2rem 0;
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

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

/* Fix para títulos das páginas */
.content-section h2 {
    color: var(--dark-color) !important;
    font-weight: 600;
}

.content-section h2 i {
    color: var(--primary-color) !important;
}

/* Fix para todos os títulos de cards que podem estar brancos */
.card-header h6,
.card-header .mb-0,
.content-section h3,
.content-section h4,
.content-section h5,
.content-section h6 {
    color: var(--dark-color) !important;
}

/* Garantir que apenas cards com gradiente tenham texto branco */
.card-header.bg-gradient h6,
.card-header.bg-gradient .mb-0 {
    color: white !important;
}

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

/* ===================================================================
   CARD STYLES
   =================================================================== */

.card {
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1) !important;
}

.card-header {
    border-radius: 0.5rem 0.5rem 0 0 !important;
    font-weight: 600;
}

/* ===================================================================
   UTILITY CLASSES
   =================================================================== */

.text-money {
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.badge-status {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================================================
   RESPONSIVE DESIGN - TABLET
   =================================================================== */

@media (min-width: 768px) {
    .sidebar-toggle {
        top: 1.5rem;
        left: 1.5rem;
    }
    
    .content-body {
        padding: 2.5rem 0;
    }
    
    .main-header {
        padding: 1.5rem 0;
    }
}

/* ===================================================================
   RESPONSIVE DESIGN - DESKTOP
   =================================================================== */

@media (min-width: 992px) {
    .sidebar {
        left: 0;
        width: var(--sidebar-width);
    }
    
    .sidebar.collapsed {
        width: var(--sidebar-collapsed-width);
    }
    
    .sidebar.collapsed .nav-text,
    .sidebar.collapsed .sidebar-header div {
        display: none;
    }
    
    .sidebar.collapsed .nav-link {
        text-align: center;
        padding: 0.75rem 0;
    }
    
    .sidebar.collapsed .nav-link i {
        margin-right: 0;
    }
    
    .main-content {
        margin-left: var(--sidebar-width);
    }
    
    .main-content.sidebar-collapsed {
        margin-left: var(--sidebar-collapsed-width);
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .content-body {
        padding: 3rem 0;
    }
}

@media (min-width: 1200px) {
    .content-body {
        padding: 3.5rem 0;
    }
}

/* ===================================================================
   DARK MODE SUPPORT
   =================================================================== */

@media (prefers-color-scheme: dark) {
    .bg-light {
        background-color: #212529 !important;
        color: white;
    }
    
    .card {
        background-color: #343a40;
        color: white;
    }
    
    .main-header {
        background-color: #343a40;
        border-bottom-color: #495057;
    }
    
    .text-muted {
        color: #adb5bd !important;
    }
}

/* ===================================================================
   ACCESSIBILITY
   =================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
.nav-link:focus,
button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .sidebar {
        border-right: 2px solid white;
    }
    
    .nav-link {
        border: 1px solid transparent;
    }
    
    .nav-link:hover,
    .nav-link:focus {
        border-color: white;
    }
}

/* ===================================================================
   ENHANCED COMPONENT STYLES
   =================================================================== */

/* Enhanced Card Styles */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    transition: all var(--transition-normal);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: white !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    font-weight: 600;
    padding: 1rem 1.5rem;
    border-radius: 0.75rem 0.75rem 0 0 !important;
}

.card-body {
    padding: 1.5rem;
}

/* Enhanced Form Styles */
.form-control {
    border: 2px solid #e3e6f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    transition: all var(--transition-fast);
    font-size: 0.95rem;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #6c757d;
}

/* Enhanced Button Styles */
.btn {
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all var(--transition-fast);
    border: none;
}

.btn-primary {
    background: var(--gradient-primary);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.5rem 1rem rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: var(--gradient-success);
}

.btn-warning {
    background: var(--gradient-warning);
}

.btn-danger {
    background: var(--gradient-danger);
}

.btn-info {
    background: var(--gradient-info);
}

/* Enhanced Table Styles */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 700;
    color: #495057;
    background: #f8f9fa;
    padding: 1rem;
}

.table td {
    padding: 1rem;
    vertical-align: middle;
    border-top: 1px solid #e9ecef;
}

.table-hover tbody tr:hover {
    background-color: #f5f6fa;
}

/* Enhanced Badge Styles */
.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.75rem;
}

/* Enhanced Progress Styles */
.progress {
    border-radius: 0.5rem;
    background-color: rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.progress-bar {
    border-radius: 0.5rem;
    transition: width var(--transition-normal);
}

/* Enhanced Alert Styles */
.alert {
    border: none;
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    border-left: 4px solid;
}

.alert-success {
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1) 0%, rgba(32, 201, 151, 0.1) 100%);
    border-left-color: #28a745;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(253, 126, 20, 0.1) 100%);
    border-left-color: #ffc107;
}

.alert-danger {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(232, 62, 140, 0.1) 100%);
    border-left-color: #dc3545;
}

.alert-info {
    background: linear-gradient(135deg, rgba(23, 162, 184, 0.1) 0%, rgba(111, 66, 193, 0.1) 100%);
    border-left-color: #17a2b8;
}

/* Enhanced Pagination Styles */
.pagination .page-link {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    color: var(--primary-color);
    margin: 0 0.125rem;
    transition: all var(--transition-fast);
}

.pagination .page-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.pagination .page-item.active .page-link {
    background: var(--gradient-primary);
    border-color: var(--primary-color);
}

/* Toast Styles */
.toast {
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
}

.toast-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

/* Loading States */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 0.5rem;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===================================================================
   ENHANCED UTILITY CLASSES
   =================================================================== */
.text-money {
    font-weight: 700;
    font-family: 'Monaco', 'Menlo', monospace;
}

.shadow-custom {
    box-shadow: var(--shadow-custom) !important;
}

.bg-gradient-primary {
    background: var(--gradient-primary) !important;
}

.bg-gradient-success {
    background: var(--gradient-success) !important;
}

.bg-gradient-warning {
    background: var(--gradient-warning) !important;
}

.bg-gradient-danger {
    background: var(--gradient-danger) !important;
}

.bg-gradient-info {
    background: var(--gradient-info) !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

/* ===================================================================
   MOBILE OPTIMIZATIONS
   =================================================================== */

/* Enhanced Mobile Sidebar Toggle */
.sidebar-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    z-index: 1051;
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-size: 1.5rem;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
}

.sidebar-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 1rem 2rem rgba(102, 126, 234, 0.3);
}

/* ===================================================================
   PRINT STYLES
   =================================================================== */
@media print {
    .sidebar,
    .sidebar-toggle,
    .main-header,
    .btn,
    .alert {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
    
    .content-body {
        padding: 0 !important;
    }
}

/* ===================================================================
   ENHANCED ACCESSIBILITY
   =================================================================== */
.btn:focus,
.form-control:focus,
.nav-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}/* FIXES PARA PORTAL CLIENTE */

/* 1. Gradiente suave */
:root {
    --gradient-primary: linear-gradient(135deg, #021aa3 0%, #1a34c4 30%, #4d6ed4 60%, #8a98e3 80%, #ad1707 100%) !important;
}

/* 2. Sidebar com gradiente forçado */
.sidebar {
    background: linear-gradient(135deg, #021aa3 0%, #1a34c4 30%, #4d6ed4 60%, #8a98e3 80%, #ad1707 100%) !important;
}

.sidebar-header {
    background: transparent !important;
}

/* 3. Dark mode com contraste adequado */
@media (prefers-color-scheme: dark) {
    .bg-light {
        background-color: #212529 !important;
        color: white !important;
    }
    
    .card {
        background-color: #343a40 !important;
        color: white !important;
    }
    
    .card-header {
        background-color: #495057 !important;
        color: white !important;
    }
    
    .card-body {
        color: white !important;
    }
    
    .main-header {
        background-color: #343a40 !important;
        border-bottom-color: #495057 !important;
        color: white !important;
    }
    
    /* Títulos claros em cards escuros */
    .card h1, .card h2, .card h3, .card h4, .card h5, .card h6 {
        color: white !important;
    }
    
    .card .text-primary { color: #74c0fc !important; }
    .card .text-success { color: #69db7c !important; }
    .card .text-info { color: #74c0fc !important; }
    .card .text-warning { color: #ffd43b !important; }
    .card .text-danger { color: #ff8787 !important; }
    
    .content-section h2 { color: #000000 !important; }
    .card-header h6, .card-header .mb-0 { color: white !important; }
}

/* ===================================================================
   CORREÇÕES DE TÍTULOS E BOTÕES MOBILE
   =================================================================== */

/* Títulos das seções sempre pretos (fundo branco em ambos os modos) */
.content-section h2 {
    color: #000000 !important;
}

.content-section h2 i {
    color: #000000 !important;
}

/* Garantir que textos em cards com fundo branco sejam pretos */
.card-header.bg-white,
.card-header.bg-white h6,
.card-header.bg-white i {
    color: #000000 !important;
}

/* Garantir que textos com opacity-75 também sejam pretos */
.card-header p.opacity-75 {
    color: #000000 !important;
}

/* Centralizar ícones nos botões de toggle */
.sidebar-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle i {
    margin: 0 !important;
}

/* Corrigir botão mobile - só aparecer em mobile e não sobrepor conteúdo */
@media (min-width: 992px) {
    .sidebar-toggle {
        display: none !important;
    }
}

/* Ajustar z-index para não ficar por cima do conteúdo */
.sidebar-toggle {
    z-index: 1040 !important;
}

/* Centralizar ícone do botão de alternância de tema */
.theme-toggle-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn i {
    margin: 0 !important;
}


/* ===================================================================
   CORREÇÕES ADICIONAIS - FORÇA TÍTULOS E SUBTÍTULOS PRETOS
   =================================================================== */

/* Forçar TODOS os títulos e subtítulos a serem pretos */
section h2,
section h3,
section h4,
section h5,
section h6,
.content-section h2,
.content-section h3,
.content-section h4,
.content-section h5,
.content-section h6,
.card-header h6,
.card-header .mb-0,
#dashboard-section h2,
#saldo-section h2,
#compras-section h2,
#perfil-section h2 {
    color: #000000 !important;
}

/* Forçar ícones dos títulos a serem pretos também */
section h2 i,
section h3 i,
.content-section h2 i,
.content-section h3 i,
.card-header h6 i,
.card-header .mb-0 i {
    color: #000000 !important;
}

/* Aplicar também no modo escuro - sobrescrever regras anteriores */
@media (prefers-color-scheme: dark) {
    .content-section h2,
    .content-section h3,
    .content-section h4,
    .content-section h5,
    .content-section h6,
    section h2,
    section h3,
    #dashboard-section h2,
    #saldo-section h2,
    #compras-section h2,
    #perfil-section h2 {
        color: #000000 !important;
    }

    /* Subtítulos dos cards com fundo branco sempre pretos */
    .card-header.bg-white h6,
    .card-header.bg-white .mb-0,
    .card-header.bg-white i {
        color: #000000 !important;
    }
}


/* ===================================================================
   CORREÇÃO DEFINITIVA BOTÃO MOBILE
   =================================================================== */

/* Esconder botão mobile completamente em desktop - DEFINITIVO */
@media (min-width: 992px) {
    .sidebar-toggle,
    #sidebarToggle,
    button#sidebarToggle,
    .btn.sidebar-toggle,
    button.sidebar-toggle.btn,
    .d-lg-none {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }
}

/* Mostrar apenas em mobile/tablet */
@media (max-width: 991.98px) {
    .sidebar-toggle {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}


/* ===================================================================
   ESCONDER BOTÃO DESKTOP TAMBÉM
   =================================================================== */

/* Esconder AMBOS os botões de menu em desktop */
#sidebarToggleDesktop,
button#sidebarToggleDesktop,
.btn#sidebarToggleDesktop {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* Força esconder qualquer botão com ícone bi-list em desktop */
@media (min-width: 992px) {
    button .bi-list,
    .btn .bi-list {
        display: none !important;
    }
    
    button:has(.bi-list),
    .btn:has(.bi-list) {
        display: none !important;
    }
}


/* ===================================================================
   CORREÇÃO FINAL - BOTÃO MOBILE INTEGRADO NO HEADER
   =================================================================== */

/* Remover estilos de botão flutuante e usar botão integrado */
.sidebar-toggle {
    /* Remover propriedades de posição fixa */
    position: static !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0.375rem !important;
    z-index: auto !important;
    background: transparent !important;
    border: 1px solid #6c757d !important;
    color: #6c757d !important;
    font-size: 1rem !important;
    box-shadow: none !important;
    transition: all 0.15s ease-in-out !important;
    bottom: auto !important;
    right: auto !important;
    top: auto !important;
    left: auto !important;
}

/* Hover do botão integrado */
.sidebar-toggle:hover {
    background-color: #6c757d !important;
    color: white !important;
    transform: none !important;
}

/* Mobile: mostrar apenas o botão integrado */
@media (max-width: 991.98px) {
    .sidebar-toggle {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0.5rem 0.75rem !important;
    }
}
