/* Horizontal Search Bar Styles */

/* Remove old sidebar layout grid */
.courses-layout {
    display: block !important;
    /* Override grid layout */
    width: 100%;
}

/* Hide sidebar just in case CSS wasn't flushed or HTML reverts */
.sidebar-filters {
    display: none !important;
}

/* Container for the floating search bar */
.horizontal-search-container {
    position: relative;
    /* Pull up into the header (approx half height of box) */
    margin-top: -3.5rem;
    margin-bottom: 3rem;
    z-index: 50;
    padding: 0 1rem;
}

/* The white box itself */
.search-box {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    /* Soft shadow */
    padding: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

/* Individual Search Groups */
.search-group {
    flex: 1;
    position: relative;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    transition: all 0.3s ease;
    min-width: 180px;
}

.search-group:hover,
.search-group:focus-within {
    border-color: var(--accent-color, #007FFF);
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 127, 255, 0.05);
}

/* Special styling for text input group to be wider */
.text-group {
    flex: 1.5;
    /* Slightly wider */
    display: flex;
    align-items: center;
    min-width: 250px;
}

/* Inputs and Selects */
.search-group input,
.search-group select {
    width: 100%;
    height: 50px;
    border: none;
    background: transparent;
    padding: 0 15px;
    font-size: 0.95rem;
    color: var(--text-dark, #334155);
    outline: none;
    border-radius: 8px;
    appearance: none;
    /* Remove default arrow for modern arrow overlap if needed */
    cursor: pointer;
}

.search-group input {
    cursor: text;
    padding-inline-start: 40px;
    /* Space for icon */
}

/* Search Icon inside Input */
.search-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1rem;
    pointer-events: none;
    /* RTL/LTR handling */
}

/* RTL Specifics */
html[dir="rtl"] .search-icon {
    right: 15px;
}

html[dir="ltr"] .search-icon {
    left: 15px;
}

html[dir="ltr"] .search-group input {
    padding-inline-start: 40px;
}


/* Filters Row Container (for flex alignment) */
.filters-row {
    display: contents;
    /* Treat children as direct children of .search-box */
}

/* Custom Select Arrow */
.search-group::after {
    content: '\f078';
    /* FontAwesome Chevron Down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.8rem;
    pointer-events: none;
    transition: transform 0.3s;
}

html[dir="rtl"] .search-group::after {
    left: 15px;
}

html[dir="ltr"] .search-group::after {
    right: 15px;
}

/* Don't show arrow on text input */
.text-group::after {
    display: none;
}

/* Focus State Arrow Animation */
.search-group:focus-within::after {
    transform: translateY(-50%) rotate(180deg);
    color: var(--accent-color, #007FFF);
}

/* Mobile Responsiveness */
@media (max-width: 991px) {
    .horizontal-search-container {
        margin-top: -2rem;
        /* Less overlap on mobile */
    }

    .search-box {
        flex-direction: column;
        padding: 1rem;
        gap: 0.75rem;
    }

    .filters-row {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }

    .search-group,
    .text-group {
        width: 100%;
        min-width: 100%;
        flex: none;
    }
}

/* ══════════════ 3-MONTH PILOT BRANCH OVERRIDES ══════════════ */

/* Hiding class for Category/Branch select dropdown groups */
.branch-page-layout .category-select-group,
.branch-page-layout .branch-select-group {
    display: none !important;
}

/* Desktop 5-filter layout (when category and branch are hidden in Stage 3) */
@media (min-width: 1200px) {
    .branch-page-layout .search-box {
        flex-wrap: nowrap !important;
        gap: 12px !important;
    }
    .branch-page-layout .search-group {
        flex: 1 1 150px !important;
        min-width: 130px !important;
    }
    .branch-page-layout .text-group {
        flex: 1.8 1 250px !important;
    }
}

/* Tablet 5-filter layout */
@media (min-width: 768px) and (max-width: 1199px) {
    .branch-page-layout .search-box {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    .branch-page-layout .text-group {
        grid-column: span 2 !important;
    }
}
/* Sticky Search Bar Mode for Calendar */
.horizontal-search-container.sticky-search-mode {
    position: sticky;
    top: 60px; /* Adjust based on your header height */
    z-index: 99;
    padding-bottom: 2rem;
    margin-bottom: 1rem;
    background-color: var(--white);
    /* Add slight margin at the top to prevent clipping when scrolled back up */
    margin-top: 1rem;
}

/* Ensure background of the whole sticky block covers items scrolling underneath */
.horizontal-search-container.sticky-search-mode::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -50vw;
    right: -50vw;
    bottom: 0;
    background-color: var(--white);
    z-index: -1;
}


/* Fix margins for sequential stages so they don't overlap */
.horizontal-search-container + .horizontal-search-container {
    margin-top: 2rem !important;
}

.horizontal-search-container.branch-page-layout {
    margin-top: 2rem !important;
}


/* Custom Sticky Search Bar Class for Calendar */
.sticky-search {
    position: sticky !important;
    top: 80px !important;
    z-index: 99 !important;
    background: var(--white);
    padding-bottom: 20px;
}
