/* =========================================================
   CALENDARIO PERSONAL
   ========================================================= */

.modal-calendario {

    position: fixed;

    inset: 0;

    display: flex;

    justify-content: center;

    align-items: center;

    padding: 25px;

    background: rgba(15, 30, 45, .48);

    backdrop-filter: blur(7px);

    -webkit-backdrop-filter: blur(7px);

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transition:
        opacity .25s ease,
        visibility .25s ease;

    z-index: 99999;

}

.modal-calendario.activo {

    opacity: 1;

    visibility: visible;

    pointer-events: auto;

}


/* =========================================================
   CONTENEDOR
   ========================================================= */

.modal-calendario-contenido {

    position: relative;

    width: 720px;

    max-width: 95vw;

    background: #FFFFFF;

    border-radius: 24px;

    padding: 28px;

    box-shadow:
        0 25px 70px rgba(0,0,0,.20);

    transform: translateY(15px) scale(.97);

    transition: transform .25s ease;

}

.modal-calendario.activo
.modal-calendario-contenido {

    transform: translateY(0) scale(1);

}


/* =========================================================
   BOTÓN CERRAR
   ========================================================= */

.calendario-cerrar {

    position: absolute;

    top: 20px;

    right: 20px;

    width: 40px;

    height: 40px;

    border: none;

    border-radius: 12px;

    background: #F3F5F8;

    color: #6F7271;

    cursor: pointer;

    font-size: 17px;

    transition: .2s ease;

}

.calendario-cerrar:hover {

    background: #DF5929;

    color: #FFFFFF;

    transform: scale(1.08);

}


/* =========================================================
   ENCABEZADO
   ========================================================= */

.calendario-encabezado {

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 20px;

    padding-right: 55px;

    margin-bottom: 25px;

}

.calendario-subtitulo {

    display: block;

    margin-bottom: 4px;

    color: #6F7271;

    font-size: 12px;

    font-weight: 600;

    text-transform: uppercase;

    letter-spacing: 1px;

}

.calendario-encabezado h2 {

    margin: 0;

    color: #17375E;

    font-size: 26px;

    font-weight: 800;

}


/* =========================================================
   NAVEGACIÓN
   ========================================================= */

.calendario-navegacion {

    display: flex;

    align-items: center;

    gap: 7px;

}

.calendario-navegacion button {

    height: 38px;

    border: none;

    border-radius: 10px;

    background: #F4F7FB;

    color: #17375E;

    cursor: pointer;

    font-size: 12px;

    font-weight: 600;

    transition: .2s ease;

}

.calendario-navegacion button:hover {

    background: #0075A9;

    color: #FFFFFF;

}

#calendarioAnterior,
#calendarioSiguiente {

    width: 38px;

}

#calendarioHoy {

    padding: 0 15px;

}


/* =========================================================
   DÍAS DE LA SEMANA
   ========================================================= */

.calendario-semana {

    display: grid;

    grid-template-columns:
        repeat(7, 1fr);

    gap: 7px;

    margin-bottom: 7px;

}

.calendario-semana span {

    text-align: center;

    padding: 8px 0;

    color: #6F7271;

    font-size: 11px;

    font-weight: 700;

    text-transform: uppercase;

}


/* =========================================================
   DÍAS
   ========================================================= */

.calendario-dias {

    display: grid;

    grid-template-columns:
        repeat(7, 1fr);

    gap: 7px;

}

.calendario-dia {

    position: relative;

    min-height: 75px;

    padding: 9px;

    border: 1px solid #E8EDF2;

    border-radius: 12px;

    background: #FFFFFF;

    cursor: pointer;

    transition: .2s ease;
  
    min-width: 0;

    padding: 9px;

}

.calendario-dia:hover {

    border-color: #0075A9;

    background: #F7FBFD;

    transform: translateY(-2px);

}

.calendario-dia.otro-mes {

    opacity: .35;

    background: #F7F8FA;

}

.calendario-numero {

    display: flex;

    align-items: center;

    justify-content: center;

    width: 27px;

    height: 27px;

    border-radius: 50%;

    color: #17375E;

    font-size: 12px;

    font-weight: 700;

}


/* =========================================================
   DÍA ACTUAL
   ========================================================= */

.calendario-dia.hoy
.calendario-numero {

    background: #3DAE2B;

    color: #FFFFFF;

}


/* =========================================================
   FERIADO
   ========================================================= */

.calendario-dia.feriado {

    border-color: rgba(223,89,41,.25);

    background: rgba(223,89,41,.05);

}

.calendario-dia.feriado
.calendario-numero {

    color: #DF5929;

}


/* =========================================================
   EVENTOS
   ========================================================= */

.calendario-eventos {

    display: flex;

    flex-direction: column;

    gap: 3px;

    margin-top: 6px;

    overflow: hidden;

}

.calendario-evento {

    padding: 3px 5px;

    border-radius: 5px;

    background: rgba(0,117,169,.10);

    color: #0075A9;

    font-size: 9px;

    font-weight: 700;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;

}

.calendario-feriado-nombre {

    margin-top: 5px;

    color: #DF5929;

    font-size: 9px;

    font-weight: 700;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
  
    min-width: 0;

}


/* =========================================================
   LEYENDA
   ========================================================= */

.calendario-leyenda {

    display: flex;

    align-items: center;

    gap: 20px;

    margin-top: 20px;

    padding-top: 15px;

    border-top: 1px solid #E8EDF2;

    color: #6F7271;

    font-size: 11px;

}

.calendario-leyenda > div {

    display: flex;

    align-items: center;

    gap: 7px;

}

.calendario-punto {

    width: 9px;

    height: 9px;

    border-radius: 50%;

    display: block;

}

.calendario-punto.evento {

    background: #0075A9;

}

.calendario-punto.feriado {

    background: #DF5929;

}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {

    .modal-calendario {

        padding: 12px;

        align-items: center;

    }

    .modal-calendario-contenido {

        width: 100%;

        max-width: 100%;

        padding: 18px;

        border-radius: 20px;

    }

    .calendario-encabezado {

        flex-direction: column;

        align-items: flex-start;

        gap: 12px;

        padding-right: 45px;

        margin-bottom: 15px;

    }

    .calendario-encabezado h2 {

        font-size: 21px;

    }

    .calendario-navegacion {

        width: 100%;

        justify-content: space-between;

    }

    .calendario-dia {

        min-height: 52px;

        padding: 5px;

        border-radius: 8px;

    }

    .calendario-numero {

        width: 24px;

        height: 24px;

        font-size: 10px;

    }

    .calendario-eventos {

        display: none;

    }

    .calendario-feriado-nombre {

        display: none;

    }

    .calendario-leyenda {

        margin-top: 12px;

    }

}

/* =====================================================
   VISTAS DEL CALENDARIO
   ===================================================== */

.calendario-vista {
    display: block;
}

.calendario-vista.oculto {
    display: none;
}


/* =====================================================
   BOTÓN AGREGAR EVENTO
   ===================================================== */

.calendario-acciones {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}


.calendario-btn-agregar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: none;
    border-radius: 10px;
    padding: 10px 15px;
    background: #0075A9;
    color: #ffffff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}


.calendario-btn-agregar:hover {
    background: #00658f;
    transform: translateY(-1px);
}


.calendario-btn-agregar:active {
    transform: translateY(0);
}


/* =====================================================
   FORMULARIO
   ===================================================== */

.calendario-formulario-evento {
    display: none;
    margin-top: 0;
    padding: 8px 0 0;
    background: transparent;
    border: none;
}


.calendario-formulario-evento.visible {
    display: block;
}


/* Encabezado */

.calendario-formulario-encabezado {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 18px;
}


.calendario-formulario-encabezado > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}


.calendario-formulario-encabezado span {
    font-size: 11px;
    font-weight: 700;
    color: #6F7271;
    text-transform: uppercase;
    letter-spacing: .5px;
}


.calendario-formulario-encabezado strong {
    font-size: 17px;
    color: #183B56;
}


#cerrarFormularioEvento {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: #f2f6f8;
    color: #4f5558;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}


#cerrarFormularioEvento:hover {
    background: #e6edf1;
    color: #183B56;
}


/* Campos */

.calendario-formulario-campos {
    display: flex;
    flex-direction: column;
    gap: 13px;
}


.calendario-campo {
    display: flex;
    flex-direction: column;
    gap: 5px;
}


.calendario-campo label {
    font-size: 12px;
    font-weight: 700;
    color: #4f5558;
}


.calendario-campo input,
.calendario-campo textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d8dfe3;
    border-radius: 10px;
    background: #ffffff;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 13px;
    color: #333333;
    outline: none;
}


.calendario-campo input:focus,
.calendario-campo textarea:focus {
    border-color: #0075A9;
    box-shadow: 0 0 0 3px rgba(0, 117, 169, .10);
}


.calendario-campo textarea {
    resize: vertical;
    min-height: 70px;
}


/* Botones */

.calendario-formulario-acciones {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}


.calendario-formulario-acciones button {
    border: none;
    border-radius: 9px;
    padding: 9px 14px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}


#cancelarEventoCalendario {
    background: #e9eef1;
    color: #4f5558;
}


#cancelarEventoCalendario:hover {
    background: #dfe5e8;
}


#guardarEventoCalendario {
    background: #0075A9;
    color: #ffffff;
}


#guardarEventoCalendario:hover {
    background: #00658f;
}


#guardarEventoCalendario:disabled {
    opacity: .6;
    cursor: not-allowed;
}


/* =====================================================
   FORMULARIO — MÓVIL
   ===================================================== */

@media (max-width: 768px) {

    .calendario-formulario-evento {
        margin-top: 12px;
        padding: 14px;
    }

    .calendario-formulario-acciones {
        flex-direction: column-reverse;
    }

    .calendario-formulario-acciones button {
        width: 100%;
    }

}

/* =====================================================
   CALENDARIO — INDICADOR PARA AGREGAR EVENTO
   ===================================================== */

.calendario-dia {
    position: relative;
}


.calendario-dia::after {
    content: "+";

    position: absolute;

    right: 8px;
    bottom: 6px;

    width: 22px;
    height: 22px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #0075A9;
    color: #ffffff;

    font-size: 18px;
    font-weight: 600;
    line-height: 1;

    opacity: 0;
    transform: scale(0.7);

    transition:
        opacity 0.15s ease,
        transform 0.15s ease;

    pointer-events: none;
}


.calendario-dia:hover::after {
    opacity: 1;
    transform: scale(1);
}

/* =====================================================
   CALENDARIO — FORMULARIO ACTIVO
   ===================================================== */

.modal-calendario-contenido.formulario-activo .calendario-encabezado,
.modal-calendario-contenido.formulario-activo .calendario-semana,
.modal-calendario-contenido.formulario-activo .calendario-leyenda {
    display: none;
}

/* =========================================
   VISTA EVENTOS DEL DÍA
   ========================================= */

.calendario-eventos-dia {
    display: none;
    width: 100%;
    animation: calendarioVistaEntrada 0.18s ease;
}

.calendario-eventos-dia.visible {
    display: block;
}

.calendario-eventos-dia-encabezado {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.calendario-eventos-dia-encabezado > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.calendario-eventos-dia-encabezado span {
    font-size: 13px;
    color: #6F7271;
}

.calendario-eventos-dia-encabezado strong {
    font-size: 21px;
    color: #333;
    text-transform: capitalize;
}

#cerrarEventosDia {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: #f1f3f4;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.15s ease;
}

#cerrarEventosDia:hover {
    background: #0075A9;
    color: #fff;
}


/* Lista */

.calendario-eventos-dia-lista {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 4px;
}

.calendario-evento-dia {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e3e6e8;
    border-radius: 10px;
    background: #fff;
}

.calendario-evento-dia-info {
    min-width: 0;
    flex: 1;
}

.calendario-evento-dia-titulo {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    word-break: break-word;
}

.calendario-evento-dia-detalles {
    margin-top: 4px;
    font-size: 12px;
    color: #6F7271;
}

.calendario-evento-dia-descripcion {
    margin-top: 5px;
    font-size: 13px;
    color: #555;
    word-break: break-word;
}


/* Botones editar / eliminar */

.calendario-evento-dia-acciones {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.calendario-evento-dia-acciones button {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.15s ease;
}

.calendario-evento-dia-editar {
    background: #eef6fa;
    color: #0075A9;
}

.calendario-evento-dia-editar:hover {
    background: #0075A9;
    color: #fff;
}

.calendario-evento-dia-eliminar {
    background: #fdf0ed;
    color: #DF5929;
}

.calendario-evento-dia-eliminar:hover {
    background: #DF5929;
    color: #fff;
}


/* Sin eventos */

.calendario-eventos-dia-vacio {
    padding: 30px 20px;
    text-align: center;
    color: #6F7271;
    font-size: 14px;
    border: 1px dashed #d5d9dc;
    border-radius: 10px;
}


/* Agregar evento */

.calendario-eventos-dia-agregar {
    margin-top: 16px;
}

#agregarEventoDesdeDia {
    width: 100%;
    min-height: 42px;
    border: 1px dashed #0075A9;
    border-radius: 9px;
    background: #f7fbfd;
    color: #0075A9;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: 0.15s ease;
}

#agregarEventoDesdeDia:hover {
    background: #0075A9;
    color: #fff;
}


/* Animación */

@keyframes calendarioVistaEntrada {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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


/* Ocultar elementos del calendario mientras se navega
   por una vista secundaria */

.modal-calendario-contenido.vista-secundaria-activa
.calendario-encabezado,
.modal-calendario-contenido.vista-secundaria-activa
.calendario-semana,
.modal-calendario-contenido.vista-secundaria-activa
.calendario-leyenda {
    display: none;
}

.modal-calendario-contenido.vista-secundaria-activa
.calendario-cerrar {
    display: none;
}


/* Móvil */

@media (max-width: 480px) {

    .calendario-eventos-dia-encabezado strong {
        font-size: 18px;
    }

    .calendario-evento-dia {
        align-items: flex-start;
    }

    .calendario-evento-dia-acciones {
        gap: 4px;
    }

    .calendario-evento-dia-acciones button {
        width: 32px;
        height: 32px;
    }

    .calendario-eventos-dia-lista {
        max-height: 260px;
    }
}

/*=====================================
EVENTOS ADICIONALES EN CALENDARIO
=====================================*/

.calendario-eventos-mas {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;

    margin-top: 4px;
    padding: 4px 6px;

    background: #E8F4F9;
    border-radius: 6px;

    color: #0075A9;
    font-size: 11px;
    font-weight: 700;

    cursor: pointer;
    transition: all 0.2s ease;
}

.calendario-eventos-mas::before {
    content: "+";

    display: flex;
    align-items: center;
    justify-content: center;

    width: 16px;
    height: 16px;

    background: #0075A9;
    color: #FFFFFF;

    border-radius: 50%;

    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.calendario-eventos-mas:hover {
    background: #D8EDF5;
    transform: translateY(-1px);
}

/* Ocultar el + de hover cuando hay más de 2 eventos */
.calendario-dia.tiene-muchos-eventos:hover::after {
    opacity: 0;
    transform: scale(.7);
}

@media (max-width: 480px) {

    .calendario-dia.tiene-eventos {
        border-color: #0075A9;
    }

}