/* =========================================
   ESTILOS DE MODALES (NEUTRO: BLACK / WHITE)
   Archivo: assets/css/modals.css
   ========================================= */

/* --- 1. CONTENEDOR PRINCIPAL DEL MODAL --- */
.modal-gestioo .modal-content {
    /* MODO OSCURO (Por defecto - NEGRO PURO) */
    background-color: #111111; /* Coincide con --bg-card */
    border: 1px solid #333333; /* Borde gris neutro */
    color: #ffffff;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8); /* Sombra fuerte */
}

.modal-gestioo .modal-header,
.modal-gestioo .modal-footer {
    border-color: #333333; /* Líneas separadoras grises */
    padding: 15px 25px;
}

.modal-gestioo .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%); /* Icono blanco */
}

/* --- 2. ADAPTACIÓN A MODO CLARO (Sobreescritura) --- */
/* Cuando main.js agrega la clase 'light-mode' al body */
body.light-mode .modal-gestioo .modal-content {
    background-color: #ffffff;
    border-color: #e5e7eb; /* Gris muy suave */
    color: #1f2937; /* Texto oscuro */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

body.light-mode .modal-gestioo .modal-header,
body.light-mode .modal-gestioo .modal-footer {
    border-color: #e5e7eb;
}

body.light-mode .modal-gestioo .btn-close {
    filter: none; /* Vuelve al color original (negro) */
}

/* --- 3. INPUTS Y SELECTS (Sin tinte azul) --- */
.modal-gestioo .form-label {
    color: #a3a3a3; /* Gris neutro claro */
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.modal-gestioo .form-control, 
.modal-gestioo .form-select,
.modal-gestioo .input-group-text {
    /* Dark Mode Inputs: Gris muy oscuro neutro */
    background-color: #1a1a1a; 
    border: 1px solid #333333;
    color: #ffffff;
    font-size: 0.9rem;
}

.modal-gestioo .input-group-text {
    color: #a3a3a3;
    background-color: #222222; /* Un poco más claro para diferenciar */
}

.modal-gestioo ::placeholder {
    color: #555555;
}

/* Inputs en Modo Claro */
body.light-mode .modal-gestioo .form-control, 
body.light-mode .modal-gestioo .form-select,
body.light-mode .modal-gestioo .input-group-text {
    background-color: #f9fafb; /* Blanco humo */
    border-color: #d1d5db;
    color: #111827;
}

body.light-mode .modal-gestioo .input-group-text {
    background-color: #f3f4f6;
}

/* Focus State (Borde Azul al escribir, se mantiene) */
.modal-gestioo .form-control:focus, 
.modal-gestioo .form-select:focus {
    border-color: #0d6efd; /* Azul corporativo */
    background-color: #1a1a1a; /* Mantiene fondo oscuro */
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
    color: #fff;
}
/* Focus en Modo Claro */
body.light-mode .modal-gestioo .form-control:focus, 
body.light-mode .modal-gestioo .form-select:focus {
    background-color: #fff;
    color: #000;
}

/* Fix Flecha Selects (SVG Blanco para Dark Mode) */
.modal-gestioo .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* Fix Flecha Selects (SVG Negro para Light Mode) */
body.light-mode .modal-gestioo .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* --- 4. TABS (Pestañas) --- */
.nav-tabs-gestioo {
    border-bottom: 1px solid #333333;
    padding: 0 25px;
}
.nav-tabs-gestioo .nav-link {
    color: #888888;
    border: none;
    background: transparent;
    padding: 10px 15px;
}
.nav-tabs-gestioo .nav-link:hover {
    color: #cccccc;
}
.nav-tabs-gestioo .nav-link.active {
    color: #ffffff;
    background: transparent;
    border-bottom: 2px solid #0d6efd;
    font-weight: 600;
}

/* Tabs en Modo Claro */
body.light-mode .nav-tabs-gestioo {
    border-color: #e5e7eb;
}
body.light-mode .nav-tabs-gestioo .nav-link {
    color: #6b7280;
}
body.light-mode .nav-tabs-gestioo .nav-link.active {
    color: #0d6efd;
    border-bottom: 2px solid #0d6efd;
}

/* =========================================
   ESTILOS ESPECÍFICOS: MODAL CLIENTE
   ========================================= */

/* Área de Foto de Perfil */
.photo-upload-container {
    background-color: #1a1a1a;
    border: 2px dashed #333;
    border-radius: 12px;
    width: 100%;
    aspect-ratio: 1/1; /* Cuadrado perfecto */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #555;
    position: relative;
}

.photo-upload-container:hover {
    border-color: #0d6efd;
    color: #0d6efd;
}

.photo-edit-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: #333;
    color: #fff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* Títulos de secciones (Correos/Teléfonos) */
.section-title-sm {
    color: #a3a3a3;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Ajuste para input group con radio button (Teléfono default) */
.input-group-radio {
    background-color: #1a1a1a;
    border: 1px solid #333;
    display: flex;
    align-items: center;
    padding: 0 10px;
}
.input-group-radio input[type="radio"] {
    accent-color: #0d6efd;
    cursor: pointer;
}

/* Modo Claro para Foto */
body.light-mode .photo-upload-container {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}
body.light-mode .section-title-sm {
    color: #6b7280;
}
/* =========================================
   7. ALERTA DINÁMICA DE TELÉFONO
   ========================================= */

.alert-bar {
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

/* Estado Inválido (Rojo) */
.alert-bar.alert-invalid {
    background-color: #ef4444; /* Rojo intenso */
    border-color: #dc2626;
    color: #ffffff;
    box-shadow: 0 4px 6px rgba(220, 38, 38, 0.2);
}

/* Estado Válido (Verde) */
.alert-bar.alert-valid {
    background-color: #10b981; /* Verde esmeralda */
    border-color: #059669;
    color: #ffffff;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}

/* =========================================
   8. VALIDACIÓN DE FORMULARIO (ESTILO GESTIOO)
   ========================================= */

/* Borde rojo en el input */
.form-control.input-error {
    border-color: #ef4444 !important; /* Rojo intenso */
    background-color: rgba(239, 68, 68, 0.05) !important; /* Fondo rojo muy suave */
    padding-right: 90px; /* Espacio para que el texto no tape la etiqueta */
}

/* Etiqueta "Obligatorio" dentro del input */
.error-badge {
    position: absolute;
    top: 50%;
    right: 12px; /* Ajustado para que no toque el borde */
    transform: translateY(-50%);
    background-color: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    pointer-events: none; /* Para poder hacer click en el input a través de la etiqueta */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
}

/* Contenedor del input necesita ser relativo para posicionar la etiqueta */
.position-relative-custom {
    position: relative !important;
}

/* Notificación Toast (Abajo a la derecha) */
.toast-error-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    animation: slideInRight 0.3s ease-out;
}

.toast-error {
    background-color: #ef4444;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* =========================================
   9. BUSCADOR PREDICTIVO (DROPDOWN)
   ========================================= */

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #000000;
    border: 1px solid #374151;
    border-top: none;
    border-radius: 0 0 8px 8px;
    
    /* CAMBIO AQUÍ: Subimos el nivel para que tape al modal */
    z-index: 2000 !important; 
    
    max-height: 250px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.8);
}

.search-result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #374151;
    cursor: pointer;
    color: #e5e7eb;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Hover Azul tipo Gestioo */
.search-result-item:hover {
    background-color: #0d6efd; 
    color: white;
}

.search-result-item small {
    color: #9ca3af;
    font-size: 0.8rem;
}
.search-result-item:hover small {
    color: #e5e7eb;
}

/* =========================================
   10. AJUSTES ESTÉTICOS (CORREGIDO)
   ========================================= */

/* Forzar esquinas redondeadas en el botón azul del buscador de clientes */
/* Usamos el selector del atributo data-bs-target para ser exactos */
.input-group .btn[data-bs-target="#modalCrearCliente"] {
    border-top-right-radius: 0.375rem !important;
    border-bottom-right-radius: 0.375rem !important;
    z-index: 5; /* Asegura que el borde se vea bien sobre el input */
}

/* Opcional: Si tienes un botón similar para "Equipo" en el futuro, agrega esto: */
.input-group .btn[data-bs-target="#modalCrearEquipo"] {
    border-top-right-radius: 0.375rem !important;
    border-bottom-right-radius: 0.375rem !important;
}

/* ==========================================
   MODAL PATRÓN DE DESBLOQUEO
   ========================================== */

/* Contenedor del Dibujo (El cuadrado azul) */
.pattern-container {
    width: 340px;
    height: 340px;
    background-color: #3b82f6; /* Azul Gestioo */
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin: 0 auto 1rem auto;
    position: relative;
}

#patternCanvas {
    width: 100%;
    height: 100%;
    cursor: pointer;
    touch-action: none;
}

/* ==========================================
   MODAL PATRÓN DE DESBLOQUEO
   ========================================== */

/* Contenedor del Dibujo (El cuadrado azul) */
.pattern-container {
    width: 340px;
    height: 340px;
    background-color: #3b82f6; /* Azul Gestioo */
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin: 0 auto 1rem auto;
    position: relative;
}

#patternCanvas {
    width: 100%;
    height: 100%;
    cursor: pointer;
    touch-action: none;
}

/* ==========================================
   MODAL PATRÓN DE DESBLOQUEO
   ========================================== */

/* Contenedor del Dibujo */
.pattern-container {
    width: 340px;
    height: 340px;
    background-color: #3b82f6; /* Azul Gestioo */
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin: 0 auto 1rem auto;
    position: relative;
}

#patternCanvas {
    width: 100%;
    height: 100%;
    cursor: pointer;
    touch-action: none;
}

/* ==========================================
   TEMA DEL MODAL (FIX VISIBILIDAD)
   ========================================== */

/* 1. MODO OSCURO (Por defecto - Negro Puro) */
.modal-theme-adaptive .modal-content {
    background-color: #000000 !important; /* Negro Puro */
    color: #ffffff !important;            /* Texto Principal Blanco */
    border: 1px solid #333333;
}

/* FIX: Hacer visible el texto "muted" (etiquetas) en fondo negro */
.modal-theme-adaptive .text-muted {
    color: #cccccc !important; /* Gris claro muy legible */
}

.modal-theme-adaptive .input-display {
    background-color: #111111 !important;
    color: #ffffff !important;
    border: 1px solid #333333 !important;
    font-size: 1.25rem;
    font-weight: bold;
    letter-spacing: 2px;
}

.modal-theme-adaptive .modal-header,
.modal-theme-adaptive .modal-footer {
    border-color: #222222 !important;
}

.modal-theme-adaptive .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%); /* Cruz blanca */
}


/* 2. MODO CLARO (Solo si se activa explícitamente) */
[data-bs-theme="light"] .modal-theme-adaptive .modal-content,
body.light-mode .modal-theme-adaptive .modal-content {
    background-color: #ffffff !important;
    color: #212529 !important;
    border-color: #dee2e6 !important;
}

/* En modo claro, el text-muted vuelve a su color original */
[data-bs-theme="light"] .modal-theme-adaptive .text-muted,
body.light-mode .modal-theme-adaptive .text-muted {
    color: #6c757d !important; 
}

[data-bs-theme="light"] .modal-theme-adaptive .input-display,
body.light-mode .modal-theme-adaptive .input-display {
    background-color: #f8f9fa !important;
    color: #212529 !important;
    border-color: #ced4da !important;
}

[data-bs-theme="light"] .modal-theme-adaptive .btn-close,
body.light-mode .modal-theme-adaptive .btn-close {
    filter: none !important;
}

