/* Estilos generales */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

/* Ajustar el contenedor principal para usar el ancho completo */
.container {
    width: 100%;
    max-width: 100%;
    padding: 0 20px;
}

header {
    background-color: #85C1E9 !important; /* Color más claro para el encabezado */
    color: white;
    text-align: center;
    padding: 1.2rem;
    border-radius: 0 0 15px 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

header h1 {
    margin: 0;
    font-weight: 500;
    font-size: 1.8rem;
}

/* Estilos mejorados para la sección de login */
#login {
    max-width: 480px;
    margin: 3rem auto;
    animation: fadeIn 0.6s ease forwards;
}

.login-card {
    border-radius: 20px !important;
    overflow: hidden;
    transition: all 0.3s ease;
}

.login-card:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15) !important;
}

/* Icono de login grande */
.login-icon {
    font-size: 5rem;
    color: #0d6efd;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

#login h2 {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #f1f1f1;
    padding-bottom: 0.8rem;
    position: relative;
}

#login h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(to right, #3498db, #2c3e50);
}

#login-form .form-label {
    font-weight: 500;
    color: #34495e;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    display: block;
    transition: all 0.3s;
}

/* Wrapper para inputs con iconos */
.input-icon-wrapper {
    position: relative !important;
    width: 100%;
}

.input-icon-wrapper .input-icon {
    position: absolute !important;
    left: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #6c757d !important;
    font-size: 1rem !important;
    z-index: 10 !important;
    pointer-events: none !important;
}

.input-icon-wrapper .input-toggle-password {
    position: absolute !important;
    right: 0.5rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #6c757d !important;
    padding: 0.25rem 0.5rem !important;
    z-index: 10 !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    text-decoration: none !important;
}

.input-icon-wrapper .input-toggle-password:hover {
    color: #0d6efd !important;
}

/* Inputs con iconos integrados */
#login-form .form-control {
    position: relative !important;
    padding: 0.875rem 1rem !important;
    padding-left: 1rem !important;
    text-indent: 2rem !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 8px !important;
    transition: all 0.3s !important;
    font-size: 1rem !important;
    height: 48px !important;
    width: 100% !important;
}

/* El placeholder también se desplaza */
#login-form .form-control::placeholder {
    text-indent: 2rem !important;
}

#login-form .form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15) !important;
    border-color: #86b7fe !important;
    outline: none !important;
}

#login-form .input-icon-wrapper:focus-within .input-icon {
    color: #0d6efd !important;
}

#login-form .form-control:focus + .form-label {
    color: #3498db;
}

#login-form .mb-3 {
    position: relative;
    margin-bottom: 1.8rem;
}

/* Botón de login mejorado */
#login-form .btn-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
}

#login-form .btn-primary:hover {
    background: linear-gradient(135deg, #0a58ca 0%, #0d6efd 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4);
}

/* ========== HEADER MODERNO ========== */
.app-header-modern {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%) !important;
    color: white;
    padding: 1.2rem 1.5rem;
    border-radius: 0 0 20px 20px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    margin-bottom: 1.5rem;
}

.header-icon-wrapper {
    font-size: 2.5rem;
    margin-right: 1rem;
    display: flex;
    align-items: center;
    animation: headerPulse 3s infinite;
}

@keyframes headerPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.85;
    }
}

.brand-modern {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    margin-bottom: 0.1rem;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    line-height: 1.2;
}

.subtitle-modern {
    font-size: 0.9rem;
    margin: 0;
    opacity: 0.92;
    font-weight: 400;
    letter-spacing: 0.5px;
    line-height: 1.3;
}

/* Botón volver al inicio en header */
.app-header-modern .btn-outline-light {
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    transition: all 0.3s ease;
}

.app-header-modern .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: white;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ========== FOOTER MODERNO ========== */
.app-footer-modern {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 3px solid #0d6efd;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    margin-top: auto;
}

.footer-icon {
    font-size: 1.5rem;
    color: #0d6efd;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.footer-link {
    color: #0d6efd;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.footer-link:hover {
    color: #0a58ca;
    text-decoration: underline;
}

.footer-link i {
    transition: transform 0.3s ease;
}

.footer-link:hover i {
    transform: scale(1.2);
}

/* Responsive Header y Footer */
@media (max-width: 768px) {
    .app-header-modern {
        padding: 0.85rem 1rem;
        border-radius: 0 0 15px 15px !important;
        margin-bottom: 1.2rem;
    }
    
    .header-icon-wrapper {
        font-size: 1.6rem;
        margin-right: 0.65rem;
    }
    
    .brand-modern {
        font-size: 1.3rem;
        letter-spacing: 0.5px;
    }
    
    .subtitle-modern {
        font-size: 0.75rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .footer-links .mx-2 {
        display: none;
    }
}

@media (max-width: 576px) {
    .app-header-modern {
        padding: 0.7rem 0.75rem;
        margin-bottom: 1rem;
    }
    
    .header-icon-wrapper {
        font-size: 1.4rem;
        margin-right: 0.5rem;
    }
    
    .brand-modern {
        font-size: 1.15rem;
        letter-spacing: 0.3px;
    }
    
    .subtitle-modern {
        font-size: 0.7rem;
        letter-spacing: 0.2px;
    }
    
    .app-footer-modern .row {
        text-align: center !important;
    }
    
    .app-footer-modern .col-md-6 {
        justify-content: center !important;
    }
}

#login-form .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(13, 110, 253, 0.3);
}

/* Mensaje de error mejorado */
#login-error {
    border-radius: 10px;
    border-left: 4px solid #dc3545;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Animación mejorada para el login */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Estilos para el sistema de login */
.login-container {
    max-width: 400px;
    margin: 20px auto;
    padding: 20px;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0069d9;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-outline-primary {
    color: #007bff;
    border: 1px solid #007bff;
    background-color: transparent;
}

.btn-outline-primary:hover {
    background-color: #007bff;
    color: white;
}

.btn-outline-danger {
    color: #dc3545;
    border: 1px solid #dc3545;
    background-color: transparent;
}

.btn-outline-danger:hover {
    background-color: #dc3545;
    color: white;
}

.text-danger {
    color: #dc3545;
}

/* Grupos de botones */
.btn-group {
    display: inline-flex;
}

.btn-group > .btn {
    border-radius: 0;
}

.btn-group > .btn:first-child {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.btn-group > .btn:last-child {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* Estilos para recibos */
.receipt-list {
    display: grid;
    gap: 10px;
}

.receipt-item {
    background-color: white;
    border: 1px solid #ddd;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s;
}

.receipt-item:hover {
    background-color: #f0f0f0;
    cursor: pointer;
}

/* Estilos para el encabezado de la tabla de recibos */
#lista-recibos .table thead th {
    background-color: #007bff !important;
    color: #fff !important;
}

/* Estilos para el visor de PDF */
.pdf-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.pdf-viewer-content {
    position: relative;
    width: 90%;
    height: 90%;
    background-color: white;
}

.pdf-viewer.active {
    display: block; /* o flex según tu diseño */
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: red;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
}

/* Estilos para el panel de administración */
.admin-panel {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Estilos específicos para el panel de super administrador */
.super-admin-panel {
    padding: 12px 10px;
}

.super-admin-panel .table-responsive {
    margin-bottom: 0;
}

.super-admin-panel .table {
    font-size: 0.85rem;
    margin-bottom: 0;
    border-collapse: collapse;
}

.super-admin-panel .table th {
    padding: 0.5rem 0.3rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    background-color: #f5f7fa;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
    height: 32px;
}

.super-admin-panel .table td {
    padding: 0.35rem 0.3rem;
    line-height: 1.1;
    height: 30px;
    vertical-align: middle;
    border-top-width: 1px;
    font-size: 0.82rem;
}

.super-admin-panel .badge {
    padding: 0.15em 0.4em;
    font-size: 0.7rem;
}

.super-admin-panel .btn-group-sm > .btn {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
}

.super-admin-panel .btn-sm {
    padding: 0.12rem 0.35rem;
    font-size: 0.7rem;
}

.super-admin-panel .bi {
    font-size: 0.75em;
    margin-right: 0.1rem;
}

/* Nuevos estilos para optimizar el espacio en el panel de super usuario */
.dense-table {
    width: 100%;
    table-layout: fixed;
    margin-bottom: 0;
}

.dense-table th, .dense-table td {
    padding: 0.2rem 0.3rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.75rem !important;
}

.dense-table thead {
    background-color: #f8f9fa;
    height: 30px;
}

.dense-table thead th {
    padding: 0.4rem 0.3rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    font-size: 0.7rem !important;
    color: #495057;
    border-bottom-width: 1px;
}

.dense-table tbody tr {
    height: 28px;
    border-bottom: 1px solid rgba(0,0,0,0.03);
}

.dense-table tbody tr:last-child {
    border-bottom: none;
}

.dense-table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.03);
}

.dense-table tbody td {
    padding: 0.3rem 0.3rem;
    font-size: 0.8rem;
}

/* Utilidades adicionales para texto compacto */
.text-small {
    font-size: 0.75rem !important;
}

.text-tiny {
    font-size: 0.7rem !important;
}

.text-compact {
    font-size: 0.82rem;
    line-height: 1.2;
}

.no-wrap {
    white-space: nowrap;
}

/* Nuevos estilos para la visualización compacta de datos */
.compact-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    white-space: nowrap;
    padding: 0.25rem 0.3rem !important;
}

.compact-badge {
    padding: 0.12em 0.35em !important;
    font-size: 65% !important;
    line-height: 1;
}

.compact-btn-group .btn {
    padding: 0.1rem 0.3rem !important;
    font-size: 0.65rem !important;
}

.compact-section {
    padding: 10px 8px !important;
}

.compact-card {
    margin-bottom: 0.5rem !important;
}

.compact-card .card-body {
    padding: 10px 12px;
}

.compact-row-height {
    height: 26px !important;
    min-height: 26px !important;
}

.compact-row {
    line-height: 1.1;
}

/* Media queries para responsividad en tablas densas */
@media (max-width: 992px) {
    .dense-table {
        font-size: 0.7rem !important;
    }
    
    .dense-table th, .dense-table td {
        padding: 0.15rem 0.25rem !important;
    }
}

@media (max-width: 768px) {
    .dense-table {
        font-size: 0.65rem !important;
    }
    
    .dense-table th, .dense-table td {
        padding: 0.1rem 0.2rem !important;
    }
    
    .compact-badge {
        font-size: 60% !important;
        padding: 0.1em 0.3em !important;
    }
}

/* Estilos compactos para la tabla del panel de administración */
.compact-table {
    width: 100%;
    table-layout: fixed;
}

.compact-table th, .compact-table td {
    padding: 0.3rem 0.4rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compact-table thead {
    background-color: #f0f2f5;
}

.compact-table thead th {
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-size: 0.75rem;
}

.compact-table tbody tr {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.compact-table tbody tr:last-child {
    border-bottom: none;
}

.compact-table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.04);
}

/* Utilidades adicionales para texto compacto */
.text-small {
    font-size: 0.78rem !important;
}

.text-tiny {
    font-size: 0.7rem !important;
}

.no-wrap {
    white-space: nowrap;
}

.tab-content {
    padding: 20px;
    background-color: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

/* Estilos para la tabla de usuarios - Versión mejorada y moderna */
#users-list {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

.table {
    width: 100%;
    margin-bottom: 0;
    background-color: white;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem; /* Aumentando el tamaño de letra */
}

.table thead {
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table th {
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    padding: 0.6rem; /* Reduciendo el padding vertical */
    vertical-align: middle;
    text-transform: uppercase;
    font-size: 0.85rem; /* Aumentando el tamaño de letra en los encabezados */
    letter-spacing: 0.5px;
}

/* Encabezado destacado para la tabla de usuarios */
#users-list .table thead th {
    background-color: #007bff !important;
    color: #fff !important;
    border-bottom: 2px solid #0056b3 !important;
    font-weight: 600 !important;
}

.table-sm th, .table-sm td {
    padding: 0.25rem 0.5rem; /* Reduciendo aún más el padding para tablas small */
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.075);
}

.table td {
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem; /* Reduciendo el padding vertical de las celdas */
    line-height: 1.3; /* Reduciendo el interlineado */
}

/* Estilos para badges en la tabla */
.badge {
    display: inline-block;
    padding: 0.25em 0.6em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 10rem;
}

.bg-success {
    background-color: #28a745 !important;
    color: white;
}

.bg-danger {
    background-color: #dc3545 !important;
    color: white;
}

.rounded-pill {
    border-radius: 50rem !important;
}

/* Estilos para iconos bootstrap */
.bi {
    display: inline-block;
    vertical-align: -.125em;
    width: 1em;
    height: 1em;
    margin-right: 0.25rem;
}

.bi-pencil-square, .bi-trash {
    font-size: 0.9em;
}

/* Clases de utilidad */
.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.font-weight-medium {
    font-weight: 500 !important;
}

.me-1 {
    margin-right: 0.25rem !important;
}

.py-2 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.align-middle {
    vertical-align: middle !important;
}

.text-center {
    text-align: center !important;
}

.text-success {
    color: #28a745 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-secondary {
    color: #6c757d !important;
}

/* Media queries para responsividad */
@media (max-width: 992px) {
    .table {
        font-size: 0.85rem;
    }
    
    .btn-group-sm > .btn {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
    
    .super-admin-panel .table {
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    .table {
        font-size: 0.8rem;
    }
    
    .badge {
        font-size: 70%;
    }
    
    .btn-group-sm > .btn {
        padding: 0.2rem 0.3rem;
        font-size: 0.7rem;
    }
    
    .super-admin-panel .table {
        font-size: 0.7rem;
    }
    
    .super-admin-panel .table th,
    .super-admin-panel .table td {
        padding: 0.25rem 0.3rem;
    }
}

/* (removido bloque antiguo de tabs para evitar override de estilos nuevos) */

/* Contenido de las pestañas */
#adminTabContent {
    width: 100%;
}

/* Estilos para el formulario de creación de usuarios */
#new-user-form .form-label {
    font-size: 0.9rem;
    color: #495057;
}

#new-user-form .form-control:focus,
#new-user-form .form-select:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* --- Reforzado final de pestañas Admin (alta especificidad) --- */
ul#adminTabs.admin-tabs-enhanced { width:100%; }
ul#adminTabs.admin-tabs-enhanced .nav-link {
    position:relative;
    font-weight:500;
    border:none !important;
    background:transparent;
    color:#495057;
    transition:background-color .25s,color .25s;
}
ul#adminTabs.admin-tabs-enhanced .nav-link.active {
    background:#0d6efd !important;
    color:#fff !important;
    box-shadow:0 2px 6px rgba(13,110,253,.4);
    border-radius:.5rem .5rem 0 0;
}
ul#adminTabs.admin-tabs-enhanced .nav-link:not(.active):hover {
    background:rgba(13,110,253,.12) !important;
    color:#0d6efd !important;
    border-radius:.5rem .5rem 0 0;
}
ul#adminTabs.admin-tabs-enhanced .nav-link:focus-visible { outline:2px solid #0d6efd; outline-offset:2px; }
ul#adminTabs.admin-tabs-enhanced .nav-link::after { content:''; position:absolute; left:10px; right:10px; bottom:4px; height:2px; background:#0d6efd; transform:scaleX(0); transform-origin:left; transition:transform .3s; }
ul#adminTabs.admin-tabs-enhanced .nav-link:hover::after, ul#adminTabs.admin-tabs-enhanced .nav-link.active::after { transform:scaleX(1); }

#new-user-form .text-danger {
    font-weight: bold;
}

#new-user-form .card {
    border-radius: 8px;
}

#new-user-form .btn-success {
    background-color: #28a745;
    border-color: #28a745;
    transition: all 0.3s ease;
}

#new-user-form .btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

#new-user-form .form-control,
#new-user-form .form-select {
    padding: 10px 15px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

#new-user-form .input-group .btn {
    z-index: 0;
}

/* Animación para mensajes de alerta */
.alert {
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Estilos para sobrescribir Bootstrap */
/* Aumentar la especificidad usando !important en estilos críticos */

/* Para asegurar que nuestros estilos de botones sobrescriban los de Bootstrap */
.btn.btn-primary {
    background-color: #007bff !important;
    border-color: #007bff !important;
}

.btn.btn-primary:hover {
    background-color: #0069d9 !important;
    border-color: #0062cc !important;
}

.btn.btn-danger {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
}

.btn.btn-danger:hover {
    background-color: #c82333 !important;
    border-color: #bd2130 !important;
}

/* Asegurar que nuestros estilos de formulario tengan prioridad */
#login-form .form-control {
    border: none !important;
    border-radius: 12px !important;
    padding: 1rem 1.2rem !important;
    background-color: #f8f9fa !important;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05) !important;
    transition: all 0.3s !important;
    margin-bottom: 1.5rem !important;
    font-size: 1rem !important;
}

#login-form .form-control:focus {
    background-color: #fff !important;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2) !important;
    outline: none !important;
    transform: translateY(-2px) !important;
}

/* Sobrescribir estilos de tablas para mantener nuestro diseño personalizado */
.table {
    width: 100% !important;
    margin-bottom: 0 !important;
    background-color: white !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    font-size: 0.95rem !important;
}

.table thead {
    background-color: #f8f9fa !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
}

.table th {
    font-weight: 600 !important;
    color: #495057 !important;
    border-bottom: 2px solid #dee2e6 !important;
    padding: 0.6rem !important;
    vertical-align: middle !important;
    text-transform: uppercase !important;
    font-size: 0.85rem !important;
    letter-spacing: 0.5px !important;
}

/* Para estilos compactos personalizados que no sean afectados por Bootstrap */
.compact-table {
    width: 100% !important;
    table-layout: fixed !important;
}

.compact-table th, .compact-table td {
    padding: 0.3rem 0.4rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Estilos para pestañas personalizadas */
#adminTabs .nav-link.active {
    color: #007bff !important;
    background-color: #fff !important;
    border-color: #dee2e6 #dee2e6 #fff !important;
}

/* Estilos para el panel de administración compacto */
.super-admin-panel .table {
    font-size: 0.85rem !important;
    margin-bottom: 0 !important;
    border-collapse: collapse !important;
}

.super-admin-panel .table th {
    padding: 0.5rem 0.3rem !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    background-color: #f5f7fa !important;
    border-bottom: 1px solid #e9ecef !important;
    vertical-align: middle !important;
    height: 32px !important;
}

.super-admin-panel .table td {
    padding: 0.35rem 0.3rem !important;
    line-height: 1.1 !important;
    height: 30px !important;
    vertical-align: middle !important;
    border-top-width: 1px !important;
    font-size: 0.82rem !important;
}

/* Clases personalizadas para evitar conflictos con Bootstrap */
.custom-button {
    padding: 0.5rem 1.2rem;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.3s;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.custom-button-primary {
    background-color: #4361ee;
    color: white;
}

.custom-button-primary:hover {
    background-color: #3a56d4;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.custom-button-secondary {
    background-color: #6c757d;
    color: white;
}

.custom-button-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.custom-input {
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    transition: all 0.2s;
    background-color: #f8f9fa;
}

.custom-input:focus {
    border-color: #4361ee;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.25);
    outline: none;
}

/* Estilos personalizados para tablas que no dependan de Bootstrap */
.custom-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.custom-table th {
    background-color: #f1f3f9;
    color: #2d3748;
    font-weight: 600;
    text-align: left;
    padding: 12px 15px;
    border-bottom: 2px solid #e2e8f0;
}

.custom-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.custom-table tr:hover {
    background-color: #f8fafc;
}

/* Estilos personalizados para modales */
.custom-modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

.custom-modal-title {
    color: #3a56d4;
    font-weight: 600;
    margin: 0;
}

.custom-modal-body {
    padding: 1.5rem;
}

.custom-modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Estilos para tabs personalizados */
.custom-tabs {
    display: flex;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 1rem;
}

.custom-tab {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-weight: 500;
    color: #6c757d;
    border: 1px solid transparent;
    border-bottom: none;
    margin-bottom: -1px;
    transition: all 0.2s;
}

.custom-tab.active {
    color: #4361ee;
    background-color: white;
    border-color: #dee2e6;
    border-bottom-color: white;
}

.custom-tab:hover:not(.active) {
    color: #4361ee;
    background-color: rgba(67, 97, 238, 0.05);
}

.custom-tab-content {
    padding: 1rem 0;
}

/* Estilos para el panel del superadministrador */
#empresas-section {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

#empresas-section .empresas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #f1f1f1;
    padding-bottom: 1rem;
}

#empresas-section h3 {
    margin: 0;
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.4rem;
}

#crear-empresa-btn {
    background: linear-gradient(to right, #3498db, #2c3e50);
    border: none;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    margin: 0;
}

#crear-empresa-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

#empresas-container {
    border-radius: 0 0 8px 8px;
    border-top: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Estilos para el panel del superadministrador (Empresas) */
.empresas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to right, #3498db, #2c3e50);
    padding: 10px 15px;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
    color: white;
    box-shadow: 0 3px 5px rgba(0,0,0,0.1);
}

.empresas-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.empresas-header button {
    padding: 5px 10px;
    font-size: 0.9rem;
    border-radius: 20px;
    border: 2px solid white;
    background-color: transparent;
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
}

.empresas-header button:hover {
    background-color: white;
    color: #2c3e50;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#empresas-container {
    border-radius: 0 0 8px 8px;
    border-top: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Estilos para tarjetas de empresas */
.empresa-card {
    border-left: 5px solid #3498db;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.empresa-card:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.empresa-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
    padding: 10px 15px;
}

.empresa-card .card-title {
    margin: 0;
    font-weight: 600;
    color: #2c3e50;
}

.empresa-card .card-actions {
    display: flex;
    gap: 8px;
}

.empresa-card .btn-sm {
    padding: 3px 8px;
    font-size: 0.8rem;
}

/* Resaltado temporal al saltar al primer pendiente */
.row-highlight {
    animation: rowFlash 1.5s ease-in-out;
}
@keyframes rowFlash {
    0%   { background-color: #fff3cd; }
    50%  { background-color: #ffe8a1; }
    100% { background-color: transparent; }
}

/* --- Ajustes de botones en la lista de recibos para móviles --- */
@media (max-width: 576px) {
    /* Hacer que ambos botones se vean iguales, más compactos y apilados */
    #lista-recibos .download-btn,
    #lista-recibos .conform-btn,
    #lista-recibos .download-conform-btn {
        display: block;
        width: 100%;
        margin-left: 0 !important; /* anula .ms-2 */
        margin-top: 6px;
        font-size: 0.78rem !important;
        padding: 0.35rem 0.5rem !important;
        border-radius: 0.35rem !important;
        line-height: 1.2 !important;
    }

    /* El primero de la columna sin margen superior extra */
    #lista-recibos td.text-end .btn:first-child {
        margin-top: 0;
    }

    /* Evitar que la columna de acción se expanda de más */
    #lista-recibos td.text-end {
        min-width: 140px;
        white-space: normal; /* permitir salto para apilado limpio */
    }
}

@media (max-width: 576px) {
  /* Mantener 'Ver Recibo' sólido y hacer 'Dar conformidad' outline */
  #lista-recibos .conform-btn.btn-success {
    background-color: transparent !important;
    color: #198754 !important;             /* success */
    border: 1px solid #198754 !important;
  }
  #lista-recibos .conform-btn.btn-success:hover,
  #lista-recibos .conform-btn.btn-success:active {
    background-color: #198754 !important;
    color: #fff !important;
  }
}

/* Reglas reforzadas también para pantallas <= 768px (muchos móviles caen aquí) */
@media (max-width: 768px) {
    /* Apilado y tamaños compactos */
    #lista-recibos td.text-end .btn.download-btn,
    #lista-recibos td.text-end .btn.conform-btn,
    #lista-recibos td.text-end .btn.download-conform-btn {
        display: block !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 6px !important;
        font-size: 0.8rem !important;
        padding: 0.38rem 0.55rem !important;
        border-radius: 0.35rem !important;
        line-height: 1.2 !important;
    }

    #lista-recibos td.text-end .btn.download-btn:first-child,
    #lista-recibos td.text-end .btn.download-conform-btn:first-child,
    #lista-recibos td.text-end .btn.conform-btn:first-child {
        margin-top: 0 !important;
    }

    #lista-recibos td.text-end { 
        min-width: 160px; 
        white-space: normal !important; 
    }

    /* “Dar conformidad” como outline para reducir jerarquía */
    #lista-recibos td.text-end .btn.conform-btn.btn-success {
        background-color: transparent !important;
        color: #198754 !important;
        border: 1px solid #198754 !important;
    }
    #lista-recibos td.text-end .btn.conform-btn.btn-success:hover,
    #lista-recibos td.text-end .btn.conform-btn.btn-success:active {
        background-color: #198754 !important;
        color: #fff !important;
    }
}

/* Media queries para ajustar iconos en vista móvil */
@media (max-width: 576px) {
    /* Ajustes para el login en móviles */
    #login {
        max-width: 100%;
        margin: 1rem auto;
    }

    .login-card .card-body {
        padding: 2rem 1.5rem !important;
    }

    /* Iconos más pequeños en móvil */
    .login-icon {
        font-size: 3.5rem !important;
    }

    /* Reducir tamaño de icono dentro del input */
    .input-icon-wrapper .input-icon {
        left: 0.5rem !important;
        font-size: 0.9rem !important;
    }

    /* Menos text-indent en inputs móvil */
    #login-form .form-control {
        padding-left: 0.75rem !important;
        text-indent: 1.5rem !important;
        font-size: 0.95rem !important;
        height: 44px !important;
    }

    #login-form .form-control::placeholder {
        text-indent: 1.5rem !important;
    }

    /* Ajustar botón toggle de contraseña */
    .input-icon-wrapper .input-toggle-password {
        right: 0.25rem !important;
        padding: 0.25rem 0.4rem !important;
        font-size: 0.9rem !important;
    }

    /* Ajustar para campo de contraseña */
    #login-form #clave {
        padding-right: 2rem !important;
    }

    /* Botón más pequeño en móvil */
    #login-form .btn-primary {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    /* Labels más pequeños */
    #login-form .form-label {
        font-size: 0.9rem;
    }

    /* Título más pequeño */
    .login-card h2 {
        font-size: 1.5rem;
    }

    .login-card .text-muted {
        font-size: 0.85rem;
    }
}

/* Ajustes para tablets pequeños */
@media (min-width: 577px) and (max-width: 768px) {
    .input-icon-wrapper .input-icon {
        left: 0.65rem !important;
        font-size: 0.95rem !important;
    }

    #login-form .form-control {
        padding-left: 0.875rem !important;
        text-indent: 1.75rem !important;
    }

    #login-form .form-control::placeholder {
        text-indent: 1.75rem !important;
    }
}

/* ========== PANEL DE ADMINISTRACIÓN COMPACTO ========== */
#admin h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

#admin h3 {
    font-size: 1.2rem;
}

/* Tabs más compactas en móviles */
@media (max-width: 768px) {
    #admin h2 {
        font-size: 1.3rem;
    }
    
    #admin h3 {
        font-size: 1.1rem;
    }
    
    ul#adminTabs.admin-tabs-enhanced .nav-link {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.85rem;
    }
    
    #admin-user-info {
        font-size: 0.8rem;
    }
    
    /* Hacer las estadísticas más compactas */
    #users-stats h6,
    #recibos-stats h6 {
        font-size: 0.9rem !important;
    }
    
    #users-stats small,
    #recibos-stats small {
        font-size: 0.65rem !important;
    }
}

@media (max-width: 576px) {
    #admin h2 {
        font-size: 1.15rem;
        margin-bottom: 0.5rem;
    }
    
    #admin h3 {
        font-size: 1rem;
    }
    
    /* Tabs aún más compactas */
    ul#adminTabs.admin-tabs-enhanced .nav-link {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.75rem;
    }
    
    /* Ocultar iconos en tabs en móvil muy pequeño */
    ul#adminTabs.admin-tabs-enhanced .nav-link i {
        display: none;
    }
    
    /* Botón de cerrar sesión más pequeño */
    #admin-logout-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    #admin-user-info {
        font-size: 0.7rem;
        display: block;
        margin-bottom: 0.25rem;
    }
    
    /* Filtros más compactos */
    #users-filters .form-control,
    #users-filters .form-select {
        font-size: 0.8rem;
        padding: 0.35rem 0.5rem;
    }
    
    /* Estadísticas en una sola fila más compacta */
    #users-stats .col-3,
    #recibos-stats .col-3 {
        padding: 0.25rem;
    }
    
    #users-stats h6,
    #recibos-stats h6 {
        font-size: 0.85rem !important;
        margin-bottom: 0.1rem !important;
    }
    
    #users-stats small,
    #recibos-stats small {
        font-size: 0.6rem !important;
    }
    
    /* Botón de actualizar más pequeño */
    #refresh-users-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    #refresh-users-btn i {
        font-size: 0.7rem;
    }
}

/* ========== BOTONES DE RECIBOS CON ESTADÍSTICAS ========== */
.ver-recibos {
    position: relative;
    font-weight: 500;
    transition: all 0.3s ease;
}

.ver-recibos:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Tooltips personalizados */
.tooltip-inner {
    max-width: 300px;
    text-align: left;
    font-size: 0.85rem;
}

/* Estilos para el modal de recibos de usuario */
#userRecibosModal .list-group-item {
    transition: background-color 0.2s ease;
}

#userRecibosModal .list-group-item:hover {
    background-color: #f8f9fa;
}

#userRecibosModal .badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.6rem;
}

/* Responsive para botones de recibos */
@media (max-width: 768px) {
    .ver-recibos {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    .ver-recibos i {
        font-size: 0.7rem;
    }
}

/* ========== BOTONES DE ACCIONES DE RECIBOS (EMPLEADO) ========== */
/* Mejoras para botones de ver/conformar/rechazar en vista empleado */
#recibo-content table .btn-sm {
    min-height: 38px;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.25s ease;
    border-width: 2px;
}

#recibo-content table .btn-sm i {
    font-size: 1rem;
}

/* Espaciado para badges de estado - Estilo circular compacto */
#recibo-content table .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 50% !important;
    line-height: 1;
}

/* Mostrar texto completo en desktop */
@media (min-width: 768px) {
    #recibo-content table .badge {
        width: auto;
        height: auto;
        padding: 0.4rem 0.8rem;
        font-size: 0.875rem;
        border-radius: 0.375rem !important;
    }
}

/* Contenedor flexible para botones */
#recibo-content table .d-flex.gap-2 {
    gap: 0.5rem !important;
}

/* Hover mejorado para botones outline */
#recibo-content table .btn-outline-primary:hover {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 123, 255, 0.3);
}

#recibo-content table .btn-outline-success:hover {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(40, 167, 69, 0.3);
}

#recibo-content table .btn-outline-danger:hover {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(220, 53, 69, 0.3);
}

/* Botones sólidos para acciones principales */
#recibo-content table .btn-success {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

#recibo-content table .btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(40, 167, 69, 0.4);
}

#recibo-content table .btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

#recibo-content table .btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(220, 53, 69, 0.4);
}

/* Estado activo */
#recibo-content table .btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
}

/* Responsive: tablets */
@media (max-width: 768px) {
    #recibo-content table .btn-sm {
        padding: 0.45rem 0.85rem;
        font-size: 0.9rem;
    }
    
    #recibo-content table .d-flex.gap-2 {
        flex-direction: column;
        width: 100%;
    }
    
    #recibo-content table .btn-sm {
        width: 100%;
    }
}

/* Responsive: móviles */
@media (max-width: 576px) {
    #recibo-content table .btn-sm {
        min-height: 44px;
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
        width: 100%;
    }
    
    #recibo-content table .btn-sm i {
        font-size: 1.1rem;
    }
    
    #recibo-content table .d-flex.gap-2 {
        gap: 0.4rem !important;
    }
    
    /* Badges circulares más pequeños en móvil */
    #recibo-content table .badge {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}