/**
 * Hero Unified Style — TASK-HP-2
 * 轮播 fadeOut + 单一搜索框 + 热门标签
 * Dependencies: OwlCarousel 2, design-system.css (tokens)
 */

/* ============================================
   1. Hero Container (override bc-form-search-all)
   ============================================ */
.bc-form-search-all.unified {
    position: relative;
    padding: 0 !important;  /* 覆盖基础 padding: 200px 0 0 */
    margin-bottom: 0 !important;
    min-height: 595px;  /* TASK-HP-5 D-3: Hero 高度 +100px（桌面） */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;  /* 允许搜索下拉浮出 */
}

@media (max-width: 768px) {
    .bc-form-search-all.unified {
        min-height: 667px; /* TASK-HP-5 D-3: Hero 高度 +100px（平板/手机） */
        max-height: none;
    }
}

@media (max-width: 480px) {
    .bc-form-search-all.unified {
        min-height: 682px; /* TASK-HP-5 D-3: Hero 高度 +100px（小屏） */
    }
}

/* ============================================
   2. Carousel Background (matches .effect > .owl-carousel > .item > .item-bg structure)
   ============================================ */

/* .effect 容器绝对定位覆盖整个 Hero */
.bc-form-search-all.unified .effect {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    overflow: hidden;
}

.bc-form-search-all.unified .effect .owl-carousel,
.bc-form-search-all.unified .effect .owl-stage-outer,
.bc-form-search-all.unified .effect .owl-stage,
.bc-form-search-all.unified .effect .owl-item {
    height: 100%;
}

.bc-form-search-all.unified .effect .owl-dots {
    display: none !important;
}

.bc-form-search-all.unified .effect .owl-nav {
    display: flex !important;
    z-index: 2;
}

/* TASK-HP-5 D-4: Desktop hover 才显示 Hero 箭头（移动端保留可见） */
@media (hover: hover) and (pointer: fine) {
    .bc-form-search-all.unified .effect .owl-nav button.owl-prev,
    .bc-form-search-all.unified .effect .owl-nav button.owl-next {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .bc-form-search-all.unified:hover .effect .owl-nav button.owl-prev,
    .bc-form-search-all.unified:hover .effect .owl-nav button.owl-next,
    .bc-form-search-all.unified:focus-within .effect .owl-nav button.owl-prev,
    .bc-form-search-all.unified:focus-within .effect .owl-nav button.owl-next {
        opacity: 1;
        pointer-events: auto;
    }
}

.bc-form-search-all.unified .effect .item {
    width: 100%;
    height: 100% !important;
}

.bc-form-search-all.unified .effect .item-bg {
    width: 100%;
    height: 100%;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Content layer 浮于背景之上 */
.bc-form-search-all.unified > .container {
    position: relative;
    z-index: 2;
}

/* Fallback: OwlCarousel 未加载时也显示第一张背景 */
.bc-form-search-all.unified .effect .owl-carousel:not(.owl-loaded) {
    display: block !important;
    height: 100%;
}

.bc-form-search-all.unified .effect .owl-carousel:not(.owl-loaded) .item {
    display: block;
    height: 100%;
}

.bc-form-search-all.unified .effect .owl-carousel:not(.owl-loaded) .item:not(:first-child) {
    display: none;
}

/* 向后兼容旧的 hero-unified-carousel 类名 */
.hero-unified-carousel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-unified-carousel .owl-carousel,
.hero-unified-carousel .owl-stage-outer,
.hero-unified-carousel .owl-stage,
.hero-unified-carousel .owl-item {
    height: 100%;
}

.hero-unified-carousel .owl-dots,
.hero-unified-carousel .owl-nav {
    display: none;
}

/* ============================================
   3. Content Layer
   ============================================ */
.hero-unified-content {
    position: relative;
    z-index: 2;
    padding-top: 40px;
    padding-bottom: 24px;
}

@media (max-width: 768px) {
    .hero-unified-content {
        padding-top: 30px;
        padding-bottom: 16px;
    }
}

/* Title — 匹配生产站 */
.text-heading,
.hero-unified-title {
    font-family: var(--font-heading, "DM Sans");
    font-weight: 700;
    font-size: 36px;
    line-height: 1.3;
    color: #fff !important;
    margin-bottom: 6px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

@media (max-width: 768px) {
    .text-heading,
    .hero-unified-title {
        font-size: 24px;
    }
}

/* Subtitle */
.sub-heading,
.hero-unified-subtitle {
    font-family: var(--font-body, "DM Sans");
    font-size: 15px;
    color: rgba(255,255,255,0.85) !important;
    margin-bottom: 20px;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

@media (max-width: 768px) {
    .sub-heading,
    .hero-unified-subtitle {
        font-size: 13px;
        margin-bottom: 16px;
    }
}

/* ============================================
   4. Search Box
   ============================================ */
.hero-search-wrap {
    position: relative;
    max-width: 600px;
    margin: 0 auto 20px;
}

.hero-search-form {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 56px;
    background: #fff;
    border-radius: 28px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    transition: box-shadow 0.25s ease;
    overflow: hidden;
}

.hero-search-form:focus-within {
    box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}

.hero-search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 100%;
    color: var(--color-text-muted, #6B7280);
    font-size: 18px;
    flex-shrink: 0;
    cursor: pointer;  /* FIX-4: 可点击 */
    transition: color 0.2s ease;
}

.hero-search-icon:hover {
    color: #FF6B35;  /* FIX-4: 悬停变色 */
}

.hero-search-input {
    flex: 1;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-body, "DM Sans");
    font-size: 16px;
    color: var(--color-text, #1F2937);
    padding-right: 12px;
}

.hero-search-input::placeholder {
    color: var(--color-text-light, #9CA3AF);
    font-size: 15px;
}

@media (max-width: 768px) {
    .hero-search-form {
        height: 48px;
        border-radius: 24px;
    }

    .hero-search-input {
        font-size: 14px;
    }

    .hero-search-input::placeholder {
        font-size: 13px;
    }

    .hero-search-icon {
        width: 44px;
        font-size: 16px;
    }
}

/* Clear button */
.hero-search-clear {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 100%;
    cursor: pointer;
    color: var(--color-text-muted, #6B7280);
    font-size: 14px;
    flex-shrink: 0;
    border: none;
    background: none;
    padding: 0;
}

.hero-search-clear.visible {
    display: flex;
}

/* ============================================
   5. Search Dropdown
   ============================================ */
.hero-search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 1050;  /* FIX-1: 高于所有 Hero 元素 */
}

.hero-search-dropdown.open {
    display: block;
}

/* Scrollbar */
.hero-search-dropdown::-webkit-scrollbar {
    width: 5px;
}

.hero-search-dropdown::-webkit-scrollbar-thumb {
    background: var(--color-border, #E5E7EB);
    border-radius: 3px;
}

/* Reuse global-search result item styles */
.hero-search-dropdown .gs-state {
    padding: 32px 20px;
    text-align: center;
    color: var(--color-text-muted, #6B7280);
    font-size: 14px;
}

.hero-search-dropdown .gs-state .gs-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--color-border, #E5E7EB);
    border-top-color: #FF6B35;
    border-radius: 50%;
    animation: gs-spin 0.6s linear infinite;
    margin-bottom: 8px;
}

.hero-search-dropdown .gs-group {
    padding: 8px 0;
}

.hero-search-dropdown .gs-group + .gs-group {
    border-top: 1px solid var(--color-border-light, #F3F4F6);
}

.hero-search-dropdown .gs-group-title {
    padding: 6px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted, #6B7280);
}

.hero-search-dropdown .gs-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.hero-search-dropdown .gs-item:hover {
    background: var(--color-bg-alt, #f8f9fa);
    text-decoration: none;
    color: inherit;
}

.hero-search-dropdown .gs-item-img {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--color-bg-alt, #f8f9fa);
}

.hero-search-dropdown .gs-item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-search-dropdown .gs-item-img .gs-icon-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--color-text-light, #9CA3AF);
}

.hero-search-dropdown .gs-item-info {
    flex: 1;  /* FIX-2: 名称区域撑满，推动价格到右侧 */
    min-width: 0;
}

.hero-search-dropdown .gs-item-title {
    font-family: var(--font-heading, "DM Sans");
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text, #1F2937);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-search-dropdown .gs-item-title .gs-hl {
    color: #FF6B35;
    font-weight: 600;
}

.hero-search-dropdown .gs-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
    font-size: 12px;
    color: var(--color-text-muted, #6B7280);
}

.hero-search-dropdown .gs-type-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.hero-search-dropdown .gs-type-hotel    { background: #DBEAFE; color: #1D4ED8; }
.hero-search-dropdown .gs-type-tour     { background: #D1FAE5; color: #047857; }
.hero-search-dropdown .gs-type-event    { background: #FEE2E2; color: #DC2626; }
.hero-search-dropdown .gs-type-dining   { background: #FEF3C7; color: #D97706; }
.hero-search-dropdown .gs-type-boat     { background: #E0E7FF; color: #4338CA; }
.hero-search-dropdown .gs-type-location { background: #F3F4F6; color: #4B5563; }

.hero-search-dropdown .gs-item-price {
    flex-shrink: 0;  /* FIX-2: 价格不缩小，保持右对齐 */
    margin-left: auto;  /* FIX-2: 强制右对齐 */
    font-family: var(--font-heading, "DM Sans");
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text, #1F2937);
    white-space: nowrap;
}

.hero-search-dropdown .gs-item-price .gs-currency {
    font-size: 11px;
    font-weight: 500;
}

.hero-search-dropdown .gs-service-count {
    font-size: 12px;
    color: var(--color-text-muted, #6B7280);
}

/* ============================================
   6. Hot Tags
   ============================================ */
.hero-hot-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
}

.hero-hot-tag {
    display: inline-block;
    padding: 6px 16px;
    background: #ffffff;
    border: 2px solid var(--color-primary, #059669);
    border-radius: 20px;
    color: var(--color-primary, #059669);
    font-family: var(--font-body, "DM Sans");
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.hero-hot-tag:hover {
    background: var(--color-primary, #059669) !important;
    border-color: #ffffff !important;
    color: #ffffff !important;
    text-decoration: none;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .hero-hot-tags {
        gap: 8px;
        padding: 0 8px; /* TASK-HP-4: Side padding for mobile */
    }

    .hero-hot-tag {
        padding: 6px 14px; /* TASK-HP-4: Slightly larger for touch (≥44px tall) */
        font-size: 12px;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
    }
}

/* TASK-HP-4 M-2: Hero search box full width on mobile */
@media (max-width: 768px) {
    .hero-search-wrap {
        max-width: 100%;
        padding: 0 12px;
    }
}

/* TASK-HP-4B-v2: Hide hero arrows on mobile — use touch swipe instead */
@media (max-width: 768px) {
    .bc-form-search-all.unified .effect .owl-nav {
        display: none !important;
    }
}

@media (max-width: 480px) {
    /* Hero content side padding */
    .hero-unified-content {
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* ============================================
   7. Carousel Dots (optional, minimal)
   ============================================ */
.hero-unified-carousel .owl-dots {
    display: flex !important;
    justify-content: center;
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    gap: 6px;
}

.hero-unified-carousel .owl-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.25s;
}

.hero-unified-carousel .owl-dot.active {
    background: #fff;
    width: 24px;
    border-radius: 4px;
}
