:root {
    --color-sidebar-header: #0b3e67; 
    
    --bg-main-gradient: linear-gradient(135deg, #1d5b96 0%, #3185c7 100%);     
    --bg-body: linear-gradient(180deg, #91c6f5ce 0%, #5f7fa3d7 90%);

    --color-primario: #3A506B;
    --color-claro: #6FFFE9;
    --text-dark-global: #0b3e67;
    
    --color-acento: #38bdf8;   
    --color-acento2: #5BC0BE; 
    --color-acento-claro: #9fe7f5;
    --color-dorado: #f7ad1a;       
    --glass-bg: rgba(255, 255, 255, 0.08); 
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15); 
}


@font-face {
    font-family: 'Material Icons';
    font-style: normal;
    font-weight: 400;
    src: url('../static/MaterialIcons-Regular.woff2') format('woff2');
}

.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    word-wrap: normal;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    vertical-align: middle;
}

#alertContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1060;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-auto-hide {
    animation: slideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards, fadeOut 0.4s ease-in 4s forwards;
}

@keyframes slideIn {
    0% { transform: translateX(120%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    0% { opacity: 1; transform: translateX(0); }
    100% { opacity: 0; transform: translateX(100%); margin-bottom: -60px; }
}
.card-table {
    background: #ffffffc5; 
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    padding: 20px;
}

.container-fluid h4,
.container-fluid p.text-white-50 {
    color: var(--text-dark-global) !important;
}

/* =========================================================
   ESTILIZACIÓN DE LA DATATABLE (MÁXIMA ESPECIFICIDAD)
   ========================================================= */
#tabla-custom table.table-custom {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    border: 1px solid rgba(11, 62, 103, 0.2) !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    background-color: #ffffff !important;
}

/* Header con degradado corporativo CONTINUO */
#tabla-custom table.table-custom thead {
    background: linear-gradient(135deg, #0b3e67 0%, #1d5b96 100%) !important;
}

#tabla-custom table.table-custom thead th {
    background: transparent !important; /* Deja ver el degradado del thead */
    color: var(--color-acento-claro) !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 14px 10px !important;
    border-bottom: 2px solid #0b3e67 !important;
    border-top: none !important;
}

/* Filas intercaladas: blancas y azul extremadamente claro */
#tabla-custom table.table-custom tbody tr:nth-child(odd) td {
    background-color: #ffffff !important;
    color: #333333 !important;
    padding: 14px 12px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

#tabla-custom table.table-custom tbody tr:nth-child(even) td {
    background-color: #f4f8fc !important; /* Azul extremadamente claro */
    color: #333333 !important;
    padding: 14px 12px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
}

#tabla-custom table.table-custom tbody tr:hover td {
    background-color: rgba(159, 231, 245, 0.2) !important;
}

/* Evitar desbordes de bordes redondeados */
#tabla-custom table.table-custom thead tr:first-child th:first-child { border-top-left-radius: 11px; }
#tabla-custom table.table-custom thead tr:first-child th:last-child { border-top-right-radius: 11px; }
#tabla-custom table.table-custom tbody tr:last-child td:first-child { border-bottom-left-radius: 11px; }
#tabla-custom table.table-custom tbody tr:last-child td:last-child { border-bottom-right-radius: 11px; }


.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper label {
    color: var(--text-dark-global) !important;
    font-weight: 500;
}

/* Ajuste de inputs externos para fondo claro */
.dataTables_filter input, .dataTables_length select {
    background-color: #ffffff !important;
    border: 1px solid rgba(11, 62, 103, 0.2) !important;
    color: var(--text-dark-global) !important;
    border-radius: 8px;
    padding: 6px 12px;
}

.dataTables_filter input:focus, .dataTables_length select:focus {
    outline: none;
    border-color: var(--color-acento-claro) !important;
    box-shadow: 0 0 5px rgba(159, 231, 245, 0.5) !important;
}

/* Margen para que respire la tabla */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 15px;
}

@media (max-width: 767.98px) {
    /* 1. Alinear todo a la izquierda en las filas colapsadas */
    table.dataTable > tbody > tr.child ul.dtr-details {
        width: 100%;
    }
    
    table.dataTable > tbody > tr.child ul.dtr-details > li {
        display: flex !important;
        flex-direction: column !important; /* Título arriba, dato abajo */
        align-items: flex-start !important; /* Alineado a la izquierda */
        text-align: left !important;
        padding: 10px 0 !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    table.dataTable > tbody > tr.child span.dtr-title {
        margin-bottom: 6px;
        color: var(--text-dark-global);
        min-width: 100% !important; /* Fuerza a que el título ocupe todo el ancho */
    }
    
    table.dataTable > tbody > tr.child span.dtr-data {
        text-align: left !important;
        padding-left: 0 !important;
        width: 100%; /* Asegura que los botones de acción no floten a la derecha */
    }

    /* 2. Paginación compacta e inteligente para móvil */
    .dataTables_wrapper .dataTables_paginate .paginate_button.first,
    .dataTables_wrapper .dataTables_paginate .paginate_button.last {
        display: none !important; /* Ocultamos "Primero" y "Último" por espacio */
    }
    
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 5px 12px !important; /* Reducimos el tamaño del botón */
        font-size: 0.85rem !important;
        margin-left: 2px !important;
    }
    
    .dataTables_wrapper .dataTables_paginate {
        display: flex !important;
        justify-content: center !important; /* Centramos la botonera */
        flex-wrap: wrap !important;
        margin-top: 15px !important;
    }
}


.modal-content {
    background-color: var(--color-sidebar-header) !important; 
    border: 1px solid var(--glass-border) !important;
    border-radius: 1rem;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
}

.modal-header {
    border-bottom: 1px solid var(--glass-border) !important;
}

.modal-footer {
    border-top: 1px solid var(--glass-border) !important;
}

.form-control-dark {
    background: rgba(0, 0, 0, 0.2) !important; 
    border: 1px solid var(--glass-border) !important;
    color: #fff !important;
}

.form-control-dark:focus {
    border-color: var(--color-acento) !important;
    box-shadow: 0 0 0 0.25rem rgba(56, 189, 248, 0.25) !important;
}

.btn-gradient {
    background: linear-gradient(135deg, var(--color-acento), var(--color-acento-claro));
    border: none;
    color: var(--color-sidebar-header) !important; 
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-gradient:hover {
    background: linear-gradient(135deg, var(--color-acento-claro), #ffffff);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(159, 231, 245, 0.4);
}

.form-control-dark::placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
    opacity: 1 !important; 
}

.form-control-dark::-webkit-input-placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

.form-control-dark::-moz-placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
    opacity: 1 !important;
}

.form-control-dark:-ms-input-placeholder {
    color: rgba(255, 255, 255, 0.5) !important;
}

select.form-control-dark option {
    background-color: var(--color-sidebar-header) !important; 
    color: #ffffff !important; 
    padding: 10px !important;
}

select.form-control-dark:focus option {
    background-color: var(--color-sidebar-header) !important;
    color: #ffffff !important;
}

.invalid-feedback {
    font-size: 0.75rem;
    color: #ff6b6b;
    font-weight: 500;
    display: block !important; 
    visibility: hidden;
    height: 16px; 
    margin-top: 2px;
}

.password-wrapper .form-control.is-invalid,
.password-wrapper .form-control.is-valid {
    background-image: none !important; 
    padding-right: 40px !important; 
}

.password-wrapper {
    position: relative;
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--color-acento2);
    z-index: 5;
    transition: color 0.2s;
}

.toggle-password:hover {
    color: var(--color-acento-claro);
}

.password-wrapper input {
    padding-right: 40px; 
}

#modal-danger-custom {
    background-color: var(--color-sidebar-header) !important; /* <-- CORREGIDO: Azul oscuro sólido */
    border-top: 3px solid #e63946 !important; 
    border-bottom: 3px solid var(--color-acento-claro) !important; /* <-- CORREGIDO: Cyan corporativo */
    border-left: 1px solid rgba(159, 231, 245, 0.2) !important;
    border-right: 1px solid rgba(159, 231, 245, 0.2) !important;
    border-radius: 1rem;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
}

#modal-danger-custom .icon-danger-pulse {
    color: #e63946;
    filter: drop-shadow(0 0 8px rgba(230, 57, 70, 0.4));
}

#btnConfirmarEliminar,
#btnConfirmarEliminarAtleta,
#btnConfirmarEliminarComp {
    background: linear-gradient(135deg, #e63946, #c1121f);
    color: white !important;
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

#btnConfirmarEliminar:hover,
#btnConfirmarEliminarAtleta:hover,
#btnConfirmarEliminarComp:hover {
    background: linear-gradient(135deg, #ff4d4d, #e63946);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(230, 57, 70, 0.6);
}

/* =========================================================
   ANIMACIÓN DE ENTRADA GLOBAL (CARGA DE MÓDULOS)
   ========================================================= */
.main-content > .container-fluid {
    /* La animación dura medio segundo con una curva de aceleración fluida */
    animation: moduleFadeInUp 0.6s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
    opacity: 0; /* Inicia invisible para evitar el parpadeo inicial */
}

@keyframes moduleFadeInUp {
    0% {
        opacity: 0;
        transform: translateY(25px); /* Entra desde 25px más abajo */
    }
    100% {
        opacity: 1;
        transform: translateY(0); /* Termina en su posición original */
    }
}

/* Efecto opcional: Que los modales también entren de forma suave */
.modal.fade .modal-dialog {
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    transform: scale(0.95) translateY(-20px);
}

.modal.show .modal-dialog {
    transform: scale(1) translateY(0);
}

/* =========================================================
   ANIMACIÓN FLIP 3D (CARNETS DIGITALES DE ASISTENCIA)
   ========================================================= */
.flip-card {
    background-color: transparent;
    perspective: 1000px;
    height: 380px; /* Aumentado para que no se vea aplastado */
    width: 100%;
    margin: 0 auto;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

.flip-card.is-flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5); /* Sombra más profunda */
}

.flip-card-front {
    background: linear-gradient(145deg, var(--color-sidebar-header) 0%, #112d57 100%); /* Degradado elegante */
    border: 1px solid var(--glass-border);
    z-index: 2;
}

.flip-card-back {
    background: linear-gradient(180deg, #112d57 0%, #040c1a 100%);
    transform: rotateY(180deg);
    border: 1px solid var(--color-acento-claro);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

::-webkit-scrollbar {
    width: 6px;  /* Ancho de la barra vertical */
    height: 6px; /* Alto de la barra horizontal */
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1); /* Fondo sutil de la pista */
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2); /* Color de la barra inactiva */
    border-radius: 10px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-acento); /* Cyan brillante al pasar el mouse */
}

::-webkit-scrollbar-corner {
    background: transparent;
}