/* ==========================================================================
   🎨 1. 全域變數與基礎設定 (整合全站所有頁面樣式)
   ========================================================================== */
:root {
    --primary-color: #2a7f8f;      
    --dark-color: #1a4d57;         
    --sidebar-color: #223e44;      
    --bg-color: #f4f7f6;           
    --card-bg: #ffffff;            
    --border-color: #e2e8f0;       
    --text-main: #223e44;          
    --text-muted: #7f8c8d;         
    --side-nav-item-height: 55px;  
    
    --success-bg: #e1f9eb;
    --success-text: #1db45a;
    --warning-bg: #fef3c7;
    --warning-text: #d97706;
    --danger-text: #ff3b30;
}

* {
    box-sizing: border-box; 
}

body {
    margin: 0;
    font-family: "PingFang TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================================
   🏛️ 2. 頂部導覽列 Navbar 與 側邊選單 Menu (header.php)
   ========================================================================== */
.navbar {
    display: flex; align-items: center; padding: 15px 40px; background: #1a4d57; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); position: sticky; top: 0; z-index: 1000;
}
.navbar-brand {
    color: #ffffff !important; text-decoration: none !important; font-size: 24px; font-weight: 700; letter-spacing: 3px; transition: opacity 0.3s;
}
.navbar-brand:hover { opacity: 0.9; }
.menu-btn, #globalMenuBtn { display: none !important; }
.navbar-menu { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.navbar-menu a {
    color: #ffffff !important; text-decoration: none !important; font-size: 14px; font-weight: 600; padding: 10px 16px; border-radius: 8px; transition: all 0.3s ease; display: flex; align-items: center; gap: 8px; 
}
.navbar-menu .nav-item:hover { background: rgba(255, 255, 255, 0.15); }
.navbar-menu .btn-reserve { background: #3a9ea8 !important; box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
.navbar-menu .btn-reserve:hover { background: #2b7f87 !important; transform: translateY(-2px); }
.navbar-menu .nav-btn-highlight { border: 2px solid #ffffff; }
.navbar-menu .nav-btn-highlight:hover { background: #ffffff !important; color: #1a4d57 !important; }

/* 側邊選單 */
.side-menu {
    position: fixed; top: 0; left: -280px; width: 280px; height: 100%; background: var(--sidebar-color); z-index: 1100; transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 4px 0 15px rgba(0,0,0,0.2); padding-top: 20px; overflow-y: auto;
}
.side-menu.active { left: 0; }
.menu-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: none; z-index: 1050; }
.menu-overlay.active { display: block; }
.side-menu-header { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.9); font-size: 18px; font-weight: bold; display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.side-menu-list { list-style: none; padding: 0; margin: 0; }
.side-menu-list a {
    display: flex; align-items: center; height: var(--side-nav-item-height); padding: 0 30px; color: rgba(255,255,255,0.8); text-decoration: none; font-size: 15px; transition: 0.3s; border-left: 4px solid transparent;
}
.side-menu-list a i { margin-right: 15px; width: 25px; text-align: center; font-size: 16px; }
.side-menu-list a:hover { background: rgba(42, 127, 143, 0.2); color: var(--primary-color); border-left-color: var(--primary-color); }
.menu-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 15px 20px; }

/* ==========================================================================
   📢 3. 全域活動推廣橫條
   ========================================================================== */
.promo-bar { background: #256f7e; color: #ffffff; height: 44px; overflow: hidden; box-shadow: inset 0 -2px 5px rgba(0,0,0,0.1); border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.promo-container { max-width: 1200px; margin: 0 auto; height: 100%; display: flex; align-items: center; justify-content: center; padding: 0 20px; }
.promo-ticker { height: 44px; overflow: hidden; width: 100%; }
.promo-slider { display: flex; flex-direction: column; animation: promoVerticalScroll 12s infinite ease-in-out; }
.promo-item { height: 44px; line-height: 44px; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; justify-content: center; text-align: center; }
.promo-icon { font-size: 15px; color: #ffeaa7; margin-right: 10px; animation: promoWobble 2.5s infinite ease-in-out; }
.promo-badge { font-size: 11px; font-weight: bold; padding: 2px 7px; border-radius: 4px; margin-right: 10px; line-height: 1.4; color: #fff; }
.badge-countdown { background: #e67e22; } .badge-hot { background: #eb4d4b; } .badge-line { background: #2ecc71; }       
.countdown-text { background: rgba(0, 0, 0, 0.25); padding: 2px 8px; border-radius: 4px; color: #ffeaa7; font-family: monospace; font-weight: bold; margin-left: 5px; }

@keyframes promoVerticalScroll { 0%, 28% { transform: translateY(0); } 33%, 61% { transform: translateY(-44px); } 66%, 94% { transform: translateY(-88px); } 100% { transform: translateY(0); } }
@keyframes promoWobble { 0%, 100% { transform: rotate(0deg); } 5%, 15% { transform: rotate(-10deg); } 10%, 20% { transform: rotate(10deg); } 25% { transform: rotate(0deg); } }

/* ==========================================================================
   🍱 4. 表單、卡片與通用區塊基礎 (整合 style.css、登入、註冊與忘記密碼)
   ========================================================================== */
.auth-box { display: flex; justify-content: center; padding: 40px 15px; width: 100%; background: #f4f7f6; }

/* 核心加強：既保留普通卡片外框，又完全相容彈出視窗（防止高度爆開） */
.card, .modal-content { 
    background: var(--card-bg); 
    padding: 35px; 
    border-radius: 20px; 
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15); 
    width: 100%; 
    box-sizing: border-box; 
    position: relative; /* 右上角小叉叉精準定位 */
    margin: auto;
    max-height: calc(100vh - 40px); /* 限制最高為螢幕高度，不被裁切 */
    overflow-y: auto; /* 欄位太多時，方塊內部會產生漂亮小捲軸 */
}
.card h2, .modal-content h3 { color: var(--dark-color); margin-top: 0; text-align: center; margin-bottom: 25px; }

/* 全域輸入框與下拉選單美化 */
input[type="text"], input[type="password"], input[type="email"], input[type="date"], input[type="tel"],
.modal-content select { 
    width: 100%; padding: 12px; margin: 4px 0 18px 0; border: 1px solid var(--border-color); border-radius: 8px; box-sizing: border-box; font-size: 16px; background: #fff; text-align: left;
}
input:disabled { background: #f5f5f5 !important; color: #999 !important; cursor: not-allowed; }

/* 🌟 微調表單標題字體大小與間距 */
.form-title-label { 
    color: var(--primary-color); 
    font-weight: bold; 
    font-size: 16px; 
    display: block; 
    text-align: left; 
    margin-bottom: 6px; 
}

.btn-main, .modal-content .btn { 
    width: 100%; background: var(--primary-color); color: white; border: none; padding: 13px; border-radius: 25px; cursor: pointer; font-size: 16px; font-weight: bold; transition: background 0.2s; box-sizing: border-box; text-align: center; display: block;
}
.btn-main:hover:not(:disabled), .modal-content .btn:hover { background: var(--dark-color); }
.btn-main:disabled { background: #ccc; cursor: not-allowed; }

.footer-link { display: flex; justify-content: space-between; margin-top: 20px; font-size: 14px; }
.footer-link a { color: var(--primary-color); text-decoration: underline; font-weight: bold; }

/* 忘記密碼與登入卡片特化居中 */
.forgot-body-layout { display: flex; align-items: center; justify-content: center; height: 100vh; background: #f4f7f6; margin: 0; }

/* ==========================================================================
   📅 5. 線上預約頁面樣式區塊 (原 booking.css)
   ========================================================================== */
.time-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 15px; margin-bottom: 20px; }
.time-box { 
    border: 1px solid #e2e8f0; padding: 14px 10px; text-align: center; border-radius: 8px; cursor: pointer; background: #fff; font-weight: bold; font-size: 16px; color: #333; transition: all 0.2s ease; box-sizing: border-box; 
}
.time-box:hover:not(.disabled):not(.selected) { background: #e1f9eb; border-color: #2a7f8f; color: #2a7f8f; }
.time-box.selected { background: #2a7f8f !important; color: white !important; border-color: #2a7f8f !important; box-shadow: 0 4px 12px rgba(42, 127, 143, 0.2); }
.time-box.disabled { background: #e5e7eb !important; color: #9ca3af !important; border-color: #e5e7eb !important; cursor: not-allowed !important; text-decoration: line-through !important; font-weight: normal; }
.notice-full { color: #ff3b30; font-weight: bold; margin-top: 10px; display: none; font-size: 14px; }
.booking-wrapper { display: flex; justify-content: center; padding: 50px 15px; background: #f4f7f6; width: 100%; }
.booking-card { max-width: 580px; background: white; padding: 35px; border-radius: 16px; box-shadow: 0 10px 30px rgba(26, 77, 87, 0.06); width: 100%; box-sizing: border-box; }
.booking-card h2 { color: #1a4d57; margin-top:0; margin-bottom:5px; font-size: 24px; text-align: left; }
.booking-card label { display: block; font-weight: bold; color: #1a4d57; margin-top: 20px; margin-bottom: 8px; font-size: 15px; text-align: left; }
.select-input { width:100%; padding:12px; border:1px solid #e2e8f0; border-radius:8px; box-sizing:border-box; font-size:16px; background:#fff; cursor: pointer; }
.back-home-link { text-align: center; margin-top: 25px; }
.back-home-link a { color: #2a7f8f; text-decoration: underline; font-weight: bold; font-size: 15px; }

/* ==========================================================================
   📸 6. 術後日誌與歷史預約區塊 (Records)
   ========================================================================== */
.page-wrapper { max-width: 900px; margin: 40px auto; padding: 0 20px; box-sizing: border-box; }
.care-box { background: #e1f9eb; color: #1a4d57; padding: 25px; border-radius: 16px; margin-bottom: 25px; border-left: 8px solid #2a7f8f; box-shadow: 0 10px 30px rgba(26, 77, 87, 0.02); text-align: left; }
.care-box h3 { margin-top: 0; }
.care-box p { font-size: 15px; line-height: 1.6; color: #445557; margin: 0; }
.care-box hr { border: 0; border-top: 1px solid rgba(0,0,0,0.06); margin: 15px 0; }
.care-box .week-counter { font-weight: bold; color: #2a7f8f; }
.care-box .week-counter .big-num { font-size: 24px; color: #1a4d57; }
.log-timeline h3 { border-bottom: 2px solid #2a7f8f; padding-bottom: 10px; color: #1a4d57; text-align: left; }
.log-item { background: white; padding: 20px; border-radius: 16px; display: flex; gap: 20px; align-items: center; margin-bottom: 20px; box-shadow: 0 5px 15px rgba(0,0,0,0.02); border: 1px solid #eef2f2; text-align: left; }
.log-item img { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; cursor: pointer; }
.log-item p { margin: 10px 0; font-size: 15px; color: #333; line-height: 1.6; }
.log-item small { color: #999; }
.week-badge { background: #2a7f8f; color: white; padding: 6px 16px; border-radius: 50px; font-weight: bold; display: inline-block; font-size: 13px; }
textarea { width: 100%; height: 110px; padding: 12px; border: 1px solid #e2e8f0; border-radius: 8px; margin: 15px 0; font-size: 16px; box-sizing: border-box; resize: vertical; }
.pagination { display: flex; justify-content: center; gap: 8px; margin: 30px 0; }
.pagination a { padding: 8px 16px; border: 1px solid #e2e8f0; border-radius: 8px; text-decoration: none; color: #333; font-weight: bold; background: white; }
.pagination .active { background: #2a7f8f; color: white; border-color: #2a7f8f; }
.no-log-msg { text-align: center; color: #ccc; padding: 40px; }

/* 權益與表格 */
.container { max-width: 1100px; margin: 40px auto; padding: 0 20px; }
.wide-card { background: #ffffff; padding: 30px; border-radius: 16px; box-shadow: 0 10px 30px rgba(26, 77, 87, 0.03); margin-bottom: 30px; border: 1px solid #eef2f2; text-align: left; }
.wide-card h2 { color: #1a4d57; margin-top: 0; margin-bottom: 20px; }
.orders-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.remain-item { padding: 20px; border-left: 6px solid #2a7f8f; background: #f4f7f6; border-radius: 0 12px 12px 0; display: flex; justify-content: space-between; align-items: center; }
table { width: 100%; border-collapse: collapse; margin-top: 15px; }
th { background-color: #f4f7f6; color: #1a4d57; padding: 14px; text-align: left; border-bottom: 2px solid #e2e8f0; font-weight: bold; }
td { padding: 14px; border-bottom: 1px solid #e2e8f0; color: #333; }
.status-tag { padding: 5px 10px; border-radius: 20px; font-weight: bold; font-size: 13px; display: inline-block; }

/* ==========================================================================
   💉 7. 療程介紹頁面樣式區塊
   ========================================================================== */
.page-banner { background: linear-gradient(135deg, #1a4d57, #2a7f8f); color: white; text-align: center; padding: 60px 20px; margin-bottom: 20px; }
.page-banner h1 { margin: 0; font-size: 2.2rem; font-weight: 600; letter-spacing: 2px; }
.page-banner p { margin: 10px 0 0 0; opacity: 0.8; font-size: 15px; }
.category-title { border-left: 6px solid var(--primary-color); padding-left: 18px; margin: 50px 0 25px; color: var(--dark-color); font-size: 24px; font-weight: bold; letter-spacing: 1px; text-align: left; }
.treatment-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 25px; }
.treatment-item { background: white; padding: 30px; border-radius: 16px; border: 1px solid #eef2f2; box-shadow: 0 8px 25px rgba(26, 77, 87, 0.03); transition: 0.3s; display: flex; flex-direction: column; justify-content: space-between; text-align: left; }
.treatment-item:hover { transform: translateY(-5px); box-shadow: 0 12px 30px rgba(26, 77, 87, 0.08); border-color: rgba(42, 127, 143, 0.3); }
.treatment-item h3 { color: var(--dark-color); margin: 0 0 10px 0; font-size: 20px; font-weight: 600; }
.price-container { margin: 12px 0; display: flex; align-items: baseline; }
.price-tag { font-size: 24px; color: #e67e22; font-weight: 700; }
.price-unit { font-size: 14px; color: #7f8c8d; margin-left: 4px; font-weight: bold; }
.duration { font-size: 13px; color: #8a999b; margin-top: 15px; background: #f4f7f6; padding: 6px 12px; border-radius: 6px; display: inline-block;}
.duration i { margin-right: 5px; color: var(--primary-color); }
.desc { color: #556668; font-size: 14px; line-height: 1.6; margin: 0; min-height: 65px; }

/* ==========================================================================
   🏡 8. 首頁主要長駐樣式 (完美融合 Flex 置中與高低捲動設定)
   ========================================================================== */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    background: rgba(34, 62, 68, 0.8); 
    z-index: 1200; 
    padding: 20px; 
    box-sizing: border-box;
    align-items: center; /* 垂直置中 */
    justify-content: center; /* 水平置中 */
}

/* 完美修復：確保原來的普通小 Modal 特性依然可以保持在中間 */
#modal .modal-content {
    max-width: 450px;
    margin: auto;
}

/* 補齊首頁專屬排版欄位 */
.hero { background: linear-gradient(rgba(26, 77, 87, 0.6), rgba(26, 77, 87, 0.6)), url('https://images.unsplash.com/photo-1588776814546-1ffcf47267a5'); background-size: cover; background-position: center; color: white; text-align: center; padding: 140px 20px; }
.hero h1 { font-size: 3rem; margin-bottom: 10px; }
.btn { display: inline-block; background: var(--primary-color); color: white; padding: 13px 32px; border-radius: 30px; text-decoration: none; font-weight: bold; transition: 0.3s; border: none; cursor: pointer; }
.btn:hover { background: var(--dark-color); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(42, 127, 143, 0.3); }
.activity { padding: 60px 20px; text-align: center; background: white; }
.activity h2 { color: var(--dark-color); margin-bottom: 30px; }
.swiper { width: 90%; max-width: 1000px; }
.swiper img { width: 100%; height: 450px; object-fit: cover; border-radius: 15px; }
.services { padding: 60px 20px; text-align: center; }
.service-container { display: flex; justify-content: center; flex-wrap: wrap; gap: 25px; }
.service-box { width: 280px; padding: 40px 20px; background: var(--card-bg); border-radius: 15px; border: 1px solid var(--border-color); transition: 0.3s; }
.service-box:hover { border-color: var(--primary-color); transform: translateY(-10px); box-shadow: 0 10px 20px rgba(0,0,0,0.05); }
.service-box h3 { color: var(--primary-color); margin-bottom: 15px; }
.service-box p { color: var(--text-muted); }
.contact-bar { background: var(--sidebar-color); color: white; padding: 8px 20px; text-align: center; font-size: 14px; }
.line-btn { position: fixed; bottom: 30px; right: 30px; background: #06c755; color: white; width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-decoration: none; box-shadow: 0 4px 12px rgba(0,0,0,0.2); z-index: 1000; font-size: 24px;}

/* ==========================================================================
   📱 9. RWD 響應式手機控制
   ========================================================================== */
@media (max-width: 768px) {
    .navbar { padding: 12px 20px; position: relative; justify-content: flex-start; }
    .navbar-menu { display: none !important; } 
    .menu-btn, #globalMenuBtn { display: block !important; font-size: 24px; color: #ffffff; cursor: pointer; } 
    .navbar-brand { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 20px; letter-spacing: 2px; }
    .promo-container { padding: 0 10px; }
    .promo-item { font-size: 11.5px; }
    .promo-badge { padding: 1px 5px; margin-right: 5px; font-size: 9.5px; }
    .countdown-text { padding: 1px 4px; margin-left: 2px; }
    .time-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
    .navbar { padding: 0 15px; }
    .card { padding: 20px 15px; }
    .auth-box { padding: 10px 8px; }
    .log-item { flex-direction: column; text-align: center; } 
    .log-item img { width: 100%; height: 200px; }
}
@media (max-width: 480px) {
    .time-grid { grid-template-columns: repeat(2, 1fr); }
}