/*
 * Azur Loc Auto — homepage hero + reservation search card.
 * Loaded in <head> by welcome.blade.php (@push('styles')) so the hero layout
 * is known before the first paint (it used to live in an inline <style> at the
 * very end of <body>, after several blocking scripts).
 *
 * Layout: .azur-hero is a one-column CSS grid with three rows:
 *
 *   row 1  minmax(--hero-h - --hero-overlap, auto)   media only
 *   row 2  --hero-overlap                            media + search card (overlap)
 *   row 3  auto                                      search card only
 *
 * The media (carousel / fallback title) spans rows 1-2, the search card spans
 * rows 2-3. The card therefore always starts exactly --hero-overlap above the
 * bottom of the media, whatever the media height is: carousel not initialised
 * yet, 0 slides, images still loading, viewport resized... No negative margin,
 * and the card can never slide up under the fixed .site-header because row 1
 * always reserves its minimum height.
 */

:root {
    --hero-h: clamp(440px, 72vh, 760px);
    --hero-overlap: 120px;
}

@media (max-width: 991.98px) {
    :root {
        --hero-h: clamp(400px, 62vh, 620px);
        --hero-overlap: 88px;
    }
}

@media (max-width: 767.98px) {
    :root {
        --hero-h: clamp(300px, 54vh, 480px);
        --hero-overlap: 48px;
    }
}

/* ---------- Hero grid ---------- */
.r-header.azur-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(calc(var(--hero-h) - var(--hero-overlap)), auto) var(--hero-overlap) auto;
    background: transparent;
    overflow: visible;
    isolation: isolate;
}

/* the decorative radial layer now belongs to the media only */
.r-header.azur-hero::before {
    display: none;
}

.azur-hero .azur-hero__media {
    grid-column: 1;
    grid-row: 1 / 3;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: var(--hero-h);
    max-height: none;
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 80%, rgba(0, 171, 228, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0, 171, 228, 0.08) 0%, transparent 50%),
        linear-gradient(135deg, #0a1220 0%, var(--azur-slate, #233e5d) 50%, #0a1220 100%);
}

/* main.css gives .r-slider-serach `position: absolute; bottom: 80px; max-width: 1170px`
   (and `left: 50px` under 1400px): neutralise all of it, the grid places the card. */
.r-header.azur-hero .azur-hero__search {
    grid-column: 1;
    grid-row: 2 / 4;
    align-self: start;
    position: relative;
    inset: auto;
    z-index: 10;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 15px;
    display: flex;
    justify-content: center;
}

.r-header.azur-hero .azur-hero__search > .container {
    max-width: 1200px;
    width: 100%;
    padding: 0;
    display: flex;
    justify-content: center;
    background: transparent;
}

/* ---------- Carousel ---------- */
#defaultHomeSlider {
    width: 100%;
}

#defaultHomeSlider .r-slider-item {
    position: relative;
    height: var(--hero-h);
    overflow: hidden;
    border-radius: 0;
}

/* before Owl initialises, show only the first slide (no tall stack, no jump) */
#defaultHomeSlider:not(.owl-loaded) > .r-slider-item ~ .r-slider-item {
    display: none;
}

#defaultHomeSlider .r-slider-item > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
    filter: brightness(0.7) contrast(1.1);
    transition: transform 0.8s ease, filter 0.8s ease;
}

#defaultHomeSlider .r-slider-item:hover > img {
    transform: scale(1.05);
    filter: brightness(0.8) contrast(1.2);
}

.r-slider-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
            rgba(0, 171, 228, 0.3) 0%,
            rgba(0, 0, 0, 0.4) 50%,
            rgba(0, 136, 204, 0.3) 100%);
    z-index: 1;
}

/* No slide configured: static title on the gradient, same height */
.azur-hero__fallback {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--hero-h);
    padding: 0 16px var(--hero-overlap);
    text-align: center;
}

.azur-hero__fallback .r-slider-top-content {
    padding: 0;
}

.container {
    position: relative;
    z-index: 3;
}

.r-slider-top-content {
    padding: 100px 0;
    text-align: center;
    position: relative;
}

.r-slider-top-content::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    max-width: 100%;
    height: 300px;
    background: radial-gradient(circle, rgba(0, 171, 228, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse-bg 4s ease-in-out infinite;
    pointer-events: none;
}

.r-slider-top-content h1 {
    font-size: 4.5rem;
    font-weight: 300;
    color: #ffffff;
    margin-bottom: 25px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 2;
    line-height: 1.1;
    letter-spacing: -2px;
}

.r-slider-top-content h1 span {
    color: #ffffff;
    font-weight: 700;
    display: block;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.r-slider-top-content h1 span.azur-white {
    color: #ffffff;
    font-weight: 700;
    display: inline;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.r-slider-top-content h1 span.loc-blue {
    color: #00ABE4;
    font-weight: 700;
    display: inline;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.r-slider-top-content h1 b {
    color: #ffffff;
    font-weight: 700;
}

.r-slider-top-content h4 {
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 40px;
    font-weight: 300;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
    position: relative;
    z-index: 2;
}

.btn-outlined {
    background: linear-gradient(135deg, #00ABE4 0%, #0088CC 100%);
    color: #ffffff;
    border: 2px solid transparent;
    padding: 18px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.4s ease;
    box-shadow: 0 8px 25px rgba(0, 171, 228, 0.3);
    position: relative;
    overflow: hidden;
    z-index: 2;
}

.btn-outlined::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.btn-outlined:hover::before {
    left: 100%;
}

.btn-outlined:hover {
    background: linear-gradient(135deg, #0088CC 0%, #006699 100%);
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0, 171, 228, 0.4);
    color: #ffffff;
    text-decoration: none;
}

/* ---------- Floating decorative icons ---------- */
.floating-elements {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2;
}

.floating-car {
    position: absolute;
    color: rgba(255, 255, 255, 0.1);
    font-size: 30px;
    animation: float-diagonal 8s ease-in-out infinite;
}

.floating-car:nth-child(1) {
    top: 20%;
    left: 10%;
    animation-delay: -2s;
}

.floating-car:nth-child(2) {
    top: 60%;
    right: 15%;
    animation-delay: -4s;
    animation-duration: 10s;
}

.floating-car:nth-child(3) {
    bottom: 30%;
    left: 20%;
    animation-delay: -6s;
    animation-duration: 12s;
}

/* ---------- Search card ---------- */
.search-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(10, 18, 32, 0.16);
    border: none;
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    text-align: left;
}

[dir="rtl"] .search-card {
    text-align: right;
}

.search-card::before {
    display: none;
}

.search-card label {
    color: #64748b;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    display: block;
}

.search-card .btn-primary {
    background: linear-gradient(135deg, #00ABE4 0%, #0088CC 100%);
    border: none;
    padding: 20px 40px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    min-width: 220px;
    min-height: 56px;
    transition: all 0.3s ease;
    box-shadow: 0 12px 30px rgba(0, 171, 228, 0.3);
    position: relative;
    overflow: hidden;
    color: #ffffff !important;
    text-transform: none;
    letter-spacing: 0.5px;
}

.search-card .btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.search-card .btn-primary:hover::before {
    left: 100%;
}

.search-card .btn-primary:hover {
    background: linear-gradient(135deg, #0088CC 0%, #006699 100%);
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0, 171, 228, 0.4);
}

.search-card .btn-primary:focus-visible {
    outline: 3px solid var(--azur-accent, #0089B6);
    outline-offset: 3px;
}

/* Search header with icon */
.search-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 35px;
    padding-bottom: 0;
    border-bottom: none;
}

.search-header img {
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    filter: none;
    background: linear-gradient(135deg, #00ABE4 0%, #0088CC 100%);
    border-radius: 12px;
    padding: 12px;
}

.search-header-text {
    min-width: 0;
}

.search-header-text h5 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    color: #1a2b3a;
    font-weight: 700;
    line-height: 1.3;
}

.search-header-text small {
    color: #64748b;
    font-size: 1rem;
    font-weight: 500;
}

/* ---------- Animations ---------- */
@keyframes pulse-bg {
    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
}

@keyframes shimmer {
    0%,
    100% {
        background-position: -200% center;
    }

    50% {
        background-position: 200% center;
    }
}

@keyframes float-diagonal {
    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(30px, -20px) rotate(90deg);
    }

    50% {
        transform: translate(0, -40px) rotate(180deg);
    }

    75% {
        transform: translate(-30px, -20px) rotate(270deg);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animated {
    animation-duration: 1s;
    animation-fill-mode: both;
}

.fadeInDown {
    animation-name: fadeInDown;
}

.fadeInLeft {
    animation-name: fadeInLeft;
    animation-delay: 0.3s;
}

.fadeInUp {
    animation-name: fadeInUp;
    animation-delay: 0.6s;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .r-slider-top-content {
        padding: 48px 0;
    }

    .r-slider-top-content h1 {
        font-size: 3.5rem;
    }
}

@media (max-width: 767.98px) {
    .r-slider-top-content {
        padding: 24px 0;
    }

    .r-slider-top-content h1 {
        font-size: clamp(2rem, 9vw, 3rem);
        letter-spacing: -1px;
        margin-bottom: 12px;
    }

    .r-slider-top-content h4 {
        font-size: 1.1rem;
        margin-bottom: 16px;
    }

    .search-card {
        padding: 24px 16px;
        border-radius: 20px;
    }

    .search-header {
        gap: 14px;
        margin-bottom: 24px;
    }

    .search-header-text h5 {
        font-size: 1.2rem;
    }

    .search-header-text small {
        font-size: 0.9rem;
    }

    .search-card .btn-primary {
        width: 100%;
        min-width: 0;
        margin-top: 20px;
        padding: 18px 32px;
    }

    .floating-car {
        display: none;
    }

    /* Fix dropdowns and calendars overflowing on mobile */
    .flatpickr-calendar {
        max-width: 95vw !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        right: auto !important;
    }

    .search-card .row {
        margin-left: 0;
        margin-right: 0;
    }

    .search-card .col-sm-6,
    .search-card .col-md-3,
    .search-card .col-md-9 {
        padding-left: 0;
        padding-right: 0;
    }

    .search-card .form-control {
        max-width: 100%;
        text-overflow: ellipsis;
    }
}

@media (max-width: 375px) {
    .r-header.azur-hero .azur-hero__search {
        padding: 0 10px;
    }

    .search-header img {
        width: 42px;
        height: 42px;
        padding: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .floating-car,
    .r-slider-top-content::before {
        animation: none;
    }

    #defaultHomeSlider .r-slider-item > img,
    .search-card .btn-primary,
    .btn-outlined {
        transition: none;
    }

    #defaultHomeSlider .r-slider-item:hover > img,
    .search-card .btn-primary:hover {
        transform: none;
    }
}
