/**
 * Dublin Booking Widget - Styles
 *
 * Refined styling for the Panoramic Ireland booking widget.
 * Warm amber / dark palette, flat surfaces, reduced weight.
 *
 * @package    Booking-System
 * @version    1.1.0
 */

/* ========================================
   COLOUR TOKENS
   ======================================== */

:root {
    --pi-dark:       #1a1a1a;
    --pi-dark-mid:   #2d2d2d;
    --pi-amber:      #BA7517;
    --pi-amber-mid:  #EF9F27;
    --pi-amber-light:#FAC775;
    --pi-amber-pale: #FAEEDA;
    --pi-amber-text: #412402;
    --pi-amber-sub:  #633806;
    --pi-off-white:  #f8f5f0;
    --pi-border:     rgba(0,0,0,0.10);
    --pi-border-mid: rgba(0,0,0,0.18);
    --pi-muted:      #6b6560;
    --pi-body:       #2a2520;
    /* Dark surface tokens */
    --pi-bg:         #1e1c1a;
    --pi-surface-1:  #282422;
    --pi-surface-2:  #322f2c;
    --pi-text:       #f0ebe3;
    --pi-text-sub:   rgba(240,235,227,0.50);
    --pi-border-dk:  rgba(255,255,255,0.08);
    --pi-border-dk-mid: rgba(255,255,255,0.14);
}

/* ========================================
   WIDGET CONTAINER
   ======================================== */

.booking-widget {
    max-width: 560px;
    margin: 30px auto;
    padding: 24px;
    background: var(--pi-bg);
    border-radius: 14px;
    border: 1px solid var(--pi-border-dk);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--pi-text);
    position: relative;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    /* Stop Chrome Font Boosting from breaking the layout */
    .booking-widget, 
    .booking-widget *,
    .calendar-day,
    .calendar-weekday {
        -webkit-text-size-adjust: none !important;
        text-size-adjust: none !important;
    }
    
    /* 1. Force the widget to stay within the screen */
    .booking-widget {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important; 
        margin: 10px auto !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        contain: none !important; /* Fixes Chrome rendering bugs */
    }
    
    /* Ensure html/body allow full height */
    html, body {
        height: auto !important;
        min-height: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
}

/* ========================================
   HEADER (dark hero card)
   ======================================== */

.booking-widget-header {
    position: relative;
    background: var(--pi-dark);
    border-radius: 10px;
    padding: 22px 20px 18px;
    margin-bottom: 20px;
    overflow: hidden;
    /* flex row: [main text | price bubble], then pills full-width below */
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0;
}

.booking-header-main {
    flex: 1;
    min-width: 0;
    padding-right: 16px;
}

.booking-widget-title {
    font-size: 20px;
    font-weight: 600;
    color: #f5f0e8;
    margin: 0 0 5px 0;
}

.booking-widget-subtitle {
    font-size: 13px;
    color: rgba(245,240,232,0.60);
    margin: 0;
}

.booking-header-price {
    flex-shrink: 0;
    align-self: flex-start;
    text-align: center;
    background: #3d2a0e;
    border-radius: 10px;
    padding: 12px 16px;
    line-height: 1;
    min-width: 88px;
}

.header-price-from {
    display: block;
    font-size: 10px;
    text-transform: lowercase;
    letter-spacing: 0.02em;
    color: rgba(245,240,232,0.55);
    margin-top: 5px;
}

.header-price-amount {
    display: block;
    font-size: 26px;
    font-weight: 700;
    color: var(--pi-amber-mid);
    line-height: 1;
}

.booking-header-pills {
    flex-basis: 100%;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 14px;
}

.header-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 20px;
    font-size: 12px;
    color: rgba(245,240,232,0.82);
    white-space: nowrap;
}

.pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pi-amber-mid);
    margin-right: 6px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .booking-widget-header {
        padding: 16px 14px 14px;
        margin-bottom: 16px;
    }
    .booking-widget-title {
        font-size: 16px;
    }
    .booking-widget-subtitle {
        font-size: 12px;
    }
    .booking-header-price {
        padding: 10px 12px;
        min-width: 74px;
    }
    .header-price-amount {
        font-size: 20px;
    }
    .header-pill {
        font-size: 11px;
        padding: 4px 9px;
    }
}

/* ========================================
   TOUR INFO SUMMARY
   ======================================== */

.booking-tour-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 10px;
    margin-bottom: 24px;
    padding: 14px 16px;
    background: var(--pi-off-white);
    border-radius: 10px;
    border: 1px solid var(--pi-border);
}

.tour-info-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: var(--pi-muted);
}

.tour-info-icon {
    font-size: 15px;
}

@media (max-width: 768px) {
    .booking-tour-info {
        flex-direction: column;
        gap: 10px;
    }
}

/* ========================================
   SECTIONS
   ======================================== */

.booking-section {
    margin-bottom: 16px;
    padding: 18px;
    background: var(--pi-surface-1);
    border-radius: 10px;
    border: 1px solid var(--pi-border-dk);
}

.section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--pi-text-sub);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 16px 0;
}

/* ========================================
   PARTICIPANTS SELECTOR
   ======================================== */

.participant-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--pi-surface-2);
    border-radius: 8px;
    border: 1px solid var(--pi-border-dk);
    margin-bottom: 8px;
}

.participant-info {
    display: flex;
    flex-direction: column;
}

.participant-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--pi-text);
}

.participant-age {
    font-size: 12px;
    color: var(--pi-text-sub);
}

.participant-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-participant-minus,
.btn-participant-plus {
    width: 30px;
    height: 30px;
    border: 1px solid var(--pi-border-dk-mid);
    background: var(--pi-surface-1);
    color: var(--pi-text);
    border-radius: 50%;
    font-size: 18px;
    font-weight: 400;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-participant-minus:hover,
.btn-participant-plus:hover {
    border-color: var(--pi-amber);
    color: var(--pi-amber);
    background: var(--pi-surface-1);
}

.btn-participant-minus:disabled,
.btn-participant-plus:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.participant-input {
    width: 40px;
    height: 36px;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    border: 1px solid var(--pi-border-dk);
    border-radius: 6px;
    background: var(--pi-surface-1);
    color: var(--pi-text);
}

.participant-note {
    font-size: 12px;
    color: var(--pi-text-sub);
    text-align: center;
    margin-top: 8px;
}

/* ========================================
   CALENDAR
   ======================================== */

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.calendar-month-display {
    font-size: 15px;
    font-weight: 500;
    color: var(--pi-text);
    text-align: center;
    flex: 1;
}

.btn-month-prev,
.btn-month-next {
    width: 30px;
    height: 30px;
    border: 1px solid var(--pi-border-dk-mid);
    background: var(--pi-surface-2);
    color: var(--pi-text-sub);
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.btn-month-prev:hover,
.btn-month-next:hover {
    border-color: var(--pi-amber);
    color: var(--pi-amber);
}

.calendar-container {
    background: transparent;
    border-radius: 8px;
    padding: 12px;
    overflow-x: visible;
    overflow-y: visible;
    width: 100%;
    box-sizing: border-box;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 6px;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
}

.calendar-weekday {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--pi-text-sub);
    padding: 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    min-height: 280px;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 2px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    background: transparent;
    border: 1px solid transparent;
    position: relative;
    overflow: visible;
}

.calendar-day-number {
    font-size: 13px;
    font-weight: 500;
    color: var(--pi-text);
    margin-bottom: 2px;
    font-family: Arial, Helvetica, -apple-system, BlinkMacSystemFont, sans-serif !important;
}

.calendar-day-price {
    font-size: 10px;
    color: var(--pi-amber);
    font-weight: 500;
}

.calendar-day.available:hover {
    background: rgba(186,117,23,0.18);
    border-color: var(--pi-amber-light);
}

.calendar-day.available {
    background: var(--pi-surface-2);
    border-color: var(--pi-border-dk-mid);
}

.calendar-day.available .calendar-day-number {
    color: var(--pi-text);
}

.calendar-day.unavailable {
    background: transparent;
    cursor: not-allowed;
    opacity: 0.4;
}

.calendar-day.unavailable .calendar-day-number {
    color: var(--pi-text-sub);
    text-decoration: line-through;
}

.calendar-day.selected {
    background: var(--pi-amber);
    border-color: var(--pi-amber);
}

.calendar-day.selected .calendar-day-number,
.calendar-day.selected .calendar-day-price {
    color: #ffffff;
}

.calendar-day.other-month {
    opacity: 0.25;
}

.calendar-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--pi-text-sub);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.legend-dot.available {
    background: var(--pi-amber);
}

.legend-dot.booked {
    background: rgba(255,255,255,0.18);
}

@media (max-width: 768px) {
    /* 2. Remove padding that pushes the calendar off-edge */
    .calendar-container {
        padding: 5px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* 3. Perfect Grid Alignment (Math-based) */
    .calendar-weekdays,
    .calendar-days {
        display: grid !important;
        grid-template-columns: repeat(7, 14.285%) !important;
        grid-gap: 0 !important;
        gap: 0 !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* 4. Fix Tiny/Misaligned Headers */
    .calendar-weekday {
        font-size: 11px !important;
        font-weight: 600 !important;
        color: var(--pi-muted) !important;
        text-align: center !important;
        padding: 8px 0 !important;
        min-width: 0 !important;
    }

    /* 5. Fix Day Buttons */
    .calendar-day {
        aspect-ratio: 1 / 1 !important;
        margin: 1px !important;
        padding: 4px 0 !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    .calendar-day-number {
        font-size: 12px !important;
        margin-bottom: 2px !important;
    }

    .calendar-day-price {
        font-size: 9px !important;
        line-height: 1 !important;
        display: block !important;
    }

    .calendar-header {
        margin-bottom: 10px !important;
        padding: 0 4px !important;
    }

    .calendar-month-display {
        font-size: 14px !important;
    }

    .btn-month-prev,
    .btn-month-next {
        width: 26px !important;
        height: 26px !important;
        font-size: 13px !important;
        padding: 0 !important;
    }
}

/* Extra aggressive for very narrow phones (e.g., iPhone SE) */
@media (max-width: 380px) {
    .calendar-weekday { font-size: 11px !important; }
    .calendar-day-number { font-size: 11px !important; }
    .calendar-day-price { display: none !important; } /* Hide price to save space */
}

/* ========================================
   SELECTED DATE & TIME
   ======================================== */

.selected-date-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--pi-surface-2);
    border-radius: 8px;
    border: 1px solid var(--pi-amber-light);
}

.selected-date-icon {
    font-size: 24px;
}

.selected-date-info {
    flex: 1;
}

.selected-date-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--pi-text);
    margin-bottom: 3px;
}

.selected-time-text {
    font-size: 13px;
    color: var(--pi-text-sub);
}

.btn-change-date {
    padding: 6px 14px;
    background: var(--pi-surface-2);
    border: 1px solid var(--pi-border-dk-mid);
    color: var(--pi-text-sub);
    border-radius: 6px;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.btn-change-date:hover {
    border-color: var(--pi-amber);
    color: var(--pi-amber);
    background: var(--pi-surface-2);
}

.time-selector {
    margin-top: 14px;
}

.time-selector-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--pi-text-sub);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.time-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}

.time-option {
    padding: 10px;
    background: var(--pi-surface-2);
    border: 1px solid var(--pi-border-dk);
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
    color: var(--pi-text-sub);
}

.time-option:hover {
    border-color: var(--pi-amber-light);
    background: var(--pi-amber-pale);
    color: var(--pi-amber-sub);
}

.time-option.selected {
    background: var(--pi-amber);
    border-color: var(--pi-amber);
    color: #ffffff;
}

/* ========================================
   CUSTOMER FORM
   ======================================== */

.customer-form {
    background: transparent;
    padding: 16px;
    border-radius: 8px;
}

.form-row {
    margin-bottom: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--pi-text-sub);
    margin-bottom: 6px;
}

.form-input,
.form-textarea {
    padding: 10px 12px;
    border: 1px solid var(--pi-border-dk-mid);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.15s;
    font-family: inherit;
    color: var(--pi-text);
    background: var(--pi-surface-2);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--pi-amber);
    box-shadow: 0 0 0 3px rgba(186, 117, 23, 0.08);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: rgba(240,235,227,0.28);
}

/* ========================================
   PRICE SUMMARY
   ======================================== */

.price-breakdown {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(186, 117, 23, 0.25);
}

.price-note {
    font-size: 12px;
    color: var(--pi-amber-sub);
    font-weight: normal;
    display: block;
    margin-top: 4px;
    font-style: italic;
}

.price-note-box {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(186, 117, 23, 0.08);
    border-left: 2px solid var(--pi-amber-light);
    border-radius: 4px;
}

.price-note-text {
    margin: 0;
    font-size: 12px;
    color: var(--pi-amber-sub);
    line-height: 1.5;
}

.price-note-text strong {
    color: var(--pi-amber-text);
    font-weight: 600;
}

.price-summary-section {
    background: var(--pi-amber-pale);
    border: 1px solid var(--pi-amber-light);
    color: var(--pi-amber-text);
}

.price-summary-section .section-title {
    color: var(--pi-amber-sub);
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 14px;
    color: var(--pi-amber-sub);
}

.price-row.price-total {
    border-top: 1px solid var(--pi-amber-light);
    margin-top: 8px;
    padding-top: 12px;
    font-size: 17px;
    font-weight: 600;
    color: var(--pi-amber-text);
}

.price-label {
    color: var(--pi-amber-sub);
}

.price-value {
    font-weight: 500;
}

/* ========================================
   PAYMENT METHODS
   ======================================== */

.payment-methods {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.payment-method {
    padding: 16px;
    background: var(--pi-surface-2);
    border: 1px solid var(--pi-border-dk-mid);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.payment-method:hover {
    border-color: var(--pi-amber-light);
    background: var(--pi-amber-pale);
}

.payment-method.selected {
    border-color: var(--pi-amber);
    background: var(--pi-amber-pale);
}

.payment-method-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.payment-method-icon {
    font-size: 26px;
}

.payment-method-details {
    display: flex;
    flex-direction: column;
}

.payment-method-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--pi-text);
}

.payment-method-desc {
    font-size: 12px;
    color: var(--pi-text-sub);
}

.payment-method-check {
    width: 20px;
    height: 20px;
    border: 1px solid var(--pi-border-dk-mid);
    border-radius: 50%;
    position: relative;
}

.payment-method.selected .payment-method-check {
    border-color: var(--pi-amber);
    background: var(--pi-amber);
}

.payment-method.selected .payment-method-check::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff;
    font-size: 11px;
    font-weight: bold;
}

/* ========================================
   QR CODE
   ======================================== */

.qr-container {
    margin-top: 16px;
    padding: 20px;
    background: var(--pi-surface-1);
    border-radius: 10px;
    border: 1px solid var(--pi-border-dk);
    text-align: center;
}

.qr-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 14px;
}

.qr-icon {
    font-size: 20px;
}

.qr-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--pi-text);
}

.qr-code-wrapper {
    display: inline-block;
    padding: 16px;
    background: #ffffff;
    border: 1px solid var(--pi-border-mid);
    border-radius: 8px;
}

.qr-code-image {
    display: block;
    width: 220px;
    height: 220px;
}

.qr-instruction {
    margin-top: 12px;
    font-size: 13px;
    color: var(--pi-text-sub);
}

@media (max-width: 768px) {
    .qr-code-image {
        width: 180px;
        height: 180px;
    }
}

/* ========================================
   BUTTONS
   ======================================== */

.booking-actions {
    margin-top: 20px;
}

.btn-book {
    width: 100%;
    padding: 14px;
    background: var(--pi-dark);
    color: #f5f0e8;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.btn-book:hover {
    background: var(--pi-dark-mid);
}

.btn-book:active {
    background: #111111;
}

.btn-book:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ========================================
   ALERTS
   ======================================== */

.booking-alert {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 380px;
    padding: 16px 44px 16px 16px;
    background: var(--pi-surface-1);
    border-radius: 10px;
    border: 1px solid var(--pi-border-dk-mid);
    z-index: 10000;
    animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(80px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.booking-alert.success {
    border-left: 3px solid #3B6D11;
}

.booking-alert.error {
    border-left: 3px solid #A32D2D;
}

.booking-alert.info {
    border-left: 3px solid var(--pi-amber);
}

.alert-content {
    font-size: 14px;
    line-height: 1.5;
    color: var(--pi-text);
}

.alert-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--pi-text-sub);
    cursor: pointer;
    transition: color 0.15s;
}

.alert-close:hover {
    color: var(--pi-text);
}

@media (max-width: 768px) {
    .booking-alert {
        bottom: 12px;
        right: 12px;
        left: 12px;
        max-width: none;
    }
}

/* ========================================
   LOADING OVERLAY
   ======================================== */

.booking-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 28, 26, 0.92);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #ede8e0;
    border-top: 3px solid var(--pi-amber);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--pi-text-sub);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #ede8e0;
    border-top: 3px solid var(--pi-amber);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-center {
    text-align: center;
}

.text-muted {
    color: #666;
}

.mt-10 {
    margin-top: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus styles for keyboard navigation */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--pi-amber);
    outline-offset: 2px;
}