﻿/* =========================================================
   1. 查詢表單 (Query Form) & RWD 核心樣式
   ========================================================= */

.query-toolbar {
    background: #fff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
}

/* 表單容器 Flex 排列 */
.form-row {
    display: flex;
    align-items: flex-end; /* 電腦版：底部對齊 */
    gap: 20px;
    flex-wrap: wrap; /* 允許換行 */
}

/* 輸入框容器 */
.form-col {
    flex: 1; /* 自動伸展佔滿空間 */
    min-width: 200px; /* 最小寬度 */
}

/* 按鈕容器預設 */
.form-btn-col {
    flex: 0 0 auto;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 8px;
    font-weight: 500;
}

/* 輸入框 */
.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s;
    background-color: #fff;
    height: 48px; /* 固定高度，與按鈕對齊 */
}

    .form-input:focus {
        border-color: var(--medical-primary);
        box-shadow: 0 0 0 3px rgba(0, 121, 107, 0.1);
        outline: none;
    }

/* 查詢按鈕本體 */
.btn-search-action {
    background-color: var(--medical-primary);
    color: #fff;
    border: none;
    padding: 0 32px;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    height: 48px; /* 與輸入框等高 */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

    .btn-search-action:hover {
        background-color: var(--medical-primary-dark);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 121, 107, 0.25);
    }

    .btn-search-action:active {
        transform: translateY(0);
    }

    .btn-search-action:disabled {
        background-color: #94a3b8;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
        opacity: 0.8;
    }

/* =========================================================
   📱 手機版查詢表單修正 (Mobile < 768px)
   ========================================================= */
@media (max-width: 768px) {

    .query-toolbar {
        padding: 20px 16px; /* 縮小內距 */
    }

    .form-row {
        flex-direction: column !important; /* 強制垂直排列 */
        align-items: stretch !important; /* 強制拉寬填滿 */
        gap: 16px;
    }

    .form-col {
        width: 100% !important;
        min-width: 0;
        flex: none !important;
    }

    /* 按鈕容器也拉滿 */
    .form-btn-col {
        width: 100% !important;
        flex: 1 1 auto;
        margin-top: 4px;
        display: block !important;
    }

    /* 按鈕變成滿版大按鈕 */
    .btn-search-action {
        width: 100% !important;
        height: 52px; /* 手機版再加高一點 */
        font-size: 1.1rem;
        display: flex !important;
    }
}


/* =========================================================
   2. 查詢結果模式 (Compact Mode)
   當容器加上 .mode-result 類別時觸發
   ========================================================= */

/* 隱藏大標題 */
.sch-container.mode-result .sch-header {
    display: none;
}

/* 壓縮工具列 */
.sch-container.mode-result .query-toolbar {
    padding: 12px 16px;
    margin-bottom: 16px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    box-shadow: none;
}

.sch-container.mode-result .form-row {
    align-items: center;
    gap: 10px;
}

.sch-container.mode-result .form-label {
    display: none;
}

.sch-container.mode-result .form-input {
    padding: 6px 12px;
    height: 42px; /* 變矮 */
    font-size: 0.95rem;
}

.sch-container.mode-result .btn-search-action {
    height: 42px; /* 變矮 */
    padding: 0 20px;
    font-size: 0.95rem;
}

/* 手機版結果模式下，表單改為橫向排列 (省空間) */
@media (max-width: 768px) {
    .sch-container.mode-result .form-row {
        flex-direction: row !important;
        flex-wrap: wrap;
    }

    .sch-container.mode-result .form-col {
        flex: 1 1 40%;
        min-width: 120px;
    }

    .sch-container.mode-result .form-btn-col {
        width: auto !important;
        flex: 0 0 auto;
        margin-top: 0;
        display: block !important;
    }

    .sch-container.mode-result .btn-search-action {
        width: 100% !important;
        height: 42px;
    }
}


/* =========================================================
   3. 下拉選單與左右導覽 (Month Navigator)
   ========================================================= */

.view-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 4px;
    flex-wrap: wrap;
    gap: 12px;
}

/* 導覽群組容器 */
.month-navigator {
    display: flex;
    align-items: center;
    gap: 8px; /* 按鈕與選單的間距 */
}

/* 左右切換按鈕 */
.nav-btn {
    width: 44px;
    height: 44px;
    border: 1px solid #cbd5e1;
    background-color: #fff;
    border-radius: 10px;
    color: #64748b;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    padding-bottom: 4px; /* 微調箭頭垂直置中 */
}

    .nav-btn:hover:not(:disabled) {
        border-color: var(--medical-primary);
        color: var(--medical-primary);
        background-color: #f0fdfa;
    }

    .nav-btn:active:not(:disabled) {
        transform: scale(0.95);
    }

    .nav-btn:disabled {
        color: #e2e8f0;
        border-color: #f1f5f9;
        cursor: not-allowed;
        background-color: #f8fafc;
    }

/* 下拉選單本體 */
.view-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 0 36px 0 16px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 1rem;
    color: #334155;
    background-color: #fff;
    cursor: pointer;
    width: 240px; /* 稍微縮小一點寬度給按鈕 */
    max-width: 100%;
    height: 44px; /* 與按鈕等高 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* 箭頭 */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748b' 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 10px center;
    background-size: 18px;
    font-weight: 500;
}

    .view-select:focus {
        outline: none;
        border-color: var(--medical-primary);
    }

/* 筆數文字 */
#recordCount {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
    margin-left: auto;
}

/* 分頁列 */
.pagination-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    user-select: none;
}

    .page-btn:hover:not(:disabled) {
        border-color: var(--medical-primary);
        color: var(--medical-primary);
    }

    .page-btn.active {
        background-color: var(--medical-primary);
        color: #fff;
        border-color: var(--medical-primary);
    }

    .page-btn:disabled {
        background-color: #f8fafc;
        color: #cbd5e1;
        cursor: not-allowed;
        border-color: #f1f5f9;
    }

.page-dots {
    color: #94a3b8;
    font-size: 0.9rem;
    padding: 0 4px;
    letter-spacing: 2px;
}

/* =========================================================
   📱 手機版選單與導覽列 RWD (Mobile < 768px)
   ========================================================= */
@media (max-width: 768px) {

    .view-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 24px;
    }

    .month-navigator {
        display: flex;
        width: 100%;
        gap: 8px;
        align-items: center;
    }

    .select-wrapper {
        flex: 1;
        min-width: 0;
    }

    .view-select {
        width: 100% !important; /* 強制滿版 */
        height: 52px; /* ✅ 高度增加到 52px */
        font-size: 1.05rem; /* 字體微調大 */
        padding-left: 12px;
        border-radius: 12px;
    }

    .nav-btn {
        width: 52px; /* ✅ 按鈕加大到 52px */
        height: 52px;
        flex: 0 0 auto;
        font-size: 1.8rem;
        border-radius: 12px;
        background-color: #f8fafc;
        active-behavior: contain;
    }

        .nav-btn:active:not(:disabled) {
            background-color: #e2e8f0;
            transform: scale(0.96);
        }

    #recordCount {
        text-align: center;
        font-size: 0.9rem;
        margin-left: 0;
        color: #64748b;
        margin-top: -4px;
    }

    .page-btn {
        min-width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
}


/* =========================================================
   4. 列表模式 (List View)
   ========================================================= */
#listView {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px;
}

/* Desktop Grid */
@media (min-width: 768px) {
    #listView {
        display: none !important;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 24px;
        align-items: start;
    }
}

.status-badge-success {
    background-color: #d1fae5;
    color: #059669;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 600;
}

/* =========================================================
   📱 手機版 RWD 極致空間優化 (Mobile < 768px)
   設計目標：
   1. 移除底部按鈕，改為整張卡片可點擊。
   2. 資訊高密度排列，減少垂直佔用。
   3. 加入右側箭頭 (Chevron) 暗示進入詳情。
   ========================================================= */
@media (max-width: 768px) {

    /* --- 1. 頁面與工具列 (保持緊湊) --- */
    .sch-page {
        padding: 12px 8px;
    }

    .query-toolbar {
        padding: 16px !important;
        margin-bottom: 12px;
        border-radius: 12px;
    }

    .form-row {
        flex-direction: column !important;
        gap: 12px !important;
    }

    .form-col {
        width: 100% !important;
        flex: none !important;
    }

    .form-input, .btn-search-action {
        height: 44px !important;
        font-size: 16px !important;
    }

    .form-btn-col {
        width: 100% !important;
        margin-top: 4px;
    }

    .btn-search-action {
        width: 100% !important;
        display: flex !important;
        border-radius: 8px;
    }

    /* --- 2. 導覽列 (橫向排列) --- */
    .view-controls {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 12px;
    }

    .month-navigator {
        display: flex;
        width: 100%;
        gap: 8px;
        align-items: center;
        flex-direction: row !important;
    }

    .select-wrapper {
        flex: 1;
        min-width: 0;
    }

    .view-select {
        width: 100% !important;
        height: 44px;
        padding-left: 8px;
        padding-right: 28px;
        background-position: right 6px center;
    }

    .nav-btn {
        width: 56px !important;
        flex: 0 0 56px !important;
        height: 44px !important;
        font-size: 1.6rem;
        padding: 0;
        border-radius: 8px;
    }

    #recordCount {
        font-size: 0.8rem;
        text-align: center;
        margin-top: -4px;
        color: #64748b;
    }

    /* =================================
       🔥 全新卡片設計 (Compact List Card)
       ================================= */

    #listView {
        gap: 10px !important;
    }

    /* 狀態標籤：移到日期旁邊 */
    .status-badge-success {
        font-size: 0.75rem !important;
        padding: 2px 8px !important;
    }

    /* 診所名稱：次要資訊 */
    .ms-name {
        font-size: 1rem !important;
        color: #334155;
        font-weight: 500;
        line-height: 1.3;
    }

    /* 隱藏原本的手機版 "掛" 字 tag，太佔位 */
    .ms-tag.mobile-only {
        display: none !important;
    }

    /* 時段：變小字，放診所下面 */
    .ms-status {
        font-size: 0.85rem !important;
        color: #64748b;
        background: transparent !important;
        padding: 0 !important;
        margin-top: 2px;
    }
        /* 前面加個小圖示或文字 */
        .ms-status::before {
            content: '🕒 ';
            font-size: 0.8rem;
        }

    /* 過期標籤 */
    .status-badge-expired {
        background-color: #e2e8f0;
        color: #64748b;
        font-size: 0.75rem !important;
        padding: 2px 8px !important;
        border-radius: 6px;
        font-weight: 600;
    }
}


/* =========================================================
   6. Loading 動畫
   ========================================================= */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.result-loading-placeholder {
    text-align: center;
    padding: 40px;
    color: var(--medical-text-light);
    animation: fadeIn 0.3s ease-out;
}

    .result-loading-placeholder .spinner-large {
        width: 3rem;
        height: 3rem;
        border: 4px solid #e2e8f0;
        border-top-color: var(--medical-primary);
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin: 0 auto 16px;
    }

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .sch-page {
        padding: 24px 12px; /* 增加一點邊距 */
    }

    .ms-tag {
        display: flex !important;
    }
}

/* Card base */
.bk-card {
    border: 1px solid rgba(0,0,0,.08);
    border-radius: 16px;
    background: #fff;
    padding: 14px 14px 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,.05);
    display: grid;
    gap: 10px;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
    user-select: none;
}

    .bk-card.is-active {
        cursor: pointer;
    }

        .bk-card.is-active:hover {
            transform: translateY(-1px);
            box-shadow: 0 10px 26px rgba(0,0,0,.08);
            border-color: rgba(0,0,0,.14);
        }

        .bk-card.is-active:focus {
            outline: none;
            border-color: rgba(37,99,235,.45);
            box-shadow: 0 0 0 4px rgba(37,99,235,.15), 0 10px 26px rgba(0,0,0,.08);
        }

    .bk-card.is-expired {
        opacity: .65;
        filter: grayscale(.35);
    }

/* Header */
.bk-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.bk-date {
    font-weight: 800;
    letter-spacing: .2px;
    font-size: 1.02rem;
    line-height: 1.2;
}

.bk-sub {
    margin-top: 4px;
    font-size: .88rem;
    color: rgba(0,0,0,.6);
}

/* Badge */
.bk-badge {
    font-size: .78rem;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
    white-space: nowrap;
}

    .bk-badge.badge-active {
        background: rgba(16,185,129,.14);
        color: rgb(6,95,70);
    }

    .bk-badge.badge-expired {
        background: rgba(148,163,184,.22);
        color: rgba(15,23,42,.75);
    }

/* Body */
.bk-clinic-name {
    font-weight: 800;
    font-size: 1rem;
    line-height: 1.25;
}

.bk-doctor {
    margin-top: 3px;
    font-size: .88rem;
    color: rgba(0,0,0,.62);
}

/* Footer action */
.bk-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px dashed rgba(0,0,0,.10);
}

.bk-foot-text {
    font-size: .88rem;
    color: rgba(0,0,0,.65);
    font-weight: 600;
}

.bk-chevron {
    font-size: 1.4rem;
    line-height: 1;
    color: rgba(0,0,0,.35);
}

.bk-foot.is-disabled .bk-foot-text {
    color: rgba(0,0,0,.5);
}

/* Mobile spacing */
@media (max-width: 767px) {
    .bk-card {
        padding: 14px;
        border-radius: 18px;
    }

    .bk-date {
        font-size: 1.05rem;
    }
}

.mobile-slot-item {
    display: grid;
    gap: 10px;
}

.ms-name {
    font-weight: 800;
    font-size: 1rem;
    line-height: 1.25;
}

.ms-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ms-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,.08);
    background: rgba(0,0,0,.03);
    line-height: 1;
}

.ms-ico {
    font-size: .92rem;
    opacity: .8;
}

.ms-label {
    font-size: .78rem;
    color: rgba(0,0,0,.55);
    font-weight: 700;
}

.ms-val {
    font-size: .88rem;
    font-weight: 900;
    color: rgba(0,0,0,.82);
}

/* 可選：讓三種資訊有微區別（更快掃描） */
.ms-chip--type {
    background: rgba(59,130,246,.08);
    border-color: rgba(59,130,246,.18);
}

.ms-chip--time {
    background: rgba(16,185,129,.10);
    border-color: rgba(16,185,129,.18);
}

.ms-chip--no {
    background: rgba(245,158,11,.10);
    border-color: rgba(245,158,11,.18);
}

/* =========================================================
   現代化緊湊卡片 (Modern Compact Card)
   目標：零浪費空間、重點資訊巨大化
   ========================================================= */

#listView {
    display: grid;
    gap: 12px; /* 縮小卡片間距 */
    padding-bottom: 40px;
}

@media (min-width: 768px) {
    #listView {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* --- 卡片容器 --- */
.bk-card {
    position: relative;
    background: #fff;
    border-radius: 12px; /* 圓角稍微縮小，更俐落 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    cursor: default;
    transition: transform 0.1s;
}

    .bk-card.is-active {
        cursor: pointer;
        border-left: 5px solid var(--medical-primary, #0ea5a4); /* 色條直接做在邊框，省空間 */
    }

        .bk-card.is-active:active {
            background-color: #f8fafc;
            transform: scale(0.99);
        }

    .bk-card.is-expired {
        background-color: #f9fafb;
        border-left: 5px solid #cbd5e1;
        opacity: 0.85;
    }

/* 移除獨立的 indicator div，改用 border-left 省空間 */
.bk-indicator {
    display: none;
}

/* --- 內容區 (極致緊湊) --- */
.bk-content {
    flex: 1;
    padding: 12px 10px 12px 16px; /* 縮減內距 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px; /* 區塊間距縮小 */
}

/* 1. Header: 日期與狀態 */
.bk-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline; /* 底部對齊 */
    border-bottom: 1px dashed #f1f5f9;
    padding-bottom: 6px;
    margin-bottom: 2px;
}

.bk-date-group {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

/* 日期：巨大化 */
.bk-date {
    font-size: 1.4rem;
    font-weight: 900;
    color: #1e293b;
    font-family: 'Roboto', sans-serif;
    line-height: 1;
}

.bk-week {
    font-size: 0.95rem;
    color: #64748b;
    font-weight: 500;
}

/* 狀態文字：簡單就好，不佔位 */
.bk-status-text {
    font-size: 0.8rem;
    color: #059669; /* 綠字 */
    font-weight: 600;
}

    .bk-status-text.expired {
        color: #94a3b8;
    }

/* 2. 核心資訊橫排 (Row) */
.bk-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bk-cell {
    display: flex;
    flex-direction: column;
    gap: 0px; /* 標籤跟數值貼近 */
}

.cell-label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 2px;
}

/* 數值通用設定 */
.cell-val {
    font-weight: 800;
    color: #334155;
    line-height: 1.1;
}

/* 診別字體 */
.shift-font {
    font-size: 1.3rem; /* 大 */
    color: #0f172a;
}

/* 時間字體 */
.time-font {
    font-size: 1.3rem; /* 大 */
    font-family: 'Roboto Mono', monospace;
}

/* 號碼字體 (最大焦點) */
.num-cell {
    text-align: right;
    padding-right: 8px; /* 與箭頭保持距離 */
}

.num-font {
    font-size: 2.2rem; /* 超巨大 */
    color: var(--medical-primary, #0ea5a4);
    font-family: 'Roboto', sans-serif;
}

.num-prefix {
    font-size: 1rem;
    color: #cbd5e1;
    font-weight: 400;
    vertical-align: middle;
}

/* 3. 底部診所名 (變小，不搶戲) */
.bk-footer-info {
    font-size: 0.85rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}

    .bk-footer-info .icon {
        opacity: 0.5;
    }

/* 右側箭頭 */
.bk-action-arrow {
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #e2e8f0;
    background: #fafafa; /* 淡淡的底色區分 */
    border-left: 1px solid #f1f5f9;
}

.bk-card.is-active:hover .bk-action-arrow {
    color: var(--medical-primary);
    background: #f0fdfa;
}

/* =========================================================
   月曆模式優化 (Calendar View) - 加入診別顯示
   ========================================================= */

/* =========================================================
   月曆小卡優化 (Calendar Pill) - 含診所名稱版
   ========================================================= */

.slot-pill {
    display: flex;
    flex-direction: column; /* 改為垂直排列 */
    gap: 4px;
    padding: 6px 8px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 3px solid var(--medical-primary, #0ea5a4);
    cursor: pointer;
    margin-bottom: 6px;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

    .slot-pill:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0,0,0,0.08);
        z-index: 1; /* 浮起時確保在最上層 */
    }

    /* 狀態區分 */
    .slot-pill.active {
        border-left-color: var(--medical-primary, #0ea5a4);
    }

        .slot-pill.active:hover {
            background-color: #f0fdfa;
            border-color: #ccfbf1;
        }

    .slot-pill.expired {
        border-left-color: #cbd5e1;
        background: #f9fafb;
        opacity: 0.75;
    }

/* --- 上層：核心資訊 --- */
.pill-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed #f1f5f9; /* 虛線分隔 */
    padding-bottom: 4px;
}

.pill-info-group {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.pill-shift {
    font-size: 0.75rem;
    color: #fff;
    background-color: #64748b; /* 用深色底塊突顯診別 */
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 500;
}
/* 不同時段可以給不同顏色 (可選) */
/* .pill-shift:contains("早") { background: #f59e0b; } */

.pill-time {
    font-size: 0.9rem;
    font-weight: 800;
    color: #334155;
    font-family: 'Roboto Mono', monospace;
}

.pill-no {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--medical-primary, #0ea5a4);
    line-height: 1;
}

/* --- 下層：診所名稱 --- */
.pill-bottom {
    font-size: 0.8rem;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* 太長自動變 ... */
    font-weight: 500;
    padding-top: 1px;
}

/* 過期狀態文字變淡 */
.slot-pill.expired .pill-no,
.slot-pill.expired .pill-time,
.slot-pill.expired .pill-clinic {
    color: #94a3b8;
}

.slot-pill.expired .pill-shift {
    background-color: #cbd5e1;
}

/* 手機版 RWD 微調 */
@media (max-width: 480px) {
    .bk-date {
        font-size: 1.3rem;
    }

    .shift-font {
        font-size: 1.2rem;
    }

    .time-font {
        font-size: 1.2rem;
    }

    .num-font {
        font-size: 2rem;
    }
}

/* =========================================================
   診別顏色定義 (Shift Colors)
   早診(A): 暖橙色
   午診(B): 天藍色
   晚診(C): 紫羅蘭
   ========================================================= */

/* --- 1. 列表模式配色 (bk-card) --- */

/* 預設邊框與文字顏色 (Fallback: 主色) */
/* =========================================================
   診別顏色定義 (Shift Colors) - 包含有效與過期狀態
   ========================================================= */

/* --- 1. 卡片基礎設定 --- */
.bk-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

    /* --- 2. 有效狀態 (Active) - 鮮豔 --- */
    .bk-card.is-active {
        border-left: 5px solid var(--medical-primary, #0ea5a4);
    }

        .bk-card.is-active .shift-font,
        .bk-card.is-active .num-font {
            color: var(--medical-primary, #0ea5a4);
        }

    /* 早診 (A) - 鮮明橙 */
    .bk-card.shift-A.is-active {
        border-left-color: #f59e0b;
    }

        .bk-card.shift-A.is-active .shift-font,
        .bk-card.shift-A.is-active .num-font {
            color: #d97706;
        }

    /* 午診 (B) - 亮麗藍 */
    .bk-card.shift-B.is-active {
        border-left-color: #3b82f6;
    }

        .bk-card.shift-B.is-active .shift-font,
        .bk-card.shift-B.is-active .num-font {
            color: #2563eb;
        }

    /* 晚診 (C) - 飽和紫 */
    .bk-card.shift-C.is-active {
        border-left-color: #8b5cf6;
    }

        .bk-card.shift-C.is-active .shift-font,
        .bk-card.shift-C.is-active .num-font {
            color: #7c3aed;
        }


    /* --- 3. 過期狀態 (Expired) - 淡化但保留原色氛圍 --- */

    /* 基礎過期樣式：移除透明度，確保文字清晰 */
    .bk-card.is-expired {
        border-left-width: 5px;
        opacity: 1; /* ✅ 改回 1，確保文字不模糊 */
        filter: none; /* ✅ 移除灰階濾鏡 */
        background-color: #f8fafc; /* 預設灰底 */
        border-color: #e2e8f0;
        cursor: not-allowed;
    }

    /* 針對不同診別，給予極淡的背景色與粉彩邊框 */

    /* 早診 (A) 過期：淡奶油黃底 + 淺橘邊 */
    .bk-card.shift-A.is-expired {
        background-color: #fffbf2; /* 極淡黃 */
        border-left-color: #fed7aa; /* 粉橘色 */
    }

    /* 午診 (B) 過期：淡冰藍底 + 淺藍邊 */
    .bk-card.shift-B.is-expired {
        background-color: #f4f8ff; /* 極淡藍 */
        border-left-color: #bfdbfe; /* 粉藍色 */
    }

    /* 晚診 (C) 過期：淡薰衣草底 + 淺紫邊 */
    .bk-card.shift-C.is-expired {
        background-color: #fbf7ff; /* 極淡紫 */
        border-left-color: #ddd6fe; /* 粉紫色 */
    }

    /* --- 4. 過期文字優化 (關鍵) --- */
    /* 強制將過期卡片內的重點文字設為「深灰色」，確保長者閱讀 */

    .bk-card.is-expired .bk-date,
    .bk-card.is-expired .shift-font,
    .bk-card.is-expired .num-font,
    .bk-card.is-expired .time-font {
        color: #475569 !important; /* Slate-600 深灰，對比度足夠 */
    }

    .bk-card.is-expired .cell-label,
    .bk-card.is-expired .bk-week,
    .bk-card.is-expired .bk-footer-info {
        color: #94a3b8 !important; /* 標籤類可以維持淺灰，區分層次 */
    }

    .bk-card.is-expired .bk-status-text {
        color: #94a3b8; /* 「已過期」字樣維持淺灰 */
        background: #f1f5f9;
        padding: 2px 8px;
        border-radius: 4px;
    }


/* --- 2. 月曆模式配色 (slot-pill) --- */

/* 標籤基礎樣式 */
.pill-shift {
    color: #fff;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* 有效狀態下的顏色 */
/* 早診 (A) */
.slot-pill.active.shift-A {
    border-left-color: #f59e0b;
}

    .slot-pill.active.shift-A .pill-shift {
        background-color: #f59e0b;
    }

    .slot-pill.active.shift-A .pill-no {
        color: #d97706;
    }

/* 午診 (B) */
.slot-pill.active.shift-B {
    border-left-color: #3b82f6;
}

    .slot-pill.active.shift-B .pill-shift {
        background-color: #3b82f6;
    }

    .slot-pill.active.shift-B .pill-no {
        color: #2563eb;
    }

/* 晚診 (C) */
.slot-pill.active.shift-C {
    border-left-color: #8b5cf6;
}

    .slot-pill.active.shift-C .pill-shift {
        background-color: #8b5cf6;
    }

    .slot-pill.active.shift-C .pill-no {
        color: #7c3aed;
    }

/* --- 過期狀態 (Expired) - 月曆版 --- */
.slot-pill.expired {
    border-left-color: #cbd5e1 !important; /* 覆蓋邊框 */
    background: #f8fafc;
    opacity: 0.65;
}

    .slot-pill.expired .pill-shift {
        background-color: #94a3b8 !important; /* 標籤變灰 */
    }

    .slot-pill.expired .pill-no {
        color: #94a3b8 !important; /* 號碼變灰 */
    }

/* 滑鼠滑過效果微調 (僅有效時) */
.slot-pill.active.shift-A:hover { background-color: #fffbeb; } /* 淺橙底 */
.slot-pill.active.shift-B:hover { background-color: #eff6ff; } /* 淺藍底 */
.slot-pill.active.shift-C:hover { background-color: #f5f3ff; } /* 淺紫底 */

/* =========================================
   預約詳情 Modal (Detail Modal)
   ========================================= */

/* 讓 Modal 稍微窄一點，聚焦資訊 */
.modal-dialog.modal-sm {
    max-width: 360px;
    width: 90%;
}

.detail-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

/* 頂部卡片 */
.detail-header-card {
    text-align: center;
}

.d-clinic-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 8px;
}

.d-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.d-date {
    font-size: 1.1rem;
    color: #64748b;
    font-weight: 500;
}

/* 診別標籤 */
.d-shift-badge {
    background: #e2e8f0;
    color: #475569;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
}

    .d-shift-badge.shift-A {
        background: #fef3c7;
        color: #d97706;
    }
    /* 橙 */
    .d-shift-badge.shift-B {
        background: #dbeafe;
        color: #2563eb;
    }
    /* 藍 */
    .d-shift-badge.shift-C {
        background: #f3e8ff;
        color: #7c3aed;
    }
/* 紫 */

/* 數據網格 */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: #f8fafc;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
}

.d-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

    .d-item label {
        font-size: 0.8rem;
        color: #94a3b8;
    }

.d-val {
    font-size: 1.4rem;
    font-weight: 800;
    color: #334155;
    font-family: 'Roboto Mono', monospace;
    line-height: 1;
}

/* 強調看診號 */
.d-item.highlight .d-val {
    color: var(--medical-primary, #0ea5a4);
    font-size: 1.8rem;
}

/* 分隔線與狀態 */
.detail-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 0 4px;
}

.detail-status {
    text-align: center;
    font-size: 0.9rem;
    color: #059669;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* 底部按鈕區 */
.vertical-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-cancel-full {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: none;
    background-color: #fee2e2;
    color: #ef4444;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

    .btn-cancel-full:hover {
        background-color: #fecaca;
        color: #dc2626;
    }

.btn-back-ghost {
    width: 100%;
    padding: 10px;
    background: transparent;
    border: 1px solid transparent;
    color: #94a3b8;
    font-size: 0.9rem;
    cursor: pointer;
}

    .btn-back-ghost:hover {
        color: #64748b;
    }

/* 2. 宣告文字容器設定 */
.recaptcha-notice {
    font-size: 0.75rem; /* 12px，縮小字體不搶鋒頭 */
    color: #cbd5e1; /* Slate-300 極淡灰，平常幾乎隱形 */
    line-height: 1.3;
    margin-top: 8px;
    transition: color 0.3s;
    /* RWD 斷行保護 */
    white-space: normal !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 滑鼠移過去時才變深，方便閱讀 */
.query-toolbar:hover .recaptcha-notice {
    color: #94a3b8; /* Slate-400 */
}

/* 連結樣式 */
.recaptcha-notice a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
}

    .recaptcha-notice a:hover {
        color: var(--medical-primary);
        border-bottom-style: solid;
    }

/* =========================================================
   系統整合通知 (System Notice Alert)
   UIUX: 使用暖色系 (Amber/Orange) 提示 "注意" 但非 "錯誤"
   ========================================================= */
.system-notice-alert {
    display: flex;
    gap: 16px;
    background-color: #fff7ed; /* 淺橘色底 */
    border: 1px solid #fed7aa; /* 橘色邊框 */
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 6px rgba(234, 88, 12, 0.05);
    align-items: flex-start;
}

.notice-icon {
    font-size: 1.5rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}

.notice-content {
    flex: 1;
}

.notice-title {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 700;
    color: #9a3412; /* 深橘褐色 */
}

.notice-list {
    margin: 0;
    padding-left: 20px;
    color: #7c2d12;
    font-size: 0.95rem;
    line-height: 1.5;
}

    .notice-list li {
        margin-bottom: 4px;
    }

        .notice-list li:last-child {
            margin-bottom: 0;
        }

/* 強調連結樣式 */
.notice-link {
    color: #ea580c; /* 鮮豔橘 */
    font-weight: 600;
    text-underline-offset: 2px;
}

    .notice-link:hover {
        color: #c2410c;
        background-color: rgba(234, 88, 12, 0.1);
    }

/* =========================================================
   Modal 內 "不可取消" 的提示訊息
   ========================================================= */
.cancel-disabled-msg {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #f1f5f9; /* 淺灰底 */
    color: #64748b; /* 深灰字 */
    padding: 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px dashed #cbd5e1;
    text-align: center;
}

    .cancel-disabled-msg .info-icon {
        font-size: 1.1rem;
    }

/* 針對手機版的優化 */
@media (max-width: 768px) {
    .system-notice-alert {
        flex-direction: column; /* 手機版垂直排列 */
        gap: 8px;
        padding: 14px;
    }

    .notice-icon {
        font-size: 1.2rem;
    }

    .notice-list {
        padding-left: 18px; /* 縮排調整 */
    }
}

@media (max-width: 768px) {
    .sch-container {
        padding: 25px 15px;
        background: #fff;
    }
    .sch-header {
        padding: 0 10px 10px;
        margin-bottom: 1rem;
    }
}