/* asistencias.css — Vista de Asistencias Médicas */

/* ─── Panel con scroll interno ───────────────────────────────────────────── */

#asistenciasPanel {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 172px);
}

/* ─── Tabla ───────────────────────────────────────────────────────────────── */

.asistencias-table-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    border-radius: 14px;
    border: 1px solid var(--hbs-border, #e2e8f0);
}

.asistencias-table-wrap::-webkit-scrollbar { width: 5px; height: 5px; }
.asistencias-table-wrap::-webkit-scrollbar-track { background: transparent; }
.asistencias-table-wrap::-webkit-scrollbar-thumb {
    background: rgba(16, 94, 166, .25);
    border-radius: 999px;
}
.asistencias-table-wrap::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 94, 166, .45);
}

/* ─── Botones de acción por fila ──────────────────────────────────────────── */

.asistencias-row__actions {
    display: flex;
    gap: .3rem;
    align-items: center;
    white-space: nowrap;
}

.asistencias-row__btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: .8rem;
    background: transparent;
    transition: background .15s ease, transform .15s ease;
}

.asistencias-row__btn:hover {
    transform: scale(1.1);
}

.asistencias-row__btn--edit {
    background: rgba(16, 94, 166, .07);
    border-color: rgba(16, 94, 166, .2);
    color: var(--hbs-primary, #105ea6);
}

.asistencias-row__btn--edit:hover {
    background: rgba(16, 94, 166, .15);
}

.asistencias-row__btn--del {
    background: rgba(239, 68, 68, .07);
    border-color: rgba(239, 68, 68, .2);
    color: var(--hbs-danger, #ef4444);
}

.asistencias-row__btn--del:hover {
    background: rgba(239, 68, 68, .15);
}

/* ─── Animación de fila saliente ──────────────────────────────────────────── */

@keyframes asistencias-row-out {
    from { opacity: 1; transform: scaleY(1); }
    to   { opacity: 0; transform: scaleY(0); }
}

.asistencias-row--removing {
    animation: asistencias-row-out .22s ease forwards;
    pointer-events: none;
    transform-origin: top;
}

/* ─── Modal ───────────────────────────────────────────────────────────────── */

.asistencias-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: hbs-fade-in .2s ease both;
}

.asistencias-modal[hidden] {
    display: none;
}

.asistencias-modal__box {
    background: #fff;
    border-radius: 20px;
    padding: 1.75rem;
    max-width: 560px;
    width: 100%;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .25);
    animation: hbs-pop-in .28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    position: relative;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

.asistencias-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: #64748b;
    font-size: .88rem;
    transition: background .15s, transform .2s ease;
}

.asistencias-modal__close:hover {
    background: #e2e8f0;
    transform: rotate(90deg);
}

.asistencias-modal__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 1.25rem;
    padding-right: 2.5rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.asistencias-modal__title i {
    color: var(--hbs-primary, #105ea6);
    font-size: 1rem;
}

/* Grid de 2 columnas para los campos del formulario */
.asistencias-modal__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem 1rem;
}

.asistencias-modal__field {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.asistencias-modal__field--full {
    grid-column: 1 / -1;
}

.asistencias-modal__label {
    font-size: .83rem;
    font-weight: 600;
    color: #374151;
}

.asistencias-modal__label span {
    color: var(--hbs-danger, #ef4444);
}

.asistencias-modal__input,
.asistencias-modal__select {
    padding: .62rem .85rem;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font: inherit;
    font-size: .9rem;
    color: #1e293b;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
}

.asistencias-modal__input:focus,
.asistencias-modal__select:focus {
    border-color: var(--hbs-primary, #105ea6);
    box-shadow: 0 0 0 4px rgba(16, 94, 166, .1);
}

.asistencias-modal__input.is-invalid,
.asistencias-modal__select.is-invalid {
    border-color: var(--hbs-danger, #ef4444);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .1);
}

.asistencias-modal__error {
    font-size: .78rem;
    color: var(--hbs-danger, #ef4444);
    display: flex;
    align-items: center;
    gap: .3rem;
    margin: .6rem 0 0;
}

.asistencias-modal__error[hidden] {
    display: none;
}

.asistencias-modal__footer {
    margin-top: 1.4rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: .65rem;
    justify-content: flex-end;
}

/* ─── Diálogo de confirmación ─────────────────────────────────────────────── */

.asistencias-confirm {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(15, 23, 42, .6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: hbs-fade-in .18s ease both;
}

.asistencias-confirm[hidden] {
    display: none;
}

.asistencias-confirm__box {
    background: #fff;
    border-radius: 18px;
    padding: 2rem 1.75rem 1.5rem;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
    animation: hbs-pop-in .26s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.asistencias-confirm__icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: rgba(239, 68, 68, .1);
    color: var(--hbs-danger, #ef4444);
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    margin: 0 auto .9rem;
}

.asistencias-confirm__title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 .4rem;
}

.asistencias-confirm__body {
    font-size: .88rem;
    color: #64748b;
    margin: 0 0 1.4rem;
    line-height: 1.5;
}

.asistencias-confirm__footer {
    display: flex;
    gap: .65rem;
    justify-content: center;
}

.asistencias-confirm__ok {
    background: var(--hbs-danger, #ef4444);
    color: #fff;
    border-color: var(--hbs-danger, #ef4444);
}

.asistencias-confirm__ok:hover {
    background: #dc2626;
    border-color: #dc2626;
}

/* ─── Toast ───────────────────────────────────────────────────────────────── */

@keyframes asistencias-toast-in {
    from { opacity: 0; transform: translateY(12px) scale(.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes asistencias-toast-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(6px) scale(.97); }
}

.asistencias-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1200;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .75rem 1.1rem;
    background: #1e293b;
    color: #fff;
    border-radius: 12px;
    font-size: .9rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
    animation: asistencias-toast-in .3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    max-width: min(340px, calc(100vw - 3rem));
}

.asistencias-toast[hidden] {
    display: none;
}

.asistencias-toast__icon {
    font-size: 1rem;
    color: var(--hbs-success, #10b981);
    flex-shrink: 0;
}

.asistencias-toast--error .asistencias-toast__icon {
    color: #f87171;
}

.asistencias-toast.is-hiding {
    animation: asistencias-toast-out .22s ease forwards;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    #asistenciasPanel {
        max-height: 55vh;
    }

    .asistencias-modal__grid {
        grid-template-columns: 1fr;
    }

    .asistencias-modal__field--full {
        grid-column: 1;
    }

    .asistencias-modal__box {
        border-radius: 16px;
        padding: 1.35rem;
    }

    .asistencias-confirm__box {
        border-radius: 14px;
        padding: 1.5rem 1.25rem 1.25rem;
    }

    .asistencias-toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}
