/* ========================================
   SISTEMA DE TEMAS DE COLORES
   ======================================== */

/* TEMA VERDE (NATURALEZA/FINANZAS) */
html.theme-green, body.theme-green {
    --primary-color: #2E8B57;
    --primary-light: #228B22;
    --primary-dark: #1B5E20;
    --accent-color: #4CAF50;
    --sidebar-gradient: linear-gradient(135deg, #2E8B57 0%, #228B22 100%);
    --card-gradient: linear-gradient(135deg, #2E8B57 0%, #228B22 100%);
}

/* TEMA AZUL (PROFESIONAL/CORPORATIVO) */
html.theme-blue, body.theme-blue {
    --primary-color: #1976D2;
    --primary-light: #42A5F5;
    --primary-dark: #0D47A1;
    --accent-color: #2196F3;
    --sidebar-gradient: linear-gradient(135deg, #1976D2 0%, #42A5F5 100%);
    --card-gradient: linear-gradient(135deg, #1976D2 0%, #42A5F5 100%);
}

/* TEMA ROJO (ENERGÍA/URGENCIA) */
html.theme-red, body.theme-red {
    --primary-color: #D32F2F;
    --primary-light: #F44336;
    --primary-dark: #B71C1C;
    --accent-color: #FF5722;
    --sidebar-gradient: linear-gradient(135deg, #D32F2F 0%, #F44336 100%);
    --card-gradient: linear-gradient(135deg, #D32F2F 0%, #F44336 100%);
}

/* TEMA NARANJA (CREATIVIDAD/INNOVACIÓN) */
html.theme-orange, body.theme-orange {
    --primary-color: #FF9800;
    --primary-light: #FFB74D;
    --primary-dark: #E65100;
    --accent-color: #FF5722;
    --sidebar-gradient: linear-gradient(135deg, #FF9800 0%, #FFB74D 100%);
    --card-gradient: linear-gradient(135deg, #FF9800 0%, #FFB74D 100%);
}

/* TEMA PÚRPURA (LUXE/PREMIUM) */
html.theme-purple, body.theme-purple {
    --primary-color: #7B1FA2;
    --primary-light: #9C27B0;
    --primary-dark: #4A148C;
    --accent-color: #E1BEE7;
    --sidebar-gradient: linear-gradient(135deg, #7B1FA2 0%, #9C27B0 100%);
    --card-gradient: linear-gradient(135deg, #7B1FA2 0%, #9C27B0 100%);
}

/* TEMA GRIS (MINIMALISTA/MODERNO) */
html.theme-gray, body.theme-gray {
    --primary-color: #424242;
    --primary-light: #616161;
    --primary-dark: #212121;
    --accent-color: #757575;
    --sidebar-gradient: linear-gradient(135deg, #424242 0%, #616161 100%);
    --card-gradient: linear-gradient(135deg, #424242 0%, #616161 100%);
}

/* TEMA TEAL (TECNOLOGÍA/MODERNO) */
html.theme-teal, body.theme-teal {
    --primary-color: #00695C;
    --primary-light: #00838F;
    --primary-dark: #004D40;
    --accent-color: #26A69A;
    --sidebar-gradient: linear-gradient(135deg, #00695C 0%, #00838F 100%);
    --card-gradient: linear-gradient(135deg, #00695C 0%, #00838F 100%);
}

/* ========================================
   APLICACIÓN DE TEMAS
   ======================================== */

/* Sidebar con tema dinámico */
.sidebar {
    background: var(--sidebar-gradient);
    min-height: 100vh;
    color: white;
    overflow-y: auto;
}

/* Tarjetas de estadísticas con tema dinámico */
.stat-card {
    background: var(--card-gradient);
    color: white;
}

/* Botones primarios con tema dinámico */
.btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Enlaces activos con tema dinámico */
.nav-link.active {
    background: rgba(255, 255, 255, 0.2) !important;
    border-left: 3px solid var(--accent-color);
}

/* Badges con tema dinámico */
.badge.bg-primary {
    background: var(--primary-color) !important;
}

/* Progress bars con tema dinámico */
.progress-bar {
    background: var(--primary-color);
}

/* ========================================
   UTILIDADES DE TEMA
   ======================================== */

/* Clase para cambiar tema dinámicamente */
.theme-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    background: white;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.theme-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin: 5px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.theme-option:hover {
    transform: scale(1.1);
    border-color: #333;
}

.theme-option.active {
    border-color: #333;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

/* Colores de los temas para el selector */
.theme-green .theme-option { background: #2E8B57; }
.theme-blue .theme-option { background: #1976D2; }
.theme-red .theme-option { background: #D32F2F; }
.theme-orange .theme-option { background: #FF9800; }
.theme-purple .theme-option { background: #7B1FA2; }
.theme-gray .theme-option { background: #424242; }
.theme-teal .theme-option { background: #00695C; }

/* ========================================
   ESTILOS DEL DROPDOWN DE TEMAS
   ======================================== */

.theme-dropdown {
    min-width: 200px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border: none;
}

.theme-dropdown .dropdown-header {
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-bottom: 5px;
}

.theme-option-item {
    padding: 8px 15px;
    transition: all 0.3s ease;
    border-radius: 5px;
    margin: 2px 5px;
}

.theme-option-item:hover {
    background: rgba(var(--primary-color), 0.1);
    transform: translateX(5px);
}

.theme-option-item.active {
    background: var(--primary-color);
    color: white;
}

.theme-option-item.active i {
    color: white !important;
}

/* ========================================
   ANIMACIONES DE TRANSICIÓN
   ======================================== */

/* Transición suave para cambios de tema */
.sidebar,
.stat-card,
.btn-primary,
.badge.bg-primary,
.progress-bar {
    transition: all 0.3s ease;
}

/* ========================================
   RESPONSIVE DESIGN PARA TEMAS
   ======================================== */

@media (max-width: 768px) {
    .theme-dropdown {
        min-width: 180px;
    }
    
    .theme-option-item {
        padding: 6px 12px;
        font-size: 0.9rem;
    }
}

/* ========================================
   MODAL DE TEMAS
   ======================================== */

.theme-card {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.theme-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.theme-card.selected {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color), 0.05);
}

.theme-preview {
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    margin-bottom: 10px;
}

.theme-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    width: 30%;
    height: 100%;
    background: var(--sidebar-gradient);
}

.theme-content {
    position: absolute;
    right: 0;
    top: 0;
    width: 70%;
    height: 100%;
    background: #f8f9fa;
    padding: 10px;
}

.theme-card-preview {
    height: 20px;
    background: var(--card-gradient);
    border-radius: 4px;
    margin-bottom: 5px;
}

.theme-card-preview:nth-child(2) {
    width: 60%;
}

.theme-info h6 {
    margin: 0;
    font-weight: 600;
    color: #333;
}

.theme-info small {
    color: #6c757d;
}

/* ========================================
   MEJORAS EN EL DROPDOWN DE TEMAS
   ======================================== */

.theme-dropdown .dropdown-header {
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 8px;
    margin-bottom: 5px;
}

.theme-option-item {
    padding: 8px 15px;
    transition: all 0.3s ease;
    border-radius: 5px;
    margin: 2px 5px;
    cursor: pointer;
}

.theme-option-item:hover {
    background: rgba(0, 123, 255, 0.1);
    transform: translateX(5px);
}

.theme-option-item.active {
    background: #007bff;
    color: white;
}

.theme-option-item.active i {
    color: white !important;
}
