/* =========================================================
   SELECTOR DE FECHA
   ---------------------------------------------------------
   El calendario se abre centrado en pantalla (position: fixed)
   para que no lo recorte la tabla con scroll y se vea bien
   también en celular.
========================================================= */


/* =========================================================
   CAMPO (botón que abre el calendario)
========================================================= */

.sf-disparador {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 160px;
    padding: 9px 12px;
    border: 1px solid #e0d5c8;
    border-radius: 10px;
    background: #ffffff;
    color: #a09388;
    font-family: inherit;
    font-size: 0.82rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

    .sf-disparador:hover {
        border-color: #d59a3d;
    }

    .sf-disparador:focus-visible {
        outline: none;
        border-color: #68091b;
        box-shadow: 0 0 0 3px rgba(104, 9, 27, 0.12);
    }

    .sf-disparador.con-valor {
        color: #3e2929;
        font-weight: 600;
    }

.sf-icono {
    color: #e49a20;
}

.sf-texto {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}

.sf-chevron {
    color: #b9ab9b;
    font-size: 0.68rem;
}


/* =========================================================
   FONDO Y VENTANA
========================================================= */

.sf-fondo {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(40, 8, 14, 0.45);
    animation: sfFondo 0.18s ease;
}

.sf-dialogo {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 1051;
    width: min(340px, calc(100vw - 32px));
    overflow: hidden;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(40, 8, 14, 0.35);
    transform: translate(-50%, -50%);
    animation: sfAparecer 0.2s ease;
}


@keyframes sfFondo {

    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


@keyframes sfAparecer {

    from {
        opacity: 0;
        transform: translate(-50%, -47%) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}


/* =========================================================
   CABECERA
========================================================= */

.sf-cabecera {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #7b0b23, #550614);
    color: #ffffff;
}

.sf-cabecera-texto span {
    display: block;
    margin-bottom: 3px;
    color: #e8ad47;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.sf-cabecera-texto strong {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
}

.sf-cerrar {
    width: 32px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s ease;
}

    .sf-cerrar:hover {
        background: rgba(255, 255, 255, 0.28);
    }


/* =========================================================
   CUERPO
========================================================= */

.sf-cuerpo {
    padding: 16px 18px 18px;
}


/* =========================================================
   NAVEGACIÓN DE MES
========================================================= */

.sf-navegacion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.sf-mes {
    color: #68091b;
    font-size: 0.95rem;
    font-weight: 800;
}

.sf-nav {
    width: 34px;
    min-width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ded5c8;
    border-radius: 50%;
    background: #fffdf9;
    color: #68091b;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

    .sf-nav:hover:not(:disabled) {
        border-color: #68091b;
        background: #68091b;
        color: #ffffff;
    }

    .sf-nav:disabled {
        opacity: 0.3;
        cursor: not-allowed;
    }


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

.sf-grilla {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.sf-dia-semana {
    padding: 6px 0;
    color: #a07846;
    font-size: 0.68rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}

.sf-dia {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #493333;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

    .sf-dia:hover:not(:disabled) {
        background: #f8ecd9;
        color: #68091b;
        transform: scale(1.08);
    }

    .sf-dia.hoy {
        box-shadow: inset 0 0 0 2px #e49a20;
    }

    .sf-dia.seleccionado,
    .sf-dia.seleccionado:hover:not(:disabled) {
        background: linear-gradient(135deg, #7b0b23, #550614);
        color: #ffffff;
        box-shadow: 0 4px 10px rgba(104, 9, 27, 0.3);
    }

    .sf-dia:disabled {
        opacity: 0.28;
        cursor: not-allowed;
    }


/* =========================================================
   PIE
========================================================= */

.sf-pie {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #f0e6da;
}

.sf-accion {
    padding: 7px 14px;
    border: none;
    border-radius: 18px;
    background: transparent;
    color: #8a7258;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

    .sf-accion:hover:not(:disabled) {
        background: #f8f1e6;
        color: #68091b;
    }

    .sf-accion:disabled {
        opacity: 0.35;
        cursor: not-allowed;
    }

.sf-accion-principal {
    background: #f8f1e6;
    color: #68091b;
}


/* =========================================================
   RANGO PERMITIDO
========================================================= */

.sf-rango {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 12px;
    padding: 9px 12px;
    border: 1px solid #f0dfc3;
    border-radius: 10px;
    background: #fff8ec;
    color: #7a5a22;
    font-size: 0.72rem;
    line-height: 1.35;
}

    .sf-rango i {
        margin-top: 1px;
        color: #e49a20;
    }


/* =========================================================
   MOVIMIENTO REDUCIDO
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .sf-fondo,
    .sf-dialogo {
        animation: none;
    }

    .sf-disparador,
    .sf-nav,
    .sf-dia,
    .sf-accion,
    .sf-cerrar {
        transition: none;
    }
}
