/* =========================================
   VARIABLES GLOBALES (Paleta de colores base)
   ========================================= */
:root {
    /* Color de acento base (Azul Turnea) */
    --primary-rgb: 37, 99, 235;
    --primary: rgb(var(--primary-rgb));

    /* Fondos Sólidos (Modo Claro) */
    --bg-body: #E2E8F0;
    --bg-card: #FFFFFF;
    --bg-input: #FFFFFF;
    --bg-config-input: rgba(0, 0, 0, 0.03);
    --text-main: #0F172A;
    --text-muted: #64748B;
    --border-strong: rgba(var(--primary-rgb), 0.1);
    /* Borde sutil del color elegido */

    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
}

/* =========================================
   VARIABLES GLOBALES (Modo Oscuro)
   ========================================= */
.dark-mode {
    --bg-body: #0F172A;
    --bg-card: #1E293B;
    --bg-input: #1E293B;
    --bg-config-input: rgba(255, 255, 255, 0.05);
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --border-strong: rgba(255, 255, 255, 0.1);
    color-scheme: dark;
}

.stat-card,
.table-container,
.link-card,
.config-card,
.modal-content,
.sidebar {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-strong) !important;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* =========================================
   ESTILOS BASE (Tipografía y reseteo)
   ========================================= */
* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    margin: 0;
    padding: 0;
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* Prevenir delay de 300ms al hacer tap en celulares */
a, button, input, select, .btn, .btn-primary, .btn-outline {
    touch-action: manipulation;
}

/* =========================================
   INPUTS, SELECTS Y LABELS
   ========================================= */
input,
select {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    font-size: 16px;
    background: var(--bg-input);
    color: var(--text-main);
    transition: 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(var(--primary-rgb), 0.5);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.config-card input,
.config-card select,
.config-card textarea {
    background: var(--bg-config-input);
}

/* Ocultar flechas (spinners) en inputs numéricos */
input[type="number"]::-webkit-inner-spin-button, 
input[type="number"]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}
input[type="number"] {
    -moz-appearance: textfield; /* Para Firefox */
}

label {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}

/* =========================================
   BOTONES GENÉRICOS (Redondeados y con hover)
   ========================================= */
/* 1. BOTONES DINÁMICOS (Reaccionan a la paleta) */

/* Botón Primario Estándar: Usa el color de la paleta */
.btn,
.btn-primary,
.btn-success,
.btn-outline,
.btn-danger,
.btn-pdf,
.btn-nuevo {
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    outline: none;
    height: 45px;
    text-decoration: none !important;
    /* Altura uniforme para todos */
}

/* 2. BOTONES SÓLIDOS (Acciones principales) */
.btn-primary,
.btn-success,
.btn-nuevo {
    background-color: var(--primary);
    color: white !important;
}

.btn-success {
    background-color: var(--success);
    /* Ahora sí verde para guardar/confirmar */
}

/* 3. BOTONES OUTLINE (Acciones secundarias) */
.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: rgba(var(--primary-rgb), 0.1);
}

/* 4. BOTONES DE PELIGRO/BORRAR */
.btn-danger,
.btn-cancelar {
    background-color: var(--danger);
    color: white;
}

/* 5. BOTÓN PDF (Estilo neutro) */
.btn-pdf {
    background-color: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

/* =========================================
   UTILIDADES
   ========================================= */
.hidden {
    display: none !important;
}

/* =========================================
   EXCEPCIONES (Checkboxes y Radios)
   ========================================= */
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    -webkit-appearance: auto;
    appearance: auto;
    padding: 0;
    margin: 0 8px 0 0;
    display: inline-block;
}

/* =========================================
   EFECTO DE GRADIENTE ANIMADO ULTRA SUAVE (Apple Style)
   ========================================= */

/* Capa de fondo animada */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    /* Se mantiene detrás de todo */
    background-image:
        radial-gradient(at 10% 10%, rgba(var(--primary-rgb), 0.12) 0px, transparent 50%),
        radial-gradient(at 90% 90%, rgba(var(--primary-rgb), 0.1) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(var(--primary-rgb), 0.08) 0px, transparent 50%);
    filter: blur(120px);
    /* Desenfoque extremo para suavidad total */
    animation: backgroundGradientMove 25s ease-in-out infinite;
    /* Movimiento ultra lento */
    opacity: 0.15;
    /* Sutil transparencia global */
    pointer-events: none;
}

/* Animación de movimiento lento */
@keyframes backgroundGradientMove {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(5%, 5%) scale(1.05);
    }

    50% {
        transform: translate(-3%, 8%) scale(1.1);
    }

    75% {
        transform: translate(6%, -4%) scale(1.02);
    }
}

/* Optimización para móviles (evitar lag por blur/animación pesada) */
@media (max-width: 768px) {
    body::before {
        animation: none;
        filter: blur(60px);
    }
}

nav, footer {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
}

footer {
    position: relative;
    z-index: 10;
}

/* =========================================
   FORMULARIOS DE AUTENTICACIÓN GLOBALES
   ========================================= */

.auth-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-strong);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 450px;
    text-align: center;
}

.auth-card h1, .auth-card h2 {
    color: var(--text-main);
    font-size: 24px;
    margin-top: 0;
    margin-bottom: 8px;
}

.auth-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 30px;
}

.input-group {
    text-align: left;
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper svg {
    position: absolute;
    left: 14px;
    width: 20px;
    height: 20px;
    color: #94a3b8;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 40px 12px 42px;
    margin-bottom: 0;
}

.toggle-eye {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}

.toggle-eye:hover {
    color: var(--text-main);
}

.slug-preview {
    font-size: 12px;
    color: var(--primary);
    margin-top: 5px;
    display: block;
}

.links {
    margin-top: 25px;
    font-size: 14px;
    color: var(--text-muted);
}

.links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.links a:hover {
    text-decoration: underline;
}

.link-volver {
    display: block;
    margin-top: 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.link-volver:hover {
    color: var(--primary);
    text-decoration: underline;
}
/* =========================================
   TOGGLE SWITCH (Modern)
   ========================================= */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}
.switch input[type="checkbox"] {
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  position: absolute;
}
.switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.2);
  transition: .4s;
  border-radius: 24px;
}
.switch .slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.switch input:checked + .slider {
  background-color: var(--primary);
}
.switch input:checked + .slider:before {
  transform: translateX(26px);
}

/* Custom Multi-Select */
.custom-multiselect {
    position: relative;
    width: 100%;
    margin-top: 15px;
    margin-bottom: 15px;
}
.multiselect-header {
    padding: 10px 15px;
    background: var(--bg-body);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
    font-size: 14px;
}
.multiselect-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-body);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    margin-top: 5px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    z-index: 99999;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    backdrop-filter: none;
}
.multiselect-options.show {
    display: block;
}
.multiselect-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 2px;
}
.multiselect-option:hover {
    background: rgba(var(--primary-rgb), 0.05);
}
.multiselect-option input {
    cursor: pointer;
    margin: 0;
}

/* Custom Checkbox for Multiselect and Work Days */
.multiselect-option input[type="checkbox"],
.chk-dia-emp {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-strong);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-right: 8px;
}

.multiselect-option input[type="checkbox"]:checked,
.chk-dia-emp:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.multiselect-option input[type="checkbox"]:checked::after,
.chk-dia-emp:checked::after {
    content: '\e5ca';
    font-family: 'Material Icons';
    color: white;
    font-size: 16px;
}

.chk-dia-emp {
    margin-right: 5px !important;
}

/* =========================================
   SWEETALERT DARK MODE
   ========================================= */
.dark-mode .swal2-popup {
    background: var(--bg-body) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-strong) !important;
}

.dark-mode .swal2-title {
    color: var(--text-main) !important;
}

.dark-mode .swal2-html-container,
.dark-mode .swal2-content {
    color: var(--text-muted) !important;
}

/* Scroll Lock Global */
html.modal-open,
body.modal-open {
    overflow: hidden !important;
}
