/* 
 * Travel Package Grid Styles
 * 旅遊行程卡片網格樣式
 * 
 * 版本: 2.1
 * 更新日期: 2025-01-23
 * 參考設計: 歐洲 Europe 行程卡片
 */

/* ============================================
   頁面頂部區域 (Header Section)
   ============================================ */

.travel-header-section {
    position: relative;
    min-height: 400px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 0 160px 0;
    /* 增加底部內距，為卡片上浮預留空間 */
    margin-bottom: 0;
}

/* 疊加層效果，增強文字對比 */
/* 疊加層效果，增強文字對比 - 修正為上方半透明，下方純白導角 */
.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* 調整遮罩透明度，使背景圖更淡，呈現浮水印般的質感 */
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.85) 0%, #ffffff 100%);
    pointer-events: none;
    z-index: 1;
}

.header-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: #4a4a4a;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-main-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #4a4a4a;
    line-height: 1.2;
    letter-spacing: 1px;
}

.header-subtitle {
    font-size: 28px;
    font-weight: 500;
    margin-bottom: 25px;
    color: #555;
}

.header-description {
    font-size: 16px;
    line-height: 1.8;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   旅遊行程容器
   ============================================ */

.travel-packages-container {
    padding: 0 15px 40px 15px;
    max-width: 1300px;
    margin: -120px auto 0 auto;
    /* 負邊距讓卡片上浮覆蓋 Header */
    position: relative;
    z-index: 5;
}

/* 強制 Grid 行為修正 (確保後端預覽與前端一致的 Flex 行為) */
.travel-packages-grid {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.travel-packages-grid>[class*="col-"] {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    box-sizing: border-box;
}

/* 修正 Grid 寬度，避免因外部樣式干擾導致換行 */
@media (min-width: 992px) {
    .travel-packages-grid .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }

    .travel-packages-grid .col-lg-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .travel-packages-grid .col-lg-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }
}

/* ============================================
   旅遊行程卡片 (Base Styles)
   ============================================ */

.travel-package-card {
    display: flex;
    flex-direction: column;
    position: relative;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.04);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none !important;
    color: inherit;
    height: 100%;
    border: none;
}

.travel-package-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

/* 圖片區域 */
.card-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #e9ecef;
}

.card-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.travel-package-card:hover .card-image {
    transform: scale(1.05);
}

/* 內容區域 */
.card-content {
    /* 移除 relative，讓 absolute tags 能相對於 card 定位 */
    padding: 24px;
    background: #fafafa;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Vertical Card Layout (Small / Default)
   ============================================ */
.layout-vertical .card-image-wrapper {
    padding-top: 60%;
    /* Aspect Ratio 5:3 */
}

/* Vertical Tags: Overlay on Image */
.layout-vertical .card-tags {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 2;
    pointer-events: none;
    /* 讓點擊穿透到卡片 */
}

.layout-vertical .tag-item {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(30, 30, 30, 0.85);
    /* 深色半透明背景 */
    color: #fff;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.layout-vertical .card-title {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 12px;
    line-height: 1.5;
    margin-top: 5px;
}

.layout-vertical .card-info {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    display: flex;
    gap: 15px;
}

.layout-vertical .info-item i {
    color: #17a2b8;
    margin-right: 5px;
}

/* Vertical card hides description */
.layout-vertical .card-description {
    display: none;
}

.layout-vertical .card-price {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.layout-vertical .price-value {
    color: #17a2b8;
    font-size: 20px;
    font-weight: 700;
}

/* ============================================
   Horizontal Card Layout (Large)
   ============================================ */
.layout-horizontal {
    flex-direction: row;
    /* 水平排列 */
    align-items: stretch;
}

.layout-horizontal .card-image-wrapper {
    width: 55%;
    /* 左側圖片 */
    flex: 0 0 55%;
    padding-top: 0;
    min-height: 100%;
}

.layout-horizontal .card-content {
    width: 45%;
    /* 右側內容 */
    flex: 0 0 45%;
    padding: 30px;
    background: #fff;
    /* 水平卡片背景純白 */
}

/* Horizontal Tags (Pill Style) - Flow in content */
.layout-horizontal .card-tags {
    position: relative;
    margin-bottom: 15px;
    width: auto;
    /* Reset absolute props */
    top: auto;
    left: auto;
}

.layout-horizontal .tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.layout-horizontal .tag-item {
    display: inline-block;
    padding: 4px 16px;
    background: transparent;
    color: #17a2b8;
    border: 1px solid #17a2b8;
    /* 藍色邊框 */
    border-radius: 20px;
    font-size: 12px;
    margin-right: 0;
    margin-bottom: 0;
}

.layout-horizontal .card-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.4;
}

.layout-horizontal .card-info {
    font-size: 15px;
    color: #666;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
}

.layout-horizontal .info-item i {
    color: #17a2b8;
    margin-right: 5px;
}

.layout-horizontal .card-description {
    font-size: 15px;
    color: #666;
    line-height: 1.7;
    margin-bottom: 25px;
    display: -webkit-box;
    -webkit-line-clamp: 2.2;
    /* Show bit more text */
    line-clamp: 2.2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.layout-horizontal .card-price {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
}

.layout-horizontal .price-value {
    color: #17a2b8;
    font-size: 24px;
    font-weight: 700;
}

/* ============================================
   Response Tweaks
   ============================================ */
@media (max-width: 991px) {

    /* 強制轉為垂直佈局 - 重置所有 Horizontal 特有樣式以匹配 Vertical */
    .layout-horizontal {
        flex-direction: column !important;
    }

    .layout-horizontal .card-image-wrapper {
        width: 100% !important;
        flex: none !important;
        padding-top: 60% !important;
        /* Restore aspect ratio */
        min-height: 0 !important;
        /* Reset desktop min-height */
    }

    .layout-horizontal .card-content {
        width: 100% !important;
        flex: none !important;
    }

    /* 水平卡片轉手機版時：標籤改回覆蓋樣式 (Overlay) */
    .layout-horizontal .card-tags {
        position: absolute;
        top: 15px;
        left: 15px;
        width: auto;
        margin-bottom: 0;
        z-index: 2;
        pointer-events: none;
    }

    /* 重置 Tag Item 樣式為深色背景 (仿照 .layout-vertical .tag-item) */
    .layout-horizontal .tag-item {
        background: rgba(30, 30, 30, 0.85);
        /* 深色半透明 */
        color: #fff;
        border: none;
        padding: 4px 12px;
        margin: 0 4px 4px 0;
        /* 調整間距 */
    }

    /* 手機版隱藏描述 (與小卡一致) */
    .layout-horizontal .card-description {
        display: none;
    }
}