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

/* ========================================
   VARIABLES CSS - TEMA POR DEFECTO (PRODUCCIÓN)
   ======================================== */
:root {
    --color-primary: #0a3d62;
    --color-primary-hover: #1e3799;
    --color-primary-light: #f4f4f9;
    --color-header-bg: #0a3d62;
    --color-header-text: #fff;
    --env-banner-display: none;
}

/* ========================================
   TEMA ENTORNO DE PRUEBAS
   Solo banner + borde rojo para identificar, colores iguales a producción
   ======================================== */
body.env-pruebas {
    --env-banner-display: block;
    /* Borde rojo alrededor de toda la página para identificar */
    border: 4px solid #b91c1c;
    min-height: 100vh;
}

/* Banner de entorno de pruebas */
.env-banner {
    display: var(--env-banner-display);
    background: repeating-linear-gradient(
        45deg,
        #b91c1c,
        #b91c1c 10px,
        #991b1b 10px,
        #991b1b 20px
    );
    color: #fff;
    text-align: center;
    padding: 12px 20px;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: sticky;
    top: 0;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(185, 28, 28, 0.4);
    animation: pulse-banner 2s ease-in-out infinite;
}

.env-banner i {
    margin-right: 10px;
    animation: shake 0.5s ease-in-out infinite;
}

@keyframes pulse-banner {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--color-primary-light);
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    padding-bottom: 60px;
    /* Aumenta este valor según la altura del footer */
}

header {
    background: var(--color-primary);
    color: var(--color-header-text);
    padding: 20px 0;
    text-align: center;
}

header h1 {
    margin: 0;
    font-size: 2.5em;
}

main {
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0px;
    background: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

h2 {
    color: var(--color-primary);
    margin-bottom: 20px;
    font-size: 2em;
    text-align: center;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table th {
    background: var(--color-primary);
    color: var(--color-header-text);
}

table tr:hover {
    background: #f1f1f1;
}

button,
.button {
    background: var(--color-primary);
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
}

button:hover,
.button:hover {
    background: var(--color-primary-hover);
}

/* Prevenir que los iconos dentro de botones capturen clics (soluciona delegación de eventos) */
button i,
.btn i {
    pointer-events: none;
}

.footer {
    background-color: var(--color-primary);
    color: var(--color-header-text);
    text-align: center;
    padding: 10px 0;
    width: 100%;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 1000;
    /* Asegura que el footer esté por encima de otros elementos */
}

/* Anular estilos del .container general para el div dentro del footer */
.footer .container {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    /* Opcional: quitar bordes redondeados si los hubiera */
    padding: 0;
    /* Opcional: quitar padding si lo hubiera heredado */
}

.fa-info-circle {
    margin-right: 8px;
}

/* Estilos personalizados adicionales si es necesario */
.navbar {
    background-color: var(--color-primary) !important;
    padding: 10px 20px;
    /* Espaciado interior del menú */
}

.navbar-brand {
    color: #fff;
    /* Color del texto del logo o título */
    font-size: 1.5rem;
    /* Tamaño del texto */
    font-weight: bold;
    /* Grosor del texto */
}

.navbar-nav .nav-item .nav-link {
    color: #fff;
    /* Color del texto de los enlaces */
    font-weight: 600;
    /* Grosor del texto */
}

.navbar-nav .nav-item .nav-link:hover {
    color: #f1f1f1;
    /* Color del texto al pasar el mouse sobre los enlaces */
}

/* Estilo para el botón navbar-toggler en vista móvil */
.navbar-toggler {
    border-color: #fff;
    /* Cambia el color del borde del botón */
}

.navbar-toggler .navbar-toggler-icon {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba%28255, 255, 255, 0.7%29' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
    /* Cambia el color de las líneas */
}

/* Asegura que los íconos tengan un alto y ancho adecuado */
.navbar-toggler .navbar-toggler-icon {
    width: 30px;
    height: 30px;
}

/* Estilo adicional para el botón Volver */
.btn-volver {
    margin-bottom: 20px;
    /* Espacio en la parte inferior */
}

/* Alinear el contenido del modal */
.modal-body ul {
    padding-left: 20px;
    /* Ajuste de sangría para la lista */
}

/* Ajuste de margen y padding en el modal */
.modal-content {
    padding: 20px;
}

/* Estilo para el título del modal */
.modal-title {
    font-weight: bold;
    font-size: 1.25rem;
    /* Tamaño de fuente un poco más grande */
    margin-bottom: 10px;
    /* Margen inferior para separación */
}

/* Estilo para el modal de inicio de sesión */
#modalIniciarSesion .modal-header {
    background: var(--color-primary);
    color: var(--color-header-text);
    border-bottom: none;
    padding: 15px 20px;
}

#modalIniciarSesion .modal-title {
    font-size: 1.5rem;
}

#modalIniciarSesion .modal-body {
    padding: 20px;
}

#modalIniciarSesion .form-group label {
    font-weight: bold;
    color: var(--color-primary);
}

#modalIniciarSesion .form-control {
    border-radius: 5px;
    border: 1px solid #ddd;
    padding: 10px;
    margin-bottom: 15px;
}

/* Sobrescribir Bootstrap btn-primary para usar colores del tema */
.btn-primary {
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--color-primary-hover) !important;
    border-color: var(--color-primary-hover) !important;
}

#modalIniciarSesion .btn-primary {
    background-color: var(--color-primary);
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#modalIniciarSesion .btn-primary:hover {
    background-color: var(--color-primary-hover);
}

/* Remove or comment out previous rank styles */
/* 
.rank-display {
    display: inline-block;
    width: 25px; 
    height: 1.2em; 
    position: relative;
    vertical-align: middle;
    margin-right: 5px; 
    font-size: 0; 
    line-height: 0; 
}

.rank-oficial::before,
.rank-inspector::before,
.rank-inspector::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px; 
    background-color: #a9a9a9; 
    border-radius: 1px;
}

.rank-oficial::before {
    top: 50%;
    transform: translateY(-50%);
}

.rank-inspector::before {
    top: 30%; 
    transform: translateY(-50%);
}

.rank-inspector::after {
    content: ''; 
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #a9a9a9;
    border-radius: 1px;
    bottom: 30%; 
    transform: translateY(50%);
}

.rank-agente {
    width: 0; 
    margin-right: 0;
}
*/

/* Optional: Add styling for the Font Awesome icons if needed */
.rank-icon {
    color: #FCFE06;
    /* Updated icon color */
    vertical-align: middle;
    /* Align icon nicely with text in other cells */
    font-size: 0.9em;
    /* Slightly smaller icon */
    /* Ensure icon is centered within the badge */
    display: inline-block;
    /* Needed for vertical align */
    line-height: 1;
    /* Match badge line-height */
}

/* New styles for the rank background badge */
.rank-badge-bg {
    display: inline-flex;
    /* Use Flexbox for internal alignment */
    align-items: center;
    /* Vertically center items */
    justify-content: flex-start;
    /* Align items to the start (letter first) */
    background-color: #02012A;
    /* Dark blue background */
    width: 55px;
    /* Fixed width for consistent size */
    padding: 2px 5px;
    /* Adjust padding (less horizontal now width controls size) */
    border-radius: 3px;
    /* Slightly rounded corners */
    min-height: 1.2em;
    /* Ensure empty badges have height */
    vertical-align: middle;
    /* Align badge with text */
    color: #FCFE06;
    /* Default text color (for the letter) */
}

/* Style for the rank letter */
.rank-badge-bg b {
    font-weight: bold;
    margin-right: 8px;
    /* Increased space between letter and icon */
    line-height: 1;
    /* Match badge line-height */
}

/* Adjust icon style slightly for better contrast/position on badge */
.rank-badge-bg .rank-icon {
    color: #FCFE06;
    /* Ensure yellow color */
    font-size: 0.9em;
    line-height: 1;
    flex-grow: 1;
    /* Allow icon to take remaining space */
    text-align: center;
    /* Center icon within its space */
}

/* Remove rule that hides agent badge */
/*
.rank-agente {
    width: 0;
    margin-right: 0;
}
*/

/* --- Admin Agentes: edición inline --- */
.inline-editing {
    background-color: #fff8e1;
    /* Suave fondo para modo edición */
}

.inline-editing input.form-control,
.inline-editing select.form-control {
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
}

.gap-1>*+* {
    margin-left: 4px;
}

/* --- Modal Administrar Agentes: más ancho y aireado --- */
#modalAdministrarAgente .modal-dialog {
    max-width: 1200px;
    /* Más ancho que modal-lg estándar */
    width: 95%;
}

/* Modal Administrar Usuarios: más ancho */
#modalAdministrarUsuario .modal-dialog {
    max-width: 1000px;
    width: 95%;
}

#modalAdministrarAgente .modal-body {
    padding-top: 10px;
}

#modalAdministrarAgente table.table {
    margin-top: 10px;
}

/* --- Turnos Operativos --- */
.badge-turno-manana {
    background: #e3f2fd;
    color: #0d47a1;
}

.badge-turno-tarde {
    background: #fff3e0;
    color: #e65100;
}

.badge-turno-noche {
    background: #ede7f6;
    color: #4a148c;
}

.badge-turno-regularizacion {
    background: #e0f2f1;
    color: #004d40;
}

/* Day of week badges (used in permutas and operativos) */
.badge-day {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    border-radius: 50%;
    background: #64748b;
    color: #fff;
    text-align: center;
    font-size: 10px;
    font-weight: 900;
    margin-right: 4px;
    vertical-align: middle;
}

.badge-day-weekend {
    background: #ef4444;
    /* Red for weekends (S and D) */
}

/* Corrección para Summernote en modo pantalla completa dentro de modales Bootstrap */
.note-editor.note-frame.fullscreen {
    z-index: 2050 !important;
    background-color: #fff !important;
}

/* --- Admin Agentes: Mejoras Premium --- */
.table-danger-light {
    background-color: #fff5f5 !important;
}

.opacity-75 {
    opacity: 0.75;
}

/* Tarjetas de estadísticas */
#statsAgentes .card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
}

#statsAgentes .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

/* Badges y Estados */
.badge-warning {
    background-color: #fff3e0;
    color: #ef6c00;
    border: 1px solid #ffe0b2;
}

.badge-success {
    border: 1px solid #c8e6c9;
}

.badge-secondary {
    background-color: #f5f5f5;
    color: #616161;
    border: 1px solid #e0e0e0;
}

/* Ajustes tabla admin */
#listaAgentes table thead th {
    background: #f8f9fa;
    color: #495057;
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    border-top: none;
}

#listaAgentes table tbody tr {
    transition: background-color 0.15s ease;
}

#listaAgentes .sequence-header {
    border-left: 4px solid var(--color-primary);
}

/* Switches en edición inline */
.custom-control-input:checked~.custom-control-label::before {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.gap-1 {
    gap: 0.25rem;
}

/* Ajuste buscador */
#searchAgente:focus {
    box-shadow: none;
    border-color: var(--color-primary);
}

#searchAgente::placeholder {
    font-size: 0.9rem;
    color: #adb5bd;
}

/* --- Admin: Vista Compacta (Agentes y Usuarios) --- */
.listaAgentes table td,
.listaAgentes table th,
.listaUsuarios table td,
.listaUsuarios table th {
    padding: 0.4rem 0.5rem !important;
    font-size: 0.85rem;
}

.listaAgentes,
.listaUsuarios {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 4px;
}

.text-strikethrough {
    text-decoration: line-through;
    opacity: 0.6;
}

.btn-xs {
    padding: 0.1rem 0.3rem;
    font-size: 0.75rem;
    line-height: normal;
    border-radius: 0.2rem;
}

.nav-tabs .nav-link {
    font-size: 0.9rem;
    padding: 0.5rem 0.8rem;
    color: #6c757d;
}

.nav-tabs .nav-link.active {
    font-weight: bold;
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
}

#agentTabs {
    margin-bottom: 1rem !important;
}



#agentTabsContent {
    background: #fff;
    padding: 2px;
}

.gap-2 {
    gap: 0.5rem;
}

/* --- Notificaciones Apilables --- */
.notification-stack {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 10000;
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    /* Dejar pasar clics si no hay nada */
    transition: top 0.3s ease-in-out;
}

.notif-item {
    pointer-events: auto;
    /* Activar clics en la notificación */
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 12px 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
    animation: slideInRight 0.3s ease-out;
    border-left: 5px solid var(--color-primary);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.notif-item:hover {
    transform: scale(1.02);
}

.notif-item.notif-danger {
    border-left-color: #dc3545;
}

.notif-item.notif-warning {
    border-left-color: #ffc107;
}

.notif-item.notif-info {
    border-left-color: #17a2b8;
}

.notif-item.notif-success {
    border-left-color: #28a745;
}

.notif-icon {
    font-size: 1.2rem;
    margin-top: 2px;
}

.notif-danger .notif-icon {
    color: #dc3545;
}

.notif-warning .notif-icon {
    color: #ffc107;
}

.notif-info .notif-icon {
    color: #17a2b8;
}

.notif-success .notif-icon {
    color: #28a745;
}

.notif-content {
    flex-grow: 1;
}

.notif-title {
    font-weight: bold;
    font-size: 0.95rem;
    margin-bottom: 3px;
    display: block;
}

.notif-text {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.3;
}

.notif-close {
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 0.9rem;
    color: #ccc;
    cursor: pointer;
    line-height: 1;
    padding: 2px;
}

.notif-close:hover {
    color: #999;
}

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

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* --- Agentes en Baja (Refuerzos) --- */
/* --- Agentes en Baja (Refuerzos) --- */
option.agente-baja {
    background-color: #fff5f5;
    /* Fondo muy suave rojizo */
    color: #c53030 !important;
    /* Rojo elegante */
}