/* Custom styles for Booking website */

/* Base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Review score badges */
.score-excellent { background-color: #003580; }
.score-very-good { background-color: #0071c2; }
.score-good { background-color: #008009; }
.score-pleasant { background-color: #febb02; color: #262626; }
.score-fair { background-color: #6b6b6b; }

/* Star ratings */
.star-rating {
    color: #febb02;
}

/* Property card hover effects */
.property-card {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.property-card:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Search form styling */
.search-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px #febb02;
}

/* Filter checkbox styling */
.filter-checkbox {
    accent-color: #003580;
}

/* Price range slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #003580;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #003580;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Gallery lightbox */
.gallery-overlay {
    background: rgba(0, 0, 0, 0.9);
}

/* Booking.com blue gradient for header */
.header-gradient {
    background: linear-gradient(180deg, #003580 0%, #00224f 100%);
}

/* Featured badge */
.featured-badge {
    background: linear-gradient(135deg, #febb02 0%, #f5a623 100%);
}

/* Genius badge styling */
.genius-badge {
    background: linear-gradient(135deg, #004cb8 0%, #003580 100%);
}

/* room-availability custom element: must be block-level so the SSR
   skeleton + post-fetch fragment establish their own layout context
   and so aria/role semantics on its children are valid. Custom
   elements default to display:inline. */
room-availability {
    display: block;
}

/* Honor user motion preferences: stop the pulse + fade-in + spin
   animations when the OS / browser advertises reduced-motion. The
   skeleton stays visible (static gray bars) so the loading affordance
   is preserved — only the animation is suppressed. */
@media (prefers-reduced-motion: reduce) {
    .animate-pulse,
    .fade-in,
    .spinner {
        animation: none !important;
    }
}

/* Loading spinner */
.spinner {
    animation: spin 1s linear infinite;
}

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

/* Fade in animation */
.fade-in {
    animation: fadeIn 0.3s ease-in;
    animation-fill-mode: backwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Slide up animation */
.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile menu styles */
@media (max-width: 768px) {
    .mobile-menu {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        z-index: 50;
        overflow-y: auto;
    }
}

/* Date picker overrides */
input[type="date"] {
    position: relative;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
}

/* Room table styling */
.room-row:hover {
    background-color: #f5f5f5;
}

/* Sticky elements */
.sticky-sidebar {
    position: sticky;
    top: 20px;
}

/* Hidden by default, shown only in print */
.print-only {
    display: none;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    .print-only {
        display: block !important;
    }

    header, footer, nav {
        display: none !important;
    }

    body {
        font-size: 11pt;
        color: #000;
        background: #fff;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Reset layout — single column, no max-width constraints */
    .print-single-col {
        display: block !important;
        max-width: 100% !important;
    }
    .print-single-col > * {
        width: 100% !important;
        max-width: 100% !important;
        flex-shrink: unset !important;
    }

    /* Ensure page breaks don't split cards */
    .print-no-break {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Hide bg colors on status banners but keep text */
    [class*="bg-green-50"],
    [class*="bg-yellow-50"],
    [class*="bg-blue-50"] {
        background: #fff !important;
        border: 1px solid #ccc !important;
    }

    /* Links: show as text, don't underline */
    a {
        color: #000 !important;
        text-decoration: none !important;
    }

    /* Property image: constrain for print */
    .print-img-small {
        max-height: 120px !important;
        object-fit: cover;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .property-card {
        border: 2px solid #000;
    }

    button {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Attention pulse for "look here" feedback (e.g. when the user clicks
   Reserve without selecting a room or dates — see flashAttention() in
   property.js). Three short pulses of a soft blue ring; remove-on-end.
   Honored by prefers-reduced-motion above (single iteration). */
@keyframes flash-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 113, 194, 0); }
    50%      { box-shadow: 0 0 0 8px rgba(0, 113, 194, 0.45); }
}
.flash-pulse {
    animation: flash-pulse 0.6s ease-in-out 3;
    border-radius: 0.375rem;
}
/* Remove default focus outline when we focus a heading programmatically —
   the pulse animation already provides the visual cue. Keyboard users still
   get the outline if they tab into it (browser default). */
.flash-pulse:focus { outline: none; }

/* PR-perf.20: reserve space for search-widget custom elements so the
   post-defer upgrade (PR-perf.19) doesn't shift content below. */
destination-autocomplete,
date-range-picker,
guest-selector {
    min-height: 40px;
}

/* PR-perf.23: render a white rounded "shell" inside undefined custom
   elements so the pre-hydration state visually matches the post-
   hydration controls. Without this, the yellow form background
   (bg-booking-yellow) shows through the 40 px reserved space, and the
   visitor sees a yellow→white flicker when each widget's _render()
   fires (typically 50-200 ms after first paint with deferred scripts).
   The :not(:defined) pseudo-class targets ONLY elements before
   customElements.define() runs — once each widget defines, the
   pseudo-element rule deactivates automatically. No JS coordination
   needed; pure CSS handoff. */
destination-autocomplete:not(:defined),
date-range-picker:not(:defined),
guest-selector:not(:defined) {
    display: block;
}
destination-autocomplete:not(:defined)::before,
date-range-picker:not(:defined)::before,
guest-selector:not(:defined)::before {
    content: "";
    display: block;
    width: 100%;
    min-height: 40px;
    box-sizing: border-box;
    background: #fff;
    border-radius: 0.25rem;
}
/* Guest-selector's _render() sets min-w-[180px] on its inner div for the
   wider trigger. Match that on the pre-hydration shell so the post-
   hydration layout doesn't shift if the trigger is wider than its flex
   share would otherwise allow. */
guest-selector:not(:defined) {
    min-width: 180px;
}

/* PR-perf.20: prevent the date display from wrapping to a second line on
   narrow viewports / long localized formats. */
date-range-picker .drp-display {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
