/* ================================
   ESTILO GENERAL PARA LA PLATAFORMA VETERINARIA
================================ */

/* Fondo general blanco */
body.search-body {
    font-family: Arial, sans-serif;
    background-color: #ffffff; /* Fondo blanco puro */
    margin: 70px 20px 80px; /* Espacio para header y footer fijo - CORREGIDO */
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

body.form-body {
    font-family: Arial, sans-serif;
    background-color: #ffffff; /* Fondo blanco puro */
    margin: 90px; /*espacio entre el formulario y el header*/
    padding: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

/*BODY DEL LOGIN*/
body.login-body {
    font-family: Arial, sans-serif;
    background-color: #ffffff; /* Fondo blanco puro */
    margin: 70px; /*espacio entre el formulario y el header - CORREGIDO*/
    padding: 0;
    min-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.neon-text {
    color: #3498db; /* ðŸ‘ˆ NeÃ³n verde brillante */
    text-shadow: 0 0 10px #3498db, 0 0 20px #3498db;	
    font-weight: bold;
    font-size: 24px;
    margin-bottom: 0px;
    display: block;
}

/*BODY DEL DASHBOARD*/
body.dashboard-body {
    font-family: Arial, sans-serif;
    background-color: #ffffff; /* Fondo blanco puro */
    margin: 70px; /*espacio entre el formulario y el header - CORREGIDO*/
    padding: 0;
    max-height: calc(100vh - 280px);
    min-height: 300px; /* Evita que desaparezca en pantallas pequeñas */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

body.dashboard-body,
body.search-body {
    margin-top: 90px;
    min-height: calc(100vh - 170px);
    max-height: none;
    overflow-y: auto;
}

/* ================================
   HEADER SUPERIOR FIJO
================================ */
.top-user-bar {
    position: fixed;
	margin:2px;/*SUBE O BAJA EL HEADER*/
    top: 0;
    left: 50%;
	transform: translateX(-50%);
    width: 98%;
	max-width: 98%;
    background-color: #DBEAFE; /*color de fondo de la barra*/
    padding: none;
    box-shadow: 0 0 10px #3498db, 0 0 20px #3498db;
    z-index: 9999;
    display: flex;
    justify-content: space-between;
    align-items: center;
	border-radius:10px; /*esquinas redondeadas de la barra superior*/		
	flex-wrap: wrap;
}

.user-info h2 {
    margin: 3px;
    font-size: 12px;
    color: #333;
}

.button-group {
    display: flex;
    gap: 2px;
}

.logout-btn,
.dashboard-btn2 {
    padding: 6px 10px;
    font-size: 12px;
    min-width: auto;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dark-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.logout-btn {
    background: #e74c3c;
    color: white;
    box-shadow: 0 0 5px #e74c3c, 0 0 10px #e74c3c;
}

.logout-btn:hover {
    background: none;
    box-shadow: 0 0 10px #c0392b, 0 0 20px #e74c3c;
}

/*BOTON DASHBOARD TAMAÑO EXCLUSIVO PARA EL HEADER*/
.dashboard-btn2 {
    padding: 6px 12px !important;
    font-size: 12px !important;
    min-width: auto !important;
    width: auto !important;
    box-shadow: 0 0 5px #2569fa, 0 0 10px #2569fa;
}

.dashboard-btn2:hover {
    background: none;
}

.dark-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px #080400, 0 0 25px #080400;
}

/* Botones principales - Verde oscuro brillante */
button,
.option-btn {
    padding: 4px 12px;
    background-color: transparent;
    color: black;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: 25%;
    font-size: 13px;
    font-weight: bold;
    box-shadow: 0 0 10px #3498db, 0 0 20px #3498db;
    transition: all 0.3s ease;
    margin: 10px 5px;
    display: inline-block;
    min-width: 150px;
    text-align: center;
}

button:hover,
.option-btn:hover {
    background-color: none;
    box-shadow: 0 0 10px #2ecc71, 0 0 20px #2ecc71;
    transform: scale(1.02);
}



/* Carrusel de consejos */
.consejos-bar {
    width: 30%;
    padding: 6px 0;
    background-color: transparent;
    border-radius: 70px;
    margin: 5px 0;
    box-shadow: none;
    overflow: hidden;
    position: relative;
    cursor: default;
}

.consejo-texto {
    display: inline-block;
    font-size: 13px;
    font-weight: 500;
    color: #FF8904;
    white-space: nowrap;
    padding: 0 20px;
    font-style: italic;
    animation: slideText 25s linear infinite;
    text-shadow: 0 0 8px #FF8904, 0 0 15px #FF8904 !important;
}

@keyframes slideText {
    0% { transform: translateX(100%); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateX(-100%); opacity: 0; }
}

/* ================================
   FORMULARIOS Y CONTENEDORES
================================ */
.form-container {
    width: 90%;
    max-width: 750px;
    padding: 20px;
    margin: 20px auto;
    background-color: #fdfdfd;
    border-radius: 8px;
    box-shadow: 0 0 10px #3498db, 0 0 20px #3498db;
}

.form-container2 {
    width: 90%;
    max-width: 450px;
    padding: 20px;
    margin: 40px auto;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 0 10px #3498db, 0 0 20px #3498db;
    text-align: center;
}

.form-container input[type="text"],
.form-container input[type="password"] {
    width: 80%;	
    max-width: 300px;	
    padding: 8px 10px;
    margin: 10px 0;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/*boton de inicio de sesión en el index.php*/
.form-container button {
    padding: 10px 16px;
    font-size: 15px;	
}

/* Formulario de búsqueda SEARCH.PHP compacto debajo del header - CORREGIDO */
.search-form-top {
    width: 98%;
    max-width: 98%;
    margin: 75px auto 10px; /* ESTA LÍNEA ES CLAVE - POSICIONA EL FORMULARIO CORRECTAMENTE */
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    background-color: #f9f9f9;
    padding: 6px 4px;   
}

#search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

#search-form input[type="text"],
#search-form input[type="number"] {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    height: 12px;/*Ancho de los botones Buscar por RUT, Nombre o Apellido, Min-Max*/
}

#search-form label {
    font-size: 12px;
    margin-right: 5px;
    white-space: nowrap;
}

#search-form button {
    padding: 6px 8px;
    color: var(--btn-delete);
    border: 2px solid var(--btn-delete);
    background-color: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;    
    transition: all 0.3s ease;
    margin: 10px 5px;
    display: inline-block;
    min-width: auto;
    width: auto;
    text-align: center;
}

#search-form button:hover {
    background: #2980b9;
}

#search-form button.btn-mostrar:hover {
    background: #27ae60;
}

#search-form button.btn-pdf:hover {
    background: #d35400;
}

/* Inputs generales */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    max-width: 300px;
    padding: 8px 10px;
    margin: 10px 0;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border: 2px solid #2d2d2d;
    box-shadow: 0 0 10px #3498db, 0 0 20px #3498db;
    background: #ffffff;
}

/* Mejora visual para selects */
select {
    padding: 8px 30px 8px 12px;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232B7FFF'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

select:focus {
    outline: none;
    box-shadow: 0 0 8px #27ae60, 0 0 15px #2ecc71;
}

.theme-toggle-container {
    text-align: center;
    margin-top: 20px;
}

/* ================================
   BOTONES ANIMADOS (NEÓN AZUL)
================================ */
.animated-btn {
    background-color: transparent;
    color: #333;
    border: 1px solid #2d2d2d;
    border-radius: 6px;
    padding: 6px 10px;
    margin: 5px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px #3498db, 0 0 20px #3498db;
}

.animated-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 8px #2B7FFF, 0 0 15px #2B7FFF;
}

.animated-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.animated-btn .icon {
    font-size: 12px;
    display: inline-block;
    transition: transform 0.3s ease;
}

.animated-btn.refresh-btn:hover .icon,
.animated-btn.clean-btn:hover .icon,
.animated-btn.pdf-btn:hover .icon,
.animated-btn.excel-btn:hover .icon {
    transform: rotate(10deg) scale(1.1);
}

/* Botones específicos */
.guardar-btn,
.modificar-btn {
    color: #27ae60;
    border: 2px solid #27ae60;
}

.eliminar-btn,
.btn-eliminar-responsable {
    color: #FB2C36;
    border: 2px solid #FB2C36;
    box-shadow: 0 0 8px #FB2C36;
}

.eliminar-btn:hover,
.btn-eliminar-responsable:hover {
    box-shadow: 0 0 15px #e74c3c;
    background-color: #ffe6e6;
}

.editar-btn,
.modificarsearch-btn {
    color: #155DFC;
    border: 2px solid #155DFC;
    box-shadow: 0 0 10px #3498db, 0 0 20px #3498db;
}

.modificarsearch-btn:hover {
    box-shadow: 0 0 15px #155DFC;
    background-color: #e8ffe8;
}

.btn-pequeno {
    padding: 6px 10px !important;
    font-size: 12px !important;
    min-width: auto !important;
    width: auto !important;
}

.btn-pequeno:hover {
    background: none;
}

/*BOTON CERRAR SESION TAMAÑO EXCLUSIVO PARA EL HEADER*/
.btn-logout {
    padding: 6px 10px !important;
    font-size: 12px !important;
    min-width: auto !important;
    width: auto !important;
    box-shadow: 0 0 5px #e74c3c, 0 0 10px #e74c3c !important;
}

.btn-logout:hover {
    background: none;
}

.dashboard-btn2 {
    box-shadow: 0 0 5px #2569fa, 0 0 10px #2569fa;
}

/* ================================
   TABLAS DE RESULTADOS
================================ */
.tabla-scroll-vertical-horizontal {
    width: 100%;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
    overflow-x: auto;
    margin-top: 10px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: white;
}

/* Ajuste de la tabla para scroll y ancho */
.data-table {
    min-width: 98%;   /* La tabla ocupa al menos el ancho del contenedor */
    width: auto;       /* No uses max-content si quieres control */
    border-collapse: collapse;
    font-size: 12px;
    table-layout: auto; /* ?Clave para controlar el ancho de celdas! */
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #ddd;
    white-space: normal;
    word-wrap: break-word;
}

/* Mejora visual de los encabezados */
.data-table thead th {
    background-color: #ecf0f1;
    color: #2c3e50;
    font-weight: bold;
	font-size: 12px;
    position: static;
    top: 0;
    z-index: 2;
    box-shadow: inset 0 2px 0 #27ae60;
    white-space: nowrap;
    min-width: 160px;
    padding: 6px 5px;
}

/* Mejora del cuerpo de la tabla */
.data-table tbody tr:hover {
    background-color: #f1f1f1;
}

/* ================================
   FIELDSET Y GRUPOS
================================ */
.grupo-afiliado {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 20px 30px;
    padding: 15px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.grupo-afiliado legend {
    font-size: 14px;
    font-weight: bold;
    color: #2c3e50;
    padding: 5px 15px;
    background: #ecf0f1;
    border-radius: 4px;
    border: 1px solid #bdc3c7;
    position: relative;
    box-shadow: 0 0 5px rgba(0,0,0,0.1);
}

/* Ne¨®n para Activa/o */
.grupo-activo legend {
    border-color: #27ae60;
    box-shadow: 0 0 8px #27ae60, 0 0 15px #27ae60;
}

/* Ne¨®n para Jubilada/o */
.grupo-jubilado legend {
    border-color: #8e44ad;
    box-shadow: 0 0 8px #8e44ad, 0 0 15px #8e44ad;
}

/* Ne¨®n para Fallecida/o */
.grupo-fallecido legend {
    border-color: #e74c3c;
    box-shadow: 0 0 8px #e74c3c, 0 0 15px #e74c3c;
}

/* ================================
   TEMA OSCURO
================================ */
body[data-theme="dark"] {
    background-color: #121212;
    color: #e0e0e0;
}

body[data-theme="dark"] .form-container,
body[data-theme="dark"] .search-form-top,
body[data-theme="dark"] table,
body[data-theme="dark"] .checklist-table,
body[data-theme="dark"] .top-user-bar,
body[data-theme="dark"] .button-group button,
body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
    background-color: #1e1e1e;
    color: #ffffff;
    border-color: #444;
}

body[data-theme="dark"] .form-container h2,
body[data-theme="dark"] .search-form-top h2,
body[data-theme="dark"] th,
body[data-theme="dark"] .neon-text {
    color: #FAFAF9;
}

body[data-theme="dark"] .guardar-btn,
body[data-theme="dark"] .modificar-btn,
body[data-theme="dark"] .dashboard-btn,
body[data-theme="dark"] .logout-btn,
body[data-theme="dark"] .dark-toggle {
    background-color: #2B7FFF;
    color: white;
    border: none;
}

body[data-theme="dark"] .guardar-btn:hover,
body[data-theme="dark"] .modificar-btn:hover,
body[data-theme="dark"] .dashboard-btn:hover,
body[data-theme="dark"] .logout-btn:hover,
body[data-theme="dark"] .dark-toggle:hover {
    background-color: transparent;
}

/* ================================
   MEJORA DE BORDES EN TEMA OSCURO
================================ */

/* Bordes más definidos para inputs y selects en tema oscuro */
body[data-theme="dark"] input[type="text"],
body[data-theme="dark"] input[type="email"],
body[data-theme="dark"] input[type="password"],
body[data-theme="dark"] input[type="date"],
body[data-theme="dark"] input[type="number"],
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
    border: 2px solid #444 !important;
    border-radius: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 0 6px rgba(100, 100, 255, 0.15) !important;
}

/* Efecto al enfocar: borde más brillante */
body[data-theme="dark"] input[type="text"]:focus,
body[data-theme="dark"] input[type="email"]:focus,
body[data-theme="dark"] input[type="password"]:focus,
body[data-theme="dark"] input[type="date"]:focus,
body[data-theme="dark"] input[type="number"]:focus,
body[data-theme="dark"] select:focus,
body[data-theme="dark"] textarea:focus {
    border: 2px solid #FAFAF9 !important;
    outline: none;
    box-shadow: 0 0 10px rgba(98, 0, 234, 0.4), 0 0 15px rgba(98, 0, 234, 0.3) !important;
    background-color: #2a2a2a !important;
}

/* Mejora para selects desplegables */
body[data-theme="dark"] select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236200ea'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px !important;
}

/* Para que los placeholders también sean visibles */
body[data-theme="dark"] ::placeholder {
    color: #aaaaaa;
    opacity: 1;
}

body[data-theme="dark"] a {
    color: #FAFAF9;
}

body[data-theme="dark"] a:hover {
    color: #d7a8ff;
}

/* Mejora visual de inputs */
body[data-theme="dark"] input, 
body[data-theme="dark"] select, 
body[data-theme="dark"] textarea {
    box-shadow: 0 0 5px rgba(100, 100, 255, 0.2);
}

/* Ajuste para el datepicker de jQuery UI */
body[data-theme="dark"] .ui-widget {
    font-family: inherit;
}

body[data-theme="dark"] .ui-widget-content {
    background: #1e1e1e;
    border: 1px solid #444;
    color: #e0e0e0;
}

body[data-theme="dark"] .ui-state-default,
body[data-theme="dark"] .ui-widget-content .ui-state-default {
    background: #2d2d2d;
    border: 1px solid #555;
    color: #e0e0e0;
}

#theme-icon {
    transition: transform 0.3s ease, font-size 0.3s ease;
    font-size: 10px;
    display: inline-block;
}

#theme-toggle:hover #theme-icon {
    transform: rotate(180deg) scale(1.5);
}

/* Botón de cambio de tema */
.dark-toggle {
    background-color: #080400 !important;
    color: white !important;
    border-radius: 100% !important;
    box-shadow: 0 0 10px #080400, 0 0 20px #080400 !important;
    transition: all 0.3s ease !important;
}

/* Hover: efecto brillante */
.dark-toggle:hover {
    background-color: #080400 !important;
    box-shadow: 0 0 15px #080400, 0 0 25px #080400 !important;
    transform: scale(1.5) !important;
}

/* Asegurar que los botones se vean bien en el contenedor */
.search-form-top .animated-btn {
    margin: 2px 5px;
}

/* En tema oscuro, mantener el estilo */
body[data-theme="dark"] .dark-toggle {
    background-color: transparent !important;
    box-shadow: 0 0 10px #fcd386, 0 0 20px #fcd386 !important;
}

body[data-theme="dark"] .dark-toggle:hover {
    background-color: transparent !important;
    box-shadow: 0 0 15px #fcd386, 0 0 25px #fcd386 !important;
}

/* Texto del header en tema oscuro */
body[data-theme="dark"] .user-info h2 {
    color: #ffffff !important;
    text-shadow: 0 0 10px #fcd386, 0 0 20px #fcd386 !important;
}

body[data-theme="dark"] .user-info h2 strong {
    color: #ffffff !important;
}

/* Tema oscuro para la tabla de bonificaciones sociales */
body[data-theme="dark"] .checklist-table-container {
    background-color: #1e1e1e;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

body[data-theme="dark"] .checklist-table-container h4 {
    color: #FAFAF9;
    text-align: center;
    margin-bottom: 10px;
}

body[data-theme="dark"] .checklist-table {
    width: 100%;
    border-collapse: collapse;
}

body[data-theme="dark"] .checklist-table td {
    padding: 8px;
}

body[data-theme="dark"] .checklist-table label {
    color: #e0e0e0;
}

body[data-theme="dark"] .checklist-table input[type="checkbox"] {
    accent-color: #bb86fc;
}

body[data-theme="dark"] .input-textbox {
    background-color: #2d2d2d !important;
    color: #e0e0e0 !important;
    border: 1px solid #555 !important;
}

/* Fondo del contenedor de cargas en tema oscuro */
body[data-theme="dark"] #cargas-container {
    background-color: #1e1e1e;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Fondo de cada carga familiar en tema oscuro */
body[data-theme="dark"] .carga-item {
    background-color: #2d2d2d !important;
    color: #e0e0e0 !important;
    border: 1px solid #444 !important;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

/* Inputs y selects dentro de cargas en tema oscuro */
body[data-theme="dark"] .carga-item input,
body[data-theme="dark"] .carga-item select,
body[data-theme="dark"] .carga-item textarea {
    background-color: #333 !important;
    color: #e0e0e0 !important;
    border: 1px solid #555 !important;
}

/* Borde neón en modo oscuro */
body[data-theme="dark"].focused input:focus,
body[data-theme="dark"].focused select:focus {
    border: 2px solid #FAFAF9 !important;
    box-shadow: 
        0 0 8px rgba(187, 134, 252, 0.3),
        0 0 14px rgba(187, 134, 252, 0.2),
        0 0 20px rgba(187, 134, 252, 0.15) !important;
}

/* ================================
   TEMA OSCURO - BOTONES DEL DASHBOARD
================================ */

/* Fondo y color general para botones en tema oscuro */
body[data-theme="dark"] .form-container {
    background-color: #1e1e1e;
    color: #e0e0e0;
    border: 1px solid #444;
}

body[data-theme="dark"] .form-container h3 {
    color: #FAFAF9;
}

/* Estilo para los botones del dashboard */
body[data-theme="dark"] .option-btn {
    background-color: #2d2d2d !important;
    color: #e0e0e0 !important;
    border: 1px solid #555 !important;
    box-shadow: 0 0 10px #3498db, 0 0 20px #3498db !important;
    transition: all 0.3s ease !important;
}

/* Hover en botones del dashboard */
body[data-theme="dark"] .option-btn:hover {
    background-color: #3a3a3a !important;
    box-shadow: 0 0 10px #FFB93B, 0 0 20px #FFB93B !important;
    transform: scale(1.02) !important;
}

/* Eliminar viñetas (puntos negros) de la lista de opciones */
.options-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.options-list li {
    margin: 10px 0;
}

/* Asegurar que los enlaces también respeten el color */
body[data-theme="dark"] .options-list a {
    text-decoration: none;
}

body[data-theme="dark"] .options-list li {
    margin: 10px 0;
}

/* Scrollbars en tema oscuro */
.tabla-scroll-vertical-horizontal::-webkit-scrollbar {
    height: 10px;
    width: 10px;
}

.tabla-scroll-vertical-horizontal::-webkit-scrollbar-thumb {
    background: #27ae60;
    border-radius: 10px;
    border: 2px solid #f1f1f1;
}

.tabla-scroll-vertical-horizontal::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

/* Asegura que la tabla interna no se achique */
.tabla-scroll-vertical-horizontal .data-table {
    max-width: 98%;
    width: auto;
    border-collapse: collapse;
    font-size: 12px;
	/*box-shadow: 0 0 15px #fcd386, 0 0 25px #fcd386 !important;*/
}

/* Estilo limpio para la tabla en tema oscuro */
body[data-theme="dark"] .tabla-scroll-vertical-horizontal {
    background-color: #1e1e1e;
    border: 1px solid #444;
    box-shadow: 0 0 10px #3498db, 0 0 20px #3498db;
}

body[data-theme="dark"] .tabla-scroll-vertical-horizontal::-webkit-scrollbar-thumb {
    background: #21BCFF;
}

body[data-theme="dark"] .data-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 12px;
    table-layout: auto;
}

body[data-theme="dark"] .data-table th,
body[data-theme="dark"] .data-table td {
    border-bottom: 1px solid #444;
    border-right: 1px solid #333;
    padding: 4px 4px;
    text-align: left;
    color: #e0e0e0;
    background-color: #1e1e1e;
}

/* Encabezados m¨¢s destacados */
body[data-theme="dark"] .data-table thead th {
    background-color: #444 !important;
    color: #FAFAF9;
    font-weight: bold;
    box-shadow: inset 0 2px 0 #196601;
    position: sticky;
    top: 0;
    z-index: 2;
    border-right: 1px solid #555;
	border-left: 1px solid #555;
    border-bottom: none;
}

/* Alternar colores de filas (opcional, para mejor lectura) */
body[data-theme="dark"] .data-table tbody tr:nth-child(even) {
    background-color: #242424;
}

body[data-theme="dark"] .data-table tbody tr:nth-child(odd) {
    background-color: #1e1e1e;
}

/* Botones de acci¨®n en tema oscuro */
body[data-theme="dark"] .modificarsearch-btn,
body[data-theme="dark"] .btn-eliminar-responsable {
    color: #ffffff;
    border: 1px solid #555;
    box-shadow: 0 0 10px #3498db, 0 0 20px #3498db;
    background-color: #2d2d2d;
}

body[data-theme="dark"] .modificarsearch-btn {
    color: #64b5f6;
    border-color: #64b5f6;
}

body[data-theme="dark"] .modificarsearch-btn:hover {
    background-color: #1a3a6e;
    box-shadow: 0 0 10px rgba(100, 181, 246, 0.4);
}

body[data-theme="dark"] .btn-eliminar-responsable {
    color: #ef5350;
    border-color: #ef5350;
}

body[data-theme="dark"] .btn-eliminar-responsable:hover {
    background-color: #5e1a1a;
    box-shadow: 0 0 10px rgba(239, 83, 80, 0.4);
}

/* Celdas con texto largo (truncado) */
body[data-theme="dark"] .truncate {
    color: #e0e0e0;
}

body[data-theme="dark"] .truncate:hover {
    background-color: #2d2d2d;
}

/* ================================
   FOOTER FIJO
================================ */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #2D9966;
    color: white;
    text-align: center;
    padding: 10px 0;
    font-size: 0.9em;
    z-index: 9999;
    box-shadow: 0 0 10px #3498db, 0 0 20px #3498db;
}

.footer-content {
    animation: neon-glow 2s ease-in-out infinite alternate;
}

@keyframes neon-glow {
    0% { text-shadow: 0 0 5px #27ae60, 0 0 10px #2ecc71; }
    100% { text-shadow: 0 0 10px #27ae60, 0 0 20px #2ecc71; }
}

/* ================================
   MENSAJES Y ERRORES
================================ */
.error-message {
    color: #e74c3c;
    background: #fdf2f2;
    border: 1px solid #e74c3c;
    padding: 10px;
    margin: 10px 0;
    border-radius: 6px;
    font-size: 14px;
}

/* ================================
   ICONOS
================================ */

/* Botón con ícono + */
.agregar-carga-btn .btn-plus {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: white;
    color: #27ae60;
    border-radius: 50%;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px #3498db, 0 0 20px #3498db;
}

.agregar-carga-btn:hover .btn-plus {
    transform: rotate(90deg) scale(1.2);
}

/* Evitar selección accidental */
#lista-comentarios td, #lista-comentarios th {
    user-select: none;
}

/* Resaltar fila al pasar el mouse */
#lista-comentarios tbody tr:hover {
    background-color: #f8f9fa !important;
}

/* === AJUSTE PARA PÁGINAS CON FORMULARIOS LARGOS === */
body.full-height-form {
    margin-bottom: 0 !important;
    padding-bottom: 100px;
}

body.full-height-form .form-container {
    margin-bottom: 90px !important;
    min-height: calc(100vh - 180px);
}

/* Asegurar que el último elemento sea visible */
.full-height-form .acciones-container:last-of-type {
    margin-bottom: 15px;
}

/* === NOTIFICACIONES TIPO TOAST === */
.toast {
    visibility: hidden;
    min-width: 300px;
    max-width: 400px;
    background-color: #333;
    color: white;
    text-align: center;
    border-radius: 8px;
    padding: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(-50px);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.toast.show {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background-color: #27ae60;
}

.toast.error {
    background-color: #e74c3c;
}

.toast.warning {
    background-color: #f39c12;
}

.toast.info {
    background-color: #3498db;
}

.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #fff, #fff);
    animation: progress-bar 5s linear forwards;
}

@keyframes progress-bar {
    from { width: 100%; }
    to { width: 0; }
}

/* ================================
   AJUSTES ESPECÍFICOS PARA FICHAS_MEDICAS.PHP
================================ */

/* Ajuste del margen superior para el body de fichas_medicas. Elevación del formulario de búsqueda y la tabla de resultados */
body.search-body {
    margin-top: 40px !important;
}

/* Ajuste específico para el formulario de búsqueda en fichas_medicas */
.search-form-top {
    margin-top: 75px !important; /*SUBE O BAJA EL FORM DE BUSQUEDA Y LA TABLA DE RESULTADOS PERO FUNCIONA EN CONJUNTO CON EL ARCHIVO FICHAS_MEDICAS.PHP*/
    margin-bottom: 5px;
}

/* Ajuste de celdas para evitar solapamiento */
.data-table td, .data-table th {
    white-space: normal;
    padding: 0px 2px; /* M¨¢s espacio vertical y horizontal */
    min-width: 160px;  /* Ajuste para que no se sobrepongan */
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
	font-size: 12px; /*Tama?o de las fuentes de la tabla*/
	word-wrap: break-word;
	border-right: 1px solid #c9c9c9;
	border-left: 1px solid #c9c9c9;
}


/* Asegurar que el contenedor de la tabla tenga el espacio correcto */
.tabla-scroll-vertical-horizontal {
    width: 98%;
	max-width: 98%;
	margin: 10px auto;
	padding: 2px;
	border: 1px solid #ddd;
	border-radius: 6px;
	background-color: #d0ece7;
	box-shadow: 0 0 10px rgba(52, 152, 219, 0.2);

	/* ? ALTURA DINÁMICA: Ocupa todo el espacio disponible SIN desbordar */
	max-height: calc(100vh - 150px);
	min-height: 300px; /* Evita que desaparezca en pantallas pequeñas */
	/* Activa scrolls cuando sea necesario */
	overflow-y: auto;
	overflow-x: auto;

	/* Scroll visible y estilizado */
	scrollbar-width: thin;
	scrollbar-color: #27ae60 #f1f1f1;
}

/* Ajuste adicional para pantallas más pequeñas */
@media (max-width: 768px) {
    body.search-body {
        margin-top: 80px !important;
    }
    
    .search-form-top {
        margin-top: 60px !important;
    }
}

/* Corrección específica para el header en fichas_medicas */
.top-user-bar {
    z-index: 10000;
    position: fixed;
    top: 8px;
}

/* Ajuste del contenido principal para que no quede detrás del header */
.main-content {
    margin-top: 100px;
}

/*RESPONSIVE*/

/* Pantallas pequeñas: laptops comunes (1366x768) */
@media (max-height: 768px), (max-width: 1366px) and (max-height: 800px) {
    .tabla-scroll-vertical-horizontal {
        max-height: calc(100vh - 340px) !important;
    }
}

@media (max-height: 768px), (max-width: 1366px) and (max-height: 800px) {
    .dashboard-body {
        max-height: calc(100vh - 120px) !important;
    }
}

/* Para dispositivos móviles */
@media (max-width: 768px) {
    body.full-height-form {
        padding-bottom: 120px;
    }
    
    body.full-height-form .form-container {
        margin-bottom: 110px;
        padding: 20px;
    }
    
    .top-user-bar {
        padding: 6px 8px;
    }
    
    .user-info h2 {
        font-size: 12px;
    }
    
    .consejos-bar {
        width: 90%;
    }
    
    .consejo-texto {
        font-size: 11px;
    }
}

/* ================================
   AJUSTES ESPECÍFICOS PARA FICHAS_MEDICAS.PHP
================================ */

/* Quitar scroll del navegador solo para fichas_medicas.php */
body.fichas-medicas-body {
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ajuste del contenido principal para fichas_medicas */
body.fichas-medicas-body .main-content {
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
}

/* Asegurar que la tabla esté sobre el footer */
body.fichas-medicas-body .tabla-scroll-vertical-horizontal {
    max-height: calc(100vh - 160px) !important;
    height: calc(100vh - 160px);
    margin: 5px auto;
    border: none;
    border-radius: 6px;
}

/* Ajustar el formulario de búsqueda */
body.fichas-medicas-body .search-form-top {
    margin: 50px auto 5px auto !important;
    width: 98%;
    border-radius: 6px;
}

/* Línea de neón azul para grupos de responsables */
.grupo-afiliado {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 15px 20px;
    padding: 15px;
    background-color: #fff;
    box-shadow: 0 0 10px #3498db, 0 0 20px #3498db;
    position: relative;
}

.grupo-afiliado::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 10px;
    background: linear-gradient(45deg, #3498db, #2B7FFF, #3498db);
    z-index: -1;
    animation: neon-border 2s ease-in-out infinite alternate;
}

@keyframes neon-border {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Estadísticas de búsqueda transparente */
.estadisticas-busqueda {
    background: transparent !important;
    border: 1px solid #c3e6cb;
    border-radius: 5px;
    padding: 8px 12px;
    margin: 10px 15px;
    font-size: 13px;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* Tema oscuro para estadísticas */
body[data-theme="dark"] .estadisticas-busqueda {
    background: transparent !important;
    border: 1px solid #444;
    color: #e0e0e0;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

/* Ajuste específico para la tabla en fichas_medicas */
body.fichas-medicas-body .data-table {
    width: 100%;
    table-layout: auto;
}

/* Header fijo para fichas_medicas */
body.fichas-medicas-body .top-user-bar {
    top: 0;
    margin: 8px auto;
}

/* Eliminar cualquier padding o margin extra */
body.fichas-medicas-body .form-container,
body.fichas-medicas-body .search-form-top,
body.fichas-medicas-body .tabla-scroll-vertical-horizontal {
    margin-left: auto;
    margin-right: auto;
}

/* ================================
   RESPONSIVE: Pantallas pequeñas (1366x768 y similares)
================================ */

/* Ajuste para el contenedor de la tabla en fichas_medicas en pantallas pequeñas */
@media (max-height: 768px), (max-width: 1366px) and (max-height: 800px) {
    body.fichas-medicas-body .tabla-scroll-vertical-horizontal {
        max-height: calc(100vh - 270px) !important;
        height: calc(100vh - 270px);
    }
}

/* Ajuste para el dashboard en pantallas pequeñas */
@media (max-height: 768px), (max-width: 1366px) and (max-height: 800px) {
    .dashboard-body {
        max-height: calc(100vh - 120px) !important;
    }
}

/* Ajuste adicional para tablets y móviles */
@media (max-width: 1024px) {
    body.fichas-medicas-body .tabla-scroll-vertical-horizontal {
        max-height: calc(100vh - 300px) !important;
        height: calc(100vh - 300px);
        margin: 5px 10px;
    }
}

/* Ajuste para móviles en landscape */
@media (max-width: 768px) and (orientation: landscape) {
    body.fichas-medicas-body .tabla-scroll-vertical-horizontal {
        max-height: calc(100vh - 320px) !important;
        height: calc(100vh - 320px);
    }
}

/* Ajuste para móviles en portrait */
@media (max-width: 768px) and (orientation: portrait) {
    body.fichas-medicas-body .tabla-scroll-vertical-horizontal {
        max-height: calc(100vh - 350px) !important;
        height: calc(100vh - 350px);
        margin: 5px;
    }
    
    /* Ajustar también el formulario de búsqueda en móviles */
    body.fichas-medicas-body .search-form-top {
        margin: 60px auto 5px auto !important;
        padding: 4px;
    }
}

/* Ajuste para pantallas muy pequeñas (móviles pequeños) */
@media (max-width: 480px) {
    body.fichas-medicas-body .tabla-scroll-vertical-horizontal {
        max-height: calc(100vh - 380px) !important;
        height: calc(100vh - 380px);
        margin: 2px;
    }
}

/* Ajuste para pantallas altas (más de 1080p) */
@media (min-height: 1080px) {
    body.fichas-medicas-body .tabla-scroll-vertical-horizontal {
        max-height: calc(100vh - 200px) !important;
        height: calc(100vh - 200px);
    }
}

/* Ajuste para pantallas ultra anchas */
@media (min-width: 1920px) {
    body.fichas-medicas-body .tabla-scroll-vertical-horizontal {
        max-height: calc(100vh - 150px) !important;
        height: calc(100vh - 150px);
        margin: 10px auto;
        max-width: 1800px;
    }
}

/* ================================
   AJUSTE ESPECÍFICO PARA LAPTOPS 1366x768
================================ */

/* Ajuste principal para la tabla en laptops 1366x768 */
@media (max-width: 1366px) and (max-height: 768px) {
    body.fichas-medicas-body {
        margin-top: 50px !important;
        overflow: auto !important;
    }
    
    body.fichas-medicas-body .search-form-top {
        margin: 60px auto 5px auto !important;
        padding: 4px 6px;
        transform: scale(0.95);
        transform-origin: top center;
    }
    
    body.fichas-medicas-body .tabla-scroll-vertical-horizontal {
        max-height: calc(100vh - 220px) !important;
        height: calc(100vh - 220px);
        margin: 2px auto;
        padding: 2px;
    }
    
    /* Reducir el tamaño de los grupos */
    .grupo-afiliado {
        margin: 8px 10px;
        padding: 8px;
    }
    
    .grupo-afiliado legend {
        font-size: 12px;
        padding: 3px 8px;
    }
    
    /* Ajustar tabla interna */
    .data-table {
        font-size: 11px;
    }
    
    .data-table th,
    .data-table td {
        padding: 4px 6px;
        min-width: 120px;
    }
    
    /* Ajustar botones */
    .animated-btn {
        padding: 4px 6px;
        font-size: 11px;
        margin: 2px;
    }
    
    /* Ajustar footer */
    .footer {
        padding: 6px 0;
        font-size: 0.8em;
        position: fixed;
        bottom: 0;
    }
}

/* Ajuste adicional para cuando la altura es exactamente 768px */
@media (max-height: 768px) {
    body.fichas-medicas-body .tabla-scroll-vertical-horizontal {
        max-height: calc(100vh - 240px) !important;
        height: calc(100vh - 240px);
    }
}

/* Ajuste extra para márgenes muy ajustados */
@media (max-width: 1366px) and (max-height: 768px) and (orientation: landscape) {
    body.fichas-medicas-body .tabla-scroll-vertical-horizontal {
        max-height: calc(100vh - 200px) !important;
        height: calc(100vh - 200px);
    }
    
    /* Comprimir aún más el formulario de búsqueda */
    #contenedor-seleccion-masiva {
        gap: 2px;
        padding: 0 2px;
    }
    
    #search-form input[type="text"] {
        width: 90px !important;
        padding: 2px 4px;
        font-size: 11px;
        height: 10px;
    }
    
    #search-form select {
        width: 80px !important;
        padding: 2px 4px;
        font-size: 11px;
    }
}