/* Conference search bar of the conference and exhibitors pages (same bar as index.html).
   Markup: .nav-middle > .header-search-box in the header, and an empty .mobile-search-strip
   right after it; behaviour: conferences.js. */

/* ===== In the header =====
   .nav-middle is display:none below 769px, where the bar moves to the phone strip. */
@media screen and (min-width: 769px) {
    /* Let the centre slot flex between the logo and the nav links instead of
       being absolutely centred, so the bar shrinks rather than overlapping them. */
    header nav .nav-middle {
        position: static;
        transform: none;
        flex: 1 1 auto;
        justify-content: center;
        min-width: 0;
        padding: 0 1.5rem;
    }

    .header-search-box {
        display: flex;
        position: relative;
        width: 100%;
        max-width: 580px;
        gap: 0;
        margin: 0;
    }

    .header-search-box .search-input-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        flex: 1;
        min-width: 0;
    }

    .header-search-box .conference-search {
        width: 100%;
        min-width: 0;
        padding: 0.55rem 6.5rem 0.55rem 2.4rem;
        border: 1px solid #a9a8a8;
        border-radius: 15px;
        font-size: 0.95rem;
        font-family: 'Inter', sans-serif;
        outline: none;
        transition: box-shadow 0.2s ease, border-color 0.2s ease;
    }

    .header-search-box .conference-search:focus {
        border-color: #11a191;
        box-shadow: 0 2px 5px 1px rgba(64, 60, 67, 0.16);
    }

    .header-search-box .search-icon {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 18px;
        height: 18px;
        color: #888;
        pointer-events: none;
    }

    .header-search-box .search-clear-btn {
        position: absolute;
        right: 82px;
        top: 50%;
        transform: translateY(-50%);
        background: transparent;
        border: none;
        padding: 4px;
        cursor: pointer;
        display: none;
        align-items: center;
        justify-content: center;
        opacity: 0.5;
        transition: opacity 0.2s ease;
    }

    .header-search-box .search-clear-btn:hover {
        opacity: 1;
    }

    .header-search-box .search-clear-btn.visible {
        display: flex;
    }

    .header-search-box .search-clear-btn svg {
        width: 16px;
        height: 16px;
        color: #666;
    }

    .header-search-box .search-inside-btn {
        position: absolute;
        right: 6px;
        top: 50%;
        transform: translateY(-50%);
        background: linear-gradient(135deg, #11a191 0%, #0d8a7a 100%);
        color: white;
        border: none;
        border-radius: 8px;
        padding: 6px 14px;
        font-size: 0.85rem;
        font-weight: 600;
        font-family: 'Inter', sans-serif;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .header-search-box .search-inside-btn:hover {
        background: linear-gradient(135deg, #0d8a7a 0%, #0a7569 100%);
        transform: translateY(-50%) scale(1.02);
    }

    .header-search-box .search-inside-btn:active {
        transform: translateY(-50%) scale(0.98);
    }

    .header-search-box .search-button {
        display: none;
    }

    /* Suggestions stay a little wider than the bar so results remain readable.
       Centring uses the offset variable that conferences.js animates against,
       so the open/close transition keeps the panel centred on the input. */
    .header-search-box .search-suggestions {
        left: 50%;
        right: auto;
        --suggestions-offset-x: -50%;
        width: 620px;
        max-width: 90vw;
        margin-top: 0.4rem;
    }

    /* The subcategory pill in each suggestion reuses .tag, which the conference page
       restyles (bigger padding / font) for its header tags. Restore the shared
       styles.css size here so it matches index.html. */
    .header-search-box .search-suggestions .suggestion-category .tag {
        padding: 0.2rem 0.6rem;
        border-radius: 12px;
        font-size: 0.8rem;
    }
}

/* Narrow desktops: the nav links leave little room, so drop the inline
   Search button — Enter and the suggestions still work. */
@media screen and (min-width: 769px) and (max-width: 1100px) {
    .header-search-box {
        max-width: 420px;
    }

    .header-search-box .search-inside-btn {
        display: none;
    }

    .header-search-box .conference-search {
        padding-right: 2.2rem;
    }

    .header-search-box .search-clear-btn {
        right: 6px;
    }
}

/* ===== Phone search strip (below the header, above the page) =====
   Full-bleed teal band holding the header search bar, which js/header-search-slot.js
   moves here below 769px. Desktop keeps the strip hidden. */
.mobile-search-strip {
    display: none;
}

@media screen and (max-width: 768px) {
    .mobile-search-strip {
        display: block;
        position: relative;
        z-index: 120; /* above the page content, far below the sticky header (50000) */
        width: 100%;
        margin: 0 0 2rem;
        padding: 16px 16px 18px;
        box-sizing: border-box;
        background: linear-gradient(120deg, #073a36 0%, #0b6b61 45%, #11a191 100%);
        isolation: isolate;
    }

    /* Slow-drifting aurora glow. Animated via background-position so nothing
       overflows the strip (an overflow:hidden here would clip the suggestions). */
    .mobile-search-strip::before {
        content: '';
        position: absolute;
        inset: 0;
        z-index: -1;
        background:
            radial-gradient(circle at 12% 25%, rgba(120, 224, 208, 0.55), transparent 42%),
            radial-gradient(circle at 88% 78%, rgba(255, 255, 255, 0.16), transparent 46%),
            radial-gradient(circle at 55% 0%, rgba(17, 161, 145, 0.7), transparent 55%);
        background-size: 200% 200%;
        animation: mobileSearchAurora 14s ease-in-out infinite alternate;
        pointer-events: none;
    }

    /* Thin light streak that sweeps along the bottom edge. */
    .mobile-search-strip::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: -1;
        height: 2px;
        background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.9) 50%, transparent 100%);
        background-size: 200% 100%;
        animation: mobileSearchShimmer 3.6s linear infinite;
        pointer-events: none;
    }

    @keyframes mobileSearchAurora {
        from { background-position: 0% 0%; }
        to { background-position: 100% 100%; }
    }

    @keyframes mobileSearchShimmer {
        from { background-position: 200% 0; }
        to { background-position: -200% 0; }
    }

    .mobile-search-strip__inner {
        position: relative;
    }

    /* Reset the shared .search-box rules (styles.css) for this slot. */
    .mobile-search-strip .header-search-box {
        display: flex;
        position: relative;
        width: 100%;
        max-width: none;
        gap: 0;
        margin: 0;
    }

    .mobile-search-strip .search-input-wrapper {
        position: relative;
        display: flex;
        align-items: center;
        flex: 1;
        min-width: 0;
    }

    /* Frosted-glass pill input. Font stays 16px so iOS Safari doesn't zoom on focus. */
    .mobile-search-strip .conference-search {
        width: 100%;
        min-width: 0;
        height: 50px;
        padding: 0 108px 0 46px;
        border: 1px solid rgba(255, 255, 255, 0.55);
        border-radius: 999px !important;
        background: rgba(255, 255, 255, 0.94);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        color: #1c2b2a;
        font-size: 16px;
        font-family: 'Inter', sans-serif;
        outline: none;
        box-shadow: 0 10px 26px rgba(3, 40, 36, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.9);
        transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease, background 0.25s ease;
        -webkit-appearance: none;
        appearance: none;
    }

    .mobile-search-strip .conference-search::placeholder {
        color: #7d908e;
        font-size: 0.95rem;
    }

    .mobile-search-strip .conference-search:focus {
        border-color: #fff;
        background: #fff;
        transform: translateY(-1px);
        box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3), 0 14px 30px rgba(3, 40, 36, 0.48);
    }

    /* z-index: the input's backdrop-filter makes it a layer that would paint over the icon */
    .mobile-search-strip .search-icon {
        position: absolute;
        z-index: 1;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
        width: 20px;
        height: 20px;
        color: #11a191;
        pointer-events: none;
        transition: transform 0.25s ease;
    }

    .mobile-search-strip .search-input-wrapper:focus-within .search-icon {
        transform: translateY(-50%) scale(1.12) rotate(-8deg);
    }

    .mobile-search-strip .search-clear-btn {
        position: absolute;
        right: 94px;
        top: 50%;
        transform: translateY(-50%);
        background: transparent;
        border: none;
        padding: 6px;
        cursor: pointer;
        display: none;
        align-items: center;
        justify-content: center;
        opacity: 0.55;
        transition: opacity 0.2s ease;
    }

    .mobile-search-strip .search-clear-btn.visible {
        display: flex;
    }

    .mobile-search-strip .search-clear-btn:hover,
    .mobile-search-strip .search-clear-btn:active {
        opacity: 1;
    }

    .mobile-search-strip .search-clear-btn svg {
        width: 16px;
        height: 16px;
        color: #4a5c5a;
    }

    .mobile-search-strip .search-inside-btn {
        position: absolute;
        right: 6px;
        top: 50%;
        transform: translateY(-50%);
        height: 38px;
        padding: 0 18px;
        background: linear-gradient(135deg, #11a191 0%, #0d8a7a 100%);
        color: #fff;
        border: none;
        border-radius: 999px;
        font-size: 0.9rem;
        font-weight: 700;
        font-family: 'Inter', sans-serif;
        letter-spacing: 0.01em;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(13, 138, 122, 0.45);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .mobile-search-strip .search-inside-btn:active {
        transform: translateY(-50%) scale(0.95);
        box-shadow: 0 2px 6px rgba(13, 138, 122, 0.4);
    }

    /* conferences.js wires this button unconditionally; the strip searches via
       the button inside the field, so it stays hidden here too. */
    .mobile-search-strip .search-button {
        display: none;
    }

    /* Suggestions panel: spans the full width of the bar. */
    .mobile-search-strip .search-suggestions {
        left: 0;
        right: 0;
        width: auto;
        max-width: none;
        --suggestions-offset-x: 0;
        margin-top: 10px;
        border: 1px solid rgba(17, 161, 145, 0.25);
        border-radius: 16px;
        box-shadow: 0 18px 40px rgba(3, 40, 36, 0.3);
        z-index: 2000;
        max-height: min(60vh, 420px);
    }

    /* The conference page enlarges .tag for its header; restore the shared
       styles.css pill size inside the suggestions (same as the desktop bar). */
    .mobile-search-strip .search-suggestions .suggestion-category .tag {
        padding: 0.2rem 0.6rem;
        border-radius: 12px;
        font-size: 0.8rem;
    }
}

@media screen and (max-width: 480px) {
    .mobile-search-strip {
        padding: 14px 12px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-search-strip::before,
    .mobile-search-strip::after {
        animation: none;
    }
}
