/* --- TOASTS --- */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 11000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 90%;
    max-width: 400px;
}

.toast {
    background: var(--bg-panel);
    color: white;
    padding: 14px 20px;
    border-radius: var(--radius-sm); /* Cuadrado — coherente con el diseño */
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 5px solid var(--primary); /* Línea lateral gruesa */
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.3s ease-out;
}

.toast.active {
    transform: translateY(0);
    opacity: 1;
}

.toast-error { border-left-color: var(--danger); }
.toast-success { border-left-color: var(--primary); }
.toast-warning { border-left-color: var(--warning); }
.toast-info { border-left-color: #3b82f6; } /* Azul info */



/* --- MODALS --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
    overflow-y: auto; /* Permite scroll si el modal es más alto que la pantalla */
}

.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal-content {
    background: var(--bg-panel);
    width: 90%;
    max-width: 400px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    transition: 0.3s;
}

.modal-overlay.active .modal-content { transform: translateY(0); }

/* En móvil: patrón Bottom Sheet — el modal se ancla desde la parte inferior.
   Cuando el teclado sube, el modal sube con él y los botones quedan siempre accesibles. */
@media (max-width: 600px) {
    .modal-overlay {
        align-items: flex-end;
    }
    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0; /* Solo esquinas superiores redondeadas */
        transform: translateY(40px);
    }
    .modal-overlay.active .modal-content { transform: translateY(0); }
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 50%;
}

.close-modal:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
    background-color: var(--primary);
    border-radius: 10px;
}

.res-date-info {
    text-align: center;
    background: var(--primary-alpha-10);
    color: var(--primary-light);
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-weight: 700;
    font-size: 1.1rem;
}

.res-options-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 15px;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.res-option { display: flex; justify-content: space-between; align-items: center; }
.res-option strong { display: block; font-size: 0.9rem; }
.res-option span { font-size: 0.7rem; color: var(--text-muted); }

/* Toggle Switch */
.toggle-switch { position: relative; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg-dark); border-radius: 0; transition: .4s; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; transition: .4s; border-radius: 0; }
input:checked + .slider { background: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

.hidden { display: none !important; }



/* --- FORMULARIOS UNIFICADOS --- */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px;
}
.field-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    min-height: 2.4em; /* Asegurar alineación si hay 2 líneas */
    display: flex;
    align-items: flex-end;
    margin-bottom: 4px;
}
.field-label--warning { color: var(--warning); }
.field-label--danger  { color: var(--danger);  }
.field-label--info    { color: #3b82f6;         }
.field-label--success { color: var(--primary);  }

.field-input {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 0;
    color: var(--text-color);
    padding: 12px 14px;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}
.field-input:focus {
    outline: none;
    border-color: var(--primary);
}
.field-input--password {
    padding-left: 45px; /* Modificado para ojo a la izquierda */
}

/* Corrección de altura/padding para evitar heredar los estilos gigantes del login,
   pero manteniendo el espacio a la izquierda para el icono del ojo */
.input-wrapper input.field-input {
    padding: 12px 14px 12px 45px !important;
    font-size: 0.9rem !important;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 15px;
}
.field-row--4 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 15px;
}

@media (max-width: 992px) {
    .field-row--4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .field-row { grid-template-columns: 1fr; gap: 10px; }
    .field-row--4 { grid-template-columns: 1fr; gap: 10px; }
}



/* --- BOTÓN SECUNDARIO (outline) --- */
.btn-secondary-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 10px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radius-sm);
}
.btn-secondary-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--white-alpha-05);
}



/* --- BOTÓN PELIGRO --- */
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-dark); }



/* --- BOTÓN WARNING --- */
.btn-warning { background: var(--warning); color: black; }
.btn-warning:hover { background: var(--warning-dark); }



/* --- BOTÓN ÉXITO --- */
.btn-success { background: var(--primary); color: white; }
.btn-success:hover { background: var(--primary-dark); }



/* --- BOTÓN INFO --- */
.btn-info { background: var(--info); color: white; }



/* --- TOGGLE ROW (opciones con switch) --- */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.toggle-row-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}



/* --- STRENGTH BAR (contraseña) --- */
.strength-bar-wrapper {
    height: 4px;
    background: rgba(255,255,255,0.05);
    width: 100%;
    margin-top: 8px;
    overflow: hidden;
}
.strength-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--danger);
    transition: all 0.3s;
}
.strength-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.strength-hint {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
}
.strength-value {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--danger);
}



/* --- PASSWORD REQ LIST --- */
.req-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}
.req-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}
.req-item i { font-size: 1rem; }



/* --- PASSWORD FIELD WRAPPER (Simplificado) --- */
.input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.input-wrapper i:not(.toggle-pass) {
    position: absolute;
    left: 15px;
    z-index: 10;
    color: var(--text-muted);
}

.input-wrapper input {
    padding-left: 45px !important;
    width: 100%;
}



/* --- SELECT UNIFICADO --- */
.field-select {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 0;
    color: var(--text-color);
    padding: 12px 14px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none;
}
.field-select:focus {
    outline: none;
    border-color: var(--primary);
}



/* --- INTERACTIVE DIALOGS (v1.4.0) --- */
.dialog-content {
    padding: 10px 5px;
}

.dialog-message {
    font-size: 0.9rem;
    color: var(--text-color);
    line-height: 1.6;
    margin-bottom: 20px;
}

.dialog-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.dialog-actions .btn {
    flex: 1;
}

/* Animación de pulso para iconos de alerta en diálogos */
@keyframes dlg-icon-pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

#modal-title i {
    margin-right: 10px;
    font-size: 1.4rem;
    vertical-align: middle;
}

#modal-title i.ri-error-warning-fill {
    animation: dlg-icon-pulse 2s infinite ease-in-out;
}

/* Las variantes de botón se definen una sola vez arriba (líneas 228-274).
   Los overrides específicos de contexto (admin, etc.) van en sus archivos correspondientes. */

/* Estilos extra para el prompt input */
#dlg-input {
    background: var(--bg-dark) !important;
    border: 1px solid var(--border-color) !important;
    color: white !important;
    width: 100% !important;
}

#dlg-input:focus {
    border-color: var(--primary) !important;
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-alpha-15);
}

/* ================================================================
   STATS DASHBOARD V4.1.0 — Integrado con look de la app
   ================================================================ */



/* --- INLINE FLEX ROW --- */
.flex-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}
.flex-row .field-group { margin-bottom: 0; flex: 1; }



/* --- HINT TEXT --- */
.field-hint {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 4px;
}



/* --- SEPARADOR --- */
.section-divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}



/* --- CHECKBOX CHIPS (Wizard/Admin) --- */
.checkbox-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--white-alpha-05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-chip); /* Excepción funcional: chip de texto */
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    margin-right: 8px;
    margin-bottom: 8px;
}

.checkbox-chip:hover {
    background: rgba(255,255,255,0.06);
    border-color: var(--chip-color, rgba(255,255,255,0.2));
}

.checkbox-chip input {
    display: none;
}

.checkbox-chip .chip-check {
    width: 16px;
    height: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: transparent;
    transition: all 0.2s;
    border-radius: 2px;
}

.checkbox-chip input:checked + .chip-check {
    background: var(--chip-color, var(--primary));
    border-color: var(--chip-color, var(--primary));
    color: white;
}

.checkbox-chip:has(input:checked) {
    border-color: var(--chip-color, var(--primary));
    background: rgba(255,255,255,0.05);
}

.checkbox-chip span {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.checkbox-chip input:checked ~ span {
    color: white;
}

/* Aumentar contraste de los iconos nativos de calendario y reloj en inputs oscuros */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(0.85);
    cursor: pointer;
    transition: opacity 0.2s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}
