/**
 * Estilos del formulario frontend — Reservas Calendar
 *
 * Diseño limpio, flexible y compatible con Elementor.
 * Prefijo "rcal-" en todas las clases.
 * Colores: verde disponible, rojo no disponible, azul noches mínimas, gris valor 0.
 */

/* ──────────────────────────────────────────────
   WRAPPER
────────────────────────────────────────────── */

.rcal-form-wrapper {
    font-family: inherit;
    max-width: 600px;
    width: 100%;
}

.rcal-form-title {
    font-size: 1.15em;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
    color: #1a1a1a;
}

/* ──────────────────────────────────────────────
   GRUPOS DE CAMPOS
────────────────────────────────────────────── */

.rcal-field-group {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
}

.rcal-field {
    flex: 1 1 220px;
    position: relative;
}

.rcal-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.rcal-required {
    color: #e53935;
    margin-left: 2px;
}

.rcal-opcional {
    color: #999;
    font-weight: 400;
    font-size: 11px;
    margin-left: 4px;
    text-transform: none;
}

/* ──────────────────────────────────────────────
   INPUTS
────────────────────────────────────────────── */

.rcal-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    color: #222;
    background: #fff;
    transition: border-color .2s;
    box-sizing: border-box;
}

.rcal-input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25,118,210,.12);
}

.rcal-input.has-error {
    border-color: #e53935;
}

.rcal-date-input-wrap {
    position: relative;
}

.rcal-date-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 16px;
}

/* ──────────────────────────────────────────────
   CONTADORES DE HUÉSPEDES
────────────────────────────────────────────── */

.rcal-counter {
    display: flex;
    align-items: center;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    height: 42px;
}

.rcal-counter-btn {
    background: #f5f5f5;
    border: none;
    width: 40px;
    height: 100%;
    font-size: 18px;
    cursor: pointer;
    color: #333;
    transition: background .15s;
    flex-shrink: 0;
}

.rcal-counter-btn:hover:not(:disabled) {
    background: #e0e0e0;
}

.rcal-counter-btn:disabled {
    color: #bbb;
    cursor: default;
}

.rcal-counter input[type="number"] {
    border: none;
    text-align: center;
    flex: 1;
    height: 100%;
    font-size: 16px;
    font-weight: 600;
    color: #222;
    -moz-appearance: textfield;
    appearance: textfield;
    padding: 0;
}

.rcal-counter input[type="number"]::-webkit-inner-spin-button,
.rcal-counter input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

.rcal-capacity-hint {
    font-size: 11px;
    color: #888;
    margin: 4px 0 0;
}

/* ──────────────────────────────────────────────
   ERRORES DE CAMPO
────────────────────────────────────────────── */

.rcal-field-error {
    font-size: 12px;
    color: #e53935;
    margin-top: 4px;
    min-height: 16px;
}

/* ──────────────────────────────────────────────
   POPUP DEL CALENDARIO
────────────────────────────────────────────── */

.rcal-calendar-popup {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 9999;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    padding: 12px;
    min-width: 280px;
    max-width: 340px;
    user-select: none;
}

/* Navegación del calendario popup */
.rcal-popup-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.rcal-popup-nav button {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}

.rcal-popup-nav button:hover {
    background: #f0f0f0;
}

.rcal-popup-month {
    font-weight: 700;
    font-size: 14px;
    color: #222;
}

/* Días de la semana */
.rcal-popup-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}

.rcal-popup-wd {
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: #888;
    padding: 4px 0;
    text-transform: uppercase;
}

/* Grilla de días */
.rcal-popup-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.rcal-popup-day {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: transform .1s;
    min-height: 36px;
}

/* Estado: disponible */
.rcal-popup-day.disponible {
    background: #e8f5e9;
    color: #2e7d32;
}

.rcal-popup-day.disponible:hover {
    background: #c8e6c9;
    transform: scale(1.08);
}

/* Estado: disponible con noches mínimas > 1 */
.rcal-popup-day.con-minimo {
    background: #e8f5e9;
    color: #2e7d32;
}

.rcal-popup-day.con-minimo .rcal-noches-badge {
    font-size: 9px;
    font-weight: 700;
    color: #1565c0;
    line-height: 1;
}

.rcal-popup-day.con-minimo:hover {
    background: #c8e6c9;
    transform: scale(1.08);
}

/* Estado: no disponible */
.rcal-popup-day.no-disponible {
    background: #e53935;
    color: #fff;
    cursor: default;
    pointer-events: none;
}

/* Estado: noches = 0 */
.rcal-popup-day.sin-checkin {
    background: #eeeeee;
    color: #9e9e9e;
    cursor: default;
    pointer-events: none;
}

/* Estado: pasado */
.rcal-popup-day.pasado {
    opacity: .3;
    cursor: default;
    pointer-events: none;
}

/* Estado: vacío (relleno de semana) */
.rcal-popup-day.vacio {
    background: transparent;
    pointer-events: none;
}

/* Estado: seleccionado */
.rcal-popup-day.seleccionado {
    background: #1976d2 !important;
    color: #fff !important;
    transform: scale(1.08);
}

.rcal-popup-day.seleccionado .rcal-noches-badge {
    color: #bbdefb !important;
}

/* Estado: inhabilitado para checkout */
.rcal-popup-day.checkout-disabled {
    opacity: .35;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Tooltip ── */
.rcal-popup-day[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.82);
    color: #fff;
    font-size: 11px;
    padding: 5px 8px;
    border-radius: 4px;
    white-space: nowrap;
    max-width: 200px;
    white-space: normal;
    text-align: center;
    z-index: 10000;
    pointer-events: none;
}

/* ──────────────────────────────────────────────
   SUBMIT
────────────────────────────────────────────── */

.rcal-submit-group {
    margin-top: 8px;
}

.rcal-btn-submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #25d366;   /* Verde WhatsApp */
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s, transform .1s;
    width: 100%;
    justify-content: center;
}

.rcal-btn-submit::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

.rcal-btn-submit:hover {
    background: #1ebe57;
    transform: translateY(-1px);
}

.rcal-btn-submit:active {
    transform: translateY(0);
}

.rcal-btn-submit:disabled {
    background: #a5d6a7;
    cursor: not-allowed;
    transform: none;
}

/* ── Feedback de envío ── */
.rcal-submit-feedback {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

.rcal-submit-feedback.success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.rcal-submit-feedback.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

/* ──────────────────────────────────────────────
   RESPONSIVE
────────────────────────────────────────────── */

@media ( max-width: 520px ) {
    .rcal-field-group {
        flex-direction: column;
    }

    .rcal-calendar-popup {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
    }
}
