/* assets/css/style.css */
:root {
    --primary-color: #4A90E2; /* Un azul amigable */
    --light-gray: #f4f7f6;
    --text-color: #333;
    --border-color: #ddd;
    --error-color: #e74c3c;
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    background-color: var(--light-gray);
    color: var(--text-color);
}

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-container {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header h2 {
    margin: 0 0 10px;
    font-weight: 600;
}

.login-header p {
    margin-bottom: 30px;
    color: #888;
}

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

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 400;
    font-size: 14px;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-login {
    width: 100%;
    padding: 15px;
    border: none;
    background-color: var(--primary-color);
    color: white;
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-login:hover {
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(37,99,235,0.25);
    transform: translateY(-2px);
}

.error-message {
    background-color: #fdd;
    color: var(--error-color);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--error-color);
}

.login-logo {
    max-width: 120px;
    margin-bottom: 0;       
    display: inline-block;  
    margin: 0;              
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    gap: 6px; 
}

.brand-logo h1 {
    margin: 0;
    font-size: 32px;
    line-height: 1;
}



/* Estilos para el Dashboard (Añadir al final de style.css) */
:root {
    --main-bg-color: #f1f5f9;
    --main-color: #4A90E2;
    --secondary-color: #3C4252;
    --text-grey: #8390A2;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--main-bg-color);
    color: var(--secondary-color);
}

.sidebar {
    width: 280px;
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--main-color);
    color: #fff;
    padding: 1.2rem;
    transition: width 300ms;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .brand span {
    display: none;
}
.sidebar.collapsed .sidebar-menu span {
    display: none;
}
.sidebar.collapsed .sidebar-menu a {
    justify-content: center;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 2rem;
}

.brand span {
    margin-left: .5rem;
}

#menu-toggle {
    font-size: 1.5rem;
    cursor: pointer;
}

.sidebar-menu ul {
    list-style-type: none;
}
.sidebar-menu a {
    display: flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: .5rem;
    transition: background 300ms;
}

.sidebar-menu a:hover, .sidebar-menu a.active {
    background: #ffffff33;
}

.sidebar-menu a span {
    margin-left: 1rem;
    font-size: 1rem;
}

.main-content {
    margin-left: 280px;
    transition: margin-left 300ms;
}
.main-content.collapsed {
    margin-left: 80px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.header-actions {
    display: flex;
    align-items: center;
}
#fullscreen-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 1.5rem;
    color: var(--text-grey);
}

.user-wrapper {
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.user-wrapper img {
    border-radius: 50%;
    margin-right: 1rem;
}
.user-wrapper small {
    color: var(--text-grey);
}
.user-wrapper .dropdown {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    width: 160px;
    overflow: hidden;
    z-index: 1;
}
.user-wrapper.active .dropdown {
    display: block;
}
.dropdown a {
    display: block;
    padding: 12px 15px;
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.9rem;
}
.dropdown a:hover {
    background: var(--main-bg-color);
}
.dropdown a i {
    margin-right: 10px;
    color: var(--text-grey);
}


main {
    padding: 1.5rem;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 2rem;
    margin-bottom: 2rem;
}

/* Y PEGA ESTE BLOQUE COMPLETO EN SU LUGAR */
/* ============================================= */
/* ==   NUEVOS ESTILOS PARA TARJETAS DEL DASHBOARD   == */
/* ============================================= */

/* 1. Estilo base para todas las tarjetas */
.card-single {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* 2. Estilo para la sección del texto */
.card-single > div:first-child span {
    color: #777;
    font-size: 1rem;
}

.card-single > div:first-child h1 {
    font-size: 2.5rem;
    margin: 0.5rem 0;
}

/* 3. Estilo para el ícono (lo nombramos card-icon en el HTML) */
.card-single .card-icon {
    font-size: 2.5rem;
    padding: 1rem;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 4. Paleta de colores para cada tarjeta */
.card-single.patients .card-icon {
    background: #e7f5ff; /* Fondo azul claro */
    color: #3498db; /* Ícono azul oscuro */
}
.card-single.patients h1 { color: #3498db; }

.card-single.consultas .card-icon {
    background: #e8f8f5; /* Fondo turquesa claro */
    color: #1abc9c; /* Ícono turquesa oscuro */
}
.card-single.consultas h1 { color: #1abc9c; }

.card-single.citas .card-icon {
    background: #f4ecf7; /* Fondo morado claro */
    color: #9b59b6; /* Ícono morado oscuro */
}
.card-single.citas h1 { color: #9b59b6; }

.card-single.ingresos .card-icon {
    background: #eafaf1; /* Fondo verde claro */
    color: #2ecc71; /* Ícono verde oscuro */
}
.card-single.ingresos h1 { color: #2ecc71; }

/* Este es el efecto hover para cada color de tarjeta */
.card-single-link:hover .card-single {
    transform: translateY(-4px); /* Mantenemos un levantamiento muy sutil */
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.08);
}
.card-single-link:hover .card-single.patients { background: #e7f5ff; }
.card-single-link:hover .card-single.consultas { background: #e8f8f5; }
.card-single-link:hover .card-single.citas { background: #f4ecf7; }
.card-single-link:hover .card-single.ingresos { background: #eafaf1; }

.recent-grid {
    display: grid;
    grid-template-columns: 65% auto;
    grid-gap: 2rem;
}

.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.card-header {
    padding: 1.2rem;
    border-bottom: 1px solid var(--main-bg-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-body {
    padding: 1.2rem;
}
.customer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .7rem 0;
}
.customer .info {
    display: flex;
    align-items: center;
}
.customer .info h4 {
    font-weight: 500;
}
.customer .info small {
    color: var(--text-grey);
}
.customer .contact i {
    color: var(--main-color);
    font-size: 1.2rem;
}

/* --- Estilos para la sección de Pacientes --- */

/* Wrapper para buscador y botón de añadir */
.search-add-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.search-form {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
}
.search-form input {
    border: none;
    padding: 0.5rem 1rem;
    outline: none;
}
.search-form button {
    background: var(--main-bg-color);
    border: none;
    padding: 0 1rem;
    cursor: pointer;
    color: var(--text-grey);
}


/* Tabla responsiva */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
table thead {
    background: var(--main-bg-color);
}
table th, table td {
    padding: 1rem;
    text-align: left;
    white-space: nowrap;
}
table tbody tr {
    border-bottom: 1px solid var(--main-bg-color);
}
table tbody tr:hover {
    background: #f9f9f9;
}
.status {
    padding: 0.3rem 0.7rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}
.status.activo {
    background-color: #27ae60; 
    color: #fff;
}
.status.activa {
    background-color: #27ae60; 
    color: #fff;
}
.status.inactivo { background: #f8d7da; color: #721c24; }
.status.anulado { background: #f8d7da; color: #721c24; }
.status.inactiva { background: #f8d7da; color: #721c24; }

.actions {
    display: flex;
    gap: 0.5rem; /* ¡Esta es la línea clave! Crea un espacio entre los botones. */
}

/* =================================== */
/* == Estilos para Botones de Acción == */
/* =================================== */

.actions .btn-action {
    display: inline-flex;  /* Activa Flexbox */
    align-items: center;    /* Centra el ícono verticalmente */
    justify-content: center;/* Centra el ícono horizontalmente */
    text-decoration: none;
    width: 36px;            /* Ancho fijo */
    height: 36px;           /* Alto fijo */
    border-radius: 50%;     /* Círculo perfecto */
    border: none;           /* Sin borde por defecto */
    background-color: #f0f4f7; /* Fondo gris claro neutro */
    color: #5a677d;         /* Color de ícono oscuro */
    cursor: pointer;
    font-size: 0.9rem;      /* Tamaño del ícono */
    transition: all 0.2s ease-in-out;
}

.actions .btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Colores específicos para cada acción */
.actions .btn-action.view { color: #3498db; }   /* Azul para Ver */
.actions .btn-action.edit { color: #f39c12; }   /* Naranja para Editar */
.actions .btn-action.delete { color: #e74c3c; } /* Rojo para Desactivar */

/* Paginación */
.pagination {
    margin-top: 1.5rem;
    text-align: center;
}
.pagination a {
    color: var(--secondary-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    margin: 0 0.2rem;
    border-radius: 5px;
}
.pagination a.active, .pagination a:hover {
    background: var(--main-color);
    color: #fff;
    border-color: var(--main-color);
}

/* --- Estilos para el Modal --- */
.modal {
    display: none; 
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}
.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    border-radius: 10px;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: slide-down 0.3s ease-out;
}
@keyframes slide-down {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h2 { font-weight: 600; }

/* Cambiamos .close-btn a .modal-header .close-btn */
/* y restauramos el tamaño de fuente para la 'X' */
.modal-header .close-btn {
    color: #aaa;
    font-size: 28px; /* Tamaño grande para la 'X' */
    font-weight: bold;
    cursor: pointer;
}

.modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}
.form-row { display: flex; gap: 1rem; }
.form-group { flex: 1; margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: .5rem; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-family: 'Poppins', sans-serif;
}
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    font-size: 15px;
    height: 40px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

/* 2. Espaciado para Íconos dentro de CUALQUIER botón .btn */
.btn i {
    margin-right: 8px; /* <-- ESTA ES LA SOLUCIÓN A TU PROBLEMA ORIGINAL */
}

/* 3. Clases Modificadoras (solo colores y espaciados únicos) */
.btn-primary {
    background: var(--main-color);
    color: #fff;
}

.btn-secondary {
    background: #ccc;
    color: var(--secondary-color);
    margin-right: 10px; /* Mantenemos tu margen específico */
}

.btn-add {
    background: var(--main-color);
    color: #fff;
    margin-left: 10px; /* Mantenemos tu margen específico */
}

/* 4. Efectos Hover */
.btn-primary:hover, .btn-add:hover {
    background-color: #357ABD; /* Un azul un poco más oscuro */
    transform: translateY(-2px);
}
.btn-secondary:hover {
    background-color: #b3b3b3;
    transform: translateY(-2px);
}

/* --- Estilos para la sección de Citas --- */
.filter-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.filter-wrapper label {
    font-weight: 500;
}

#calendario {
    padding-top: 1rem;
}
/* Asegura que el calendario se vea bien */
:root {
    --fc-border-color: var(--border-color);
    --fc-button-bg-color: var(--main-color);
    --fc-button-active-bg-color: #357ABD;
    --fc-today-bg-color: rgba(74, 144, 226, 0.1);
}

/* Estilos para que Select2 funcione bien en el modal */
.select2-container--default .select2-selection--single {
    height: calc(1.5em + 1.4rem + 2px); /* Ajustar altura */
    padding: 0.7rem;
    border: 1px solid var(--border-color);
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: calc(1.5em + 1.4rem);
}
.select2-dropdown {
    border: 1px solid var(--border-color);
    z-index: 1051; /* Mayor que el modal */
}

/* --- Estilos para la sección de Consultas --- */

.status.completada { background: #d1ecf1; color: #0c5460; }

/* Estilos para el estado de pago */
.status.pendiente {
    background-color: #f39c12; /* Naranja */
    color: #fff;
}
.status.pagado {
    background-color: #27ae60; /* Verde */
    color: #fff;
}

/* Estilos para el sistema de pestañas */
.tabs-container {
    width: 100%;
}
.tabs-nav {
    display: flex;
    list-style: none;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}
.tabs-nav li {
    margin-bottom: -2px; /* Alinea el borde inferior */
}
.tabs-nav a {
    display: block;
    padding: 0.8rem 1.2rem;
    text-decoration: none;
    color: var(--text-grey);
    border: 2px solid transparent;
    border-bottom: none;
}
.tabs-nav li.active a {
    color: var(--main-color);
    border-color: var(--border-color);
    border-bottom-color: #fff;
    border-radius: 5px 5px 0 0;
    font-weight: 600;
}
.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
    animation: fade-in 0.5s;
}
@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Estilos para tabla de receta */
#tabla-receta { width: 100%; margin-bottom: 1rem; }
#tabla-receta th, #tabla-receta td { padding: 0.5rem; }
#tabla-receta thead { background: #f9f9f9; }

#tabla-receta select, #tabla-receta input {
    font-size: 1rem; /* Tamaño de fuente estándar */
    padding: 0.5rem;
}

/* Aumenta el tamaño de letra en el campo de indicaciones generales */
textarea#indicaciones_generales {
    font-size: 1rem; /* Mismo tamaño para consistencia */
    line-height: 1.6;
}

.btn-add-mini {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    cursor: pointer;
}

#tabla-medicamentos-externos {
 width: 100%; margin-bottom: 1rem; 
}
#tabla-medicamentos-externos thead {
    background: #f9f9f9;
}
#tabla-medicamentos-externos th,
#tabla-medicamentos-externos td {
padding: 0.5rem; 
}

/* Inputs iguales a receta */
#tabla-medicamentos-externos input {
    font-size: 1rem;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-family: 'Poppins', sans-serif;
}

/* Input de cantidad más compacto */
#tabla-medicamentos-externos input[type="number"] {
    text-align: center; 
}

/* Centrar cabeceras */
#tabla-medicamentos-externos thead th {
    text-align: center;
    font-weight: 600;
}

/* --- Corrección de altura para el Select2 en el modal de consultas --- */

#modal-consulta .select2-selection--single {
    height: 38px; /* Mantenemos la altura fija */
    display: flex;
    align-items: center; /* Esta es la clave para un centrado vertical perfecto */
}

#modal-consulta .select2-selection__rendered {
    line-height: 36px !important; /* Centramos el texto verticalmente */
}

#modal-consulta .select2-selection__arrow {
    height: 36px !important; /* Centramos la flecha verticalmente */
}

/* Utilidad para dar espacio vertical a un grupo de botones de acción */
.form-action-group {
    margin: 1.5rem 0;
}

/* --- Estilos para la legibilidad de la receta médica --- */

.image-gallery { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.image-gallery-item { border: 1px solid #ddd; padding: 0.5rem; border-radius: 5px; text-align: center; }
.image-gallery-item img { max-width: 150px; max-height: 150px; display: block; margin-bottom: 0.5rem; }

/* --- Ajuste de altura para Select2 en el modal de Citas --- */

#modal-cita .select2-selection--single {
    height: 40px;
    display: flex;
    align-items: center;
}

/* Estilo para que el buscador de pacientes en la pestaña de cobro ocupe el 100% */
#tab-cobro .select2-selection--single {
    height: 40px;
    display: flex;
    align-items: center;
}


/* Clase para ocultar columnas */
.table-responsive th.hidden-col,
.table-responsive td.hidden-col {
    display: none;
}

#btn-filtro-columnas i {
    margin-right: 6px; /* Ajusta este valor si quieres más o menos espacio */
}

button:disabled {
    background-color: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Ajuste de altura SOLO para el filtro de paciente en reportes */
.patient-filter .select2-container .select2-selection--single {
    height: 44px; /* Mantenemos la altura fija */
    display: flex;
    align-items: center; /* Esta es la clave para un centrado vertical perfecto */
}

.patient-filter .select2-selection__rendered {
    line-height: 42px !important;
}

.patient-filter .select2-selection__arrow {
    height: 40px !important;
}

/* Forzar mayúsculas en campos de nombre */
#modal-paciente #nombres,
#modal-paciente #apellidos,
#modal-paciente #documento,
#modal-paciente #nombre_responsable,
#modal-paciente #doc_responsable,
#modal-paciente #direccion {
    text-transform: uppercase;
}

input:read-only,
textarea:read-only,
select:disabled {
    background-color: #e9ecef; /* Un color gris claro */
    opacity: 0.8;
    cursor: not-allowed;
}

#modal-cita #cita-observaciones {
    text-transform: uppercase;
}

#modal-consulta .consulta-anamnesis, 
#modal-consulta .consulta-exploracion_fisica,
#modal-consulta .consulta-diagnostico,
#modal-consulta .consulta-tratamiento,
#modal-consulta .consulta-observaciones {
    text-transform: uppercase;
}

.texto-mayusculas {
    text-transform: uppercase;
}

/* ======================================================= */
/* ==   ESTILO ALTAMENTE REFINADO PARA LISTA DE CITAS   == */
/* ======================================================= */

/* Contenedor de cada cita (ahora con borde inferior) */
.customer-link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 1rem;
    border-bottom: 1px solid #eef2f7; /* Separador de línea sutil */
    transition: background-color 0.2s ease-in-out;
}
.customers .card-body {
    /* Quitamos el padding del contenedor para que las líneas lleguen a los bordes */
    padding: 0; 
}
.customer-link:last-child {
    border-bottom: none; /* Sin borde en el último elemento */
}
.customer-link:hover {
    background-color: #f8fafc; /* Un hover aún más sutil y limpio */
}

/* Contenedor interno para alinear todo */
.customer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.customer-link .info {
    display: flex;
    align-items: center;
}

/* Tipografía refinada para mejor jerarquía visual */
.customer-link .info h4 {
    margin: 0 0 2px 0;
    font-size: 0.95rem;
    font-weight: 600; /* Ligeramente más grueso para resaltar */
    color: #3f4a5c; /* Un gris oscuro profesional, no negro puro */
}
.customer-link .info small {
    font-size: 0.8rem;
    color: #8a96a8; /* Un gris más suave para la info secundaria */
}

/* Punto de estado con más detalle */
.status-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 15px;
    /* Sombra sutil para dar un poco de profundidad */
    box-shadow: inset 0 0 3px rgba(0,0,0,0.1);
}
.status-dot.agendada { background-color: #4A90E2; } /* Azul */
.status-dot.confirmada { background-color: #27ae60; } /* Verde */

/* Icono de flecha y su micro-interacción */
.customer-link .contact i {
    color: #c0c8d4; /* Un gris claro para el ícono en reposo */
    transition: transform 0.2s ease, color 0.2s ease;
}
.customer-link:hover .contact i {
    transform: translateX(4px); /* La flecha se mueve a la derecha */
    color: #3498db; /* La flecha se colorea en el hover, indicando acción */
}

/* Estilos para el perfil del paciente */
.patient-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: 1.5rem 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.patient-info h2 {
    margin: 0 0 0.5rem 0;
    color: var(--main-color);
    display: flex;
    align-items: center;
    gap: 0.75rem; 
}
.patient-info p {
    margin: 0;
    color: #555;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.patient-info p .separator {
    color: #ddd;
    margin: 0 0.5rem;
}
.patient-actions {
    display: flex;
    gap: 1rem;
}

/* ==================================================== */
/* ==   ESTILOS DEFINITIVOS: EXPEDIENTE DE PACIENTE   == */
/* ==================================================== */

/* 1. Cabecera del Perfil */
.patient-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: 1.5rem 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.patient-info h2 {
    margin: 0 0 0.5rem 0;
}
.patient-info p {
    margin: 0;
    color: #555;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.patient-info p .separator {
    color: #ddd;
    margin: 0 0.5rem;
}

/* 2. Cuadrícula y Ficha de Paciente con Iconos */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    grid-gap: 2rem;
    margin-bottom: 2rem;
}
.patient-data-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.patient-data-list li {
    display: flex;
    align-items: center;
    padding: 0.9rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95rem;
}
.patient-data-list li:last-child {
    border-bottom: none;
}
.patient-data-list li .fa-solid {
    width: 20px;
    text-align: center;
    color: var(--main-color, #3498db);
    font-size: 1rem;
    margin-right: 15px;
    opacity: 0.7;
    font-family: 'Font Awesome 6 Free'; 
    font-weight: 900;
}
.patient-data-list li span {
    color: #555;
    word-break: break-word;
}

/* Botón de tres puntos */
.patient-actions .btn-action {
    background: #374151;  /* gris oscuro */
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 8px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.patient-actions .btn-action:hover {
    background: #1f2937;
    transform: translateY(-2px);
}

/* Dropdown elegante */
.actions-dropdown, .column-filter {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background-color: #ffffff;
    min-width: 220px;
    box-shadow: 0px 8px 24px rgba(0,0,0,0.12);
    border-radius: 12px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.25s ease;
    z-index: 100;
}

.dropdown-content.show-dropdown {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-content a {
    color: #555;
    padding: 12px 18px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
}

.dropdown-content a i {
    width: 18px;
    text-align: center;
    color: #999;
    transition: color 0.2s ease;
}

.dropdown-content a:hover {
    background-color: #f5f7fa; 
    color: var(--main-color);
}


.dropdown-content a:hover i {
    color: var(--main-color);
}

/* --- INICIO: ADAPTACIÓN PARA EL FILTRO DE COLUMNAS --- */
.column-filter .dropdown-content {
    padding: 10px;
    min-width: 180px;
}
.column-filter .dropdown-content label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
    transition: background-color 0.2s ease;
}
.column-filter .dropdown-content label:hover {
    background-color: #f5f7fa; /* Mismo color de hover que los enlaces */
}

.column-filter .dropdown-content input[type="checkbox"] {
    cursor: pointer;
}

/* --- FIN: ADAPTACIÓN --- */

/* Estilo para el enlace de editar */
.dropdown-content a.btn-edit-from-profile:hover {
    color: #f39c12; /* amarillo fuerte para texto */
}

.dropdown-content a.btn-edit-from-profile:hover i {
    color: #f39c12; /* amarillo fuerte para ícono */
}

/* Estilo para el enlace de eliminar */
.dropdown-content a.btn-delete-from-profile:hover {
    color: #e74c3c; /* rojo fuerte para texto */
}

.dropdown-content a.btn-delete-from-profile:hover i {
    color: #e74c3c; /* rojo fuerte para ícono */
}


/* 4. Lista de Historial de Consultas */

/* Ajuste visual del paginador en historial de consultas */
#historial-consultas .pagination {
    padding: 1rem 0 1.5rem;
}

.card-body.no-padding { padding: 0; }

.consultation-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.consultation-history-list .no-history {
    text-align: center;
    padding: 2rem;
    color: #888;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease;
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background-color: #f8fafc; }

.history-date {
    text-align: center;
    margin-right: 1.5rem;
    flex-shrink: 0;
}
.history-date .day {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--main-color);
    display: block;
    line-height: 1;
}
.history-date .month-year {
    font-size: 0.8rem;
    color: #888;
}

.history-details .doctor {
    font-size: 0.8rem;
    color: #777;
    margin-bottom: 0.3rem;
    display: block;
}
.history-details .diagnosis {
    margin: 0;
    line-height: 1.4;
    color: #333;
}

.history-action {
    margin-left: auto;
    color: #ccc;
}
.history-item:hover .history-action {
    color: var(--main-color);
}

/* Corrige el cursor en los botones para subir archivos */
input[type="file"] {
    cursor: pointer;
}

/* Estilos para el contenedor del campo de contraseña */
.password-container {
    position: relative;
}

/* Ajusta el padding del input para que el texto no se oculte detrás del ícono */
.password-container input {
    padding-right: 40px !important;
}

/* Estilos para el ícono del 'ojito' */
.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #888;
}

#control_inventario {
    cursor: pointer;
}

/* Aplica el cursor de puntero también a la etiqueta asociada */
label[for="control_inventario"] {
    cursor: pointer;
}

/* --- ESTILOS PARA EL FORMULARIO ESTRUCTURADO DE HISTORIA CLÍNICA --- */
.structured-form .form-section-header {
    font-size: 1.1rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 8px;
    margin-top: 20px;
    margin-bottom: 15px;
}
/* Asegura que los campos deshabilitados se vean bien */
.structured-form input:disabled, .structured-form textarea:disabled {
    background-color: #f0f0f0;
    cursor: not-allowed;
}
.structured-form .checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}
.structured-form .checkbox-group label {
    margin-bottom: 0;
}

/* --- ESTILOS PARA CORREGIR ALINEAMIENTO DEL FORMULARIO GRANDE --- */
.structured-form .form-row {
    display: flex;
    flex-wrap: wrap; /* Permite que los elementos pasen a la siguiente línea si no caben */
    gap: 1.5rem;   /* Espacio entre campos */
    margin-bottom: 1rem;
}

.structured-form .form-row .form-group {
    flex: 1; /* ¡La regla clave! Hace que todos los campos en una fila ocupen el mismo ancho */
    min-width: 200px; /* Evita que los campos se compriman demasiado en pantallas pequeñas */
    margin-bottom: 0;
}

/* Un pequeño ajuste para que los textareas largos no rompan la alineación */
.structured-form .form-group {
    display: flex;
    flex-direction: column;
}
.structured-form .form-group textarea {
    flex-grow: 1;
}

/* Alinea correctamente los grupos de radio-botones dentro de un form-row */
.form-row .radio-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    height: 100%;
    padding-top: 5px; /* Pequeño ajuste vertical */
}

/* Puntero de mano para checkboxes, radio-botones y sus etiquetas */
.structured-form .checkbox-group label,
.structured-form .radio-group label,
.structured-form input[type="checkbox"],
.structured-form input[type="radio"] {
    cursor: pointer;
}

.card-subsection {
    margin-bottom: 20px;
    padding: 15px;
    border-top: 1px solid #eee;
}
.card-subsection h4 {
    margin-bottom: 10px;
    font-size: 16px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-subsection h3 i { 
    color: var(--main-color, #3498db);
    margin-right: 8px; 
    opacity: 0.7;
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.card-header h3 i {
    color: var(--main-color, #3498db);
    margin-right: 8px;
    opacity: 0.7;
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

/* --- Pequeños añadidos para el Dashboard del POS --- */

/* 1. Colores para las nuevas tarjetas de KPI (reutilizando tu estructura) */
.card-single.ventas .card-icon {
    background: #fef0e7; /* Naranja claro */
    color: #f39c12;      /* Naranja */
}
.card-single.ventas h1 { color: #f39c12; }

.card-single.tickets .card-icon {
    background: #e9ecef; /* Gris claro */
    color: #343a40;      /* Gris oscuro */
}
.card-single.tickets h1 { color: #343a40; }

.card-single-link:hover .card-single.ventas { background: #fef0e7; }
.card-single-link:hover .card-single.tickets { background: #e9ecef; }


/* 2. Contenedor para los botones de acción principales */
.main-actions-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.main-actions-container .btn {
    flex-grow: 1; /* Para que ocupen el espacio equitativamente */
    font-size: 1.1rem;
    padding: 1.2rem;
}

/* ==========================
   ESTILOS FILTROS SELECT2 (Sucursales / Médicos)
   ========================== */

/* Contenedor visible (el "input" Select2) */
#filtro-sucursal,
#filtro-sucursal-select2,
#filtro-sucursal-select2-prod,
#filtro-sucursal-select2-mov,
#filtro-medico {
    min-width: 220px !important;
    width: 220px !important;
}

/* Apariencia principal del Select2 */
#filtro-sucursal + .select2-container .select2-selection--single,
#filtro-sucursal-select2 + .select2-container .select2-selection--single,
#filtro-sucursal-select2-prod + .select2-container .select2-selection--single,
#filtro-sucursal-select2-mov + .select2-container .select2-selection--single,
#filtro-medico + .select2-container .select2-selection--single {
    height: 35px !important;
    display: flex !important;
    align-items: center !important;
    border-radius: 20px !important; /* 🔹 Bordes suaves y redondeados */
    border: 1px solid var(--border-color) !important;
    background-color: #fff !important;
    font-family: 'Poppins', sans-serif !important;
    font-size: 0.95rem !important;
    color: var(--secondary-color) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Hover / Focus */
#filtro-sucursal + .select2-container .select2-selection--single:hover,
#filtro-sucursal-select2 + .select2-container .select2-selection--single:hover,
#filtro-sucursal-select2-prod + .select2-container .select2-selection--single:hover,
#filtro-sucursal-select2-mov + .select2-container .select2-selection--single:hover,
#filtro-medico + .select2-container .select2-selection--single:hover,
#filtro-sucursal + .select2-container .select2-selection--single:focus,
#filtro-sucursal-select2 + .select2-container .select2-selection--single:focus,
#filtro-sucursal-select2-prod + .select2-container .select2-selection--single:focus,
#filtro-sucursal-select2-mov + .select2-container .select2-selection--single:focus,
#filtro-medico + .select2-container .select2-selection--single:focus {
    border-color: var(--main-color) !important;
    box-shadow: 0 0 0 3px rgba(74,144,226,0.2);
}

/* Texto interno */
#filtro-sucursal + .select2-container .select2-selection__rendered,
#filtro-sucursal-select2 + .select2-container .select2-selection__rendered,
#filtro-sucursal-select2-prod + .select2-container .select2-selection__rendered,
#filtro-sucursal-select2-mov + .select2-container .select2-selection__rendered,
#filtro-medico + .select2-container .select2-selection__rendered {
    line-height: 38px !important;
    padding-left: 12px !important;
    color: var(--secondary-color) !important;
}

/* Flecha del dropdown */
#filtro-sucursal + .select2-container .select2-selection__arrow,
#filtro-sucursal-select2 + .select2-container .select2-selection__arrow,
#filtro-sucursal-select2-prod + .select2-container .select2-selection__arrow,
#filtro-sucursal-select2-mov + .select2-container .select2-selection__arrow,
#filtro-medico + .select2-container .select2-selection__arrow {
    height: 38px !important;
    right: 10px !important;
}


/* ======================================================= */
/* ==  ESTILOS DEL MENÚ DESPLEGABLE DE SELECT2 == */
/* ======================================================= */

.select2-container--default .select2-dropdown {
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important; /* 🔹 Bordes redondeados abajo */
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08) !important;
    background-color: #fff !important;
    margin-top: 4px !important;
}

/* Opciones dentro del dropdown */
.select2-container--default .select2-results__option {
    padding: 8px 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    color: var(--secondary-color);
    border-radius: 6px; /* 🔹 bordes sutiles al resaltar */
    transition: background-color 0.2s, color 0.2s;
}

/* Opción seleccionada / hover */
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--main-color) !important;
    color: #fff !important;
}

/* Campo de búsqueda dentro del dropdown */
.select2-container--default .select2-search--dropdown .select2-search__field {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    outline: none;
    margin-bottom: 4px;
}

/* Opción ya seleccionada (cuando el menú está abierto) */
.select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: #e7f1fb !important; /* Azul pastel claro (acorde con la paleta) */
    color: var(--main-color) !important; /* Texto azul corporativo */
}

/* Opción al pasar el cursor o al navegar con el teclado */
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--main-color) !important; /* Azul principal */
    color: #fff !important;
}

/* ======================================================= */
/* == FIX FINAL: QUITAR EL GRIS DEL ELEMENTO SELECCIONADO == */
/* ======================================================= */

/* Esta es la clase que Select2 usa internamente para marcar el item activo */
.select2-container--default .select2-results__option--selected {
    background-color: #e7f1fb !important; /* 🔹 Azul pastel claro (acorde con la paleta) */
    color: var(--main-color) !important;  /* Texto azul corporativo */
}

/* Asegura consistencia con hover */
.select2-container--default .select2-results__option--selected.select2-results__option--highlighted {
    background-color: var(--main-color) !important; /* Azul principal */
    color: #fff !important;
}

/* ==========================
   ESTILOS PARA TAB MOVIMIENTOS
   ========================== */

/* Contenedor general de filtros */
#tab-movimientos .search-add-wrapper {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Inputs de fecha */
#tab-movimientos input[type="date"].form-control {
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 0.4rem 0.8rem;
  height: 38px;
  font-size: 0.95rem;
  color: var(--secondary-color);
  background: #fff;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#tab-movimientos input[type="date"].form-control:focus {
  border-color: var(--main-color);
  box-shadow: 0 0 0 2px rgba(74,144,226,0.2);
}

/* ======== BOTÓN FILTRAR ======== */
#tab-movimientos #btn-mov-filtrar {
  background-color: var(--main-color);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 38px;
  transition: background 0.2s ease, transform 0.2s ease;
  margin-left: auto;
}

#tab-movimientos #btn-mov-filtrar:hover {
  background-color: #357ABD;
  transform: translateY(-2px);
}

/* ==========================
   SELECT2 (Sucursal, Tipo, Producto)
   Igual que el filtro de sucursal en Productos
   ========================== */

/* Contenedor visible */
#tab-movimientos #filtro-sucursal-select2-mov,
#tab-movimientos #mov-tipo,
#tab-movimientos #mov-producto {
  width: 250px !important;
  min-width: 250px !important;
}

/* Apariencia principal del Select2 */
#tab-movimientos #filtro-sucursal-select2-mov + .select2-container .select2-selection--single,
#tab-movimientos #mov-tipo + .select2-container .select2-selection--single,
#tab-movimientos #mov-producto + .select2-container .select2-selection--single {
  height: 35px !important;
  display: flex !important;
  align-items: center !important;
  border-radius: 20px !important;
  border: 1px solid var(--border-color) !important;
  background-color: #fff !important;
  font-family: 'Poppins', sans-serif !important;
  font-size: 0.95rem !important;
  color: var(--secondary-color) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* 🔹 Forzar ancho del contenedor Select2 */
#tab-movimientos #filtro-sucursal-select2-mov + .select2-container,
#tab-movimientos #mov-tipo + .select2-container,
#tab-movimientos #mov-producto + .select2-container {
  width: 250px !important;
}

/* Hover / Focus */
#tab-movimientos #filtro-sucursal-select2-mov + .select2-container .select2-selection--single:hover,
#tab-movimientos #mov-tipo + .select2-container .select2-selection--single:hover,
#tab-movimientos #mov-producto + .select2-container .select2-selection--single:hover,
#tab-movimientos #filtro-sucursal-select2-mov + .select2-container .select2-selection--single:focus,
#tab-movimientos #mov-tipo + .select2-container .select2-selection--single:focus,
#tab-movimientos #mov-producto + .select2-container .select2-selection--single:focus {
  border-color: var(--main-color) !important;
  box-shadow: 0 0 0 3px rgba(74,144,226,0.2);
}

/* Texto interno y placeholder */
#tab-movimientos #filtro-sucursal-select2-mov + .select2-container .select2-selection__rendered,
#tab-movimientos #mov-tipo + .select2-container .select2-selection__rendered,
#tab-movimientos #mov-producto + .select2-container .select2-selection__rendered {
  line-height: 38px !important;
  padding-left: 12px !important;
  color: var(--secondary-color) !important;
}

/* Placeholder gris (cuando no hay selección) */
#tab-movimientos .select2-selection__rendered[title=""] {
  color: #aaa !important;
}

/* Flecha del dropdown */
#tab-movimientos #filtro-sucursal-select2-mov + .select2-container .select2-selection__arrow,
#tab-movimientos #mov-tipo + .select2-container .select2-selection__arrow,
#tab-movimientos #mov-producto + .select2-container .select2-selection__arrow {
  height: 38px !important;
  right: 10px !important;
}

/* Dropdown general */
#tab-movimientos .select2-dropdown {
  border-radius: 8px;
  border-color: var(--border-color);
  font-size: 0.95rem;
}

/* === Placeholder gris para los filtros con Select2 (Tipo, Producto, Sucursal) === */
#tab-movimientos .select2-container--default .select2-selection--single .select2-selection__rendered:empty::before,
#tab-movimientos .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #aaa !important; /* gris tenue */
}

/* 🔹 Ajuste adicional: si la opción seleccionada es la vacía ("Todos los tipos") */
#tab-movimientos #mov-tipo + .select2-container .select2-selection__rendered[title="Todos los tipos"],
#tab-movimientos #mov-producto + .select2-container .select2-selection__rendered[title="Todos los productos"],
#tab-movimientos #filtro-sucursal-select2-mov + .select2-container .select2-selection__rendered[title="Todas las Sucursales"] {
  color: #aaa !important;
}

/* === Ajuste simple para los select2 del modal de Entradas === */
/* === Ajuste para Select2 en panel fijo de Entradas/Salidas === */
#panel-entrada .select2-container--default .select2-selection--single,
#panel-salida  .select2-container--default .select2-selection--single {
  height: 42px !important;
  display: flex !important;
  align-items: center !important;
}

/* centra el texto del select */
#panel-entrada .select2-container--default .select2-selection--single .select2-selection__rendered,
#panel-salida  .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 42px !important;   /* 🔑 evita texto abajo */
  text-align: center !important;
}

/* centra placeholder */
#panel-entrada .select2-container--default .select2-selection--single .select2-selection__placeholder,
#panel-salida  .select2-container--default .select2-selection--single .select2-selection__placeholder {
  text-align: center !important;
}

/* flechita centrada vertical */
#panel-entrada .select2-container--default .select2-selection--single .select2-selection__arrow,
#panel-salida  .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 42px !important;
}

/* Separación del botón Guardar en Ajustes */
#panel-entrada .modal-footer,
#panel-salida  .modal-footer {
  margin-top: 24px;
  padding-top: 16px;
  display: flex;
  justify-content: flex-end;
}

#panel-entrada .form-row:last-of-type,
#panel-salida  .form-row:last-of-type {
  margin-bottom: 10px;
}


/* ===== Centrar texto y ajustar altura (versión final funcional) ===== */
#modal-transfer .select2-container {
  width: 100% !important;
}

#modal-transfer .select2-selection--single {
  height: 42px !important;
  display: flex !important;
  align-items: center !important; /* centra verticalmente */
  justify-content: center !important; /* centra horizontalmente */
}

#modal-transfer .select2-selection__rendered {
  text-align: center !important; /* centra el texto del select */
  width: 100%;
}

/* ===== Altura uniforme y texto alineado a la izquierda en "Agregar Producto a Transferencia" ===== */
#modal-transfer-item .select2-selection--single {
  height: 42px !important;          /* altura igual que los otros campos */
  line-height: 42px !important;
  display: flex !important;
  align-items: center !important;   /* centra verticalmente */
  justify-content: flex-start !important; /* 🔹 alinea texto a la izquierda */
  text-align: left !important;
  padding-left: 10px;               /* pequeña sangría visual */
}

#modal-transfer-item .select2-selection__rendered {
  text-align: left !important;      /* texto y placeholder a la izquierda */
  line-height: 42px !important;
}

#tabla-venta th, #tabla-venta td,
#tabla-ventas-pendientes th, #tabla-ventas-pendientes td {
    text-align: center;
    vertical-align: middle;
}

.alerta-pendiente {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
}

/* Centrar las acciones en todas las tablas uniformemente */
#tabla-ventas-pendientes td.actions {
    text-align: center;
    vertical-align: middle;
}

/* Asegurar que los botones estén alineados en una línea */
#tabla-ventas-pendientes .actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
}

/* ==========================================================
   MEJORA VISUAL PARA VENTA DIRECTA (REUTILIZA ESTILO EXISTENTE)
   ========================================================== */

/* Estructura general, igual a Nuevo Cobro */
.venta-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  align-items: start;
  margin-top: 1rem;
}

/* Ajuste del card-body principal */
.venta-main .card-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-bottom: 1.5rem;
}

/* Apariencia del select2 (usando tu sistema actual) */
#venta-buscar-producto + .select2-container .select2-selection--single {
  height: 42px !important;
  display: flex !important;
  align-items: center !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
  padding-left: 10px !important;
  font-size: 0.95rem;
  background-color: #fff;
}

/* Búsqueda interna del Select2 */
#venta-buscar-producto + .select2-container .select2-selection__rendered {
  line-height: 40px !important;
  color: var(--secondary-color);
}

/* Espaciado interno en el resumen */
.venta-sidebar .card-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.venta-sidebar .form-group {
  margin-bottom: 1rem;
}

/* Tabla más legible */
#tabla-venta th,
#tabla-venta td {
  padding: 0.75rem;
  text-align: center;
  vertical-align: middle;
  font-size: 0.95rem;
}

/* Botones de acción de venta */
#btn-venta-pendiente,
#btn-venta-finalizar {
  height: 44px;
  font-size: 0.95rem;
  border-radius: 6px;
}

/* Mejor separación visual entre secciones */
#tab-venta .card + .card {
  margin-top: 2.5rem;
}

/* Espaciado general y aire visual */
#tab-venta .card {
  margin-bottom: 1rem;
}

.btn-eliminar-cargo i {
  font-size: 1rem;
  line-height: 1;
  margin: 0;
}

.tabs-nav li.bloqueada a {
  pointer-events: none;
  opacity: 0.5;
  cursor: not-allowed;
}
.bloqueo-aviso {
  background-color: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
  padding: 1rem;
  margin-top: 1rem;
  text-align: center;
}

#tab-movimientos .table-responsive {
    overflow-x: visible !important;
}

.ingrediente-tooltip { 
    position: relative; 
    cursor: help; 
    display: inline-block; 
} 
 /* CUERPO DEL TOOLTIP */ 
.ingrediente-tooltip::after { 
    content: attr(data-full); 
    position: absolute; 
    top: 120%; left: 0; 
    background: var(--primary-color);
    color: #ffffff; 
    padding: 10px 12px; 
    border-radius: 6px; 
    font-size: 0.8rem; 
    line-height: 1.3; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.25); 
    opacity: 0; visibility: hidden; 
    transform: translateY(8px); 
    transition: opacity .22s ease, transform .22s ease; 
    z-index: 2000; 
} 
/* FLECHITA */ 
.ingrediente-tooltip::before { 
    content: ""; 
    position: absolute; 
    top: 110%; 
    left: 15px; 
    width: 0; 
    height: 0; 
    border-left: 7px solid transparent; 
    border-right: 7px solid transparent; 
    border-bottom: 7px solid var(--primary-color);; 
    opacity: 0; visibility: hidden; 
    transform: translateY(8px); 
    transition: opacity .22s ease, transform .22s ease; 
    z-index: 1999; 
} 

/* MOSTRAR TOOLTIP */ 
.ingrediente-tooltip:hover::after, .ingrediente-tooltip:hover::before { 
    opacity: 1; 
    visibility: visible; 
    transform: translateY(0); 
} 

#tab-productos .table-responsive {
    overflow: visible !important;
}

/* ========== MODAL MODERNO ========== */

.fade-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(2px);
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.fade-modal .modal-box {
    background: white;
    width: 450px;
    padding: 25px;
    border-radius: 14px;
    box-shadow: 0 5px 20px rgba(0,0,0,.25);
    animation: modalFadeIn .25s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(.95); }
    to   { opacity: 1; transform: scale(1); }
}

.fade-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fade-modal .modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.fade-modal .modal-body {
    margin-top: 15px;
}

.fade-modal input[type="file"] {
    width: 100%;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #ccc;
    margin-top: 5px;
}

.modal-info {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
}

/* ========== LOADER EXCEL ========== */

.loader-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0,0,0,.45);
    backdrop-filter: blur(2px);
    justify-content: center;
    align-items: center;
}

.loader-box {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 18px rgba(0,0,0,.2);
}

.spinner {
    width: 45px;
    height: 45px;
    border: 5px solid #ddd;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Toggle Entrada/Salida ===== */
#tab-ajustes .ajuste-toggle{
  display: inline-flex;
  background: #f3f4f6;
  padding: 4px;
  border-radius: 30px;
  gap: 4px;
}

#tab-ajustes .toggle-btn{
  height: 42px;
  padding: 0 16px;
  border-radius: 30px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color:#374151;
  transition: .15s ease;
}

#tab-ajustes .toggle-btn.active[data-tipo="entrada"]{
  background:#16a34a;
  color:#fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}

#tab-ajustes .toggle-btn.active[data-tipo="salida"]{
  background:#dc2626;
  color:#fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}

#tab-ajustes .toggle-btn:not(.active):hover{
  background: #e5e7eb;
}

/* ===== Bloqueo de acceso (Pantalla moderna) ===== */

.blocked-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.blocked-box {
    background: #fff;
    width: 100%;
    max-width: 420px;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    animation: fadeIn 0.35s ease;
}

.blocked-icon i {
    font-size: 70px;
    color: #e74c3c;
    margin-bottom: 15px;
}

.blocked-title {
    font-size: 26px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.blocked-message {
    font-size: 16px;
    color: #555;
    margin-bottom: 15px;
}

.blocked-message .motivo {
    color: #e74c3c;
    font-size: 18px;
}

.blocked-hint {
    color: #777;
    margin-bottom: 25px;
    font-size: 14px;
}

.blocked-btn {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==============================
   FIX MODAL: BUSCAR PRODUCTO
   ============================== */
#modal-buscar-producto .form-group{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#modal-buscar-producto .form-group label{
  margin: 0;
  font-weight: 600;
}

#modal-buscar-producto .select2-container{
  width: 100% !important;
}

/* Altura y alineación consistentes dentro del modal */
#modal-buscar-producto .select2-container--default .select2-selection--single{
  height: 42px !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 12px !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
}

#modal-buscar-producto .select2-container--default .select2-selection--single .select2-selection__rendered{
  line-height: 42px !important;
  padding-left: 0 !important;
}

#modal-buscar-producto .select2-container--default .select2-selection--single .select2-selection__arrow{
  height: 42px !important;
}

/* =====================================================
   FIX RESPONSIVE DEFINITIVO – PANTALLAS 19" (1366x768)
   ===================================================== */
@media (max-width: 1366px) {

  /* =================================================
     ESCALA TIPOGRÁFICA GENERAL
     ================================================= */
  body {
    font-size: 14px;
  }

  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.35rem; }
  h3 { font-size: 1.15rem; }
  h4 { font-size: 1rem; }

  /* =================================================
     LAYOUT GENERAL
     ================================================= */
  .sidebar {
    width: 220px;
  }

  .main-content {
    margin-left: 220px;
  }

  .cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .recent-grid,
  .venta-grid {
    grid-template-columns: 1fr;
  }

  .search-add-wrapper,
  .filter-wrapper,
  .main-actions-container {
    flex-wrap: wrap;
  }

  #filtro-sucursal,
  #filtro-medico,
  #mov-producto,
  #mov-tipo {
    width: 100% !important;
    min-width: unset !important;
  }

  /* =================================================
     TABLAS – CONFIGURACIÓN BASE
     ================================================= */
  table {
    table-layout: fixed;
    width: 100%;
  }

  table th {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.55rem 0.6rem;
    white-space: nowrap;
  }

  table td {
    font-size: 0.8rem;
    padding: 0.45rem 0.6rem;
    vertical-align: middle;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
  }

  /* Columnas que deben permanecer en una línea */
  table th:nth-child(2),
  table td:nth-child(2),   /* Costo / Precio */
  table th:nth-child(5),
  table td:nth-child(5) { /* Fecha */
    white-space: nowrap;
  }

  /* =================================================
     DENSIDAD VISUAL – INVENTARIO / PRODUCTOS
     ================================================= */
  table td strong,
  table td b {
    font-size: 0.82rem;
    font-weight: 600;
    display: block;
    line-height: 1.25;
  }

  table td small,
  table td .text-muted {
    font-size: 0.7rem;
    color: #6b7280;
    display: block;
    margin-top: 2px;
    line-height: 1.2;
  }

  /* Presentación */
  table td:nth-child(3) {
    font-size: 0.75rem;
    line-height: 1.25;
  }

  /* Precio / Stock */
  table td:nth-child(6),
  table td:nth-child(7) {
    font-size: 0.78rem;
  }

  /* =================================================
     ESTADOS (BADGES)
     ================================================= */
  .status {
    padding: 0.18rem 0.45rem;
    font-size: 0.7rem;
  }

  /* =================================================
     COLUMNA ACCIONES
     ================================================= */
  table th:last-child,
  table td:last-child {
    width: 130px;
    min-width: 130px;
    max-width: 130px;
    text-align: center;
  }

  table td:last-child .actions {
    justify-content: center;
    gap: 5px;
  }

  .actions .btn-action {
    width: 30px;
    height: 30px;
    font-size: 0.78rem;
  }

  /* =================================================
     BOTONES GENERALES
     ================================================= */
  .btn {
    font-size: 0.82rem;
    padding: 7px 11px;
  }
}


/* =====================================================
   TABLETS Y LAPTOPS PEQUEÑAS (1024px)
   ===================================================== */
@media (max-width: 1024px) {

  .sidebar {
    position: fixed;
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }
}
.suc-preview{
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.suc-badge{
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.suc-badge button{
  border: none;
  background: transparent;
  cursor: pointer;
  font-weight: bold;
  line-height: 1;
}