/* ==========================================================================
   Hero Search UI — Category Tabs + Autocomplete + Action Cards
   ========================================================================== */

/* --- Search Tabs --- */
.hero-search-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 2px;
}
.hero-search-tabs::-webkit-scrollbar {
    display: none;
}
.hero-search-tab {
    flex-shrink: 0;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1.5px solid #ddd;
    background: #f5f5f5;
    color: #555;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.hero-search-tab:hover {
    background: #e8e8e8;
    color: #333;
    border-color: #ccc;
}
.hero-search-tab.is-active {
    background: var(--dpfp-blue, #003884);
    color: #fff;
    border-color: var(--dpfp-blue, #003884);
    font-weight: 700;
}

/* --- Search Bar Container --- */
.hero-search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    z-index: 200;
}

/* Ensure hero section sits above next sections and allows dropdown overflow */
.dpfp-main-hero {
    position: relative;
    z-index: 50;
    overflow: visible;
}

/* --- Autocomplete Dropdown --- */
.search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    overflow: hidden;
    display: none;
    max-height: 400px;
    overflow-y: auto;
}
.search-dropdown.is-visible {
    display: block;
    animation: dropdownFadeIn 0.2s ease;
}
@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.search-dropdown-group {
    padding: 8px 0;
}
.search-dropdown-group + .search-dropdown-group {
    border-top: 1px solid #f0f0f0;
}
.search-dropdown-label {
    padding: 6px 16px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}
.search-result-item:hover,
.search-result-item.is-focused {
    background: #f5f7fa;
}
.search-result-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.search-result-icon.type-policy  { background: #e8f0fe; color: var(--dpfp-blue, #003884); }
.search-result-icon.type-member  { background: #fef3e0; color: #e65100; }
.search-result-icon.type-glossary { background: #e8f5e9; color: #2e7d32; }
.search-result-icon.type-video   { background: #fce4ec; color: #c62828; }

.search-result-text {
    flex: 1;
    min-width: 0;
}
.search-result-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-badge {
    flex-shrink: 0;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: #f0f0f0;
    color: #666;
}

/* Loading spinner */
.search-dropdown-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #999;
    font-size: 0.85rem;
    gap: 8px;
}
.search-dropdown-loading i {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* No results */
.search-dropdown-empty {
    padding: 24px;
    text-align: center;
    color: #999;
    font-size: 0.85rem;
}

/* "See all results" link */
.search-dropdown-footer {
    display: block;
    padding: 12px 16px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dpfp-blue, #003884);
    border-top: 1px solid #f0f0f0;
    text-decoration: none;
    transition: background 0.15s;
}
.search-dropdown-footer:hover {
    background: #f5f7fa;
}

/* --- Action Cards --- */
.hero-action-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 28px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}
.hero-action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px 16px;
    background: #f7f8fa;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    text-decoration: none;
    color: #333;
    transition: all 0.25s ease;
    cursor: pointer;
}
.hero-action-card:hover {
    background: #edf0f5;
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: var(--dpfp-blue, #003884);
}
.hero-action-card-icon {
    font-size: 1.6rem;
    line-height: 1;
    color: var(--dpfp-blue, #003884);
}
.hero-action-card-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
    color: #333;
}
.hero-action-card-arrow {
    font-size: 0.7rem;
    color: #999;
    transition: color 0.2s;
}
.hero-action-card:hover .hero-action-card-arrow {
    color: var(--dpfp-blue, #003884);
}

/* --- Override dpfp-front.css glassmorphism for white hero background --- */
.dpfp-main-hero .dpfp-search-form-modern {
    background: #f5f7fa;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid #ddd;
}
.dpfp-main-hero .dpfp-search-form-modern:hover,
.dpfp-main-hero .dpfp-search-form-modern:focus-within {
    background: #eef1f6;
    border-color: var(--dpfp-blue, #003884);
}
.dpfp-main-hero .glass-tag {
    background: #f0f2f5;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid #ddd;
    color: #444;
}
.dpfp-main-hero .glass-tag:hover {
    background: var(--dpfp-blue, #003884);
    color: #fff;
    border-color: var(--dpfp-blue, #003884);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero-search-tabs {
        justify-content: flex-start;
        padding-bottom: 2px;
    }
    .hero-action-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    .hero-action-card {
        padding: 16px 8px 12px;
    }
    .hero-action-card-icon {
        font-size: 1.3rem;
    }
    .hero-action-card-label {
        font-size: 0.78rem;
    }
}

@media (max-width: 480px) {
    .hero-search-tab {
        padding: 5px 12px;
        font-size: 0.8rem;
    }
    .hero-action-cards {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
    }
    .hero-action-card {
        padding: 14px 6px 10px;
        border-radius: 12px;
    }
    .hero-action-card-icon {
        font-size: 1.2rem;
    }
    .hero-action-card-label {
        font-size: 0.75rem;
    }
    .search-result-item {
        padding: 8px 12px;
        gap: 10px;
    }
}
