/**
 * Public Booking Widget Styles
 *
 * Loaded by templates/layout/widget.php. The dynamic theme colour is provided
 * by the layout as a :root custom property (--primary-color); everything here
 * is static and cacheable.
 *
 * Calendar-cell styling lives ONLY in availability-calendar.css — do not add
 * .fc-* rules here.
 */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
    background-color: #ffffff;
}

.widget-container {
    max-width: 100%;
    padding: 16px;
}

/* ===== Buttons ===== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none; /* .btn is also used on <a> (e.g. retry payment) */
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
}

.btn-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
}

/* ===== Forms ===== */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Focus visible for keyboard navigation */
.btn:focus-visible, .form-input:focus-visible, .form-select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    z-index: 100;
    text-decoration: none;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    top: 0;
}

.form-input.error, .form-select.error {
    border-color: #ef4444;
}

/* Readonly-with-preset-value state (e.g. "No vehicle" fills the reg field) */
.form-input.is-readonly {
    background-color: #f3f4f6;
}

.form-error {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.field-hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
}

.checkbox-label--center {
    align-items: center;
}

.checkbox-label--center input[type="checkbox"] {
    margin-top: 0;
}

.checkbox-label--spaced {
    margin-top: 8px;
}

.required::after {
    content: ' *';
    color: #ef4444;
}

/* ===== Step indicator ===== */

.step-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.step {
    display: flex;
    align-items: center;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    background-color: #e5e7eb;
    color: #6b7280;
}

.step.active .step-number {
    background-color: var(--primary-color);
    color: #ffffff;
}

.step.completed .step-number {
    background-color: #10b981;
    color: #ffffff;
}

.step-label {
    margin-left: 8px;
    font-size: 13px;
    color: #6b7280;
}

.step.active .step-label {
    color: #1f2937;
    font-weight: 500;
}

.step-connector {
    width: 40px;
    height: 2px;
    background-color: #e5e7eb;
    margin: 0 12px;
}

.step-connector.completed {
    background-color: #10b981;
}

/* ===== Booking form structure ===== */

.step-heading {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.section-heading {
    font-size: 16px;
    font-weight: 500;
    margin: 24px 0 12px;
}

.step-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

.step-actions--split {
    justify-content: space-between;
}

/* Selected-dates summary bar (step 2) */
.dates-summary {
    background: linear-gradient(to right, #eff6ff, #eef2ff);
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
}

.dates-summary-items {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
    align-items: center;
}

.dates-summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dates-summary-item--end {
    margin-left: auto;
}

.dates-summary-total {
    font-size: 16px;
}

.icon-sm {
    width: 18px;
    height: 18px;
}

.icon-checkin {
    color: #16a34a;
}

.icon-checkout {
    color: #dc2626;
}

.icon-nights {
    color: #4f46e5;
}

.icon-inline {
    width: 14px;
    height: 14px;
    display: inline;
    vertical-align: middle;
    margin-right: 4px;
}

/* Marketing preferences box */
.consent-box {
    margin-top: 16px;
    padding: 16px;
    background-color: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.consent-box-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #374151;
}

.consent-box-intro {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 12px 0;
}

.consent-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.consent-text {
    font-size: 14px;
    color: #374151;
}

.link-primary {
    color: var(--primary-color);
}

/* ===== Pricing summary ===== */

.pricing-summary {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.pricing-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}

.pricing-row.total {
    border-top: 1px solid #d1d5db;
    margin-top: 8px;
    padding-top: 12px;
    font-weight: 600;
    font-size: 16px;
}

/* ===== Alert messages ===== */

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert--left {
    text-align: left;
}

.alert-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-success {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-info {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* ===== Loading states ===== */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Calendar loading overlay */
.calendar-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.loading-spinner {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Button loading state */
.btn-loading {
    display: inline-flex;
    align-items: center;
}

/* ===== Confirmation pages (step 3, payment success/cancel) ===== */

.confirmation {
    text-align: center;
    padding: 32px 16px;
}

.confirmation-icon {
    width: 64px;
    height: 64px;
    background-color: #10b981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.confirmation-icon--warning {
    background-color: #f59e0b;
}

.confirmation-icon svg {
    width: 32px;
    height: 32px;
    color: #ffffff;
}

.confirmation-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.confirmation-code {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: 2px;
    margin: 16px 0;
}

.confirmation-summary {
    background-color: #f9fafb;
    border-radius: 8px;
    padding: 20px;
    margin: 24px 0;
    text-align: left;
}

.summary-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.confirmation-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.confirmation-row:last-child {
    border-bottom: none;
}

.confirmation-contact {
    margin-top: 24px;
    text-align: left;
}

/* ===== Utilities ===== */

.text-muted {
    color: #6b7280;
}

.text-dark {
    color: #1f2937;
}

.text-indigo {
    color: #4f46e5;
}

.text-green {
    color: #059669;
}

.text-small {
    font-size: 13px;
}

.fw-medium {
    font-weight: 500;
}

.fw-semibold {
    font-weight: 600;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

/* Visibility utility (also defined in availability-calendar.css for admin
   pages that load only that file). */
.is-hidden {
    display: none !important;
}

/* Hide honeypot */
.hp-field {
    position: absolute;
    left: -9999px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Responsive ===== */

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .widget-container {
        padding: 12px;
    }

    /* Make buttons full width on mobile */
    .btn {
        width: 100%;
        padding: 12px 16px;
        font-size: 15px;
    }

    /* Stack step indicator labels below numbers on small screens */
    .step-indicator {
        padding: 0 8px;
    }

    .step-label {
        display: none;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .step-connector {
        width: 24px;
        margin: 0 8px;
    }

    /* Larger touch targets for form inputs */
    .form-input, .form-select, .form-textarea {
        padding: 12px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    /* Pricing summary adjustments */
    .pricing-summary {
        padding: 12px;
    }

    .pricing-row {
        font-size: 13px;
    }

    .pricing-row.total {
        font-size: 15px;
    }

    /* Confirmation page */
    .confirmation {
        padding: 20px 12px;
    }

    .confirmation-code {
        font-size: 20px;
        letter-spacing: 1px;
    }

    .confirmation-summary {
        padding: 16px;
    }

    /* Alert messages */
    .alert {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Tablets and small desktops */
@media (min-width: 481px) and (max-width: 768px) {
    .widget-container {
        padding: 16px;
    }

    .step-label {
        font-size: 12px;
    }
}

/* Ensure minimum touch target size (44x44px) */
@media (pointer: coarse) {
    .btn, .form-input, .form-select {
        min-height: 44px;
    }
}
