/**
 * Respiraccion Booking Widget - Premium Styles
 * Following CREATION-STYLES.md brand guidelines
 */

/* ===================================
   CSS Variables - Respiracción Palette
   =================================== */
:root {
    /* Primary Colors */
    --rb-calma: #79afd2;
    --rb-dinamismo: #25c2f2;
    --rb-marino: #022859;
    --rb-corporativo: #295a99;
    --rb-dorado: #ae873e;

    /* Button Colors (Botón Perfecto) */
    --rb-btn-bg: #E1C9A6;
    --rb-btn-border: #C8A87E;
    --rb-btn-text: #2A3D4F;

    /* UI Colors */
    --rb-bg-light: #F0F8FF;
    --rb-text: #2A3D4F;
    --rb-text-light: #6b7280;
    --rb-white: #ffffff;
    --rb-border: rgba(121, 175, 210, 0.25);

    /* Shadows & Effects */
    --rb-shadow: 0 8px 32px rgba(2, 40, 89, 0.1);
    --rb-shadow-hover: 0 12px 48px rgba(37, 194, 242, 0.15);
    --rb-glow: 0 0 20px rgba(37, 194, 242, 0.2);
}

/* ===================================
   Main Container - Glassmorphism
   =================================== */
.respiraccion-booking-widget {
    background: linear-gradient(145deg,
            rgba(121, 175, 210, 0.08) 0%,
            rgba(2, 40, 89, 0.04) 50%,
            rgba(37, 194, 242, 0.06) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--rb-border);
    border-radius: 24px;
    padding: 32px;
    max-width: 900px;
    margin: 24px auto;
    box-shadow: var(--rb-shadow);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    position: relative;
    overflow: hidden;
}

/* Shine effect on top */
.respiraccion-booking-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.5) 50%,
            transparent 100%);
}

/* ===================================
   Header
   =================================== */
.booking-header {
    text-align: center;
    margin-bottom: 28px;
}

.booking-header h2 {
    color: var(--rb-marino);
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    font-family: 'Montserrat', sans-serif;
}

.booking-duration {
    color: var(--rb-text-light);
    font-size: 0.95rem;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.booking-duration .icon {
    font-size: 1.1rem;
}

/* ===================================
   Two Column Layout - Calendar Wider
   =================================== */
.booking-main {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
}

.booking-calendar-panel,
.booking-slots-panel {
    background: var(--rb-white);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(121, 175, 210, 0.15);
    transition: all 0.3s ease;
}

.booking-calendar-panel:hover,
.booking-slots-panel:hover {
    border-color: rgba(37, 194, 242, 0.3);
    box-shadow: 0 6px 24px rgba(37, 194, 242, 0.1);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.step-badge {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--rb-dinamismo) 0%, var(--rb-calma) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37, 194, 242, 0.3);
}

.panel-header h3 {
    color: var(--rb-corporativo);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

/* ===================================
   Calendar Styles (Flatpickr Override)
   =================================== */
.calendar-wrapper {
    margin-bottom: 16px;
}

.flatpickr-calendar {
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
    font-family: inherit !important;
}

.flatpickr-innerContainer,
.flatpickr-rContainer,
.flatpickr-days {
    width: 100% !important;
}

.dayContainer {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    gap: 4px;
}

.flatpickr-day {
    max-width: none !important;
    width: 100% !important;
    height: 42px !important;
    line-height: 42px !important;
    border-radius: 8px !important;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border: 2px solid transparent !important;
    color: var(--rb-text);
}

.flatpickr-day.available-day {
    background: linear-gradient(135deg, rgba(37, 194, 242, 0.08) 0%, rgba(121, 175, 210, 0.12) 100%);
    border-color: var(--rb-calma) !important;
    color: var(--rb-corporativo);
    font-weight: 600;
}

.flatpickr-day.available-day:hover {
    background: linear-gradient(135deg, var(--rb-dinamismo) 0%, var(--rb-calma) 100%) !important;
    border-color: var(--rb-dinamismo) !important;
    color: white !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(37, 194, 242, 0.3);
}

.flatpickr-day.selected {
    background: linear-gradient(135deg, var(--rb-dinamismo) 0%, var(--rb-calma) 100%) !important;
    border-color: var(--rb-dinamismo) !important;
    color: white !important;
    box-shadow: 0 4px 16px rgba(37, 194, 242, 0.35);
}

.flatpickr-day.flatpickr-disabled {
    color: #ccd6dd !important;
    background: transparent !important;
    border-color: transparent !important;
}

.flatpickr-day.today:not(.selected) {
    border-color: var(--rb-dorado) !important;
    background: rgba(174, 135, 62, 0.1);
    color: var(--rb-dorado);
}

.flatpickr-months {
    position: relative;
    padding-bottom: 10px;
    align-items: center;
}

.flatpickr-current-month {
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: var(--rb-marino) !important;
    padding-top: 5px !important;
    height: auto !important;
}

.flatpickr-weekday {
    color: var(--rb-calma) !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    text-transform: uppercase;
}

.flatpickr-prev-month,
.flatpickr-next-month {
    fill: var(--rb-corporativo) !important;
}

.flatpickr-prev-month:hover svg,
.flatpickr-next-month:hover svg {
    fill: var(--rb-dinamismo) !important;
}

/* Calendar Legend */
.calendar-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--rb-text-light);
    font-size: 0.8rem;
    margin: 0;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    background: linear-gradient(135deg, rgba(37, 194, 242, 0.3) 0%, rgba(121, 175, 210, 0.4) 100%);
    border: 2px solid var(--rb-calma);
}

/* ===================================
   Slots Panel (Right Side)
   =================================== */
.slots-empty-state {
    text-align: center;
    padding: 40px 16px;
    color: var(--rb-text-light);
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.slots-empty-state p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.selected-date-label {
    color: var(--rb-marino);
    font-size: 1rem;
    margin: 0 0 16px 0;
    text-transform: capitalize;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rb-border);
}

.slots-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Custom scrollbar */
.slots-list::-webkit-scrollbar {
    width: 4px;
}

.slots-list::-webkit-scrollbar-track {
    background: rgba(121, 175, 210, 0.1);
    border-radius: 2px;
}

.slots-list::-webkit-scrollbar-thumb {
    background: var(--rb-calma);
    border-radius: 2px;
}

/* Base Slot Style - Matching Boton Perfecto */
.slot-btn {
    background: var(--color-beige-claro-boton) !important;
    border: 2px solid var(--color-beige-oscuro-borde-boton) !important;
    border-radius: 25px;
    /* Matching global button radius */
    padding: 14px 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--color-azul-grisaceo-texto-boton) !important;
    margin-bottom: 8px;
    /* Spacing */
}

/* Hover Slot Style - Matching Boton Perfecto Hover */
.slot-btn:hover {
    background: var(--color-beige-oscuro-borde-boton) !important;
    border-color: var(--color-primario-principal-calma) !important;
    color: var(--color-blanco-puro) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(200, 168, 126, 0.3);
}

.slot-btn:hover .slot-time {
    color: inherit;
}

.slot-btn:hover .slot-duration {
    background: rgba(255, 255, 255, 0.2);
    color: inherit;
}

/* Selected Slot Style - Explicit Match to Boton Perfecto */
.slot-btn.selected {
    background: var(--color-beige-claro-boton) !important;
    border: 2px solid var(--color-beige-oscuro-borde-boton) !important;
    color: var(--color-azul-grisaceo-texto-boton) !important;
    box-shadow: none !important;
}

.slot-btn.selected:hover {
    background: var(--color-beige-oscuro-borde-boton) !important;
    border-color: var(--color-primario-principal-calma) !important;
    color: var(--color-blanco-puro) !important;
}

.slot-btn .slot-time {
    font-size: 1.1rem;
    font-weight: 700;
    color: inherit !important;
}

.slot-btn.selected .slot-duration {
    background: rgba(42, 61, 79, 0.1);
    color: inherit;
}

/* Back to Calendar Button - Handled by style.css (.boton-perfecto style) */
.back-to-calendar {
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    padding: 8px 16px;
    margin-left: auto;
    border-radius: 25px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-transform: none;
}

.back-to-calendar:hover {
    transform: translateY(-2px);
}

.booking-summary-card {
    background: linear-gradient(135deg, rgba(37, 194, 242, 0.06) 0%, rgba(121, 175, 210, 0.1) 100%);
    border-left: 4px solid var(--rb-dinamismo);
    border-radius: 12px;
    padding: 18px 22px;
    margin-bottom: 24px;
}

.summary-text {
    margin: 0;
    font-size: 1.05rem;
    color: var(--rb-text);
}

.summary-duration {
    color: var(--rb-text-light);
    font-size: 0.85rem;
}

.booking-form .form-row {
    margin-bottom: 20px;
}

.booking-form label {
    display: block;
    color: var(--rb-text);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.booking-form .optional {
    font-weight: 400;
    color: var(--rb-text-light);
    font-size: 0.85rem;
}

.booking-form input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--rb-border);
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s ease;
    box-sizing: border-box;
    background: var(--rb-white);
}

.booking-form input:focus {
    outline: none;
    border-color: var(--rb-dinamismo);
    box-shadow: 0 0 0 4px rgba(37, 194, 242, 0.12);
}

.booking-form input::placeholder {
    color: #a0aec0;
}

/* ===================================
   Botón Perfecto 2 (Cyan Gradient - CTA Style)
   =================================== */
.btn-confirmar {
    width: 100%;
    padding: 16px 28px;
    background: linear-gradient(135deg, #25c2f2 0%, #79afd2 100%) !important;
    border: 2px solid #25c2f2 !important;
    color: white !important;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    box-shadow: 0 4px 15px rgba(37, 194, 242, 0.3);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.btn-confirmar:hover:not(:disabled) {
    background: linear-gradient(135deg, #79afd2 0%, #295a99 100%) !important;
    border-color: #79afd2 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 194, 242, 0.4);
}

.btn-confirmar:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-loading .spinner {
    width: 22px;
    height: 22px;
    border-color: rgba(42, 61, 79, 0.25);
    border-top-color: var(--rb-btn-text);
    display: inline-block;
}

/* ===================================
   Success Panel
   =================================== */
.booking-success-panel {
    text-align: center;
    padding: 48px 24px;
    background: var(--rb-white);
    border-radius: 16px;
    border: 1px solid rgba(121, 175, 210, 0.15);
}

.success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--rb-dinamismo) 0%, var(--rb-calma) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    margin: 0 auto 24px;
    animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 8px 24px rgba(37, 194, 242, 0.35);
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.booking-success-panel h3 {
    color: var(--rb-corporativo);
    font-size: 1.6rem;
    margin: 0 0 12px;
    font-weight: 700;
}

.success-details {
    font-size: 1.15rem;
    color: var(--rb-text);
    margin: 0 0 8px;
}

.success-note {
    color: var(--rb-text-light);
    margin: 0 0 28px;
    font-size: 0.95rem;
}

.btn-secondary {
    display: inline-block;
    padding: 14px 32px;
    background: transparent;
    border: 2px solid var(--rb-calma);
    color: var(--rb-corporativo);
    border-radius: 25px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--color-beige-oscuro-borde-boton) !important;
    border-color: var(--color-primario-principal-calma) !important;
    color: var(--color-blanco-puro) !important;
    box-shadow: 0 4px 16px rgba(200, 168, 126, 0.3);
}

/* ===================================
   Responsive - Tablet
   =================================== */
@media (max-width: 768px) {
    .respiraccion-booking-widget {
        padding: 20px 16px;
        margin: 16px 10px;
        border-radius: 20px;
    }

    .booking-main {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .booking-calendar-panel,
    .booking-slots-panel {
        padding: 18px;
    }

    .slots-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        max-height: none;
        gap: 8px;
    }

    .slot-btn {
        flex-direction: column;
        text-align: center;
        padding: 12px 8px;
        gap: 4px;
    }

    .slot-btn .slot-duration {
        display: none;
    }

    .flatpickr-day {
        height: 38px !important;
        line-height: 38px !important;
        font-size: 0.9rem;
    }

    .booking-header h2 {
        font-size: 1.4rem;
    }

    .panel-header h3 {
        font-size: 1rem;
    }
}

/* ===================================
   Responsive - Mobile Small
   =================================== */
@media (max-width: 480px) {
    .respiraccion-booking-widget {
        padding: 16px 12px;
        margin: 12px 8px;
    }

    .booking-calendar-panel,
    .booking-slots-panel {
        padding: 14px;
    }

    .slots-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .flatpickr-day {
        height: 34px !important;
        line-height: 34px !important;
        font-size: 0.85rem;
    }

    .step-badge {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .booking-form input {
        padding: 12px 14px;
    }

    .btn-confirmar {
        padding: 14px 24px;
        font-size: 1rem;
    }
}

/* Fully Booked / Unavailable override */
.flatpickr-day.fully-booked {
    text-decoration: line-through;
    opacity: 0.5;
    pointer-events: none;
}