/**
 * Beach Booking System - Frontend Styles
 *
 * @package BeachBooking
 * @version 1.1.0
 */

/* =========================================================
   PALETTE MAPPING: inherit from Riviera Spineta theme (rs-*)
   with hardcoded fallback so the widget works standalone.
   ========================================================= */
.bb-booking-wrapper {
    --bb-primary:       var(--rs-primary,     #8B2E3B);
    --bb-secondary:     var(--rs-secondary,   #A8936A);
    --bb-bg:            var(--rs-bg,          #F5F0EB);
    --bb-card:          var(--rs-card,        #FFFDF9);
    --bb-text:          var(--rs-text,        #2C1810);
    --bb-text-muted:    var(--rs-text-muted,  #6B5B52);
    --bb-success:       var(--rs-success,     #2F7A4A);
    --bb-error:         var(--rs-error,       #C0392B);
    --bb-radius:        var(--rs-r,           8px);
    --bb-radius-lg:     var(--rs-r-lg,        16px);
    --bb-shadow:        var(--rs-shadow,      0 4px 24px rgba(44,24,16,.10));
    --bb-shadow-lg:     0 8px 40px rgba(44,24,16,.15);
    --bb-font-body:     var(--rs-b-font,      system-ui, -apple-system, 'Segoe UI', sans-serif);
    --bb-font-heading:  var(--rs-h-font,      Georgia, 'Times New Roman', serif);

    /* Legacy aliases kept for backward compat with older CSS blocks */
    --bb-primary-dark:  #7a2434;
    --bb-warning:       #ed8936;
    --bb-danger:        var(--bb-error);
    --bb-border:        rgba(44,24,16,.14);
    --bb-white:         #ffffff;
    --bb-radius-sm:     var(--bb-radius);
    --bb-transition:    all .25s cubic-bezier(.4,0,.2,1);
    --bb-font:          var(--bb-font-body);

    font-family: var(--bb-font-body);
}

.bb-booking-wrapper h2,
.bb-booking-wrapper h3 {
    font-family: var(--bb-font-heading);
    color: var(--bb-primary);
}

/* =========================================================
   CSS VARIABLES (root-level fallback for elements outside wrapper)
   ========================================================= */
:root {
    --bb-primary:       #8B2E3B;
    --bb-primary-dark:  #7a2434;
    --bb-secondary:     #A8936A;
    --bb-success:       #2F7A4A;
    --bb-warning:       #ed8936;
    --bb-danger:        #C0392B;
    --bb-error:         #C0392B;
    --bb-text:          #2C1810;
    --bb-text-muted:    #6B5B52;
    --bb-border:        rgba(44,24,16,.14);
    --bb-bg:            #F5F0EB;
    --bb-card:          #FFFDF9;
    --bb-white:         #ffffff;
    --bb-radius:        8px;
    --bb-radius-sm:     8px;
    --bb-radius-lg:     16px;
    --bb-shadow:        0 4px 24px rgba(44,24,16,.10);
    --bb-shadow-lg:     0 8px 40px rgba(44,24,16,.15);
    --bb-transition:    all .25s cubic-bezier(.4,0,.2,1);
    --bb-font:          system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bb-font-body:     system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bb-font-heading:  Georgia, 'Times New Roman', serif;
}

/* =========================================================
   WRAPPER
   ========================================================= */
.bb-booking-wrapper {
    font-family: var(--bb-font);
    color: var(--bb-text);
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px 60px;
}

/* =========================================================
   HEADER
   ========================================================= */
.bb-booking-header {
    text-align: center;
    padding: 48px 0 32px;
}

.bb-booking-header h2 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--bb-primary), var(--bb-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 8px;
}

.bb-subtitle {
    color: var(--bb-text-muted);
    font-size: 1rem;
    margin: 0;
}

/* =========================================================
   STEP INDICATOR
   ========================================================= */
.bb-steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 40px;
    position: relative;
}

.bb-steps-indicator::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 80px);
    height: 2px;
    background: var(--bb-border);
    z-index: 0;
}

.bb-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    position: relative;
    z-index: 1;
}

.bb-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bb-border);
    color: var(--bb-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .9rem;
    transition: var(--bb-transition);
    border: 3px solid var(--bb-white);
    box-shadow: 0 0 0 2px var(--bb-border);
}

.bb-step.active .bb-step-number,
.bb-step.completed .bb-step-number {
    background: linear-gradient(135deg, var(--bb-primary), var(--bb-secondary));
    color: var(--bb-white);
    box-shadow: 0 0 0 2px var(--bb-primary);
}

.bb-step-label {
    font-size: .75rem;
    font-weight: 600;
    color: var(--bb-text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.bb-step.active .bb-step-label {
    color: var(--bb-primary);
}

/* =========================================================
   STEP CONTENT CARD
   ========================================================= */
.bb-step-content {
    background: var(--bb-white);
    border-radius: var(--bb-radius);
    box-shadow: var(--bb-shadow);
    padding: 36px;
    margin-bottom: 24px;
    border: 1px solid var(--bb-border);
    animation: bbFadeIn .3s ease;
}

@keyframes bbFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bb-step-content h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--bb-text);
    margin: 0 0 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--bb-border);
}

/* =========================================================
   BOOKING TYPE TOGGLE
   ========================================================= */
.bb-booking-type-toggle {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.bb-radio-card {
    flex: 1;
    cursor: pointer;
}

.bb-radio-card input[type="radio"] {
    display: none;
}

.bb-radio-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
    border: 2px solid var(--bb-border);
    border-radius: var(--bb-radius-sm);
    transition: var(--bb-transition);
    text-align: center;
}

.bb-radio-card input:checked + .bb-radio-content {
    border-color: var(--bb-primary);
    background: rgba(102,126,234,.06);
    color: var(--bb-primary);
}

.bb-radio-content strong {
    font-size: .95rem;
    font-weight: 700;
}

.bb-radio-content small {
    font-size: .8rem;
    color: var(--bb-text-muted);
    margin-top: 2px;
}

/* =========================================================
   DATE INPUT
   ========================================================= */
.bb-date-input-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.bb-date-input-wrapper label {
    display: block;
    font-weight: 600;
    font-size: .875rem;
    color: var(--bb-text);
    margin-bottom: 8px;
}

.bb-date-input {
    width: 100%;
    padding: 12px 44px 12px 16px;
    border: 2px solid var(--bb-border);
    border-radius: var(--bb-radius-sm);
    font-size: 1rem;
    font-family: var(--bb-font);
    color: var(--bb-text);
    background: var(--bb-white);
    transition: var(--bb-transition);
    box-sizing: border-box;
    cursor: pointer;
}

.bb-date-input:focus {
    outline: none;
    border-color: var(--bb-primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,.15);
}

.bb-date-icon {
    position: absolute;
    right: 14px;
    bottom: 12px;
    font-size: 1.2rem;
    pointer-events: none;
}

.bb-date-summary {
    background: rgba(102,126,234,.06);
    border: 1px solid rgba(102,126,234,.2);
    border-radius: var(--bb-radius-sm);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: .9rem;
}

.bb-date-summary p {
    margin: 4px 0;
}

/* =========================================================
   MAP CONTROLS
   ========================================================= */
.bb-map-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.bb-zoom-controls {
    display: flex;
    gap: 6px;
}

.bb-btn-icon {
    padding: 8px 14px;
    border: 2px solid var(--bb-border);
    border-radius: var(--bb-radius-sm);
    background: var(--bb-white);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    color: var(--bb-text);
    transition: var(--bb-transition);
}

.bb-btn-icon:hover {
    border-color: var(--bb-primary);
    color: var(--bb-primary);
}

.bb-btn-auto-suggest {
    background: linear-gradient(135deg, var(--bb-primary), var(--bb-secondary));
    color: var(--bb-white) !important;
    border-color: transparent !important;
}

/* =========================================================
   BEACH MAP
   ========================================================= */
.bb-beach-map {
    width: 100%;
    min-height: 400px;
    border: 2px solid var(--bb-border);
    border-radius: var(--bb-radius-sm);
    overflow: hidden;
    position: relative;
    background: linear-gradient(180deg, #87ceeb 0%, #f0e68c 60%, #deb887 100%);
    cursor: grab;
}

.bb-beach-map:active {
    cursor: grabbing;
}

.bb-map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.8);
    gap: 12px;
}

.bb-map-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--bb-border);
    border-top-color: var(--bb-primary);
    border-radius: 50%;
    animation: bbSpin .8s linear infinite;
}

@keyframes bbSpin {
    to { transform: rotate(360deg); }
}

.bb-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.bb-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .8rem;
    color: var(--bb-text-muted);
}

.bb-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.bb-selection-info {
    background: rgba(102,126,234,.06);
    border: 1px solid rgba(102,126,234,.2);
    border-radius: var(--bb-radius-sm);
    padding: 10px 16px;
    margin-top: 12px;
    font-size: .9rem;
}

/* =========================================================
   CONFIGURATION FORM
   ========================================================= */
.bb-form-group {
    margin-bottom: 24px;
}

.bb-form-group label {
    display: block;
    font-weight: 600;
    font-size: .875rem;
    color: var(--bb-text);
    margin-bottom: 8px;
}

.bb-form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--bb-border);
    border-radius: var(--bb-radius-sm);
    font-size: 1rem;
    font-family: var(--bb-font);
    color: var(--bb-text);
    background: var(--bb-white);
    transition: var(--bb-transition);
    box-sizing: border-box;
}

.bb-form-input:focus {
    outline: none;
    border-color: var(--bb-primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,.15);
}

/* Counter */
.bb-counter {
    display: flex;
    align-items: center;
    gap: 0;
    width: fit-content;
    border: 2px solid var(--bb-border);
    border-radius: var(--bb-radius-sm);
    overflow: hidden;
}

.bb-counter-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bb-bg);
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--bb-text);
    transition: var(--bb-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.bb-counter-btn:hover {
    background: var(--bb-primary);
    color: var(--bb-white);
}

.bb-counter-input {
    width: 60px;
    height: 44px;
    border: none;
    border-left: 2px solid var(--bb-border);
    border-right: 2px solid var(--bb-border);
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--bb-text);
    background: var(--bb-white);
    -moz-appearance: textfield;
}

.bb-counter-input::-webkit-outer-spin-button,
.bb-counter-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
}

/* Services Grid */
.bb-services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.bb-service-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid var(--bb-border);
    border-radius: var(--bb-radius-sm);
    cursor: pointer;
    transition: var(--bb-transition);
}

.bb-service-item:hover {
    border-color: var(--bb-primary);
}

.bb-service-item input:checked ~ .bb-service-content {
    color: var(--bb-primary);
}

.bb-service-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bb-service-price {
    font-size: .8rem;
    color: var(--bb-text-muted);
}

/* Customer Info */
.bb-customer-info {
    border-top: 2px solid var(--bb-border);
    padding-top: 24px;
    margin-top: 8px;
}

.bb-customer-info h4 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 20px;
}

/* =========================================================
   PRICE SUMMARY
   ========================================================= */
.bb-price-summary {
    background: linear-gradient(135deg, rgba(102,126,234,.06), rgba(118,75,162,.06));
    border: 1px solid rgba(102,126,234,.2);
    border-radius: var(--bb-radius-sm);
    padding: 20px;
    margin: 24px 0;
}

.bb-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: .95rem;
    border-bottom: 1px solid rgba(102,126,234,.1);
}

.bb-price-row:last-child {
    border-bottom: none;
}

.bb-price-total {
    padding-top: 12px;
    margin-top: 4px;
    font-size: 1.1rem;
    border-top: 2px solid rgba(102,126,234,.2);
    border-bottom: none !important;
}

/* =========================================================
   CHECKOUT
   ========================================================= */
.bb-order-summary {
    background: var(--bb-bg);
    border-radius: var(--bb-radius-sm);
    padding: 20px;
    margin-bottom: 24px;
}

.bb-order-summary h4 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 16px;
}

#bb-payment-element {
    min-height: 200px;
}

.bb-error-message {
    background: rgba(252,92,125,.1);
    border: 1px solid rgba(252,92,125,.3);
    color: #c53030;
    border-radius: var(--bb-radius-sm);
    padding: 12px 16px;
    font-size: .9rem;
    margin-bottom: 16px;
}

/* =========================================================
   SUCCESS MESSAGE
   ========================================================= */
.bb-success-message {
    text-align: center;
    padding: 60px 36px;
    background: var(--bb-white);
    border-radius: var(--bb-radius);
    box-shadow: var(--bb-shadow);
    border: 1px solid var(--bb-border);
}

.bb-success-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.bb-success-message h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--bb-success);
    margin: 0 0 12px;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.bb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: var(--bb-radius-sm);
    font-size: .95rem;
    font-weight: 600;
    font-family: var(--bb-font);
    cursor: pointer;
    transition: var(--bb-transition);
    text-decoration: none;
    min-height: 44px;
}

.bb-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

.bb-btn-primary {
    background: linear-gradient(135deg, var(--bb-primary), var(--bb-secondary));
    color: var(--bb-white);
    box-shadow: 0 4px 14px rgba(102,126,234,.35);
}

.bb-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102,126,234,.45);
}

.bb-btn-secondary {
    background: var(--bb-white);
    color: var(--bb-text);
    border: 2px solid var(--bb-border);
}

.bb-btn-secondary:hover:not(:disabled) {
    border-color: var(--bb-primary);
    color: var(--bb-primary);
}

.bb-btn-success {
    background: linear-gradient(135deg, var(--bb-success), #38a169);
    color: var(--bb-white);
    box-shadow: 0 4px 14px rgba(72,187,120,.35);
}

.bb-btn-success:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(72,187,120,.45);
}

.bb-step-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 2px solid var(--bb-border);
    gap: 12px;
}

.bb-btn-next {
    margin-left: auto;
}

/* =========================================================
   FLATPICKR OVERRIDES
   ========================================================= */
.flatpickr-calendar {
    border-radius: var(--bb-radius) !important;
    box-shadow: var(--bb-shadow-lg) !important;
    border: 1px solid var(--bb-border) !important;
    font-family: var(--bb-font) !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: var(--bb-primary) !important;
    border-color: var(--bb-primary) !important;
}

.flatpickr-day.inRange {
    background: rgba(102,126,234,.15) !important;
    border-color: rgba(102,126,234,.15) !important;
    box-shadow: none !important;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 640px) {
    .bb-step-content {
        padding: 20px 16px;
    }

    .bb-booking-type-toggle {
        flex-direction: column;
    }

    .bb-steps-indicator::before {
        display: none;
    }

    .bb-step-label {
        display: none;
    }

    .bb-step-buttons {
        flex-direction: column-reverse;
    }

    .bb-btn {
        width: 100%;
    }

    .bb-services-grid {
        grid-template-columns: 1fr;
    }

    .bb-map-controls {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
}
