/* -----------------------------------------------------------
   CJRI RESERVAS - HOJA DE ESTILOS PRINCIPAL
   Versión: 2.0.0
   ----------------------------------------------------------- */

/* --- 1. VARIABLES GLOBALES Y PALETA --- */
:root {
    --color-primary: #454734;
    --color-primary-dark: #3a3c2b;
    --color-bg-modal: #F9EDCC;
    --color-text-primary: #454734;
    --color-text-secondary: #6a6d5a;
    --color-text-muted: #8f927d;
    --color-bg-overlay: rgba(10, 25, 47, 0.7);
    --color-bg-input: #ffffff;
    --color-border: #E9DDBB;
    --color-success: #34d399;
    --color-success-bg: #f0fdfa;
    --color-danger: #ef4444;
    --color-danger-bg: #fef2f2;
    --shadow-focus-ring: 0 0 0 3px rgba(69, 71, 52, 0.25);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --border-radius-md: 8px;
    --border-radius-lg: 16px;
    --border-radius-full: 9999px;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* --- 2. OVERLAY Y MODAL --- */
.bricks-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-bg-overlay);
    display: none; /* Se activa con JS (display: flex) */
    justify-content: center;
    align-items: center;
    z-index: 99998;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 1rem;
    box-sizing: border-box;
    font-family: var(--font-sans);
    animation: bricksFadeIn 0.3s ease-out;
}

.bricks-popup-content {
    background-color: var(--color-bg-modal);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 800px;
    position: relative;
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: row; /* Diseño 2 columnas Desktop */
}

/* Animación de entrada */
@keyframes bricksFadeIn {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Botón de Cierre */
.bricks-popup-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-bg-input);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.bricks-popup-close:hover {
    background-color: #fdfbf3;
    color: var(--color-text-primary);
    transform: rotate(90deg);
}

/* --- 3. ESTRUCTURA DE COLUMNAS --- */
.popup-column {
    flex: 1;
}

.popup-column-image {
    order: 1;
    flex: 0 0 40%; /* Ancho fijo imagen desktop */
    position: relative;
}

.popup-product-image {
    width: 100%;
    height: 100%;
    min-height: 550px;
    object-fit: cover;
    display: block;
}

.popup-column-details {
    order: 2;
    flex: 1 1 60%;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

/* --- 4. TIPOGRAFÍA Y CONTENIDO --- */
.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.popup-title {
    margin: 0;
    color: var(--color-text-primary);
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.popup-price {
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
    padding-right: 5rem;
    white-space: nowrap;
    line-height: 1.3;
}

.popup-availability-status {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 1.25rem 0;
    padding: 0.3rem 0.8rem;
    border-radius: var(--border-radius-full);
    display: inline-block;
    width: fit-content;
    line-height: 1.4;
}
.popup-availability-status.disponible { color: var(--color-success); background-color: var(--color-success-bg); }
.popup-availability-status.reservado { color: var(--color-danger); background-color: var(--color-danger-bg); }

.popup-description-wrapper {
    margin-bottom: 1.5rem;
    max-height: 140px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
}

.popup-description {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--color-text-secondary);
}

/* --- 5. FORMULARIOS E INPUTS --- */
.popup-options {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.popup-options label {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--color-text-primary);
    margin: 0;
    display: block;
}

.select-wrapper {
    position: relative;
}
/* Flecha custom para selects */
.select-wrapper::after {
    content: '';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236a6d5a'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd' /%3E%3C/svg%3E");
    background-repeat: no-repeat;
    pointer-events: none;
}

.popup-options select,
.popup-options input[type="text"],
.popup-options input[type="number"] {
    width: 100%;
    padding: 0.85rem 1.1rem;
    font-size: 1.1rem;
    color: var(--color-text-primary);
    background-color: var(--color-bg-input);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    box-sizing: border-box;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.popup-options select:focus,
.popup-options input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-focus-ring);
}

.date-time-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.date-time-grid .span-2 { grid-column: 1 / -1; }

.booking-summary {
    font-size: 1rem;
    color: var(--color-text-primary);
    margin-top: 10px;
    font-style: italic;
    font-weight: 500;
    min-height: 1.2em;
}

.form-hint {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin: 0.25rem 0 0 0;
}

/* --- 6. PARKING --- */
.popup-parking-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--color-bg-input);
    padding: 1.3rem;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--color-border);
}

.parking-details .parking-label {
    font-weight: 600 !important;
    font-size: 1.1rem;
    cursor: pointer;
    margin: 0;
    color: var(--color-text-primary);
}

.parking-details .parking-description-display {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
    display: block;
    margin-top: 2px;
}

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; margin: 0; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--color-border); transition: .3s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .3s cubic-bezier(0.175, 0.885, 0.32, 1.275); border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
input:checked + .slider { background-color: var(--color-primary); }
input:focus-visible + .slider { box-shadow: var(--shadow-focus-ring); }
input:checked + .slider:before { transform: translateX(20px); }

/* --- 7. BOTONES Y FOOTER --- */
.popup-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bricks-popup-checkout-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--color-primary);
    color: var(--color-bg-modal) !important; 
    padding: 1rem 1.5rem;
    text-decoration: none;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 1.15rem;
    transition: background-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: none;
    text-align: center;
    line-height: 1.5;
    width: 100%;
}

.bricks-popup-checkout-button:hover:not(:disabled) {
    background-color: var(--color-primary-dark);
    box-shadow: var(--shadow-md);
}
.bricks-popup-checkout-button:disabled {
    background-color: #a0aec0;
    color: #fff !important;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Spinner de carga */
.bricks-popup-checkout-button .button-loading { display: none; align-items: center; gap: 0.75rem; }
.spinner { animation: rotate 2s linear infinite; width: 1.2em; height: 1.2em; }
.spinner .path { stroke: var(--color-bg-modal); stroke-linecap: round; animation: dash 1.5s ease-in-out infinite; }
@keyframes rotate { 100% { transform: rotate(360deg); } }
@keyframes dash { 0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; } 50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; } 100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; } }

.checkout-note {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    text-align: center;
}

.popup-error-message {
    font-size: 0.95rem;
    color: var(--color-danger);
    background-color: var(--color-danger-bg);
    padding: 0.75rem;
    border-radius: var(--border-radius-md);
    text-align: center;
    font-weight: 500;
    margin: 0.5rem 0 0 0;
}

/* --- 8. PUNTOS INTERACTIVOS (MAPA SVG) --- */
#interactive-layer circle.interactive-point {
    cursor: pointer;
    fill: var(--color-primary) !important;
	stroke: var(--color-primary) !important;
    transition: all 0.2s ease-in-out;
    opacity: 0.8;
    animation: pulse-svg-circle 2s ease-in-out infinite;
}
#interactive-layer circle.interactive-point:hover {
    transform-origin: center;
    opacity: 1;
    animation-play-state: paused;
    r: 14; /* Efecto zoom */
}
#interactive-layer circle.interactive-point.reservado {
    fill: #a0aec0 !important;
    cursor: not-allowed;
    opacity: 0.6;
    animation: none;
}
@keyframes pulse-svg-circle { 
    0% { r: 10; opacity: 0.7; } 
    50% { r: 12; opacity: 1; } 
    100% { r: 10; opacity: 0.7; } 
}


/* --- 9. TEMA PERSONALIZADO FLATPICKR (CALENDARIO) --- */
.flatpickr-calendar {
    background-color: var(--color-bg-input, #FFFFFF);
    border-radius: var(--border-radius-lg, 16px) !important;
    border: 1px solid var(--color-border, #E9DDBB) !important;
    box-shadow: var(--shadow-lg) !important;
    font-family: var(--font-sans, 'Inter', sans-serif);
    width: 320px;
    z-index: 99999 !important; /* Importante: Sobre el modal */
}

.flatpickr-months {
    background-color: var(--color-bg-modal, #F9EDCC);
    border-bottom: 1px solid var(--color-border);
    border-radius: 16px 16px 0 0;
    padding: 0.75rem 1rem;
}

.flatpickr-current-month {
    color: var(--color-text-primary);
    font-weight: 600;
}

.flatpickr-day {
    border-radius: 9999px;
    color: var(--color-text-primary);
}

.flatpickr-day.selected, 
.flatpickr-day.startRange, 
.flatpickr-day.endRange {
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: var(--color-bg-modal) !important;
}

.flatpickr-day.today {
    border-color: var(--color-primary);
}

/* Rangos visuales */
.flatpickr-day.inRange {
    background-color: rgba(69, 71, 52, 0.1);
    border-color: transparent;
    box-shadow: none;
}


/* --- 10. RESPONSIVE DESIGN --- */

/* Tablet (Apilar columnas) */
@media (max-width: 768px) {
    .bricks-popup-content {
        flex-direction: column;
    }
    .popup-column-image {
        flex: 1;
    }
    .popup-product-image {
        height: 220px;
        min-height: 0;
    }
    .popup-column-details {
        flex: 1;
        padding: 2rem;
    }
}

/* Móvil Pequeño */
@media (max-width: 478px) {
    .popup-column-details {
        padding: 1.5rem;
    }
    .popup-title {
        font-size: 1.5rem;
    }
    .popup-price {
        font-size: 1.3rem;
    }
    .bricks-popup-checkout-button {
        font-size: 1rem;
        padding: 0.85rem;
    }
}