:root {
    /* Light Theme (Default) */
    --bg-main: #f3f4f6;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --accent: #f59e0b;
    /* Gold/Orange for Royal Prestige */
    --border: #e5e7eb;
    --sidebar-bg: #ffffff;
    --sidebar-text: #374151;
    --sidebar-active: #eff6ff;
    --sidebar-active-text: #2563eb;
}

[data-theme="dark"] {
    /* Dark Theme */
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --accent: #fbbf24;
    --border: #334155;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #1e293b;
    /* Slightly lighter or different for contrast */
    --sidebar-active-text: #3b82f6;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
}

/* Glassmorphism Utilities */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glass {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Card Styles */
.card {
    background-color: var(--bg-card);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border);
    transition: background-color 0.3s, border-color 0.3s;
}

/* Inputs */
.input-field {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary);
}

/* Sidebar */
.sidebar-container {
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    transition: background-color 0.3s, border-color 0.3s;
}

.nav-link {
    color: var(--sidebar-text);
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--sidebar-active);
    color: var(--sidebar-active-text);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
}

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--bg-main);
}

/* Theme Toggle */
.theme-toggle {
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.theme-toggle:hover {
    background-color: var(--border);
}

/* Animations */
.animate-fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Timeline Historial */
.timeline-item {
    position: relative;
    padding-left: 1.5rem;
    padding-bottom: 1.2rem;
    border-left: 2px solid #e5e7eb;
}
.dark .timeline-item { border-left-color: #374151; }

.timeline-item:last-child { border-left-color: transparent; }

.timeline-dot {
    position: absolute;
    left: -0.35rem;
    top: 0.25rem;
    height: 0.7rem;
    width: 0.7rem;
    border-radius: 50%;
    border: 2px solid white;
}
.dark .timeline-dot { border-color: #1f2937; }

.timeline-content { font-size: 0.85rem; }
.timeline-date { font-size: 0.7rem; opacity: 0.7; }

/* Corrección para Inputs en Modales SweetAlert */
div:where(.swal2-container) input:where(.custom-swal-input),
div:where(.swal2-container) textarea:where(.custom-swal-input),
div:where(.swal2-container) select:where(.custom-swal-input) {
    background-color: #ffffff !important;
    color: #1f2937 !important;
    border: 1px solid #d1d5db !important;
}

/* Ajuste para que el calendario no quede oculto por el modal */
.flatpickr-calendar {
    z-index: 9999 !important;
}
