/* ===== Hero Carousel - 獨立樣式檔案 ===== */

:root {
    --carousel-height: 75vh;
}

/* ===== 基本容器限制 ===== */

.hero-carousel-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    height: var(--carousel-height, 75vh) !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    position: relative !important;
    z-index: 1 !important;
}

.hero-carousel-wrapper .carousel {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.hero-carousel-wrapper .carousel-inner {
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* ===== 輪播項目 ===== */

.hero-carousel-wrapper .carousel-item {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    z-index: 1 !important;
    transition: opacity 1.2s ease-in-out !important;
    overflow: hidden !important;
}

.hero-carousel-wrapper .carousel-item.active {
    opacity: 1 !important;
    z-index: 2 !important;
}

/* ===== Bootstrap Carousel Fade 效果 ===== */

.hero-carousel-wrapper .carousel.carousel-fade .carousel-item {
    display: block !important;
    opacity: 0 !important;
    transition: opacity 1.2s ease-in-out !important;
    transform: none !important;
}

.hero-carousel-wrapper .carousel.carousel-fade .carousel-item.active {
    opacity: 1 !important;
    z-index: 2 !important;
}

.hero-carousel-wrapper .carousel.carousel-fade .carousel-item-next.carousel-item-start,
.hero-carousel-wrapper .carousel.carousel-fade .carousel-item-prev.carousel-item-end {
    opacity: 0 !important;
    z-index: 1 !important;
}

.hero-carousel-wrapper .carousel.carousel-fade .carousel-item-next,
.hero-carousel-wrapper .carousel.carousel-fade .carousel-item-prev,
.hero-carousel-wrapper .carousel.carousel-fade .carousel-item.active {
    transform: none !important;
}

/* ===== 輪播背景圖片 ===== */

.hero-carousel-wrapper .carousel-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    z-index: 0 !important;
}

/* ===== 遮罩層 ===== */

.hero-carousel-wrapper .carousel-item::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: linear-gradient(to right, rgba(0, 51, 102, 1) 0%, rgba(0, 51, 102, 1) 30%, rgba(0, 51, 102, 0) 100%) !important;
    z-index: 1 !important;
}

/* ===== 文字容器 ===== */

.hero-carousel-wrapper .carousel-caption {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    z-index: 10 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
}

.hero-carousel-wrapper .carousel-caption .container {
    position: relative !important;
    z-index: 20 !important;
    padding-left: var(--bs-gutter-x, 0.75rem) !important;
    padding-right: var(--bs-gutter-x, 0.75rem) !important;
    margin: 0 auto !important;
    width: 100% !important;
    max-width: var(--container-max-width, 1320px) !important;
    height: auto !important;
}

.hero-carousel-wrapper .carousel-caption .caption-content {
    position: relative !important;
    z-index: 25 !important;
    padding: 0 !important;
    margin: 0 !important;
    background: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    width: 100% !important;
}

/* ===== 文字樣式 ===== */

.hero-carousel-wrapper .carousel-title {
    position: relative !important;
    z-index: 30 !important;
    font-size: clamp(2rem, 4vw, 3rem) !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    margin: 0 0 1.5rem 0 !important;
    padding: 0 !important;
    text-align: left !important;
    line-height: 1.2 !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.hero-carousel-wrapper .carousel-subtitle {
    position: relative !important;
    z-index: 30 !important;
    font-size: clamp(1rem, 1.5vw, 1.25rem) !important;
    color: #ffffff !important;
    margin: 0 0 2rem 0 !important;
    padding: 0 !important;
    text-align: left !important;
    line-height: 1.6 !important;
    max-width: 550px !important;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3) !important;
}

/* ===== 按鈕樣式 ===== */

.hero-carousel-wrapper .carousel-button {
    position: relative !important;
    z-index: 30 !important;
    background: transparent !important;
    border: 2px solid #ffffff !important;
    color: #ffffff !important;
    padding: 0.875rem 2.5rem !important;
    margin: 0 0 3.5rem 0 !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    display: inline-block !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

.hero-carousel-wrapper .carousel-button:hover {
    background: #ffffff !important;
    color: #003366 !important;
    border-color: #ffffff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ===== 內容動畫 ===== */

.hero-carousel-wrapper .carousel-item .carousel-title,
.hero-carousel-wrapper .carousel-item .carousel-subtitle,
.hero-carousel-wrapper .carousel-item .carousel-button {
    opacity: 0 !important;
    transform: translateY(20px) !important;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out !important;
}

/* 當 carousel-item 變成 active 時，直接顯示文字 */
.hero-carousel-wrapper .carousel-item.active .carousel-title,
.hero-carousel-wrapper .carousel-item.active .carousel-subtitle,
.hero-carousel-wrapper .carousel-item.active .carousel-button {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* 文字延遲動畫效果 */
.hero-carousel-wrapper .carousel-item.active .carousel-title {
    transition-delay: 0.2s !important;
}

.hero-carousel-wrapper .carousel-item.active .carousel-subtitle {
    transition-delay: 0.4s !important;
}

.hero-carousel-wrapper .carousel-item.active .carousel-button {
    transition-delay: 0.6s !important;
}

/* ===== 控制按鈕 ===== */

.hero-carousel-wrapper .carousel-control-prev,
.hero-carousel-wrapper .carousel-control-next {
    position: absolute !important;
    top: 50% !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
    width: auto !important;
    height: auto !important;
    background: none !important;
    border: none !important;
    opacity: 0.8 !important;
    z-index: 30 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.hero-carousel-wrapper .carousel-control-prev:hover,
.hero-carousel-wrapper .carousel-control-next:hover {
    opacity: 1 !important;
    background: none !important;
}

.hero-carousel-wrapper .carousel-control-prev-icon,
.hero-carousel-wrapper .carousel-control-next-icon {
    width: 3rem !important;
    height: 3rem !important;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* ===== 指示器 ===== */

.hero-carousel-wrapper .carousel-indicators {
    position: absolute !important;
    bottom: 1.5rem !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    margin: 0 !important;
    z-index: 20 !important;
    display: flex !important;
    gap: 8px;
    justify-content: center !important;
}

.hero-carousel-wrapper .carousel-indicators button {
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    background-color: rgba(255, 255, 255, 0.5) !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 1 !important;
    transition: all 0.3s ease !important;
}

.hero-carousel-wrapper .carousel-indicators button.active {
    background-color: #ffffff !important;
    transform: scale(1.2) !important;
}

/* ===== 響應式設計 ===== */

/* 平板直向 (768px - 991px) */
@media (max-width: 991px) {
    .hero-carousel-wrapper {
        height: 45vh !important;
        aspect-ratio: 16 / 10 !important;
    }

    .hero-carousel-wrapper .carousel-title {
        font-size: clamp(1.5rem, 3.5vw, 2.25rem) !important;
        margin-bottom: 1rem !important;
    }

    .hero-carousel-wrapper .carousel-subtitle {
        font-size: clamp(0.9rem, 2.5vw, 1.05rem) !important;
        margin-bottom: 1.25rem !important;
    }

    .hero-carousel-wrapper .carousel-button {
        padding: 0.65rem 1.75rem !important;
        font-size: 0.9rem !important;
        margin-bottom: 3rem !important;
    }

    .hero-carousel-wrapper .carousel-control-prev,
    .hero-carousel-wrapper .carousel-control-next {
        display: none !important;
    }
}

/* 手機版 (≤768px) */
@media (max-width: 768px) {
    .hero-carousel-wrapper {
        height: 35vh !important;
        aspect-ratio: 16 / 12 !important;
    }

    /* 移除固定 padding，使用 container 的標準間距 */

    .hero-carousel-wrapper .carousel-item::before {
        background: linear-gradient(to right, rgba(0, 51, 102, 0.95) 0%, rgba(0, 51, 102, 0.8) 50%, rgba(0, 51, 102, 0.4) 100%) !important;
    }

    .hero-carousel-wrapper .carousel-title {
        font-size: clamp(1.25rem, 4vw, 1.75rem) !important;
        margin-bottom: 0.75rem !important;
    }

    .hero-carousel-wrapper .carousel-subtitle {
        font-size: clamp(0.85rem, 2.5vw, 0.95rem) !important;
        margin-bottom: 1rem !important;
    }

    .hero-carousel-wrapper .carousel-button {
        padding: 0.6rem 1.5rem !important;
        font-size: 0.85rem !important;
        margin-bottom: 3rem !important;
    }

    .hero-carousel-wrapper .carousel-control-prev,
    .hero-carousel-wrapper .carousel-control-next {
        display: none !important;
    }

    .hero-carousel-wrapper .carousel-indicators {
        left: 50% !important;
        transform: translateX(-50%) !important;
        bottom: 0.75rem !important;
        gap: 6px;
    }

    .hero-carousel-wrapper .carousel-indicators button {
        width: 8px !important;
        height: 8px !important;
    }
}

/* 小手機 (≤480px) */
@media (max-width: 480px) {
    .hero-carousel-wrapper {
        height: 32vh !important;
        aspect-ratio: 16 / 13 !important;
    }

    /* 移除固定 padding，使用 container 的標準間距 */

    .hero-carousel-wrapper .carousel-item::before {
        background: rgba(0, 51, 102, 0.85) !important;
    }

    .hero-carousel-wrapper .carousel-title {
        font-size: clamp(1.1rem, 5vw, 1.5rem) !important;
        margin-bottom: 0.5rem !important;
    }

    .hero-carousel-wrapper .carousel-subtitle {
        font-size: clamp(0.8rem, 2.5vw, 0.9rem) !important;
        margin-bottom: 0.75rem !important;
    }

    .hero-carousel-wrapper .carousel-button {
        padding: 0.5rem 1.25rem !important;
        font-size: 0.8rem !important;
        margin-bottom: 2.5rem !important;
    }

    .hero-carousel-wrapper .carousel-control-prev,
    .hero-carousel-wrapper .carousel-control-next {
        display: none !important;
    }

    .hero-carousel-wrapper .carousel-indicators {
        left: 50% !important;
        transform: translateX(-50%) !important;
        bottom: 0.5rem !important;
        gap: 5px;
    }

    .hero-carousel-wrapper .carousel-indicators button {
        width: 6px !important;
        height: 6px !important;
    }
}

/* 極小手機 (≤360px) */
@media (max-width: 360px) {
    .hero-carousel-wrapper {
        height: 30vh !important;
        aspect-ratio: 16 / 14 !important;
    }

    /* 移除固定 padding，使用 container 的標準間距 */

    .hero-carousel-wrapper .carousel-title {
        font-size: 1.1rem !important;
        margin-bottom: 0.4rem !important;
    }

    .hero-carousel-wrapper .carousel-subtitle {
        font-size: 0.75rem !important;
        margin-bottom: 0.5rem !important;
    }

    .hero-carousel-wrapper .carousel-button {
        padding: 0.45rem 1rem !important;
        font-size: 0.75rem !important;
        margin-bottom: 2rem !important;
    }

    .hero-carousel-wrapper .carousel-indicators {
        left: 50% !important;
        transform: translateX(-50%) !important;
        bottom: 0.4rem !important;
    }

    .hero-carousel-wrapper .carousel-indicators button {
        width: 5px !important;
        height: 5px !important;
    }
}

/* ===== 可訪問性 ===== */

.hero-carousel-wrapper .carousel-control-prev:focus,
.hero-carousel-wrapper .carousel-control-next:focus,
.hero-carousel-wrapper .carousel-indicators button:focus {
    outline: 2px solid #ffffff;
    outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
    .hero-carousel-wrapper .carousel-item,
    .hero-carousel-wrapper .carousel-item .carousel-title,
    .hero-carousel-wrapper .carousel-item .carousel-subtitle,
    .hero-carousel-wrapper .carousel-item .carousel-button {
        transition: none !important;
        animation: none !important;
    }
}
