/**
 * Migrant Ticket - Header Inline Styles (Extracted from JSP)
 * 從 common/header.jsp 提取的 inline CSS
 * TODO: 未來逐步遷移到設計系統
 */

:root {
    --primary-color: #0066cc;
    --secondary-color: #28a745;
    --danger-color: #dc3545;
}

/* ========== 頁面過場動畫 ========== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    /* 移除 opacity: 0 避免白屏 */
}

body.page-loaded {
    /* 保留類別但不需要樣式 */
}

/* 頁面淡出效果 */
body.page-transition {
    opacity: 0;
    transition: opacity 0.3s ease-in-out; /* 延長至 300ms */
}

/* Loading overlay */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
}

.page-loader.active {
    opacity: 1;
    pointer-events: all;
}

.loader-content {
    text-align: center;
    background: white;
    padding: 2rem 3rem;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e0e0e0;
    border-top: 5px solid #0066cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.loader-text {
    margin-top: 1.25rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
}

.loader-subtext {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #718096;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 手機版 Loading 優化 */
@media (max-width: 768px) {
    .loader-content {
        padding: 1.5rem 2rem;
        margin: 0 1rem;
    }

    .loader-text {
        font-size: 1rem;
    }

    .loader-subtext {
        font-size: 0.875rem;
    }
}

@media (max-width: 375px) {
    .loader-content {
        padding: 1.25rem 1.5rem;
    }

    .loader-spinner {
        width: 40px;
        height: 40px;
        border-width: 4px;
    }

    .loader-text {
        font-size: 0.95rem;
        margin-top: 1rem;
    }

    .loader-subtext {
        font-size: 0.875rem;
    }
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0052a3 100%);
    color: white;
    padding: 3rem 0;
}

.search-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 2rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border: none;
}

.btn-primary:hover {
    background-color: #0052a3;
}

.flight-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s;
}

.flight-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.price-badge {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.airline-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.footer {
    background-color: #343a40;
    color: white;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* ========== 返回頂部按鈕 ========== */
.back-to-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #0066cc 0%, #004a99 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}

.back-to-top-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 102, 204, 0.5);
}

.back-to-top-btn:active {
    transform: translateY(0);
}

.back-to-top-btn.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 手機版返回頂部按鈕優化 */
@media (max-width: 768px) {
    .back-to-top-btn {
        bottom: 20px;
        right: 20px;
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }
}

/* 小螢幕手機 */
@media (max-width: 375px) {
    .back-to-top-btn {
        bottom: 15px;
        right: 15px;
        width: 44px;
        height: 44px;
    }
}

/* ========== 新搜尋表單樣式 ========== */

/* 旅程類型選擇器 */
.trip-type-selector {
    display: flex;
    gap: 1rem;
    background: #f8f9fa;
    padding: 0.5rem;
    border-radius: 12px;
}

.trip-type-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: white;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 1.1rem;
    color: #495057;
}

.trip-type-option:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.trip-type-option i {
    font-size: 1.3rem;
}

input[type="radio"]:checked + .trip-type-option {
    background: linear-gradient(135deg, #0066cc 0%, #004a99 100%);
    color: white;
    border-color: #0066cc;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4);
}

/* 表單輸入框包裝器 */
.search-input-wrapper {
    position: relative;
}

/* 表單標籤樣式增強 */
.hero-section .form-label,
.search-card .form-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.95rem;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.hero-section .form-label i,
.search-card .form-label i {
    font-size: 1.1rem;
}

/* 表單輸入框樣式增強 */
.hero-section .form-control,
.search-card .form-control {
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
    font-weight: 500;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
}

/* 下拉選單樣式增強 */
.hero-section .form-select,
.search-card .form-select {
    padding: 1rem 1.25rem;
    padding-right: 2.5rem;
    font-size: 1.1rem;
    font-weight: 500;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
}

.hero-section .form-select optgroup,
.search-card .form-select optgroup {
    font-weight: 600;
    font-size: 1rem;
    color: #4a5568;
    background: #f7fafc;
    padding: 0.5rem;
}

.hero-section .form-select option,
.search-card .form-select option {
    padding: 0.75rem;
    font-weight: 400;
    color: #2d3748;
    background: #ffffff;
}

.search-hint {
    display: block;
    margin-top: 0.4rem;
    color: #718096;
    font-size: 0.875rem;
}

/* 乘客選擇器 */
.passenger-selector {
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.passenger-selector:hover {
    border-color: #cbd5e0;
    background: #edf2f7;
}

.passenger-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #2d3748;
}

.passenger-label i {
    font-size: 1.2rem;
    color: #0066cc;
}

.passenger-label small {
    display: block;
    font-size: 0.875rem;
    font-weight: 400;
}

.passenger-select {
    width: 70px;
    padding: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.passenger-select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.passenger-select:hover {
    border-color: #0066cc;
}

/* 搜尋按鈕（覆寫 Bootstrap 按鈕樣式） */
.hero-section .btn-primary,
.search-card .btn-primary {
    padding: 1.25rem 2rem;
    font-size: 1.2rem;
    font-weight: 700;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.hero-section .btn-primary:hover,
.search-card .btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 102, 204, 0.4);
}

.hero-section .btn-primary:active,
.search-card .btn-primary:active {
    transform: translateY(-1px);
}

.hero-section .btn-primary i,
.search-card .btn-primary i {
    font-size: 1.3rem;
}

/* 紫色文字顏色 */
.text-purple {
    color: #9f7aea !important;
}

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

/* Mobile Portrait (320px - 575px) */
@media (max-width: 575px) {
    .hero-section {
        padding: 2rem 0;
    }

    .search-card {
        padding: 1.25rem;
    }

    .trip-type-selector {
        flex-direction: column;
        gap: 0.75rem;
    }

    .trip-type-option {
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }

    .form-label {
        font-size: 0.9rem;
    }

    .form-control,
    .form-select {
        font-size: 1rem;
        padding: 0.875rem 1rem;
    }

    .hero-section .btn-primary,
    .search-card .btn-primary {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }

    .passenger-selector {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .passenger-select {
        width: 100%;
    }
}

/* Tablet (576px - 991px) */
@media (min-width: 576px) and (max-width: 991px) {
    .search-card {
        padding: 1.75rem;
    }

    .trip-type-option {
        font-size: 1.05rem;
    }
}

/* Medium devices - 768px breakpoint for compatibility */
@media (max-width: 768px) {
    .trip-type-selector {
        flex-direction: column;
    }

    .passenger-selector {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .passenger-select {
        width: 100%;
    }
}

/* Desktop (992px+) - Full experience */
@media (min-width: 992px) {
    .search-card {
        padding: 2rem;
    }

    /* Add hover animations only on desktop */
    .flight-option-card {
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }
}

/* High-resolution displays */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }

    .search-card {
        padding: 2.5rem;
    }
}

/* Landscape mode on mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .hero-section {
        padding: 1.5rem 0;
    }

    .search-card {
        padding: 1rem;
    }
}

/* 動畫效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-card {
    animation: fadeInUp 0.6s ease-out;
}

/* 回程日期欄位動畫 */
#returnDateWrapper {
    transition: all 0.4s ease;
    overflow: hidden;
}

#returnDateWrapper.hiding {
    opacity: 0;
    max-height: 0;
    margin: 0 !important;
    padding: 0 !important;
}

/* ========== 首頁搜尋表單 - 手機版優化 ========== */
@media (max-width: 768px) {
    /* Hero Section */
    .hero-section {
        padding: 2rem 0;
    }

    .hero-section h1 {
        font-size: 1.75rem !important;
    }

    .hero-section p.lead {
        font-size: 1rem !important;
    }

    /* 搜尋卡片 */
    .search-card {
        padding: 1.25rem;
        margin: 0 0.5rem;
    }

    /* 旅程類型選擇器 */
    .trip-type-selector {
        flex-direction: column;
        gap: 0.75rem;
    }

    .trip-type-option {
        padding: 0.875rem 1.25rem;
        font-size: 0.95rem;
    }

    .trip-type-option i {
        font-size: 1.1rem;
    }

    /* 搜尋標籤 */
    .search-label {
        font-size: 0.9rem;
    }

    .search-label i {
        font-size: 1rem;
    }

    /* 搜尋輸入框和下拉選單 */
    .search-input,
    .search-select {
        padding: 0.875rem 1rem;
        font-size: 16px !important; /* 防止 iOS 自動縮放 */
        min-height: 48px;
    }

    .search-select {
        padding-right: 2.25rem;
    }

    /* 乘客選擇器 */
    .passenger-selector {
        padding: 0.875rem 1rem;
        font-size: 16px !important;
        min-height: 48px;
    }

    .passenger-selector .passenger-value {
        font-size: 1rem;
    }

    .passenger-selector .passenger-label {
        font-size: 0.875rem;
    }

    /* 乘客調整面板 */
    .passenger-dropdown {
        min-width: 100%;
        left: 0 !important;
        right: 0 !important;
    }

    .passenger-item {
        padding: 0.875rem;
    }

    .passenger-item-label {
        font-size: 0.95rem;
    }

    .passenger-item-desc {
        font-size: 0.875rem;
    }

    .passenger-controls {
        gap: 0.75rem;
    }

    .passenger-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .passenger-count {
        min-width: 36px;
        font-size: 1rem;
    }

    /* 日期選擇器 */
    input[type="date"],
    input.flatpickr-input {
        font-size: 16px !important;
        padding: 0.875rem 1rem;
        min-height: 48px;
    }

    /* 回程日期區域動畫 */
    #returnDateWrapper {
        transition: all 0.3s ease;
    }

    /* 搜尋按鈕 */
    button[type="submit"] {
        padding: 1rem;
        font-size: 1.1rem;
        min-height: 52px;
        width: 100%;
    }

    button[type="submit"] i {
        font-size: 1.2rem;
    }

    /* Alert 說明框 */
    .alert {
        font-size: 0.875rem;
        padding: 0.875rem;
    }

    .alert ul {
        padding-left: 1.2rem;
    }

    .alert li {
        margin-bottom: 0.4rem;
    }

    /* Row 間距調整 */
    .row.g-3 {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 1rem;
    }

    /* 容器左右邊距 */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* 小螢幕手機優化 (iPhone SE, 小型 Android) */
@media (max-width: 375px) {
    .hero-section h1 {
        font-size: 1.5rem !important;
    }

    .hero-section p.lead {
        font-size: 0.95rem !important;
    }

    .search-card {
        padding: 1rem;
    }

    .trip-type-option {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .search-input,
    .search-select,
    .passenger-selector {
        padding: 0.75rem 0.875rem;
        font-size: 15px !important;
    }

    button[type="submit"] {
        padding: 0.875rem;
        font-size: 1rem;
    }

    .passenger-btn {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .passenger-count {
        min-width: 32px;
        font-size: 0.95rem;
    }
}

/* 橫向模式優化 (手機橫放) */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        padding: 1.5rem 0;
    }

    .hero-section h1 {
        font-size: 1.5rem !important;
        margin-bottom: 0.75rem !important;
    }

    .hero-section p.lead {
        font-size: 0.9rem !important;
        margin-bottom: 1.5rem !important;
    }

    .search-card {
        padding: 1rem;
    }
}
