/* ==========================================================================
   CSS 變數定義：集中管理顏色、圓角與陰影，方便初學者修改與學習
   ========================================================================== */
:root {
    /* 品牌色彩 */
    --primary-color: #4f46e5;       /* 主題靛藍色 */
    --primary-hover: #4338ca;       /* 主題色懸停狀態 */
    --secondary-color: #06b6d4;     /* 輔助青色 */
    --accent-color: #f59e0b;        /* 強調金黃色 (用於價錢、標籤) */
    
    /* 文字色彩 */
    --text-main: #1e293b;           /* 主要文字深灰色 */
    --text-muted: #64748b;          /* 次要文字淺灰色 */
    
    /* 背景與毛玻璃效果變數 */
    --bg-body: #f8fafc;             /* 網頁主背景極淺灰 */
    --glass-bg: rgba(255, 255, 255, 0.75);      /* 半透明白色背景 */
    --glass-border: rgba(255, 255, 255, 0.45);  /* 半透明白色邊框 */
    
    /* 圓角與陰影 */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(99, 102, 241, 0.08), 0 4px 6px -2px rgba(99, 102, 241, 0.03);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    
    /* 動態過渡時間 */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   基礎與重設樣式
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Noto Sans TC', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* ==========================================================================
   背景發光光暈 (微光美學裝飾)
   ========================================================================== */
.bg-glow {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.35;
    pointer-events: none;
}

.bg-glow-1 {
    top: -100px;
    left: -100px;
    background: radial-gradient(circle, var(--primary-color) 0%, rgba(255,255,255,0) 70%);
}

.bg-glow-2 {
    bottom: -100px;
    right: -100px;
    background: radial-gradient(circle, var(--secondary-color) 0%, rgba(255,255,255,0) 70%);
}

/* ==========================================================================
   版面容器
   ========================================================================== */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==========================================================================
   頁首標題區（加入背景輪播支援）
   ========================================================================== */
header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
    padding: 60px 20px;
    border-radius: var(--radius-lg);
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
}

/* 輪播背景容器 */
.header-slideshow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* 單張輪播圖片樣式 */
.header-slideshow .slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1s ease-in-out; /* 1 秒的淡入淡出平滑動畫 */
}

/* 當圖片被設為 active 時的樣式，限制最高不透明度以確保前方的文字清晰 */
.header-slideshow .slide.active {
    opacity: 0.35;
}

/* 漸層遮罩：提升前景色對比度，並完美融入網頁背景 */
.slideshow-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.5) 100%);
    pointer-events: none;
}

/* 頁首文字內容容器：置於最上層 */
.header-content {
    position: relative;
    z-index: 1;
}

.logo {
    display: inline-flex;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 6px 16px;
    background: white;
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    color: var(--primary-color);
}

.logo .badge {
    font-size: 0.75rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2px 8px;
    border-radius: 50px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #1e293b 30%, #4f46e5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 400;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* ==========================================================================
   主要內容與搜尋區
   ========================================================================== */
main {
    flex: 1;
}

/* 搜尋區域卡片 (毛玻璃效果) */
.search-sectioncard {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 35px;
}

.search-form {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
}

.input-group {
    flex: 1;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
}

.input-group input {
    width: 100%;
    padding: 14px 18px;
    border: 1.5px solid rgba(203, 213, 225, 0.6);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
    transition: var(--transition-smooth);
    color: var(--text-main);
}

/* 輸入框聚焦樣式 */
.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    background: white;
}

/* 起訖點交換按鈕 */
.swap-btn-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 12px;
}

#swap-btn {
    background: white;
    border: 1px solid rgba(226, 232, 240, 0.8);
    cursor: pointer;
    font-size: 1.2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

#swap-btn:hover {
    transform: rotate(180deg);
    background: #f1f5f9;
}

/* 主按鈕樣式 */
.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 52px;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
    filter: brightness(1.05);
}

.primary-btn:active {
    transform: translateY(0);
}

/* 熱門推薦路線快捷鍵 */
.quick-links {
    margin-top: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px dashed rgba(203, 213, 225, 0.6);
    padding-top: 20px;
}

.quick-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.quick-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quick-route-btn {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.8);
    color: var(--text-main);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-sm);
}

.quick-route-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* ==========================================================================
   預設提示畫面 / 無結果畫面
   ========================================================================== */
.info-placeholder {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition-smooth);
}

.placeholder-content {
    max-width: 450px;
    margin: 0 auto;
}

.placeholder-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    animation: float 3s ease-in-out infinite;
}

.info-placeholder h3 {
    font-size: 1.4rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.info-placeholder p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ==========================================================================
   規劃結果呈現區 (搜尋後顯示)
   ========================================================================== */
.result-section {
    transition: var(--transition-smooth);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 當隱藏時的狀態 */
.hidden {
    display: none !important;
}

.result-header {
    margin-bottom: 20px;
}

.result-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

#route-title {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 14px;
    border-radius: 50px;
    font-size: 1.3rem;
}

/* 雙欄排版 */
.result-grid {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 25px;
}

/* 結果卡片基礎 */
.result-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-md);
}

.result-card h3 {
    font-size: 1.15rem;
    margin-bottom: 20px;
    border-bottom: 1.5px solid rgba(226, 232, 240, 0.8);
    padding-bottom: 12px;
    color: var(--text-main);
}

/* 交通方式清單 */
.transport-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.transport-item {
    background: white;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-sm);
}

.transport-item:hover {
    transform: translateX(4px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.transport-icon {
    font-size: 2rem;
    background: rgba(99, 102, 241, 0.08);
    width: 50px;
    height: 50px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.transport-details {
    flex: 1;
}

.transport-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--text-main);
}

.transport-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.transport-cost {
    color: var(--accent-color);
    font-weight: 700;
}

/* 推薦景點網格 */
.spots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.spot-card {
    background: white;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-sm);
}

.spot-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(99, 102, 241, 0.3);
}

/* 景點照片/小圖裝飾容器 */
.spot-image-placeholder {
    height: 150px; /* 稍微拉高高度，使景點照片呈現更美觀的比例 */
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden; /* 確保懸停放大時圖片不會超出卡片範圍 */
}

/* 景點真實照片樣式 */
.spot-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 保持原圖比例並填滿容器 */
    transition: var(--transition-smooth); /* 平滑過渡動畫 */
}

/* 當滑鼠懸停在卡片上時，圖片微放大，營造動態高級感 */
.spot-card:hover .spot-image {
    transform: scale(1.08);
}

/* 當無照片時顯示的預設 Emoji 樣式 */
.spot-image-emoji {
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 為每個無照片的景點隨機加入不同色系的漸層 */
.spot-card:nth-child(2n) .spot-image-placeholder {
    background: linear-gradient(135deg, #ec4899, #f43f5e);
}
.spot-card:nth-child(3n) .spot-image-placeholder {
    background: linear-gradient(135deg, #10b981, #059669);
}

.spot-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.spot-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.spot-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.spot-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.spot-tag {
    font-size: 0.75rem;
    background: rgba(241, 245, 249, 0.9);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

/* ==========================================================================
   頁尾樣式
   ========================================================================== */
footer {
    text-align: center;
    margin-top: 50px;
    padding-top: 25px;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ==========================================================================
   動畫效果定義
   ========================================================================== */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   響應式設計 (RWD) 調整
   ========================================================================== */
@media (max-width: 850px) {
    .result-grid {
        grid-template-columns: 1fr; /* 在平板與手機上改為單欄排版 */
    }
    
    header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 20px 12px;
    }
    
    .search-sectioncard {
        padding: 20px 15px;
    }
    
    .search-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .swap-btn-container {
        padding-bottom: 0;
        margin: -5px 0;
    }
    
    #swap-btn {
        transform: rotate(90deg);
    }
    
    #swap-btn:hover {
        transform: rotate(270deg);
    }
    
    .primary-btn {
        width: 100%;
        margin-top: 10px;
    }
    
    .quick-links {
        flex-direction: column;
        align-items: flex-start;
    }
}
