/* --- 基礎變數與重置 --- */
:root {
    --primary-blue: #0d6efd;
    --hover-blue: #0a58ca;
    --line-green: #06C755;
    --google-red: #ea4335;
    --border-color: #dee2e6;
    --bg-light: #f8f9fa;
    --text-main: #212529;
    --text-muted: #6c757d;
} 

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    margin: 0; 
    padding: 1rem;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

/* --- 佈局容器 --- */
/* 加寬容器，讓桌面版與大螢幕手機有更多空間顯示捷運資訊 */
.wizard-container { 
    max-width: 850px; 
    margin: 0 auto; 
    display: none; 
    padding-bottom: 20px; 
}
.wizard-header { margin-bottom: 1.2rem; }

/* --- 響應式標題區塊 --- */
.header-title-box { 
    position: relative; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    text-align: center;
    margin-bottom: 1rem;
}

.header-title-box h1, 
.header-title-box h2 {
    margin: 0;
    font-size: clamp(1rem, 4.5vw, 1.6rem);
    white-space: nowrap; 
    display: flex;
    align-items: center;
    justify-content: center;
    color: #329cde;
    width: 100%;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.title-logo {
    height: 1.3em; 
    width: auto;
    margin-right: 0.4em; 
    object-fit: contain;
    transform: translateY(-1px);
}

/* --- 導覽按鈕 --- */
.floating-nav-btn {
    position: fixed; bottom: 2rem; right: 0.8rem; z-index: 9999;
    text-align: center; cursor: pointer; background: rgba(255,255,255,0.95);
    padding: 8px 10px; border-radius: 12px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    backdrop-filter: blur(5px);
}
.nav-text { 
    font-size: 0.85rem; font-weight: bold; color: #0632f8; 
    display: block; line-height: 1.2; margin-bottom: 4px; 
}
.nav-icon { width: 2.5rem; height: 2.5rem; display: block; margin: 0 auto; }

/* --- 註冊引導卡片 --- */
.guest-invite-card {
    background: linear-gradient(135deg, #fffcf0 0%, #fff3bf 100%);
    border-radius: 16px; padding: 1.2rem; margin-bottom: 1.2rem;
    box-shadow: 0 4px 15px rgba(240, 140, 0, 0.1);
    animation: slideDown 0.5s ease-out;
}
.invite-header { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.invite-icon { 
    font-size: 1.6rem; background: #fff; width: 45px; height: 45px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.invite-content { flex: 1; }
.invite-title { margin: 0 0 5px 0; color: #856404; font-weight: 800; font-size: clamp(1rem, 4vw, 1.15rem); }
.invite-text { margin: 0; font-size: clamp(0.85rem, 3.5vw, 0.95rem); color: #927012; line-height: 1.5; }

.btn-register-highlight {
    background: var(--line-green); color: #fff; border: none; width: 100%;
    padding: 12px; border-radius: 10px; 
    font-size: clamp(0.95rem, 4vw, 1.1rem); font-weight: 700;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    cursor: pointer; transition: transform 0.2s;
    box-shadow: 0 4px 12px rgba(6, 199, 85, 0.2);
}
.btn-register-highlight:active { transform: scale(0.98); }

/* --- 步驟區塊樣式 --- */
.wizard-step { 
    border: 1px solid var(--border-color); border-radius: 12px;
    padding: 1.2rem; margin-bottom: 1rem; background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
}
.wizard-step.disabled { opacity: 0.5; pointer-events: none; filter: grayscale(0.5); }

.step-title-box { display: flex; align-items: center; gap: 8px; margin-bottom: 1rem; flex-wrap: wrap; }
.step-indicator { width: 4px; height: 1.2rem; background: var(--primary-blue); border-radius: 2px; }

.wizard-step h3 { 
    margin: 0; color: var(--hover-blue); 
    font-size: clamp(1.1rem, 4.5vw, 1.25rem); 
    font-weight: 700;
}

/* --- 課程分類標題 --- */
.category-title {
    margin: 0 0 0.8rem 0; 
    font-size: clamp(1rem, 4vw, 1.1rem);
    color: #495057; font-weight: 700; 
    border-left: 4px solid var(--primary-blue); padding-left: 8px;
}
.dashed-hr { margin: 1.2rem 0; border: 0; border-top: 1px dashed var(--border-color); }

/* --- 表單控制元件 (包含 iPhone 強制不換行修正) --- */
.form-group { margin-bottom: 1rem; }
.input-label { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 6px; display: block; font-weight: 600; }

.form-control {
    display: block; /* 確保寬度計算準確 */
    width: 100%; 
    box-sizing: border-box; /* 包含 padding 與 border */
    padding: 10px 35px 10px 14px; /* 右側留空間給箭頭圖示，避免文字蓋到 */
    font-size: 16px; 
    border: 1.5px solid var(--border-color); 
    border-radius: 10px;
    background-color: #fff; 
    color: #495057; 
    
    /* 移除原生樣式 (iPhone 必要) */
    -webkit-appearance: none; 
    -moz-appearance: none;
    appearance: none;

    /* 下拉箭頭圖示 */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23adb5bd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; 
    background-position: right 12px center; 
    background-size: 16px;

    /* 【關鍵修正】防止 iPhone 換行與垂直撐開 */
    height: 46px; /* 固定高度防止因換行而長高 */
    line-height: 24px; /* 對應 padding 計算出的垂直中心線 */
    white-space: nowrap; /* 不換行 */
    overflow: hidden; /* 超出隱藏 */
    text-overflow: ellipsis; /* 超出顯示省略號 (...) */
}
.form-control:focus { border-color: var(--primary-blue); outline: none; }

/* 針對 iOS 下拉選單內部文字樣式微調 */
select.form-control option {
    font-weight: normal;
}

/* --- 店家功能按鈕 (地圖/LINE) --- */
.shop-action-row {
    display: flex; gap: 10px; margin-top: 1rem; width: 100%;
}
.btn-action-half {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 4px; 
    border-radius: 50px; 
    font-size: clamp(0.85rem, 3.5vw, 0.95rem); 
    font-weight: 600; cursor: pointer; border: none;
    white-space: nowrap; 
}
.btn-action-half svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-map { background-color: #fff; color: #5f6368; border: 1.5px solid #dadce0; }
.btn-line { background-color: var(--line-green); color: #fff; }

/* --- 選擇格線與項目 --- */
.selection-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); 
    gap: 0.8rem; 
}
.time-grid { 
    grid-template-columns: repeat(auto-fill, minmax(75px, 1fr)); 
    gap: 0.6rem; 
}

.selection-item { 
    padding: 0.8rem 0.4rem; 
    border: 1.5px solid var(--border-color); border-radius: 10px;
    text-align: center; cursor: pointer; background: #fff;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    min-height: 50px;
    font-size: clamp(0.9rem, 3.5vw, 1rem);
    line-height: 1.35;
}
.selection-item.selected { background: var(--primary-blue); color: #fff; border-color: var(--hover-blue); }
.selection-item.disabled-item { opacity: 0.4; pointer-events: none; background-color: #e9ecef; filter: grayscale(1); }

.service-details { 
    font-size: 0.85em; 
    opacity: 0.9; 
    display: block; margin-top: 4px; font-weight: normal; 
}

/* --- 日曆樣式 --- */
.calendar-grid { 
    display: grid; grid-template-columns: repeat(7, 1fr); 
    border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; 
}
.calendar-header, .calendar-day { 
    text-align: center; padding: 0.5rem 0; 
    border: 0.5px solid #eee; font-size: 0.9rem; 
}
.calendar-header { font-weight: bold; background: #f8f9fa; }
.calendar-day { min-height: 40px; display: flex; align-items: center; justify-content: center; }
.calendar-day.available { cursor: pointer; background: #e7f1ff; color: var(--hover-blue); font-weight: 700; }
.calendar-day.selected { background: var(--primary-blue) !important; color: #fff !important; }

/* --- 預約紀錄按鈕 (ReserveList) --- */
.ReserveList .button {
    width: 100%; border: 1px solid var(--border-color); background: #fff;
    border-radius: 12px; padding: 1rem; margin-bottom: 1rem;
    text-align: left; position: relative;
    font-size: clamp(0.9rem, 3.5vw, 1rem); 
    line-height: 1.6; color: #495057;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}
.button-del {
    position: absolute; right: 1rem; top: 1rem;
    background: #dc3545; color: #fff; padding: 4px 10px;
    border-radius: 20px; font-size: 0.8rem; cursor: pointer;
}
.button-wait {
    display: inline-block; background: #ffc107; color: #000;
    padding: 2px 8px; border-radius: 4px; font-size: 0.8rem; margin-top: 5px;
}

/* --- 致歉動畫區塊 --- */
.empty-slot-message {
    text-align: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, #fffcf0 0%, #fff8e1 100%);
    border: 2px dashed #ffe082;
    border-radius: 16px;
    color: #856404;
    margin: 1rem 0;
}
.apology-icon {
    font-size: clamp(3rem, 12vw, 4rem); 
    display: inline-block; margin-bottom: 0.5rem;
    animation: bow-motion 2s ease-in-out infinite; transform-origin: bottom center;
}
@keyframes bow-motion {
    0%, 100% { transform: translateY(0) scaleY(1); }
    50% { transform: translateY(5px) scaleY(0.9); }
}
.empty-text strong {
    font-size: clamp(1.1rem, 4.5vw, 1.25rem);
    display: block; margin-bottom: 0.5rem; color: #d39e00;
}
.empty-text p {
    margin: 0; font-size: clamp(0.9rem, 3.5vw, 1rem);
    line-height: 1.5; font-weight: 500;
}

/* --- 加載動畫 --- */
.loading-spinner {
    width: 30px; height: 30px; border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-blue); border-radius: 50%;
    animation: spin 1s linear infinite; margin: 1.5rem auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.animated-fade-in { animation: slideDown 0.4s ease; }

.spacer-80 { height: 80px; }
.no-record { text-align: center; padding: 3rem; color: var(--text-muted); font-size: 1rem; }

/* --- SweetAlert 優化 --- */
.swal2-popup { border-radius: 20px !important; font-size: 0.95rem !important; }
.swal2-confirm, .swal2-cancel { border-radius: 50px !important; padding: 10px 24px !important; }

/* --- 手機版響應式空間優化 --- */
@media (max-width: 480px) {
    body {
        padding: 0.75rem; 
    }
    .wizard-step {
        padding: 1.2rem 0.6rem; /* 再度縮減左右內距，騰出更多選單寬度 */
    }
    .form-control {
        padding-left: 10px; /* 縮減內部左邊距 */
        font-size: 15px;   /* 稍微調小字體以在有限空間內容納更多文字 */
    }
}