/* ============================================
   TEMA SYSTEM - BARBEARIA ELEGANTE
   ============================================ */

:root {
    --transition-speed: 0.3s;
}

/* ============================================
   DARK THEME (Padrão - Preto e Dourado)
   ============================================ */
[data-theme="dark"] {
    /* Backgrounds */
    --bg-primary: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    --bg-secondary: linear-gradient(135deg, rgba(26, 26, 26, 0.9) 0%, rgba(10, 10, 10, 0.9) 100%);
    --bg-card: linear-gradient(135deg, rgba(26, 26, 26, 0.8) 0%, rgba(10, 10, 10, 0.8) 100%);
    --bg-sidebar: linear-gradient(180deg, #0a0a0a 0%, #1a1a1a 100%);
    --bg-header: rgba(26, 26, 26, 0.8);
    --bg-input: rgba(26, 26, 26, 0.8);
    --bg-table: rgba(26, 26, 26, 0.4);
    --bg-hover: rgba(212, 165, 116, 0.1);
    
    /* Colors */
    --color-primary: #d4a574;
    --color-secondary: #b8860b;
    --color-tertiary: #c9a961;
    --color-accent: #d4a574;
    
    /* Text */
    --text-primary: #f5f5f5;
    --text-secondary: rgba(212, 165, 116, 0.8);
    --text-muted: rgba(245, 245, 245, 0.6);
    --text-heading: #ffffff;
    
    /* Borders */
    --border-primary: rgba(212, 165, 116, 0.3);
    --border-secondary: rgba(212, 165, 116, 0.15);
    --border-light: rgba(212, 165, 116, 0.1);
    
    /* Shadows */
    --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 12px 48px rgba(212, 165, 116, 0.2);
    --shadow-hover: 0 16px 48px rgba(212, 165, 116, 0.25);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #d4a574 0%, #b8860b 100%);
    --gradient-hover: linear-gradient(135deg, #b8860b 0%, #d4a574 100%);
    --gradient-text: linear-gradient(135deg, #ffffff 0%, #d4a574 100%);
}

/* ============================================
   WHITE THEME (Claro - Branco e Dourado Escuro)
   ============================================ */
[data-theme="white"] {
    /* Backgrounds */
    --bg-primary: linear-gradient(135deg, #fafafa 0%, #ffffff 100%);
    --bg-secondary: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 250, 250, 0.95) 100%);
    --bg-card: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(250, 250, 250, 0.9) 100%);
    --bg-sidebar: linear-gradient(180deg, #ffffff 0%, #f5f5f5 100%);
    --bg-header: rgba(255, 255, 255, 0.95);
    --bg-input: rgba(255, 255, 255, 0.9);
    --bg-table: rgba(250, 250, 250, 0.5);
    --bg-hover: rgba(139, 95, 36, 0.08);
    
    /* Colors */
    --color-primary: #8b5f24;
    --color-secondary: #6d4c1f;
    --color-tertiary: #a0752e;
    --color-accent: #8b5f24;
    
    /* Text */
    --text-primary: #1a1a1a;
    --text-secondary: rgba(139, 95, 36, 0.9);
    --text-muted: rgba(26, 26, 26, 0.6);
    --text-heading: #0a0a0a;
    
    /* Borders */
    --border-primary: rgba(139, 95, 36, 0.3);
    --border-secondary: rgba(139, 95, 36, 0.15);
    --border-light: rgba(139, 95, 36, 0.08);
    
    /* Shadows */
    --shadow-sm: 0 4px 20px rgba(139, 95, 36, 0.1);
    --shadow-md: 0 8px 32px rgba(139, 95, 36, 0.15);
    --shadow-lg: 0 12px 48px rgba(139, 95, 36, 0.2);
    --shadow-hover: 0 16px 48px rgba(139, 95, 36, 0.25);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #8b5f24 0%, #6d4c1f 100%);
    --gradient-hover: linear-gradient(135deg, #6d4c1f 0%, #8b5f24 100%);
    --gradient-text: linear-gradient(135deg, #0a0a0a 0%, #8b5f24 100%);
}

/* ============================================
   COLOR THEME (Vibrante - Cores Ricas)
   ============================================ */
[data-theme="color"] {
    /* Backgrounds */
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --bg-secondary: linear-gradient(135deg, rgba(26, 26, 46, 0.95) 0%, rgba(22, 33, 62, 0.95) 100%);
    --bg-card: linear-gradient(135deg, rgba(26, 26, 46, 0.9) 0%, rgba(22, 33, 62, 0.9) 100%);
    --bg-sidebar: linear-gradient(180deg, #0f3460 0%, #1a1a2e 100%);
    --bg-header: rgba(22, 33, 62, 0.9);
    --bg-input: rgba(26, 26, 46, 0.8);
    --bg-table: rgba(22, 33, 62, 0.4);
    --bg-hover: rgba(232, 162, 55, 0.15);
    
    /* Colors */
    --color-primary: #e8a237;
    --color-secondary: #e94560;
    --color-tertiary: #0088cc;
    --color-accent: #e8a237;
    
    /* Text */
    --text-primary: #e5e5e5;
    --text-secondary: rgba(232, 162, 55, 0.95);
    --text-muted: rgba(229, 229, 229, 0.7);
    --text-heading: #ffffff;
    
    /* Borders */
    --border-primary: rgba(232, 162, 55, 0.4);
    --border-secondary: rgba(232, 162, 55, 0.2);
    --border-light: rgba(232, 162, 55, 0.1);
    
    /* Shadows */
    --shadow-sm: 0 4px 20px rgba(232, 162, 55, 0.2);
    --shadow-md: 0 8px 32px rgba(232, 162, 55, 0.25);
    --shadow-lg: 0 12px 48px rgba(232, 162, 55, 0.3);
    --shadow-hover: 0 16px 48px rgba(232, 162, 55, 0.4);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #e8a237 0%, #e94560 100%);
    --gradient-hover: linear-gradient(135deg, #e94560 0%, #e8a237 100%);
    --gradient-text: linear-gradient(135deg, #ffffff 0%, #e8a237 100%);
}

/* ============================================
   APLICAÇÃO DOS TEMAS NOS COMPONENTES
   ============================================ */

body {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    transition: background var(--transition-speed) ease, color var(--transition-speed) ease;
}

/* Sidebar */
.sidebar {
    background: var(--bg-sidebar) !important;
    border-right-color: var(--border-secondary) !important;
}

.sidebar-item {
    color: var(--text-secondary) !important;
}

.sidebar-item:hover {
    background: var(--bg-hover) !important;
    color: var(--color-primary) !important;
}

.sidebar-item.active {
    background: var(--bg-hover) !important;
    color: var(--color-primary) !important;
}

/* Header */
.header {
    background: var(--bg-header) !important;
    border-bottom-color: var(--border-secondary) !important;
}

.header h2 {
    color: var(--text-heading) !important;
    background: var(--gradient-text) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

.header .h-10.w-10 {
    background: var(--gradient-primary) !important;
}

/* Cards */
.card,
.stat-card {
    background: var(--bg-card) !important;
    border-color: var(--border-secondary) !important;
    box-shadow: var(--shadow-md) !important;
}

.card:hover,
.stat-card:hover {
    box-shadow: var(--shadow-hover) !important;
    border-color: var(--border-primary) !important;
}

.stat-card .text-2xl {
    background: var(--gradient-text) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

/* Buttons */
.btn-primary {
    background: var(--gradient-primary) !important;
}

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

/* Inputs */
input[type="email"],
input[type="password"],
input[type="text"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    background: var(--bg-input) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px var(--border-light) !important;
}

/* Tables */
.table th {
    background: var(--bg-secondary) !important;
    color: var(--color-primary) !important;
    border-bottom-color: var(--border-primary) !important;
}

.table td {
    border-bottom-color: var(--border-light) !important;
    color: var(--text-primary) !important;
    background: var(--bg-table) !important;
}

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

/* Pipeline */
.pipeline-column {
    background: var(--bg-card) !important;
    border-color: var(--border-secondary) !important;
}

.pipeline-card {
    background: var(--bg-secondary) !important;
    border-color: var(--border-secondary) !important;
}

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

.pipeline-column-title,
.pipeline-column-count {
    color: var(--color-primary) !important;
}

.pipeline-card-name {
    background: var(--gradient-text) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

.pipeline-card-phone {
    color: var(--text-secondary) !important;
}

/* Modals */
.modal-content {
    background: var(--bg-secondary) !important;
    border-color: var(--border-secondary) !important;
}

/* Status badges */
.status-badge {
    color: var(--color-primary) !important;
    border-color: var(--border-primary) !important;
}

/* Toasts */
.toast-info {
    background: var(--bg-secondary) !important;
    color: var(--color-primary) !important;
    border-color: var(--border-primary) !important;
}

/* Override Tailwind */
.bg-gray-100,
.bg-gray-50 {
    background: var(--bg-primary) !important;
}

.bg-white {
    background: var(--bg-secondary) !important;
}

.text-gray-900,
.text-gray-800 {
    color: var(--text-primary) !important;
}

.text-gray-600,
.text-gray-500 {
    color: var(--text-secondary) !important;
}

.border-gray-300,
.border-gray-200 {
    border-color: var(--border-primary) !important;
}

.text-blue-600 {
    color: var(--color-primary) !important;
}

/* Theme Switcher Button */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 0.75rem;
    padding: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.theme-switcher:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

.theme-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
    border: 2px solid transparent;
    background: var(--bg-input);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    position: relative;
    overflow: hidden;
}

.theme-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.theme-btn:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
}

.theme-btn.active {
    border-color: var(--color-primary);
    box-shadow: 0 0 20px var(--border-primary);
}

.theme-btn.active::before {
    opacity: 0.2;
}

.theme-btn span {
    position: relative;
    z-index: 1;
}

/* Sidebar theme switcher */
#sidebar-theme-switcher {
    display: none;
}

/* Mobile: Hide header theme switcher, show sidebar theme switcher */
@media (max-width: 1024px) {
    .header-theme-switcher {
        display: none !important;
    }
    
    #sidebar-theme-switcher {
        display: block;
    }
}

/* Desktop: Show header theme switcher, hide sidebar theme switcher */
@media (min-width: 1025px) {
    .header-theme-switcher {
        display: flex;
    }
    
    #sidebar-theme-switcher {
        display: none;
    }
}

/* Tema específico - White theme adjustments */
[data-theme="white"] .sidebar {
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

[data-theme="white"] .table tbody tr:hover td {
    color: var(--text-primary);
}

[data-theme="white"] .btn-primary {
    color: #ffffff !important;
}

[data-theme="white"] input::placeholder,
[data-theme="white"] textarea::placeholder {
    color: rgba(139, 95, 36, 0.4) !important;
}

/* Color theme specific */
[data-theme="color"] .pipeline-column[data-status="LEAD"] {
    color: #e8a237;
}

[data-theme="color"] .pipeline-column[data-status="CONTACTED"] {
    color: #0088cc;
}

[data-theme="color"] .pipeline-column[data-status="WON"] {
    color: #10b981;
}

[data-theme="color"] .pipeline-column[data-status="LOST"] {
    color: #e94560;
}

[data-theme="color"] .status-scheduled {
    color: #0088cc !important;
    border-color: rgba(0, 136, 204, 0.3) !important;
}

[data-theme="color"] .status-confirmed {
    color: #10b981 !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

[data-theme="color"] .status-completed {
    color: #e8a237 !important;
    border-color: rgba(232, 162, 55, 0.3) !important;
}

[data-theme="color"] .status-cancelled {
    color: #e94560 !important;
    border-color: rgba(233, 69, 96, 0.3) !important;
}

/* ============================================
   ESTILOS DE RELATÓRIOS
   ============================================ */

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

.page-title {
    color: var(--text-heading) !important;
    background: var(--gradient-text) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

.report-card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-secondary) !important;
    box-shadow: var(--shadow-md) !important;
    transition: all 0.3s ease !important;
}

.report-card:hover {
    box-shadow: var(--shadow-hover) !important;
    border-color: var(--border-primary) !important;
}

.report-title {
    color: var(--text-heading) !important;
    background: var(--gradient-text) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

.report-item {
    border-bottom: 1px solid var(--border-light) !important;
    padding-bottom: 0.75rem !important;
}

.report-item-last {
    border-bottom: none !important;
}

.report-label {
    color: var(--text-muted) !important;
}

.report-sublabel {
    color: var(--text-muted) !important;
}

.report-value {
    color: var(--text-primary) !important;
}

.report-value-success {
    color: #10b981 !important;
}

.report-value-danger {
    color: #ef4444 !important;
}

.report-value-info {
    color: var(--color-primary) !important;
}

.report-error {
    color: #ef4444 !important;
    padding: 1rem;
    text-align: center;
}

[data-theme="white"] .report-error {
    color: #dc2626 !important;
}

/* ============================================
   WHITE THEME - MELHORIAS DE CONTRASTE
   ============================================ */

[data-theme="white"] .main-content {
    background: linear-gradient(135deg, #e8e2d8 0%, #d9d0c2 100%) !important;
}

[data-theme="white"] .report-card {
    background: #fffef9 !important;
    border: 2px solid rgba(80, 55, 20, 0.35) !important;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="white"] .report-card:hover {
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16), 0 4px 8px rgba(0, 0, 0, 0.1) !important;
    border-color: rgba(80, 55, 20, 0.5) !important;
    transform: translateY(-2px);
}

[data-theme="white"] .report-label {
    color: #3d2e1a !important;
    font-weight: 600 !important;
}

[data-theme="white"] .report-sublabel {
    color: #5c4a30 !important;
    font-weight: 500 !important;
}

[data-theme="white"] .report-value {
    color: #1a1408 !important;
    font-weight: 700 !important;
}

[data-theme="white"] .report-title {
    color: #1a1408 !important;
    font-weight: 700 !important;
}

[data-theme="white"] .report-item {
    border-bottom: 1px solid rgba(80, 55, 20, 0.25) !important;
    padding-bottom: 1rem !important;
    margin-bottom: 1rem !important;
}

[data-theme="white"] .report-item-last {
    border-bottom: none !important;
}

[data-theme="white"] .report-value-success {
    color: #047857 !important;
}

[data-theme="white"] .report-value-danger {
    color: #b91c1c !important;
}

[data-theme="white"] .report-value-info {
    color: #92400e !important;
}

[data-theme="white"] .card {
    background: #fffef9 !important;
    border: 2px solid rgba(80, 55, 20, 0.3) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="white"] .card:hover {
    border-color: rgba(80, 55, 20, 0.45) !important;
}

[data-theme="white"] .stat-card {
    background: #fffef9 !important;
    border: 2px solid rgba(80, 55, 20, 0.3) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="white"] .page-title {
    color: #1a1408 !important;
    background: none !important;
    -webkit-text-fill-color: #1a1408 !important;
}

[data-theme="white"] .modal-content {
    background: #fffef9 !important;
    border: 2px solid rgba(80, 55, 20, 0.35) !important;
}

[data-theme="white"] .table td {
    background: #fffef9 !important;
    border-bottom: 1px solid rgba(80, 55, 20, 0.2) !important;
    color: #1a1408 !important;
}

[data-theme="white"] .table th {
    background: #f0e8d8 !important;
    color: #3d2e1a !important;
    font-weight: 700 !important;
    border-bottom: 2px solid rgba(80, 55, 20, 0.3) !important;
}

/* Gráficos no tema branco */
[data-theme="white"] .chart-container,
[data-theme="white"] canvas {
    background: #fffef9 !important;
    border-radius: 8px;
}

/* ============================================
   STAT CARDS TEMÁTICOS (relatorios.html)
   ============================================ */

.stat-card-blue,
.stat-card-green,
.stat-card-purple,
.stat-card-orange {
    padding: 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.stat-card-blue {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.stat-card-green {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.stat-card-purple {
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.stat-card-orange {
    background: rgba(249, 115, 22, 0.15);
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.stat-card-label {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-card-value-blue {
    font-size: 1.5rem;
    font-weight: 700;
    color: #3b82f6;
}

.stat-card-value-green {
    font-size: 1.5rem;
    font-weight: 700;
    color: #10b981;
}

.stat-card-value-purple {
    font-size: 1.5rem;
    font-weight: 700;
    color: #8b5cf6;
}

.stat-card-value-orange {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f97316;
}

/* White theme stat cards */
[data-theme="white"] .stat-card-blue {
    background: rgba(59, 130, 246, 0.12);
    border: 2px solid rgba(59, 130, 246, 0.4);
}

[data-theme="white"] .stat-card-green {
    background: rgba(16, 185, 129, 0.12);
    border: 2px solid rgba(16, 185, 129, 0.4);
}

[data-theme="white"] .stat-card-purple {
    background: rgba(139, 92, 246, 0.12);
    border: 2px solid rgba(139, 92, 246, 0.4);
}

[data-theme="white"] .stat-card-orange {
    background: rgba(249, 115, 22, 0.12);
    border: 2px solid rgba(249, 115, 22, 0.4);
}

[data-theme="white"] .stat-card-label {
    color: #3d2e1a !important;
    font-weight: 600;
}

[data-theme="white"] .stat-card-value-blue {
    color: #1d4ed8;
}

[data-theme="white"] .stat-card-value-green {
    color: #047857;
}

[data-theme="white"] .stat-card-value-purple {
    color: #6d28d9;
}

[data-theme="white"] .stat-card-value-orange {
    color: #c2410c;
}

/* Containers e backgrounds temáticos */
.theme-bg-primary {
    background: var(--bg-primary);
}

.theme-bg-card {
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
}

.theme-bg-section {
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    padding: 1rem;
}

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

.theme-text-muted {
    color: var(--text-muted) !important;
}

.theme-text-heading {
    color: var(--text-primary) !important;
    font-weight: 600;
}

/* White theme containers */
[data-theme="white"] .theme-bg-primary {
    background: linear-gradient(135deg, #e8e2d8 0%, #d9d0c2 100%) !important;
}

[data-theme="white"] .theme-bg-card {
    background: #fffef9 !important;
    border: 2px solid rgba(80, 55, 20, 0.3) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="white"] .theme-bg-section {
    background: #f5f0e6 !important;
    border: 1px solid rgba(80, 55, 20, 0.2);
}

[data-theme="white"] .theme-text-primary {
    color: #1a1408 !important;
}

[data-theme="white"] .theme-text-muted {
    color: #3d2e1a !important;
}

[data-theme="white"] .theme-text-heading {
    color: #1a1408 !important;
}

/* Tab buttons temáticos */
.theme-tab {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.theme-tab:hover {
    color: var(--text-primary);
    border-bottom-color: var(--border-secondary);
}

.theme-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

[data-theme="white"] .theme-tab {
    color: #5c4a30;
}

[data-theme="white"] .theme-tab:hover {
    color: #1a1408;
    border-bottom-color: rgba(80, 55, 20, 0.4);
}

[data-theme="white"] .theme-tab.active {
    color: #92400e;
    border-bottom-color: #92400e;
}

/* Input fields temáticos */
[data-theme="white"] input,
[data-theme="white"] select {
    background: #fffef9 !important;
    border: 2px solid rgba(80, 55, 20, 0.3) !important;
    color: #1a1408 !important;
}

[data-theme="white"] input:focus,
[data-theme="white"] select:focus {
    border-color: #92400e !important;
    box-shadow: 0 0 0 3px rgba(146, 64, 14, 0.15) !important;
}

[data-theme="white"] input::placeholder {
    color: #8b7355 !important;
}

[data-theme="white"] label {
    color: #3d2e1a !important;
}
