/* ====================================
   DIVALI TI - SISTEMA DE TEMAS
   Dark/Light Mode
   ==================================== */

/* Variables Light Theme (default) */
:root {
    --theme-bg-primary: #f5f7fa;
    --theme-bg-secondary: #ffffff;
    --theme-bg-card: rgba(255, 255, 255, 0.95);
    --theme-bg-input: #ffffff;
    --theme-bg-hover: rgba(26, 35, 126, 0.05);
    --theme-text-primary: #37474f;
    --theme-text-secondary: #666666;
    --theme-text-muted: #999999;
    --theme-border: #e0e0e0;
    --theme-shadow: 0 10px 30px rgba(26, 35, 126, 0.08);
    --theme-shadow-hover: 0 15px 40px rgba(26, 35, 126, 0.15);
    --theme-navbar-bg: rgba(255, 255, 255, 0.95);
    --theme-navbar-text: #37474f;
    --theme-gradient-start: #667eea;
    --theme-gradient-end: #764ba2;
    --theme-table-header: #f8f9fa;
    --theme-table-row-alt: #f5f7fa;
    --theme-table-border: #dee2e6;
    --theme-modal-bg: #ffffff;
    --theme-modal-overlay: rgba(0, 0, 0, 0.5);
    --theme-scrollbar-bg: #f1f1f1;
    --theme-scrollbar-thumb: #c1c1c1;
    --theme-skeleton-bg: #e0e0e0;
    --theme-skeleton-shine: #f5f5f5;
}

/* Dark Theme */
[data-theme="dark"] {
    --theme-bg-primary: #1a1a2e;
    --theme-bg-secondary: #16213e;
    --theme-bg-card: rgba(22, 33, 62, 0.95);
    --theme-bg-input: #0f3460;
    --theme-bg-hover: rgba(233, 69, 96, 0.1);
    --theme-text-primary: #e0e0e0;
    --theme-text-secondary: #b0b0b0;
    --theme-text-muted: #808080;
    --theme-border: #2a2a4a;
    --theme-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --theme-shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.5);
    --theme-navbar-bg: rgba(22, 33, 62, 0.98);
    --theme-navbar-text: #e0e0e0;
    --theme-gradient-start: #e94560;
    --theme-gradient-end: #0f3460;
    --theme-table-header: #0f3460;
    --theme-table-row-alt: #1a1a2e;
    --theme-table-border: #2a2a4a;
    --theme-modal-bg: #16213e;
    --theme-modal-overlay: rgba(0, 0, 0, 0.7);
    --theme-scrollbar-bg: #1a1a2e;
    --theme-scrollbar-thumb: #0f3460;
    --theme-skeleton-bg: #2a2a4a;
    --theme-skeleton-shine: #3a3a5a;
}

/* Transicion suave entre temas */
body,
.navbar,
.card,
.module-card,
.stat-card,
.modal,
.table,
input,
select,
textarea,
.sidebar {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Aplicar variables del tema a elementos comunes */
[data-theme="dark"] body {
    background: var(--theme-bg-primary);
    color: var(--theme-text-primary);
}

[data-theme="dark"] .navbar {
    background: var(--theme-navbar-bg) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .navbar .nav-link,
[data-theme="dark"] .navbar .logo,
[data-theme="dark"] .navbar a {
    color: var(--theme-navbar-text) !important;
}

[data-theme="dark"] .navbar .nav-link:hover {
    background: var(--theme-gradient-start) !important;
    color: white !important;
}

[data-theme="dark"] .hero-section,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .module-card,
[data-theme="dark"] .card,
[data-theme="dark"] .content-card,
[data-theme="dark"] .main-content {
    background: var(--theme-bg-card) !important;
    color: var(--theme-text-primary);
    box-shadow: var(--theme-shadow);
}

[data-theme="dark"] .hero-title,
[data-theme="dark"] .section-title {
    color: var(--theme-text-primary) !important;
    -webkit-text-fill-color: unset !important;
}

[data-theme="dark"] .hero-subtitle,
[data-theme="dark"] .stat-label,
[data-theme="dark"] p {
    color: var(--theme-text-secondary) !important;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--theme-bg-input) !important;
    color: var(--theme-text-primary) !important;
    border-color: var(--theme-border) !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--theme-text-muted) !important;
}

[data-theme="dark"] table {
    color: var(--theme-text-primary);
}

[data-theme="dark"] th {
    background: var(--theme-table-header) !important;
    color: var(--theme-text-primary) !important;
    border-color: var(--theme-table-border) !important;
}

[data-theme="dark"] td {
    border-color: var(--theme-table-border) !important;
    color: var(--theme-text-primary);
}

[data-theme="dark"] tr:nth-child(even) {
    background: var(--theme-table-row-alt);
}

[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal-body,
[data-theme="dark"] .popup,
[data-theme="dark"] .dialog {
    background: var(--theme-modal-bg) !important;
    color: var(--theme-text-primary) !important;
}

[data-theme="dark"] .modal-overlay,
[data-theme="dark"] .overlay {
    background: var(--theme-modal-overlay) !important;
}

[data-theme="dark"] h1, [data-theme="dark"] h2, [data-theme="dark"] h3,
[data-theme="dark"] h4, [data-theme="dark"] h5, [data-theme="dark"] h6 {
    color: var(--theme-text-primary);
}

[data-theme="dark"] .user-info {
    background: rgba(233, 69, 96, 0.1) !important;
    color: var(--theme-text-primary) !important;
}

[data-theme="dark"] label {
    color: var(--theme-text-secondary) !important;
}

[data-theme="dark"] .alert,
[data-theme="dark"] .notification {
    background: var(--theme-bg-secondary) !important;
    border-color: var(--theme-border) !important;
    color: var(--theme-text-primary) !important;
}

/* Scrollbar dark */
[data-theme="dark"] ::-webkit-scrollbar {
    background: var(--theme-scrollbar-bg);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--theme-scrollbar-thumb);
    border-radius: 4px;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 2px solid currentColor;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    color: var(--theme-text-primary);
    padding: 0;
}

.theme-toggle:hover {
    transform: rotate(30deg) scale(1.1);
    background: rgba(102, 126, 234, 0.1);
}

[data-theme="dark"] .theme-toggle {
    color: #ffd700;
    border-color: #ffd700;
}

[data-theme="dark"] .theme-toggle:hover {
    background: rgba(255, 215, 0, 0.15);
}

/* Loading skeleton animation */
.skeleton {
    background: linear-gradient(90deg, var(--theme-skeleton-bg) 25%, var(--theme-skeleton-shine) 50%, var(--theme-skeleton-bg) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

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

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    width: 100%;
}

.skeleton-title {
    height: 24px;
    margin-bottom: 12px;
    width: 60%;
}

.skeleton-card {
    height: 120px;
    margin-bottom: 16px;
}

/* Enhanced hover effects for cards */
.module-card,
.stat-card,
.manual-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.module-card:hover,
.stat-card:hover,
.manual-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--theme-shadow-hover);
}

/* Button micro-interactions */
button, .btn, .nav-button, .redirect-button {
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease;
}

button:active, .btn:active, .nav-button:active {
    transform: scale(0.97);
}

/* Responsive improvements */
@media (max-width: 768px) {
    .nav-menu {
        gap: 0.5rem !important;
    }

    .nav-link {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.85rem !important;
    }

    .theme-toggle {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .modules-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .hero-title {
        font-size: 2rem !important;
    }
}

/* Manuales dark theme specifics */
[data-theme="dark"] .header,
[data-theme="dark"] .content,
[data-theme="dark"] .footer,
[data-theme="dark"] .redirect-container {
    background: var(--theme-bg-card) !important;
    color: var(--theme-text-primary);
}

[data-theme="dark"] .manual-card {
    background: var(--theme-bg-secondary) !important;
    color: var(--theme-text-primary);
}

[data-theme="dark"] .manual-card h3 {
    color: var(--theme-gradient-start) !important;
}

[data-theme="dark"] .manual-card p {
    color: var(--theme-text-secondary) !important;
}

[data-theme="dark"] .section h2 {
    -webkit-text-fill-color: unset !important;
    color: var(--theme-gradient-start) !important;
}

/* Dark login page */
[data-theme="dark"] .login-container {
    background: var(--theme-bg-card) !important;
    box-shadow: var(--theme-shadow);
}

[data-theme="dark"] .login-form input {
    background: var(--theme-bg-input) !important;
    color: var(--theme-text-primary) !important;
    border-color: var(--theme-border) !important;
}
