/* 1. ESTILOS GLOBALES Y VARIABLES */
:root {
    --primary: #1e293b; --primary-light: #334155; --accent-radio: #0284c7;
    --accent-lab: #0d9488; --accent-inst: #4f46e5; --accent-quote: #22c55e;
    --bg-main: #f8fafc; --bg-card: #ffffff; --text-main: #0f172a;
    --text-muted: #64748b; --border: #e2e8f0; --danger: #ef4444; --warning: #f59e0b; 
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-main); color: var(--text-main); padding: 20px; line-height: 1.5; }
.container { max-width: 1200px; margin: 0 auto; background: var(--bg-card); padding: 25px; border-radius: 12px; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05); }

/* 2. ENCABEZADO Y PESTAÑAS */
header { margin-bottom: 25px; border-bottom: 2px solid var(--border); padding-bottom: 25px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }
header h1 { font-size: 24px; color: var(--primary); font-weight: 700; }
header p { color: var(--text-muted); font-size: 14px; }
.header-tabs { display: flex; gap: 10px; }
.tab-btn { padding: 10px 18px; font-weight: 600; font-size: 14px; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; transition: all 0.2s ease; background: #fff; color: var(--primary-light); }
.tab-btn:hover { background: #f1f5f9; }
.tab-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* 3. ZONA DE BÚSQUEDA Y FILTROS */

#zona-busqueda {

    background-image: url('js/img/fondo.png'); 
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
       /* Agrega un poco de padding y bordes suaves si es un contenedor intermedio */
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}


.search-section { 
    
    /* Cambiamos el fondo sólido por uno blanco con 75% de opacidad */
    background: rgba(200, 208, 221, 0.75) !important; 
    
    /* El truco de magia: difumina lo que está detrás para que las letras se sigan leyendo perfecto */
    backdrop-filter: blur(.5px);
    -webkit-backdrop-filter: blur(.5px); /* Compatibilidad para Safari */
    
    /* Opcional: un borde sutil para delimitar la caja */
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: #f1f5f9; padding: 20px; border-radius: 8px; margin-bottom: 25px; }
.search-bar { position: relative; margin-bottom: 15px; }
.search-bar input { width: 100%; padding: 12px 15px; font-size: 16px; border: 1px solid var(--border); border-radius: 6px; outline: none; transition: border-color 0.2s; }
.search-bar input:focus { border-color: var(--accent-radio); box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1); }
.filter-group { margin-bottom: 15px; }
.filter-label { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }

.search-section .filter-label {
    color: #0f172a !important; /* Un slate/navy bien oscuro */
    font-weight: 600; /* Un toque más de grosor para que salte a la vista */
}
/* 📑 Sombra base para TODOS los botones del buscador (Blancos, Oscuros y el Rojo) */
.search-section button {
    /* Combinación de sombras para dar profundidad suave sobre el cristal */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 
                0 1px 2px rgba(0, 0, 0, 0.04) !important;
    
    /* Transición suave para que la elevación no sea tosca */
    transition: all 0.2s ease-in-out !important; 
}

/* 🚀 Efecto de elevación interactiva al pasar el cursor (Aplica también al botón rojo) */
.search-section button:hover {
    transform: translateY(-1px) !important; /* El botón sube sutilmente */
    
    /* La sombra se expande simulando que se separa del fondo */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12), 
                0 2px 4px rgba(0, 0, 0, 0.06) !important;
}
.btn-container { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { padding: 8px 16px; font-size: 14px; font-weight: 500; border: 1px solid var(--border); border-radius: 6px; background: #ffffff; color: var(--primary-light); cursor: pointer; transition: all 0.2s ease; }
.btn:hover { background: #f8fafc; border-color: var(--text-muted); }
.btn.active-all { background: var(--primary); color: white; border-color: var(--primary); }
.btn.active-radio { background: var(--accent-radio); color: white; border-color: var(--accent-radio); }
.btn.active-lab { background: var(--accent-lab); color: white; border-color: var(--accent-lab); }
.btn.active-inst { background: var(--accent-inst); color: white; border-color: var(--accent-inst); }
.btn-clear { background: #ef4444; color: white; border-color: #ef4444; }
.btn-clear:hover { background: #dc2626 !important; color: white !important; border-color: #dc2626 !important; }

/* 4. TABLAS DE RESULTADOS Y COLORES */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
th { background-color: var(--primary); color: white; padding: 12px 15px; font-weight: 600; cursor: pointer; user-select: none; }
th:hover { background-color: #475569; }
td { padding: 12px 15px; border-bottom: 1px solid var(--border); vertical-align: middle; }

.inst-PARTICULAR { background-color: #fffbeb !important; border-left: 5px solid #f59e0b !important; }
.inst-IMSS { background-color: #ecfdf5 !important; border-left: 5px solid #10b981 !important; }
.inst-ISSSTE { background-color: #f0f9ff !important; border-left: 5px solid #0ea5e9 !important; }
.inst-UASLP { background-color: #eef2ff !important; border-left: 5px solid #6366f1 !important; }
.inst-SALUD-Y-COMUNION { background-color: #eff6ff !important; border-left: 5px solid #3b82f6 !important; }
.inst-DIF { background-color: #fdf2f8 !important; border-left: 5px solid #ec4899 !important; }
.inst-SOMME-SANTE { background-color: #f5f3ff !important; border-left: 5px solid #8b5cf6 !important; }
.inst-STAR-MEDICA { background-color: #fefce8 !important; border-left: 5px solid #eab308 !important; }
.inst-AMANC { background-color: #fff7ed !important; border-left: 5px solid #f97316 !important; }

.badge { display: inline-block; padding: 3px 8px; font-size: 11px; font-weight: 600; border-radius: 4px; }
.badge-lab { background: #ccfbf1; color: #0f766e; }
.badge-radio { background: #e0f2fe; color: #0369a1; }

.price-container { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price-text { font-weight: 700; white-space: nowrap; }
.btn-add-quote { background-color: var(--accent-quote); color: white; border: none; width: 28px; height: 28px; border-radius: 6px; font-weight: 700; font-size: 16px; cursor: pointer; transition: transform 0.1s; }
.btn-add-quote:hover { background-color: #16a34a; transform: scale(1.05); }

/* 5. FORMULARIOS PACIENTE Y POS */
.capitalize-input { text-transform: capitalize; }
.form-paciente { margin-top: 30px; background: #f8fafc; padding: 25px; border-radius: 8px; border: 1px solid var(--border); display: none; }
.form-paciente h3 { margin-bottom: 20px; color: var(--primary); border-bottom: 2px solid var(--border); padding-bottom: 25px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.form-control-group { display: flex; flex-direction: column; gap: 8px; }
.form-control-group label { font-size: 13px; font-weight: 600; color: var(--primary-light); }
.form-control-group input, 
.form-control-group textarea, 
.form-control-group select { padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 15px; outline: none; }
.form-full-width { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 25px; border-top: 1px solid var(--border); padding-top: 20px; }

.pos-summary-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 25px; }
.pos-summary-box { background: white; padding: 15px; border-radius: 8px; border: 1px solid var(--border); }
.pos-total-box { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; background: #f0fdf4; border: 1px solid #bbf7d0; padding: 15px; border-radius: 8px; }

/* 6. NOTIFICACIONES Y MODALES */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 15px 20px; border-radius: 8px; color: white; font-weight: 500; box-shadow: 0 4px 6px rgba(0,0,0,0.1); animation: slideIn 0.3s ease forwards; opacity: 0; transform: translateX(100%); }
.toast.success { background: #10b981; } .toast.error { background: var(--danger); } .toast.warning { background: var(--warning); } .toast.info { background: #0284c7; }
@keyframes slideIn { to { transform: translateX(0); opacity: 1; } }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: none; justify-content: center; align-items: center; z-index: 1000; }
.modal-box { background: white; padding: 25px; border-radius: 12px; width: 100%; max-width: 400px; box-shadow: 0 10px 15px rgba(0,0,0,0.1); }
.modal-box h3 { margin-bottom: 15px; color: var(--primary); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 25px; }
/* Resaltado para navegación por teclado */
.fila-seleccionada {
    background-color: #e2e8f0 !important; /* Un gris claro azulado */
    outline: 2px solid #3b82f6; /* Borde azul para destacar */
    transition: all 0.1s ease-in-out;
}
/* Botón Flotante */
.btn-flotante {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background-color: #2563eb; /* Color azul premium (cámbiatelo por tu var(--accent-radio) si prefieres) */
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    z-index: 9999; /* Asegura que flote por encima de todo */
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s;
}

.btn-flotante:hover {
    transform: scale(1.1); /* Efecto de agrandado sutil al pasar el cursor */
    background-color: #1d4ed8;
}

/* Contador Rojo (Badge) */
.badge-contador {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #ef4444; /* Rojo vibrante */
    color: white;
    font-size: 12px;
    font-weight: bold;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white; /* Borde blanco para resaltar */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}