/* =========================================================
   全台牙醫通｜診所獨立頁 clinic.php 專用樣式
   class 一律 cp- 開頭，不影響 primary.css 既有樣式
   ========================================================= */

.cp-page {
    --cp-main: #00796b;
    --cp-main-dark: #00564c;
    --cp-main-soft: #e0f2f1;
    --cp-main-mid: #4db6ac;
    --cp-ink: #1f2d2b;
    --cp-muted: #6b7c7a;
    --cp-line: #e3ebea;
    --cp-bg: #f6f9f8;
    --cp-star: #f5a623;

    font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    color: var(--cp-ink);
    background: var(--cp-bg);
    padding: 28px 16px 64px;
    line-height: 1.7;
}

.cp-wrap {
    max-width: 1080px;
    margin: 0 auto;
}

.cp-page *,
.cp-page *::before,
.cp-page *::after {
    box-sizing: border-box;
}

/* primary.css 第 8 行把所有 a 強制成 font-size:1rem、改字型，這裡改回跟著外層。
   用 :where() 讓這條的權重跟 primary.css 一樣低，.cp-btn 等自己設的字級仍然有效 */
:where(.cp-page) a {
    font-size: inherit;
    font-family: inherit;
}

/* ---------- 麵包屑 ---------- */
.cp-breadcrumb ol {
    list-style: none;
    margin: 0 0 18px;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    color: var(--cp-muted);
}

.cp-breadcrumb li + li::before {
    content: "›";
    margin-right: 6px;
    color: #b5c4c2;
}

.cp-breadcrumb a {
    color: var(--cp-muted);
    text-decoration: none;
    font-size: inherit;
}

.cp-breadcrumb a:hover {
    color: var(--cp-main);
}

/* ---------- 頂部名稱區 ---------- */
.cp-hero {
    background: #fff;
    border: 1px solid var(--cp-line);
    border-radius: 18px;
    padding: 28px 30px;
    position: relative;
    overflow: hidden;
}

.cp-hero::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: linear-gradient(180deg, var(--cp-main-mid), var(--cp-main));
}

.cp-hero h1 {
    margin: 0 0 10px;
    font-size: 30px;
    line-height: 1.35;
    font-weight: 700;
    letter-spacing: .02em;
}

.cp-hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    font-size: 14px;
    color: var(--cp-muted);
}

.cp-rating {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.cp-rating b {
    color: var(--cp-star);
    font-size: 17px;
}

.cp-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--cp-main-soft);
    color: var(--cp-main);
    border-radius: 999px;
    padding: 2px 12px;
    font-size: 13px;
    font-weight: 500;
}

.cp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.cp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--cp-main);
    color: var(--cp-main);
    background: #fff;
    transition: background .2s, color .2s;
}

.cp-btn:hover {
    background: var(--cp-main-soft);
}

.cp-btn--solid {
    background: var(--cp-main);
    color: #fff;
}

.cp-btn--solid:hover {
    background: var(--cp-main-dark);
    color: #fff;
}

.cp-btn svg {
    width: 18px;
    height: 18px;
    flex: none;
}

/* ---------- 主體兩欄 ---------- */
.cp-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 24px;
    margin-top: 24px;
    align-items: start;
}

.cp-main,
.cp-side {
    display: grid;
    gap: 24px;
}

.cp-side {
    position: sticky;
    top: 90px;
}

.cp-card {
    background: #fff;
    border: 1px solid var(--cp-line);
    border-radius: 16px;
    padding: 24px 26px;
}

.cp-card h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    font-size: 19px;
    font-weight: 700;
}

.cp-card h2 .cp-no {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--cp-main-soft);
    color: var(--cp-main);
    font-size: 13px;
    font-weight: 700;
}

/* ---------- 1.1 門診基本資訊 ---------- */
.cp-info {
    margin: 0;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
}

.cp-info dt,
.cp-info dd {
    margin: 0;
    padding: 12px 0;
    border-bottom: 1px dashed var(--cp-line);
}

.cp-info dt {
    color: var(--cp-muted);
    font-size: 14px;
}

.cp-info dd {
    font-size: 15px;
    word-break: break-word;
}

.cp-info dt:last-of-type,
.cp-info dd:last-of-type {
    border-bottom: 0;
}

.cp-info a {
    color: var(--cp-main);
    text-decoration: none;
    font-weight: 500;
}

.cp-info a:hover {
    text-decoration: underline;
}

.cp-info small {
    color: var(--cp-muted);
    margin-left: 6px;
}

/* ---------- 1.2 門診時間表格 ---------- */
.cp-hours-box {
    border: 1px solid var(--cp-line);
    border-radius: 14px;
    overflow-x: auto;
}

.cp-hours {
    width: 100%;
    min-width: 420px;
    border-collapse: separate;
    border-spacing: 0;
    text-align: center;
    table-layout: fixed;
}

.cp-hours th,
.cp-hours td {
    padding: 14px 4px;
    border-bottom: 1px solid var(--cp-line);
}

.cp-hours tbody tr:last-child th,
.cp-hours tbody tr:last-child td {
    border-bottom: 0;
}

.cp-hours thead th {
    background: var(--cp-main);
    color: #fff;
    font-weight: 500;
    font-size: 15px;
    padding: 12px 4px;
    position: relative;
}

.cp-hours thead th:first-child {
    width: 84px;
}

/* 週六、週日欄位底色區隔 */
.cp-hours thead th.is-weekend {
    background: var(--cp-main-dark);
}

.cp-hours td.is-weekend {
    background: #fafcfc;
}

.cp-hours tbody th {
    font-weight: 500;
    font-size: 15px;
    text-align: left;
    padding-left: 18px;
    line-height: 1.3;
}

/* 有看診：綠底圓角方塊＋勾 */
.cp-on {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--cp-main-mid);
    color: #fff;
}

.cp-on::before {
    content: "";
    width: 11px;
    height: 6px;
    border-left: 2.5px solid currentColor;
    border-bottom: 2.5px solid currentColor;
    transform: translateY(-2px) rotate(-45deg);
}

/* 休診：淺灰短線 */
.cp-off {
    display: inline-block;
    width: 14px;
    height: 2px;
    border-radius: 2px;
    background: #cfd8d7;
    vertical-align: middle;
}

/* 圖例 */
.cp-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin: 14px 2px 0;
    font-size: 13px;
    color: var(--cp-muted);
}

.cp-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cp-legend .cp-on {
    width: 18px;
    height: 18px;
    border-radius: 6px;
}

.cp-legend .cp-on::before {
    width: 7px;
    height: 4px;
    border-width: 2px;
}

/* 各日實際時段 */
.cp-detail {
    margin-top: 18px;
    border-top: 1px solid var(--cp-line);
    padding-top: 6px;
}

.cp-detail summary {
    cursor: pointer;
    padding: 10px 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--cp-main);
    list-style: none;
}

.cp-detail summary::-webkit-details-marker {
    display: none;
}

.cp-detail summary::before {
    content: "＋";
    display: inline-block;
    width: 22px;
}

.cp-detail[open] summary::before {
    content: "－";
}

.cp-detail ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cp-detail li {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 14px;
}

.cp-detail li:nth-child(odd) {
    background: var(--cp-bg);
}

.cp-detail li b {
    font-weight: 500;
}

.cp-detail .cp-times {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
}

.cp-detail .is-closed {
    color: #9aa9a7;
}

.cp-note {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    margin: 16px 0 0;
    font-size: 13px;
    color: var(--cp-muted);
}

.cp-note::before {
    content: "i";
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    margin-top: 3px;
    border-radius: 50%;
    border: 1px solid currentColor;
    font-size: 11px;
    font-style: italic;
    font-weight: 700;
    line-height: 1;
}

.cp-empty {
    margin: 0;
    padding: 18px;
    border-radius: 12px;
    background: var(--cp-bg);
    color: var(--cp-muted);
    font-size: 15px;
}

/* ---------- 1.3 官方網站 ---------- */
.cp-site {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--cp-line);
    text-decoration: none;
    color: var(--cp-ink);
    font-size: 14px;
    word-break: break-all;
}

a.cp-site:hover {
    border-color: var(--cp-main-mid);
    background: var(--cp-main-soft);
}

.cp-site svg {
    width: 26px;
    height: 26px;
    flex: none;
    color: var(--cp-main);
}

/* ---------- 1.4 社群連結 ---------- */
.cp-social {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
}

/* 側欄改到下方時（平板／手機），社群連結排兩欄 */
@media (max-width: 900px) {
    .cp-social {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.cp-social a,
.cp-social span.cp-sns {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--cp-line);
    font-size: 14px;
    text-decoration: none;
    color: var(--cp-ink);
}

.cp-social a:hover {
    border-color: var(--cp-main-mid);
    background: var(--cp-main-soft);
}

.cp-sns-icon {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 9px;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    font-family: Arial, sans-serif;
}

.cp-sns-icon.is-facebook { background: #1877f2; font-size: 18px; }
.cp-sns-icon.is-instagram { background: linear-gradient(45deg, #f9a825, #e1306c 55%, #833ab4); }

/* 尚未提供：整塊變灰 */
.is-pending {
    color: #9aa9a7 !important;
    background: var(--cp-bg);
    border-style: dashed !important;
}

.is-pending .cp-sns-icon {
    background: #cfd8d7 !important;
}

.is-pending svg {
    color: #b5c4c2 !important;
}

.cp-pending-text {
    display: block;
    font-size: 12px;
}

/* ---------- 頁尾說明 ---------- */
.cp-foot {
    margin-top: 28px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--cp-muted);
}

.cp-foot a {
    color: var(--cp-main);
    text-decoration: none;
    font-weight: 500;
}

.cp-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- 平板／手機 ---------- */
@media (max-width: 900px) {
    .cp-body {
        grid-template-columns: minmax(0, 1fr);
    }

    .cp-side {
        position: static;
    }
}

@media (max-width: 600px) {
    .cp-page {
        padding: 16px 12px 48px;
    }

    .cp-hero {
        padding: 22px 20px;
    }

    .cp-hero h1 {
        font-size: 24px;
    }

    .cp-actions .cp-btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    .cp-card {
        padding: 20px 16px;
    }

    .cp-info {
        grid-template-columns: 76px minmax(0, 1fr);
    }

    .cp-hours {
        min-width: 0;
    }

    .cp-hours thead th:first-child {
        width: 52px;
    }

    .cp-hours tbody th {
        padding-left: 8px;
        font-size: 14px;
    }


    .cp-hours th,
    .cp-hours td {
        padding: 12px 2px;
    }

    .cp-on {
        width: 24px;
        height: 24px;
        border-radius: 7px;
    }

    .cp-on::before {
        width: 9px;
        height: 5px;
        border-width: 2px;
    }
}
