/* =========================================================================
   GermanUSA Airbnb — Components
   =========================================================================
   Header, hero, search bar, and mobile nav. Consumes tokens from tokens.css.
   Loaded after base.css.
   ========================================================================= */

/* ------------------------------------------------------------------------- */
/* Header                                                                      */
/* ------------------------------------------------------------------------- */
.gu-header {
    position: sticky;
    top: 0;
    z-index: var(--gu-z-header);
    background: var(--gu-bg);
    border-bottom: 1px solid var(--gu-border);
    transition: background var(--gu-duration) var(--gu-ease), box-shadow var(--gu-duration) var(--gu-ease);
}

.gu-header-transparent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: transparent;
    border-bottom: none;
}

.gu-header-transparent .gu-header-logo-text { color: var(--gu-bg); }
.gu-header-transparent .gu-header-nav a { color: var(--gu-bg); }
.gu-header-transparent .gu-header-nav a:hover { color: var(--gu-gold); }
.gu-header-transparent .gu-header-toggle .gu-header-toggle-bar { background: var(--gu-bg); }

.gu-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gu-space-4);
    padding-block: var(--gu-space-3);
    max-width: var(--gu-container);
    margin-inline: auto;
    padding-inline: var(--gu-space-4);
}
@media (min-width: 768px) {
    .gu-header-inner { padding-inline: var(--gu-space-6); padding-block: var(--gu-space-4); }
}

.gu-header-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}
.gu-header-logo img { height: 36px; width: auto; }
.gu-header-logo-text {
    font-size: var(--gu-text-xl);
    font-weight: var(--gu-fw-bold);
    color: var(--gu-rot);
    letter-spacing: var(--gu-tracking-tight);
}

.gu-header-nav { display: none; }
@media (min-width: 992px) {
    .gu-header-nav { display: block; }
}

.gu-nav-list {
    display: flex;
    align-items: center;
    gap: var(--gu-space-6);
    list-style: none;
    margin: 0;
    padding: 0;
}
.gu-nav-list a {
    display: block;
    padding: var(--gu-space-2) 0;
    font-size: var(--gu-text-sm);
    font-weight: var(--gu-fw-medium);
    color: var(--gu-text);
    text-decoration: none;
    transition: color var(--gu-duration-fast) var(--gu-ease);
}
.gu-nav-list a:hover { color: var(--gu-rot); text-decoration: none; }
.gu-nav-list .sub-menu {
    position: absolute;
    background: var(--gu-bg);
    border: 1px solid var(--gu-border);
    border-radius: var(--gu-radius);
    box-shadow: var(--gu-shadow-md);
    padding: var(--gu-space-2);
    min-width: 200px;
    list-style: none;
    margin: 0;
}
.gu-nav-list li { position: relative; }
.gu-nav-list li:hover > .sub-menu { display: block; }
.gu-nav-list .sub-menu { display: none; }
.gu-nav-list .sub-menu a { padding: var(--gu-space-2) var(--gu-space-3); border-radius: var(--gu-radius-sm); }
.gu-nav-list .sub-menu a:hover { background: var(--gu-bg-subtle); }

.gu-header-actions { display: flex; align-items: center; gap: var(--gu-space-3); }
.gu-header-cta { display: none; }
@media (min-width: 768px) { .gu-header-cta { display: inline-flex; } }

.gu-header-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--gu-border-strong);
    border-radius: var(--gu-radius-pill);
    background: var(--gu-bg);
    cursor: pointer;
    transition: border-color var(--gu-duration-fast) var(--gu-ease);
}
.gu-header-toggle:hover { border-color: var(--gu-text); }
.gu-header-toggle-bar { display: block; width: 18px; height: 2px; background: var(--gu-text); border-radius: 1px; margin-inline: auto; transition: all var(--gu-duration-fast) var(--gu-ease); }
@media (min-width: 992px) { .gu-header-toggle { display: none; } }

.gu-header-toggle[aria-expanded="true"] .gu-header-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.gu-header-toggle[aria-expanded="true"] .gu-header-toggle-bar:nth-child(2) { opacity: 0; }
.gu-header-toggle[aria-expanded="true"] .gu-header-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.gu-mobile-nav {
    display: none;
    padding: var(--gu-space-4);
    background: var(--gu-bg);
    border-top: 1px solid var(--gu-border);
}
.gu-mobile-nav[hidden] { display: none; }
.gu-mobile-nav:not([hidden]) { display: block; }
.gu-mobile-nav-list { list-style: none; margin: 0 0 var(--gu-space-4); padding: 0; }
.gu-mobile-nav-list a {
    display: block;
    padding: var(--gu-space-3) 0;
    font-size: var(--gu-text-base);
    font-weight: var(--gu-fw-medium);
    color: var(--gu-text);
    text-decoration: none;
    border-bottom: 1px solid var(--gu-border);
}
.gu-mobile-nav-list a:hover { color: var(--gu-rot); text-decoration: none; }
.gu-mobile-cta { width: 100%; }

/* ------------------------------------------------------------------------- */
/* Hero section                                                               */
/* ------------------------------------------------------------------------- */
.gu-hero {
    position: relative;
    display: flex;
    align-items: center;
    /* Subtle warm gradient — no image, zero bandwidth */
    background: linear-gradient(180deg, #fffdf6 0%, #ffffff 70%);
    border-bottom: 1px solid var(--gu-border);
}

/* Thin German flag accent stripe — tasteful brand cue */
.gu-hero-flag {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg,
        var(--gu-schwarz) 0 33.333%,
        var(--gu-rot)    33.333% 66.666%,
        var(--gu-gold)   66.666% 100%);
}

.gu-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: var(--gu-schwarz);
    padding-block: var(--gu-space-16) var(--gu-space-12);
    max-width: 720px;
}

.gu-hero-title {
    font-size: var(--gu-text-4xl);
    font-weight: var(--gu-fw-bold);
    color: var(--gu-schwarz);
    letter-spacing: -0.02em;
    margin-bottom: var(--gu-space-3);
}
@media (min-width: 768px) {
    .gu-hero-title { font-size: var(--gu-text-5xl); }
}

.gu-hero-subtitle {
    font-size: var(--gu-text-lg);
    color: var(--gu-text-muted);
    margin-bottom: var(--gu-space-8);
}

/* ------------------------------------------------------------------------- */
/* Search bar — Airbnb style pill                                             */
/* ------------------------------------------------------------------------- */
.gu-search {
    display: flex;
    align-items: center;
    background: var(--gu-bg);
    border: 1px solid var(--gu-border);
    border-radius: var(--gu-radius-pill);
    box-shadow: var(--gu-shadow-lg);
    padding: var(--gu-space-2);
    max-width: 640px;
    margin-inline: auto;
    transition: box-shadow var(--gu-duration) var(--gu-ease);
}
.gu-search:hover { box-shadow: 0 12px 40px rgba(0,0,0,0.18); }
.gu-search:focus-within { box-shadow: var(--gu-shadow-lg), var(--gu-shadow-focus); }

.gu-search-segment {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--gu-space-1) var(--gu-space-4);
    border-radius: var(--gu-radius-pill);
    cursor: pointer;
    transition: background var(--gu-duration-fast) var(--gu-ease);
    text-align: left;
    min-width: 0;
}
.gu-search-segment:hover { background: var(--gu-bg-subtle); }
.gu-search-segment-active { background: var(--gu-bg-subtle); box-shadow: var(--gu-shadow-sm); }
.gu-search-segment-filled .gu-search-segment-select-input { color: var(--gu-text); font-weight: var(--gu-fw-medium); }

.gu-search-segment-label {
    font-size: var(--gu-text-xs);
    font-weight: var(--gu-fw-semibold);
    color: var(--gu-text);
    line-height: 1;
    margin-bottom: 2px;
}

.gu-search-segment-input,
.gu-search-segment-select-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: var(--gu-text-sm);
    color: var(--gu-text-muted);
    padding: 0;
    outline: none;
    cursor: pointer;
}
.gu-search-segment-input::placeholder { color: var(--gu-text-muted); }
.gu-search-segment-input:focus { color: var(--gu-text); }

.gu-search-segment-select { position: relative; }
.gu-search-segment-select-input {
    appearance: none;
    -webkit-appearance: none;
    padding-right: var(--gu-space-4);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23717171' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
}

/* Category custom dropdown */
.gu-search-segment-category { position: relative; }

.gu-search-category-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gu-space-2);
    width: 100%;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: var(--gu-text-sm);
    color: var(--gu-text-muted);
    text-align: left;
}
.gu-search-category-trigger-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gu-search-category-trigger[aria-expanded="true"] .gu-search-category-caret { transform: rotate(180deg); }
.gu-search-category-caret { transition: transform var(--gu-duration-fast) var(--gu-ease); flex-shrink: 0; color: var(--gu-text-muted); }

.gu-search-category-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 320px;
    max-height: 380px;
    overflow-y: auto;
    background: var(--gu-bg);
    border: 1px solid var(--gu-border);
    border-radius: var(--gu-radius-lg);
    box-shadow: var(--gu-shadow-lg);
    padding: var(--gu-space-2);
    z-index: var(--gu-z-popover);
    /* closed state — element stays rendered so transitions animate */
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
    transform-origin: top left;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity var(--gu-duration) var(--gu-ease-out),
        transform var(--gu-duration) var(--gu-ease-out),
        visibility 0ms var(--gu-duration);
}
.gu-search-category-menu.gu-is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
    pointer-events: auto;
    transition:
        opacity var(--gu-duration) var(--gu-ease-out),
        transform var(--gu-duration) var(--gu-ease-out),
        visibility 0ms 0ms;
}

.gu-search-category-header {
    font-size: var(--gu-text-xs);
    font-weight: var(--gu-fw-semibold);
    color: var(--gu-text-muted);
    text-transform: uppercase;
    letter-spacing: var(--gu-tracking-wide);
    padding: var(--gu-space-2) var(--gu-space-3) var(--gu-space-1);
}

.gu-search-category-list { display: flex; flex-direction: column; gap: 2px; }

.gu-search-category-item {
    display: flex;
    align-items: center;
    gap: var(--gu-space-3);
    width: 100%;
    padding: var(--gu-space-2) var(--gu-space-3);
    background: transparent;
    border: none;
    border-radius: var(--gu-radius);
    cursor: pointer;
    text-align: left;
    transition: background var(--gu-duration-fast) var(--gu-ease);
}
.gu-search-category-item:hover { background: var(--gu-bg-subtle); }
.gu-search-category-item[aria-selected="true"] { background: var(--gu-rot-soft); }

.gu-search-category-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--gu-radius);
    background: var(--gu-cat-tint, var(--gu-bg-subtle));
    color: var(--gu-text);
    flex-shrink: 0;
}

.gu-search-category-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.gu-search-category-title { font-size: var(--gu-text-sm); font-weight: var(--gu-fw-semibold); color: var(--gu-text); line-height: 1.3; }
.gu-search-category-subtitle { font-size: var(--gu-text-xs); color: var(--gu-text-muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Mobile: dropdown becomes full-width bottom sheet */
@media (max-width: 639px) {
    .gu-search-category-menu {
        position: fixed;
        left: var(--gu-space-4);
        right: var(--gu-space-4);
        bottom: var(--gu-space-4);
        top: auto;
        min-width: 0;
        max-height: 60vh;
        transform-origin: bottom center;
        transform: translateY(8px) scale(0.96);
    }
    .gu-search-category-menu.gu-is-open {
        transform: translateY(0) scale(1);
    }
}

.gu-search-divider {
    width: 1px;
    height: 32px;
    background: var(--gu-border);
    flex-shrink: 0;
}

.gu-search-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--gu-space-2);
    background: var(--gu-rot);
    color: var(--gu-text-inverse);
    border: none;
    border-radius: 999px !important;
    -webkit-border-radius: 999px !important;
    padding: var(--gu-space-3);
    width: 48px;
    height: 48px;
    min-width: 48px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--gu-duration-fast) var(--gu-ease), width var(--gu-duration) var(--gu-ease), box-shadow var(--gu-duration-fast) var(--gu-ease);
    box-shadow: 0 2px 8px rgba(200, 16, 46, 0.3);
}
.gu-search-button:hover { background: var(--gu-rot-hover); box-shadow: 0 4px 12px rgba(200, 16, 46, 0.4); }

/* Geocoding-in-progress state */
.gu-search-button.gu-is-geocoding { cursor: progress; opacity: 0.85; }
.gu-search-button.gu-is-geocoding svg { animation: gu-spin 0.7s linear infinite; }
@keyframes gu-spin { to { transform: rotate(360deg); } }

.gu-search-button-text { display: none; font-size: var(--gu-text-sm); font-weight: var(--gu-fw-semibold); white-space: nowrap; }

@media (min-width: 640px) {
    .gu-search-button { width: auto; padding-inline: var(--gu-space-6); height: 48px; }
    .gu-search-button-text { display: inline; }
}

/* Mobile: stack segments vertically */
@media (max-width: 639px) {
    .gu-search {
        flex-direction: column;
        align-items: stretch;
        border-radius: var(--gu-radius-lg);
        padding: var(--gu-space-3);
        max-width: 100%;
    }
    .gu-search-segment { padding: var(--gu-space-2) var(--gu-space-3); }
    .gu-search-divider { width: 100%; height: 1px; margin-block: var(--gu-space-1); }
    .gu-search-button { width: 100%; height: 44px; margin-top: var(--gu-space-2); }
}

/* ------------------------------------------------------------------------- */
/* Main content area                                                           */
/* ------------------------------------------------------------------------- */
.gu-main { padding-block: var(--gu-space-12); }
.gu-page-content { max-width: var(--gu-container-narrow); margin-inline: auto; }

/* Hide the old GD search widget on the homepage — replaced by gu-search */
.home .geodir-search-container,
.home .wp-block-geodirectory-geodir-widget-search,
.home .geodir-search-form-wrapper { display: none !important; }
