/* ===================================================================
   SISTEMA DE TEMAS CLARO/ESCURO
   =================================================================== */

/* Variables for Light Theme (default) */
:root {
    --theme-bg-primary: #ffffff;
    --theme-bg-secondary: #f8f9fa;
    --theme-bg-tertiary: #e9ecef;
    --theme-text-primary: #212529;
    --theme-text-secondary: #6c757d;
    --theme-text-muted: #6c757d;
    --theme-border: #dee2e6;
    --theme-shadow: rgba(0, 0, 0, 0.1);
    
    /* Card specific */
    --theme-card-bg: #ffffff;
    --theme-card-text: #212529;
    --theme-card-header-bg: #ffffff;
    --theme-card-border: #dee2e6;
    
    /* Colors for theme compatibility */
    --theme-primary: #0d6efd;
    --theme-success: #198754;
    --theme-info: #0dcaf0;
    --theme-warning: #fd7e14;
    --theme-danger: #dc3545;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --theme-bg-primary: #212529;
    --theme-bg-secondary: #343a40;
    --theme-bg-tertiary: #495057;
    --theme-text-primary: #ffffff;
    --theme-text-secondary: #e9ecef;
    --theme-text-muted: #adb5bd;
    --theme-border: #495057;
    --theme-shadow: rgba(0, 0, 0, 0.3);
    
    /* Card specific */
    --theme-card-bg: #343a40;
    --theme-card-text: #ffffff;
    --theme-card-header-bg: #495057;
    --theme-card-border: #495057;
    
    /* Colors for dark theme */
    --theme-primary: #74c0fc;
    --theme-success: #69db7c;
    --theme-info: #74c0fc;
    --theme-warning: #ffd43b;
    --theme-danger: #ff8787;
}

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

/* Body and main elements */
body {
    background-color: var(--theme-bg-secondary) !important;
    color: var(--theme-text-primary) !important;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Cards */
.card {
    background-color: var(--theme-card-bg) !important;
    color: var(--theme-card-text) !important;
    border-color: var(--theme-card-border) !important;
    box-shadow: 0 0.5rem 1rem var(--theme-shadow) !important;
}

.card-header {
    background-color: var(--theme-card-header-bg) !important;
    color: var(--theme-card-text) !important;
    border-bottom-color: var(--theme-border) !important;
}

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

/* Text colors */
.card .text-primary {
    color: var(--theme-primary) !important;
}

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

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

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

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

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

/* Titles and headings */
.card h1, .card h2, .card h3, .card h4, .card h5, .card h6,
.content-section h1, .content-section h2, .content-section h3, .content-section h4, .content-section h5, .content-section h6 {
    color: var(--theme-card-text) !important;
}

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

/* Buttons and form elements */
.btn-outline-secondary {
    border-color: var(--theme-border) !important;
    color: var(--theme-text-secondary) !important;
}

.btn-outline-secondary:hover {
    background-color: var(--theme-bg-tertiary) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text-primary) !important;
}

/* Table styles */
.table {
    color: var(--theme-text-primary) !important;
}

.table th {
    background-color: var(--theme-bg-tertiary) !important;
    color: var(--theme-text-primary) !important;
    border-color: var(--theme-border) !important;
}

.table td {
    border-color: var(--theme-border) !important;
}

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

/* ===================================================================
   THEME TOGGLE BUTTON STYLES
   =================================================================== */

.theme-toggle-btn {
    position: relative;
    width: 40px;
    height: 32px;
    border-radius: 20px !important;
    transition: all 0.3s ease;
    overflow: hidden;
}

.theme-toggle-btn:hover {
    transform: scale(1.05);
}

.theme-toggle-btn .theme-icon-light,
.theme-toggle-btn .theme-icon-dark {
    font-size: 14px;
    transition: all 0.3s ease;
}

/* Animation for theme switching */
[data-theme="dark"] .theme-icon-light {
    display: none !important;
}

[data-theme="dark"] .theme-icon-dark {
    display: inline-block !important;
}

/* Smooth transitions for all theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

/* Special handling for gradients - preserve them in both themes */
.sidebar {
    background: linear-gradient(135deg, #021aa3 0%, #1a34c4 30%, #4d6ed4 60%, #8a98e3 80%, #ad1707 100%) !important;
}

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

/* Remove the old media query dark mode since we're using data attributes now */
@media (prefers-color-scheme: dark) {
    /* This is now handled by JavaScript and data attributes */
}