:root {
    /* --- 品牌色系 (Brand Colors) --- */
    --azan-deep-blue:    #003366;   /* 深海藍 */
    --azan-deep-blue-hover: #004a99; /* 懸停深藍 */
    --color-brown:       #40220f;   /* 深棕色 */
    --color-brown-light: #6a3906;   /* 淺棕色 */
    --azan-gold-soft:    #c5a059;   /* 香檳金 */
    --open-emerald:      #1b5e20;   /* 質感綠 */
    --closed-muted:      #9e9e9e;   /* 中性灰 */
    --sunday-red:        #d32f2f;   /* 週日紅 */

    /* --- 背景與文字 (Background & Text) --- */
    --azan-bg-silk:      #fdfdfd;   /* 絲綢白 */
    --color-cream:       #fffdf5;   /* 奶油白：全網頁背景 */
    --color-text-main:   #2c241b;   /* 焦糖黑：主文字 */
    --bg-white:          #ffffff;   /* 純白色：卡片 */
    --bg-black:          #000000;   /* 純黑色：返回按鈕 */
    --bg-sidebar:        #fafafa;   /* 側欄灰：時間背景 */
    --bg-footer:         #fdf9f0;   /* 暖光黃：頁尾背景 */
    --bg-hover-row:      #fcfdfd;   /* 懸停白：滑過效果 */

    /* --- 線條與裝飾 (Lines & Effects) --- */
    --border-soft:       #eee;      /* 表格線 */
    --border-status:     #f0f0f0;   /* 單元格底線 */
    --border-footer:     #f0e6d2;   /* 頁尾邊框 */
    --glass-shadow:      0 0.75rem 2.5rem rgba(0, 51, 102, 0.08); 
    --border-card:       1px solid rgba(0, 0, 0, 0.05);
    
    /* --- 動態控制 (Animation) --- */
    --transition-fast:   0.2s ease;
}

/* --- 重置與基礎設定 --- */
*, *::before, *::after {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Roboto", "Helvetica Neue", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
                 "PingFang TC", "Microsoft JhengHei", sans-serif;
    color: var(--color-text-main);
    background: var(--color-cream);
    line-height: 1.5;
    padding: 1rem;
}

/* --- 返回按鈕 --- */
.back-btn {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    color: white;
    text-decoration: none;
    font-size: 0.9375rem;
    padding: 0.625rem 1.25rem;
    border-radius: 1.875rem;
    transition: var(--transition-fast);
    z-index: 1000;
    background-color: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(4px);
}

.back-btn:hover {
    background-color: var(--bg-black);
    transform: translateX(-3px);
}

/* --- 診間容器 --- */
.schedule-section {
    max-width: 75rem;
    margin: 4rem auto;
    background: var(--bg-white);
    border-radius: 1.25rem;
    box-shadow: var(--glass-shadow);
    overflow: hidden;
    border: var(--border-card);
}

.clinic-header {
    background: linear-gradient(135deg, var(--color-brown-light) 0%, var(--color-brown) 100%);
    padding: 2.1875rem 1.25rem;
    text-align: center;
}

.clinic-header h1 {
    color: var(--azan-gold-soft);
    margin: 0;
    font-size: 1.75rem;
    letter-spacing: 0.25rem;
    font-weight: 600;
}

/* --- Grid 核心佈局 --- */
.schedule-container {
    width: 100%;
}

.schedule-grid {
    display: grid;
    grid-template-columns: 10rem repeat(7, minmax(5rem, 1fr));
    min-width: 40rem; 
    width: 100%;
}

/* 表頭單元格 */
.grid-header-cell {
    background: var(--bg-white);
    color: var(--closed-muted);
    font-weight: 500;
    padding: 1.25rem 0.5rem;
    font-size: 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-soft);
}

.sun-label {
    color: var(--sunday-red) !important;
}

/* 側邊時間欄位 */
.time-sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-soft);
    padding: 1.5625rem 0.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-status);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.period-name {
    display: block;
    color: var(--azan-deep-blue);
    font-size: 1.25rem;
    font-weight: 700;
}

.period-hours {
    display: block;
    color: var(--azan-gold-soft);
    font-size: 0.8125rem;
    font-weight: 600;
}

/* 狀態單元格 */
.status-cell {
    padding: 0.9375rem 0.3125rem;
    text-align: center;
    border-bottom: 1px solid var(--border-status);
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-indicator {
    width: 80%;
    max-width: 5rem;
    padding: 0.625rem 0;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 1.0625rem;
}

.is-open {
    color: var(--open-emerald);
    background: rgba(27, 94, 32, 0.05);
    border: 1px solid rgba(27, 94, 32, 0.1);
}

.is-closed {
    color: var(--closed-muted);
    background: var(--bg-sidebar);
    font-weight: 400;
    text-decoration: line-through;
    opacity: 0.6;
}

/* --- 頁尾 --- */
.reservation-footer {
    background: var(--bg-footer);
    padding: 1.875rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    border-top: 1px solid var(--border-footer);
}

.footer-hint {
    color: var(--closed-muted);
    font-weight: 500;
}

.phone-btn {
    background: var(--azan-deep-blue);
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.875rem;
    border-radius: 3.125rem;
    font-size: 1.125rem;
    font-weight: 600;
    box-shadow: 0 0.25rem 0.9375rem rgba(0, 51, 102, 0.15);
    transition: var(--transition-fast);
}

.phone-btn:hover {
    transform: translateY(-2px);
    background: var(--azan-deep-blue-hover);
}

/* --- RWD 手機端調整 --- */
@media (max-width: 48rem) {

    body { 
        padding: 0; 
    }
    
    .schedule-section {
        margin: 0;
    }

    .schedule-grid {
        grid-template-columns: 4.5rem repeat(3, 1fr);
        grid-auto-flow: column;
        grid-template-rows: repeat(8, auto);
        width: 100%;
        min-width: 0; /* 覆蓋可能的電腦版設定 */
    }

    /* 讓內容物字體縮小 */
    .grid-header-cell, .time-sidebar {
        padding: 1rem 0.25rem;
        font-size: 0.9rem;
    }

    .period-name { font-size: 1rem; }
    .period-hours { font-size: 0.65rem; }

    .status-cell {
        padding: 0.75rem 0.1rem;
    }

    .status-indicator {
        font-size: 0.85rem; /* 手機版字體略微縮小 */
        width: 95%; 		/* 讓它佔滿一點，防止文字折行 */
    }

    .back-btn {
        top: 0.75rem;
        left: 0.75rem;
        padding: 0.5rem 1rem;
    }

    .clinic-header h1 {
        font-size: 1.25rem;
        letter-spacing: 0.1rem;
    }

    .reservation-footer {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem 1rem;
    }

    .phone-btn {
        width: 100%;
        text-align: center;
        font-size: 1rem;
    }
}
