/* 店家後台共用樣式（手機優先）。載入在 Bulma 之後，覆蓋 Bulma 的預設外觀。
   設計見 back/admin-ui-plan.md */

:root {
    --primary: #c0446b;
    --primary-dark: #a23558;
    --primary-soft: #fbe9ef;
    --ink: #2b2b33;
    --muted: #7a7a85;
    --line: #e8e8ee;
    --bg: #f6f6f8;
    --card: #ffffff;
    --danger: #d64545;
    --header-h: 52px;
    --bottom-h: 60px;
    --sidebar-w: 220px;

    --st-pending: #b7791f;
    --st-pending-bg: #fdf2d8;
    --st-confirmed: #2b6cb0;
    --st-confirmed-bg: #e3eefb;
    --st-completed: #2f855a;
    --st-completed-bg: #e1f4e9;
    --st-cancelled: #6b6b75;
    --st-cancelled-bg: #ececf0;
    --st-no_show: #c53030;
    --st-no_show-bg: #fde4e4;
}

html { -webkit-text-size-adjust: 100%; }
body {
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    padding-top: var(--header-h);
    padding-bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom));
}
a { color: var(--primary); }

/* ---------- 頂部列 ---------- */
.ad-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
    height: var(--header-h);
    display: flex; align-items: center; gap: 4px;
    padding: 0 8px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}
.ad-header .ad-title { flex: 1; font-size: 1.05rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-header .ad-who {
    font-size: .78rem; font-weight: 600; color: var(--primary-dark); background: var(--primary-soft);
    padding: 4px 10px; margin-right: 4px; border-radius: 999px; white-space: nowrap;
}
.ad-iconbtn {
    width: 44px; height: 44px; border: 0; background: transparent; color: var(--ink);
    font-size: 1.15rem; border-radius: 10px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.ad-iconbtn:active { background: var(--bg); }

/* 外框的按鈕要擋住各頁內嵌樣式裡全域的 button 規則（config、deposit 等頁還沒整理，
   會把漢堡鈕、選單按鈕撐成整條漸層）。階段 4 清掉內嵌樣式後可以拿掉 !important。 */
.ad-header button.ad-iconbtn, .ad-header button.ad-iconbtn:hover {
    width: 44px !important; height: 44px !important; padding: 0 !important; margin: 0 !important;
    background: transparent !important; color: var(--ink) !important; border: 0 !important; border-radius: 10px !important;
    box-shadow: none !important; transform: none !important; letter-spacing: 0 !important; font-size: 1.15rem !important;
}
.ad-header button.ad-iconbtn:active { background: var(--bg) !important; }
.ad-menu button.ad-menu-toggle, .ad-menu button.ad-menu-toggle:hover {
    width: 100% !important; margin: 0 !important; padding: 0 12px !important; background: transparent !important;
    color: var(--ink) !important; border: 0 !important; border-radius: 10px !important; box-shadow: none !important;
    transform: none !important; letter-spacing: 0 !important; font-size: 1rem !important; font-weight: 400 !important;
}
.ad-menu button.ad-menu-toggle:active { background: var(--bg) !important; }

/* ---------- 抽屜／側邊欄 ---------- */
.ad-drawer {
    position: fixed; top: 0; left: 0; bottom: 0; width: 260px; max-width: 82vw; z-index: 1002;
    background: var(--card);
    transform: translateX(-100%); transition: transform .22s ease;
    overflow-y: auto; padding: 12px 0 24px;
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
}
.ad-drawer.is-open { transform: none; }
.ad-backdrop {
    position: fixed; inset: 0; z-index: 1001; background: rgba(0,0,0,.35);
    opacity: 0; pointer-events: none; transition: opacity .22s;
}
.ad-backdrop.is-open { opacity: 1; pointer-events: auto; }
.ad-drawer-head { padding: 8px 20px 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.ad-drawer-head strong { display: block; font-size: 1.05rem; }
.ad-drawer-head span { font-size: .85rem; color: var(--muted); }
.ad-menu { list-style: none; margin: 0; padding: 0 8px; }
.ad-menu a, .ad-menu button.ad-menu-toggle {
    display: flex; align-items: center; gap: 12px;
    width: 100%; min-height: 46px; padding: 0 12px;
    border: 0; background: transparent; border-radius: 10px;
    color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.ad-menu a i, .ad-menu button i { width: 20px; text-align: center; color: var(--muted); }
.ad-menu a:active, .ad-menu button.ad-menu-toggle:active { background: var(--bg); }
.ad-menu a.is-active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }
.ad-menu a.is-active i { color: var(--primary); }
.ad-menu .ad-sub { list-style: none; margin: 0; padding: 0 0 0 20px; display: none; }
.ad-menu .ad-sub.is-open { display: block; }
.ad-menu .ad-sep { height: 1px; background: var(--line); margin: 8px 12px; }

/* ---------- 底部導覽 ---------- */
.ad-bottom {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
    height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: flex; background: var(--card); border-top: 1px solid var(--line);
}
.ad-bottom a {
    flex: 1 1 0; min-width: 0; padding: 0 2px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted); font-size: .66rem; line-height: 1.1; white-space: nowrap; text-decoration: none;
}
.ad-bottom i { font-size: 1.1rem; }
.ad-bottom a.is-active { color: var(--primary); font-weight: 700; }

/* ---------- 內容區 ---------- */
.ad-main { padding: 16px; max-width: 960px; margin: 0 auto; }
.main-content-bulma { padding: 16px; }  /* 其他頁面還在用的 Bulma section */
.main-content-bulma .container { max-width: 960px; }
.title { color: var(--ink); }

.ad-card {
    background: var(--card); border-radius: 12px; padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 12px;
}
.box { border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

/* ---------- 表單與按鈕 ---------- */
.input, .select select, .textarea { font-size: 16px; min-height: 44px; border-radius: 10px; border-color: var(--line); }
.input:focus, .select select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.select, .select select { width: 100%; }
.button { min-height: 44px; border-radius: 10px; font-weight: 600; }
.button.is-small { min-height: 40px; font-size: .9rem; padding-left: 16px; padding-right: 16px; }
.button.is-link, .button.is-primary { background: var(--primary); border-color: transparent; color: #fff; }
.button.is-link:hover, .button.is-link:active, .button.is-primary:hover { background: var(--primary-dark); color: #fff; }
.button.is-link.is-light { background: var(--primary-soft); color: var(--primary-dark); }
.button.is-danger.is-light { background: #fde8e8; color: var(--danger); }
.button.is-success.is-light { background: var(--st-completed-bg); color: var(--st-completed); }
.notification { border-radius: 12px; }

/* ---------- 狀態標籤 ---------- */
.ad-tag {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    font-size: .8rem; font-weight: 700; white-space: nowrap;
}
.ad-tag.st-pending { color: var(--st-pending); background: var(--st-pending-bg); }
.ad-tag.st-confirmed { color: var(--st-confirmed); background: var(--st-confirmed-bg); }
.ad-tag.st-completed { color: var(--st-completed); background: var(--st-completed-bg); }
.ad-tag.st-cancelled { color: var(--st-cancelled); background: var(--st-cancelled-bg); }
.ad-tag.st-no_show { color: var(--st-no_show); background: var(--st-no_show-bg); }
.ad-tag.st-discount { color: var(--st-pending); background: var(--st-pending-bg); font-weight: 600; }

/* ---------- 列表卡片（取代手機上的表格） ---------- */
.ad-group-title { margin: 20px 4px 8px; font-size: .9rem; font-weight: 700; color: var(--muted); }
.ad-item {
    background: var(--card); border-radius: 12px; padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 10px;
    border-left: 4px solid var(--line);
}
.ad-item.st-pending { border-left-color: var(--st-pending); }
.ad-item.st-confirmed { border-left-color: var(--st-confirmed); }
.ad-item.st-completed { border-left-color: var(--st-completed); }
.ad-item.st-no_show { border-left-color: var(--st-no_show); }
.ad-item.st-cancelled { opacity: .75; }
.ad-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ad-item-time { font-size: 1.15rem; font-weight: 700; }
.ad-item-name { margin-top: 4px; font-weight: 600; }
.ad-item-meta { color: var(--muted); font-size: .88rem; }
.ad-item-note { margin-top: 6px; font-size: .9rem; background: var(--bg); border-radius: 8px; padding: 6px 10px; }
.ad-item-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ad-item-actions form { display: contents; }
.ad-item-actions .button { flex: 1 1 0; }
.ad-cancel-box { display: none; width: 100%; gap: 8px; }
.ad-cancel-box.is-open { display: flex; flex-wrap: wrap; }
.ad-cancel-box .input { flex: 1 1 100%; }
.ad-cancel-box form { display: flex; gap: 8px; width: 100%; }
.ad-cancel-box .button { flex: 0 0 auto; }

.ad-filter summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.ad-filter-body { display: grid; gap: 12px; margin-top: 12px; }
.ad-empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- 桌機 ---------- */
@media (min-width: 1024px) {
    body { padding-bottom: 0; }
    .ad-bottom, .ad-backdrop, #adBurger { display: none !important; }
    .ad-drawer {
        top: var(--header-h); width: var(--sidebar-w); max-width: none;
        transform: none; box-shadow: none; border-right: 1px solid var(--line);
    }
    .ad-main, .main-content-bulma { margin-left: var(--sidebar-w); max-width: none; padding: 24px 32px; }
    .ad-main > *, .main-content-bulma > .container { max-width: 960px; }
    .ad-header { padding-left: 16px; }
    .ad-filter-body { grid-template-columns: repeat(3, auto); align-items: end; justify-content: start; }
}

/* ---------- 表單版面（優惠券等頁共用） ---------- */
.ad-form-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.ad-form-grid .span-2 { grid-column: 1 / -1; }
.ad-form-pair { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ad-form-pair .input { min-width: 0; width: 100%; }   /* 手機也兩欄並排（日期、金額與百分比） */
.ad-hint { margin-top: 4px; font-size: .8rem; color: var(--muted); }
.ad-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; line-height: 1.4; }
.ad-check input { flex: none; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--primary); }
.ad-form-actions { display: flex; gap: 8px; margin-top: 18px; }
.ad-form-actions .button { flex: 1 1 0; }
.ad-section-title { margin: 24px 4px 8px; font-size: 1rem; font-weight: 700; color: var(--ink); }
.ad-item-value { font-size: 1.15rem; font-weight: 700; color: var(--primary-dark); margin-top: 2px; }
.ad-item-desc { margin-top: 4px; font-size: .9rem; color: var(--ink); }
.ad-item.is-inactive { opacity: .7; }
@media (min-width: 640px) {
    .ad-form-grid { grid-template-columns: 1fr 1fr; }
    .ad-form-actions .button { flex: 0 0 auto; min-width: 120px; }
}

/* ---------- 預約設定：營業時間、服務設定 ---------- */
.ad-form-triple { display: grid; gap: 10px; grid-template-columns: 1.2fr 1fr 1fr; }
.ad-hours-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.ad-hours-day { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
@media (min-width: 640px) {
    .ad-hours-row { display: grid; grid-template-columns: 160px 1fr; align-items: center; gap: 12px; }
    .ad-hours-day { margin-bottom: 0; gap: 16px; justify-content: flex-start; }
    .ad-hours-day strong { min-width: 3em; }
}
.ad-seg { display: grid; grid-template-columns: 3.4em minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 6px; }
.ad-seg .input { padding-left: 8px; padding-right: 6px; }
.ad-seg:first-child { margin-top: 0; }
.ad-day { padding: 8px 0; border-bottom: 1px solid var(--line); }
.ad-seg-head { margin-bottom: 2px; }
.ad-seg-head .ad-form-pair span { font-size: .8rem; color: var(--muted); font-weight: 600; padding-left: 4px; }
.ad-day-more { margin: 4px 0 0 0; }
.ad-day-more summary { cursor: pointer; font-size: .85rem; color: var(--primary-dark); padding: 6px 0 6px 0; list-style: none; }
.ad-day-more summary::-webkit-details-marker { display: none; }
.ad-day-more .ad-seg { margin-top: 2px; }

/* ---------- 產品列表卡片 ---------- */
.ad-product { display: flex; gap: 12px; align-items: flex-start; }
.ad-product-img { flex: none; width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: var(--bg); }
.ad-product-noimg { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 1.4rem; }
.ad-product-body { flex: 1; min-width: 0; }
.ad-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 卡片裡可展開的區塊（店員帳號等） ---------- */
.ad-fold { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 4px; }
.ad-fold summary { cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--primary-dark); min-height: 40px; display: flex; align-items: center; list-style: none; }
.ad-fold summary::-webkit-details-marker { display: none; }
.ad-fold summary::before { content: '＋'; margin-right: 6px; }
.ad-fold[open] summary::before { content: '－'; }
.ad-fold form { padding: 4px 0 10px; }

/* ---------- 彈出視窗（新增、修改技師等） ---------- */
.ad-modal { display: none; position: fixed; inset: 0; z-index: 1200; background: rgba(0,0,0,.45); padding: 16px; overflow-y: auto; }
.ad-modal.is-open { display: flex; }
.ad-modal-card { background: var(--card); border-radius: 16px; padding: 20px; width: 100%; max-width: 420px; margin: auto; box-shadow: 0 8px 30px rgba(0,0,0,.2); }

/* ---------- 色彩統一：主題粉色負責裝飾與操作，狀態才用語意色 ---------- */
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
.select:not(.is-multiple):not(.is-loading)::after { border-color: var(--primary); }
.button:focus:not(:active), .button.is-focused:not(:active) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.button:hover { border-color: var(--primary); color: var(--primary-dark); }
.button.is-link:hover, .button.is-link:focus { color: #fff; }
.button.is-danger.is-light:hover { border-color: transparent; color: var(--danger); }
.tag:not(body).is-link.is-light { background-color: var(--primary-soft); color: var(--primary-dark); }
.tag .delete { background-color: rgba(162, 53, 88, .25); }
/* 資訊類標籤（公開、分類、贈送比例、自訂權限…）：不是狀態，用主題色 */
.ad-tag.is-soft { color: var(--primary-dark); background: var(--primary-soft); }
/* 卡片左邊的色條：一般卡片用主題色；只有預約狀態才用語意色 */
.ad-item.is-accent { border-left-color: var(--primary); }
.ad-quickfill { background: var(--primary-soft); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.ad-quickfill .label { color: var(--primary-dark); }
.ad-quickfill .button { background: #fff; color: var(--primary-dark); border-color: var(--primary); }

/* 班表每天的「休假」按鈕：按下去清空當天時間；整天沒有時間時顯示成實心 */
.ad-dayname { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.ad-off-btn { font-size: .72rem; line-height: 1.2; padding: 2px 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; cursor: pointer; }
.ad-off-btn.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 定價規則頁 ---------- */
.ad-fold-title { margin: 0 0 10px; font-size: 1rem; font-weight: 700; }
.ad-rule-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: nowrap; }
.ad-rule-row .input { flex: 1 1 0; min-width: 0; padding-left: 8px; padding-right: 6px; }
.ad-rule-row .ad-item-meta { white-space: nowrap; font-size: .85rem; }
.ad-daypart { padding: 8px 0; border-top: 1px solid var(--line); }
.ad-daypart:first-of-type { border-top: 0; padding-top: 0; }
.ad-daychips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ad-daychip input { position: absolute; opacity: 0; pointer-events: none; }
.ad-daychip span { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--muted); font-size: .9rem; cursor: pointer; }
.ad-daychip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.ad-daychip input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-soft); }
.ad-preview-row { display: grid; grid-template-columns: 3.4em auto 1fr; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.ad-preview-tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.ad-price-down { color: var(--primary-dark); }
.ad-price-up { color: var(--st-pending); }
.notification.is-info.is-light { background: var(--primary-soft); color: var(--primary-dark); }
.ad-progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 6px 0; }
.ad-progress span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
