/* ================================================
   Rediseño Moderno - Barra de Reservas
   ================================================ */

* {
    box-sizing: border-box;
}

.calendario-reservas-wrapper {
    width: 100%;
    padding: 0;
    background: transparent;
}

.calendario-reservas-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    display: none;
}

/* ================================================
   FORMULARIO - ESTILOS GENERALES
   ================================================ */

#reservation-form {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 16px;
    padding: 24px;
    background: linear-gradient(135deg, #ffffff 0%, #fafaf8 100%);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(198, 159, 22, 0.1);
    margin-bottom: 24px;
}

/* En modal - ajustes responsivos */
.calendar-modal-content #reservation-form {
    gap: 16px;
    padding: 20px;
    grid-template-rows: auto auto auto;
    align-items: center;
}

.calendar-modal-content #reservation-form .btn-search {
    grid-column: auto;
    grid-row: auto;
    margin-left: 0;
}

@media (max-width: 768px) {
    #reservation-form {
        display: flex;
        flex-direction: column;
    }

    #reservation-form .form-row {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    #reservation-form .form-field {
        width: 100%;
        flex: none;
        min-width: auto;
    }

    #reservation-form .form-field-group {
        flex-direction: column;
        flex: none;
        width: 100%;
    }

    #reservation-form .form-field-group .form-field {
        flex: none;
        width: 100%;
    }

    #reservation-form .btn-search {
        grid-column: 1;
        width: 100%;
        margin-left: 0;
    }

    .form-row-button {
        grid-column: auto;
        grid-row: auto;
        width: 100%;
        margin-top: 8px;
    }

    .calendar-modal-content #reservation-form .btn-search {
        width: 100%;
    }

    .calendar-modal-content #reservation-form {
        padding: 16px;
        gap: 8px;
        align-items: start;
    }

    .calendars-container {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .calendar-modal-content {
        padding: 24px;
        width: 95%;
    }

    .calendar-legend {
        flex-wrap: wrap;
        gap: 16px;
    }

    .form-input {
        font-size: 14px;
    }
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.form-row-button {
    display: flex;
    align-items: center;
    justify-content: center;
    grid-column: 2;
    grid-row: 1 / 4;
    align-self: end;
}

.tp-caption .form-row {
    gap: 8px;
}

.form-row-personal {
    justify-content: flex-start;
    grid-column: 1;
    grid-row: 1;
}

.form-row-dates {
    justify-content: flex-start;
    grid-column: 1;
    grid-row: 2;
}

/* ================================================
   CAMPOS DE ENTRADA
   ================================================ */

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 180px;
}

.tp-caption .form-field {
    min-width: 150px;
    gap: 4px;
}

.form-field-group {
    display: flex;
    gap: 12px;
    flex: 2;
}

.form-field-group .form-field {
    flex: 1;
}

.form-label {
    font-size: 11px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
}

.tp-caption .form-label {
    font-size: 9px;
}

.form-input {
    padding: 10px 12px;
    font-size: 13px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #ffffff;
    color: #333;
    transition: all 0.3s ease;
    font-family: inherit;
    height: 40px;
    line-height: 20px;
    vertical-align: middle;
}

.tp-caption .form-input {
    padding: 8px 10px;
    font-size: 12px;
    height: 36px;
    line-height: 18px;
}

.form-input:focus {
    outline: none;
    border-color: #C69F16;
    box-shadow: 0 0 0 3px rgba(198, 159, 22, 0.1);
}

.form-input::placeholder {
    color: #bbb;
}

.form-input[readonly] {
    background: #f9f9f9;
    cursor: pointer;
}

select.form-input {
    cursor: pointer;
    appearance: none;
    padding-right: 24px;
    padding-left: 12px;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2.5'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 4px center;
    background-size: 14px;
}

/* ================================================
   BOTÓN DE BÚSQUEDA
   ================================================ */

.btn-search {
    padding: 8px 16px;
    background: linear-gradient(135deg, #128C7E 0%, #0f6b5c 100%);
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 36px;
    line-height: 20px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(18, 140, 126, 0.3);
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: center;
    margin-left: 16px;
}

.tp-caption .btn-search {
    padding: 8px 16px;
    font-size: 10px;
    height: 36px;
    line-height: 18px;
    margin-left: 12px;
}

.btn-search:hover {
    background: linear-gradient(135deg, #0f6b5c 0%, #0a4a40 100%);
    box-shadow: 0 4px 12px rgba(18, 140, 126, 0.4);
    transform: translateY(-2px);
}

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

/* ================================================
   MODAL DEL CALENDARIO
   ================================================ */

.calendar-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.calendar-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.calendar-modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    padding: 32px;
    max-width: 1050px;
    width: 95%;
    max-height: 95vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s ease;
}

@media (max-width: 768px) {
    .calendar-modal-content {
        padding: 48px 20px 20px 20px;
        width: 98%;
        display: flex;
        flex-direction: column;
    }

    .calendar-modal-content > * {
        flex-shrink: 0;
    }

    .calendar-modal-content .calendar-actions {
        flex-shrink: 0;
        margin-top: auto;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.calendar-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

@media (max-width: 768px) {
    .calendar-modal-close {
        top: 12px;
        right: 12px;
        font-size: 24px;
    }
}

.calendar-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* ================================================
   CONTROLES DEL CALENDARIO
   ================================================ */

.calendar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

@media (max-width: 768px) {
    .calendar-controls {
        margin-bottom: 16px;
        gap: 8px;
    }
}

.btn-nav {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: all 0.2s ease;
}

.btn-nav:hover {
    background: #C69F16;
    border-color: #C69F16;
    color: #ffffff;
}

.months-label {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* ================================================
   CONTENEDOR DE CALENDARIOS
   ================================================ */

.calendars-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 24px;
    overflow-y: auto;
    flex: 1;
}

.calendar-month {
    display: flex;
    flex-direction: column;
}

.calendar-header {
    margin-bottom: 16px;
}

.calendar-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

/* ================================================
   GRID DEL CALENDARIO
   ================================================ */

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

.day-header {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    padding: 8px 0;
    letter-spacing: 0.5px;
}

.days-container {
    display: contents;
}

/* ================================================
   DÍAS DEL CALENDARIO
   ================================================ */

.dia {
    aspect-ratio: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    border-radius: 6px !important;
    cursor: default !important;
    border: 1px solid transparent !important;
    transition: all 0.2s ease !important;
    font-weight: 500 !important;
}

.dia.vacio {
    background: transparent !important;
    cursor: default !important;
}

.dia.no-disponible {
    background-color: #f5f5f5 !important;
    color: #ccc !important;
    cursor: not-allowed !important;
}

.dia.disponible {
    background-color: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    color: #333 !important;
    cursor: pointer !important;
}

.dia.disponible:hover {
    border-color: #C69F16 !important;
    background-color: #fafaf8 !important;
}

.dia.preReserva {
    background-color: #ffc107 !important;
    color: #333 !important;
    cursor: not-allowed !important;
    font-weight: 600 !important;
}

.dia.reservada {
    background-color: #e74c3c !important;
    color: #ffffff !important;
    cursor: not-allowed !important;
    font-weight: 600 !important;
}

.dia.seleccionado {
    background: linear-gradient(135deg, #C69F16 0%, #b38f13 100%) !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(198, 159, 22, 0.3) !important;
}

.dia.en-rango {
    background-color: rgba(198, 159, 22, 0.15) !important;
    border-color: #C69F16 !important;
    color: #333 !important;
}

.dia.hoy {
    border: 2px solid #C69F16 !important;
}

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

.calendar-legend {
    display: flex;
    gap: 24px;
    justify-content: flex-start;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* ================================================
   ACCIONES DEL CALENDARIO
   ================================================ */

.calendar-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.btn-accept {
    padding: 10px 32px;
    background: linear-gradient(135deg, #C69F16 0%, #b38f13 100%);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(198, 159, 22, 0.2);
}

.btn-accept:hover {
    background: linear-gradient(135deg, #b38f13 0%, #a17f10 100%);
    box-shadow: 0 4px 12px rgba(198, 159, 22, 0.3);
    transform: translateY(-2px);
}

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

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-color.disponible {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
}

.legend-color.preReserva {
    background-color: #ffc107;
}

.legend-color.reservada {
    background-color: #e74c3c;
}

.legend-text {
    font-weight: 500;
    color: #333;
}

/* ================================================
   BOTÓN ABRIR RESERVA (HERO SLIDE)
   ================================================ */

#btn-abrir-reserva {
    background-color: #FFD700 !important;
    color: #000000 !important;
}

/* ================================================
   NOTIFICACIONES
   ================================================ */

.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.notification {
    margin-bottom: 12px;
    border-radius: 8px;
    animation: slideInRight 0.4s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    position: relative;
}

.notification-error {
    background-color: #fee;
    border-left: 4px solid #e74c3c;
    color: #c0392b;
}

.notification-success {
    background-color: #efe;
    border-left: 4px solid #27ae60;
    color: #229954;
}

.notification-info {
    background-color: #eef;
    border-left: 4px solid #3498db;
    color: #2980b9;
}

.notification-warning {
    background-color: #fef3e6;
    border-left: 4px solid #f39c12;
    color: #d68910;
}

.notification-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.notification-text {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.notification-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.notification-close:hover {
    opacity: 1;
}

/* ================================================
   RESPONSIVE - NO USAR ESTA SECCIÓN, VER ARRIBA
   ================================================ */

/* ================================================
   MODAL DE PAGO PAYPAL
   ================================================ */

#modal-pago-paypal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

#modal-pago-paypal > div {
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-height: 80vh;
    overflow-y: auto;
}

#modal-pago-paypal > div > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

#modal-pago-paypal h2 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

#modal-pago-paypal .close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

#resumen-pago {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

#resumen-pago > div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

#resumen-pago > div span {
    color: #666;
}

#resumen-pago > div:last-child {
    border-top: 1px solid #ddd;
    padding-top: 10px;
    font-size: 18px;
}

#resumen-total {
    color: #2c3e50;
}

/* ================================================
   FORMULARIO - MODAL ESPECÍFICA
   ================================================ */

#calendar-modal-form .form-label {
    font-size: 14px !important;
    font-weight: 600 !important;
}

#calendar-modal-form .form-input {
    font-size: 14px !important;
    padding: 12px !important;
    height: auto !important;
}

#calendar-modal-form select.form-input {
    padding: 10px !important;
}

/* ================================================
   BOTONES DEL FORMULARIO
   ================================================ */

.form-row-button {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

#btn-apartar-whatsapp {
    background-color: #25D366 !important;
    border-color: #25D366 !important;
    width: 100%;
}

#btn-apartar-whatsapp:hover {
    background: linear-gradient(135deg, #1e9a56 0%, #17753f 100%) !important;
}

#btn-buscar {
    width: 100%;
}

/* ================================================
   MENSAJES DEL FORMULARIO
   ================================================ */

#dias-mensaje {
    margin: 20px 0;
    padding: 15px;
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    display: none;
}

#dias-mensaje p {
    margin: 0;
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

#dias-mensaje p:last-child {
    margin: 8px 0 0 0;
    color: #666;
    font-size: 12px;
    font-weight: normal;
}

#minimo-noches-mensaje {
    background-color: #e3f2fd;
    border-left: 4px solid #1976D2;
    padding: 10px 12px;
    margin-bottom: 15px;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    text-align: center;
}

.precio-temporada-mensaje {
    background-color: #f5f5f5;
    border-left: 4px solid #999;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: 4px;
    font-size: 13px;
    color: #666;
    text-align: center;
    transition: all 0.3s ease;
    grid-column: 2;
    grid-row: 1 / 3;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.precio-temporada-mensaje strong {
    font-weight: 600;
}

/* ================================================
   RESPONSIVE - NO USAR ESTA SECCIÓN, VER ARRIBA
   ================================================ */

@media (max-width: 480px) {
    .form-input {
        height: 40px;
        padding: 10px 12px;
        font-size: 13px;
    }

    .calendar-grid {
        gap: 2px;
    }

    .dia {
        font-size: 11px;
    }

    .calendar-modal-content {
        padding: 16px;
    }

    .calendar-controls {
        margin-bottom: 16px;
        gap: 8px;
    }

    .months-label {
        font-size: 14px;
    }

    .calendar-legend {
        flex-direction: column;
        gap: 8px;
    }

    #reservation-form {
        padding: 12px;
    }

    .form-label {
        font-size: 10px;
    }
}

/* ================================================
   MODAL DE RESERVA - LAYOUT DE 2 COLUMNAS
   (Escritorio: formulario | resumen de precio)
   ================================================ */

.reserva-modal-content {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px 30px;
    align-items: flex-start;
    overflow-x: hidden;
}

/* Título del modal (mismo estilo que el del calendario) */
.reserva-modal-title {
    flex: 0 0 100%;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-right: 40px;
}

.reserva-modal-title i {
    color: #c19b76;
}

.reserva-col {
    flex: 1 1 0;
    min-width: 0;
}

.reserva-col-resumen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 400px;
}

.precio-temporada-mensaje--modal {
    border: none;
    padding: 0;
    background-color: transparent;
}

#precio-temporada-texto {
    display: block;
    width: 100%;
}

.form-row-button--modal {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* .btn-search trae margin-left/grid-* pensados para la barra horizontal */
.form-row-button--modal .btn-search {
    width: 100%;
    margin-left: 0;
}

/* Desglose de precios generado por JS */
.desglose-precio {
    font-size: 12px;
    line-height: 1.8;
}

.desglose-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

/* ================================================
   MODAL DE RESERVA - PANTALLAS MEDIANAS (<= 991px)
   Las columnas se apilan: formulario -> precio -> botones
   ================================================ */

@media (max-width: 991px) {
    .reserva-modal-content {
        flex-direction: column;
        /* Con direction:column, wrap partiría el contenido en columnas
           laterales al topar con el max-height del modal. */
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 16px;
    }

    .reserva-modal-title {
        flex: 0 0 auto;
        width: 100%;
    }

    /* Sin esto los hijos con flex-basis 0 se comprimen en vertical
       y el contenido del precio se desborda sobre los botones. */
    .reserva-col {
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
    }

    .reserva-col-resumen {
        min-height: 0;
        justify-content: flex-start;
    }

    .reserva-modal-content .precio-temporada-mensaje {
        display: block;
        min-height: 0;
        margin-bottom: 0;
    }

    .calendar-modal-content #reservation-form {
        margin-bottom: 0;
    }
}

/* ================================================
   MODAL DE RESERVA - PANTALLAS PEQUEÑAS (<= 768px)
   ================================================ */

@media (max-width: 768px) {
    /* Se ancla arriba con un margen para que la X no quede pegada
       a la barra de direcciones del navegador móvil. */
    #calendar-modal-form.calendar-modal.active {
        align-items: flex-start;
        padding: 24px 0 20px 0;
    }

    .reserva-modal-content {
        padding: 44px 16px 20px 16px;
        width: 96%;
        max-height: calc(100vh - 84px);
        max-height: calc(100dvh - 84px);
        gap: 14px;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .form-row-button--modal {
        margin-top: 4px;
        gap: 10px;
    }

    /* Botones cómodos para tocar y con texto que puede ocupar 2 líneas */
    .form-row-button--modal .btn-search {
        width: 100%;
        height: auto;
        min-height: 48px;
        padding: 12px 14px;
        white-space: normal;
        line-height: 1.3;
        font-size: 12px;
        margin-left: 0;
    }

    .desglose-precio {
        font-size: 13px;
        line-height: 1.6;
    }
}

/* ================================================
   MODAL DE RESERVA - MÓVIL (<= 600px)
   El desglose pasa a una sola columna
   ================================================ */

@media (max-width: 600px) {
    .desglose-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 14px;
    }

    .desglose-grid > div {
        padding: 12px !important;
    }

    .reserva-modal-content {
        padding: 44px 14px 18px 14px;
        width: 96%;
        max-height: calc(100vh - 84px);
        max-height: calc(100dvh - 84px);
        border-radius: 14px;
    }
}
