/* =========================================================
   汽車美容管理系統 Web 版 - 主要樣式（Bootstrap 5 擴充, RWD）
   色彩豐富版：深藍漸層側欄、彩色統計卡、彩色快捷按鈕
   主色由 --brand / --brand-rgb / --brand-dark 控制
   ========================================================= */
:root {
  --brand: #2563eb;        /* 主色：亮藍 */
  --brand-rgb: 37, 99, 235;
  --brand-dark: #1d4ed8;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --surface: #f8fafc;
  /* 輔助色 */
  --c-blue: #2563eb;   --c-blue-soft: #dbeafe;
  --c-green: #059669;  --c-green-soft: #d1fae5;
  --c-amber: #d97706;  --c-amber-soft: #fef3c7;
  --c-orange: #ea580c; --c-orange-soft: #ffedd5;
  --c-violet: #7c3aed; --c-violet-soft: #ede9fe;
  --c-rose: #e11d48;   --c-rose-soft: #ffe4e6;
  --c-teal: #0d9488;   --c-teal-soft: #ccfbf1;
  --accent: #fbbf24;
  --sidebar-bg: linear-gradient(180deg, #1e3a8a 0%, #172554 100%);
  --sidebar-fg: #c7d2fe;
  --sidebar-w: 250px;
  --bs-primary: var(--brand);
  --bs-primary-rgb: var(--brand-rgb);
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: var(--brand-rgb);
  --bs-link-hover-color: var(--brand-dark);
  --bs-body-font-family: system-ui, -apple-system, "Segoe UI", "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif;
  --bs-body-bg: #f1f5fb;
  --bs-body-color: var(--ink);
}
body { background: var(--bs-body-bg); font-size: .95rem; color: var(--ink); }

.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark);
  --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
}
.text-primary { color: var(--brand) !important; }
.bg-primary { background-color: var(--brand) !important; }
.form-control:focus, .form-select:focus { border-color: rgba(var(--brand-rgb), .55); box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .18); }
.page-link { color: var(--brand); }
.active > .page-link, .page-link.active { background-color: var(--brand); border-color: var(--brand); }
/* 示範版停用的匯出按鈕：保留滑鼠提示文字，游標顯示禁止 */
.btn.export-locked, .btn.export-locked:disabled { pointer-events: auto; cursor: not-allowed; opacity: .5; }

/* ---------- 版面 ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.app-shell .sidebar { background: var(--sidebar-bg) !important; color: var(--sidebar-fg); }
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; flex: 0 0 var(--sidebar-w); width: var(--sidebar-w); display: flex; flex-direction: column; overflow-y: auto; }
}
@media (max-width: 991.98px) {
  .sidebar.offcanvas-lg { --bs-offcanvas-width: 275px; display: flex; flex-direction: column; }
}
.sidebar-brand { display: flex; align-items: center; padding: 1rem 1rem .75rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-brand .brand-title { color: #fff; font-weight: 700; font-size: 1.02rem; line-height: 1.2; }
.sidebar-brand .brand-sub { color: #a5b4fc; font-size: .72rem; letter-spacing: .08em; }
.sidebar-nav { padding: .5rem .5rem 1rem; flex: 1 1 auto; overflow-y: auto; }
.nav-group-title { width: 100%; display: flex; justify-content: space-between; align-items: center; background: none; border: 0; color: rgba(199,210,254,.6);
  font-size: .74rem; letter-spacing: .12em; padding: .8rem .75rem .35rem; text-transform: uppercase; }
.nav-group-title .bi { transition: transform .2s; font-size: .7rem; }
.nav-group-title.collapsed .bi { transform: rotate(-90deg); }
.sidebar .nav-link { display: flex; align-items: center; gap: .65rem; color: var(--sidebar-fg); padding: .5rem .75rem; border-radius: .5rem; font-size: .92rem; margin: 1px 0; border-left: 3px solid transparent; }
.sidebar .nav-link .bi { font-size: 1.05rem; width: 1.2rem; text-align: center; opacity: .9; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar .nav-link.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; border-left-color: var(--accent); }
.sidebar .nav-link.active .bi { color: var(--accent); opacity: 1; }
.sidebar .nav-link .prg-no { margin-left: auto; font-size: .66rem; color: rgba(199,210,254,.5); }
.sidebar .nav-link.active .prg-no { color: rgba(255,255,255,.75); }
.sidebar-foot { padding: .6rem 1rem; font-size: .72rem; color: rgba(199,210,254,.6); border-top: 1px solid rgba(255,255,255,.1); }

.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .5rem; height: 58px; padding: 0 1rem;
  background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.page-title { font-size: 1.12rem; font-weight: 700; margin: 0; color: var(--ink); }
.global-search { width: 300px; max-width: 46vw; }
.global-search .bi-search { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: .85rem; }
.global-search input { padding-left: 1.8rem; border-radius: 2rem; background: #eef2f9; border-color: transparent; }
.global-search input:focus { background: #fff; }
.global-search .dropdown-menu { width: 100%; min-width: 280px; max-height: 70vh; overflow-y: auto; }
.user-btn { border-radius: 2rem; }
.content { padding: 1.1rem; flex: 1 1 auto; }
@media (max-width: 575.98px) {
  .content { padding: .6rem; }
  .topbar { padding: 0 .5rem; }
  .global-search { width: auto; flex: 1 1 auto; max-width: none; }
  .page-title { display: none; }
}

/* ---------- 示範版橫幅 ---------- */
.demo-banner { display: flex; align-items: center; gap: .5rem; padding: .45rem 1.1rem; font-size: .86rem; color: #fff;
  background: linear-gradient(90deg, #6d28d9, #c026d3); }
.demo-banner .btn { --bs-btn-padding-y: .15rem; --bs-btn-font-size: .8rem; }
@media (max-width: 575.98px) { .demo-banner { padding: .4rem .6rem; } }
.fake-data-notice { padding: .4rem 1.1rem; font-size: .8rem; line-height: 1.45; color: #92400e; background: #fffbeb; border-bottom: 1px solid #fde68a; }
.fake-data-notice a { color: #92400e; font-weight: 600; }
.print-fake-note { font-size: 9pt; color: #9a3412; border: 1px dashed #f59e0b; padding: 2px 6px; margin: 6px 0; text-align: center; }
@media print { .fake-data-notice { display: block !important; background: #fff; border: 1px dashed #999; color: #000; } }

/* ---------- 卡片 / 表格 ---------- */
.page-card { border: 0; border-radius: .8rem; box-shadow: 0 1px 3px rgba(15,23,42,.06), 0 8px 20px -12px rgba(15,23,42,.12); }
.page-card > .card-header { background: #fff; border-bottom: 1px solid var(--line); border-radius: .8rem .8rem 0 0; padding: .8rem 1rem; }
.page-card > .card-header strong { display: inline-flex; align-items: center; gap: .5rem; }
.page-card > .card-header strong::before { content: ""; width: 4px; height: 1em; border-radius: 2px; background: linear-gradient(180deg, var(--c-blue), var(--c-violet)); }
.card-sub { border: 1px solid var(--line); border-radius: .6rem; box-shadow: none; }
.card-sub > .card-header { background: #eff6ff; color: #1e3a8a; font-weight: 600; font-size: .9rem; padding: .5rem .8rem; }
table.dataTable { font-size: .9rem; }
table.dataTable thead th { white-space: nowrap; background: #eff6ff; color: #1e40af; font-weight: 600; }
table.dataTable tbody tr { cursor: default; }
table.dataTable tbody tr:hover > * { background: #f8fbff; }
div.dataTables_wrapper div.dataTables_filter input { width: 220px; }
@media (max-width: 575.98px) {
  div.dataTables_wrapper div.dataTables_filter, div.dataTables_wrapper div.dataTables_length { text-align: left !important; }
  div.dataTables_wrapper div.dataTables_filter input { width: 100%; margin-left: 0; }
  div.dataTables_wrapper div.dataTables_filter label { width: 100%; }
}
.table-totals td, tr.table-totals td { font-weight: 700; background: #fef9c3 !important; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.badge-soft { background: rgba(var(--brand-rgb), .12); color: var(--brand-dark); font-weight: 600; }
/* 車牌：仿真實車牌的黃底黑字 */
.plate { display: inline-block; font-family: "Consolas", "Courier New", monospace; font-weight: 700; letter-spacing: .04em; background: #fef9c3;
  border: 1px solid #eab308; color: #422006; border-radius: .3rem; padding: 0 .4rem; font-size: .88rem; white-space: nowrap; }

/* ---------- 表單 ---------- */
.form-label { font-size: .82rem; color: #475569; margin-bottom: .2rem; font-weight: 600; }
.form-label .req { color: #dc3545; margin-left: 2px; }
.form-text { font-size: .76rem; }
.upper { text-transform: uppercase; }
.line-table { margin-bottom: 0; }
.line-table th { font-size: .8rem; color: #1e40af; font-weight: 600; background: #eff6ff; white-space: nowrap; }
.line-table td { padding: .25rem; vertical-align: middle; }
.line-table .form-control, .line-table .form-select { font-size: .88rem; padding: .25rem .45rem; }
.line-table .col-del { width: 38px; text-align: center; }
.sum-box { background: linear-gradient(135deg, #eff6ff, #f5f3ff); border-radius: .6rem; padding: .75rem; }
.sum-box .sum-row { display: flex; justify-content: space-between; align-items: center; padding: .15rem 0; gap: .5rem; }
.sum-box .sum-row .form-control { max-width: 120px; text-align: right; }
.sum-total { font-size: 1.4rem; font-weight: 800; color: var(--brand); }
.sum-receivable { font-size: 1.15rem; font-weight: 700; color: var(--c-orange); }
.history-list { max-height: 420px; overflow-y: auto; }
.history-list .list-group-item { cursor: pointer; font-size: .86rem; }
.history-list .list-group-item.current { background: rgba(var(--brand-rgb), .08); border-left: 3px solid var(--brand); }
.sticky-actions { position: sticky; bottom: 0; z-index: 10; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); padding: .6rem 1rem; margin: 1rem -1rem -1rem; border-radius: 0 0 .8rem .8rem; }

/* ---------- 儀表板：彩色統計卡 ---------- */
.stat-card { border: 0; border-radius: .9rem; padding: 1rem 1.1rem; color: #fff; position: relative; overflow: hidden; min-height: 104px;
  box-shadow: 0 10px 24px -14px rgba(15,23,42,.45); transition: transform .15s; }
.stat-card::after { content: ""; position: absolute; width: 140px; height: 140px; right: -40px; top: -50px; border-radius: 50%; background: rgba(255,255,255,.12); }
.stat-card .stat-label { font-size: .82rem; opacity: .92; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 800; line-height: 1.2; margin-top: .2rem; }
.stat-card .stat-sub { font-size: .76rem; opacity: .9; }
.stat-card .bi { position: absolute; right: .8rem; bottom: .2rem; font-size: 3.2rem; opacity: .22; }
a .stat-card:hover { transform: translateY(-2px); }
.bg-g1 { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.bg-g2 { background: linear-gradient(135deg, #047857, #10b981); }
.bg-g3 { background: linear-gradient(135deg, #c2410c, #f59e0b); }
.bg-g4 { background: linear-gradient(135deg, #6d28d9, #a855f7); }

/* ---------- 儀表板：彩色快捷按鈕（依順序配色） ---------- */
.quick-btn { --qb: var(--brand); --qb-soft: var(--c-blue-soft);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .45rem; padding: .9rem .5rem; border-radius: .8rem;
  background: #fff; border: 1px solid var(--line); color: #334155; text-decoration: none; font-size: .86rem; height: 100%; transition: border-color .15s, box-shadow .15s, transform .15s; }
.quick-btn .bi { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; font-size: 1.35rem; color: var(--qb); background: var(--qb-soft); }
.quick-btn:hover { border-color: var(--qb); color: var(--qb); box-shadow: 0 8px 18px -10px var(--qb); transform: translateY(-2px); }
.row > :nth-child(1) > .quick-btn { --qb: var(--c-blue);   --qb-soft: var(--c-blue-soft); }
.row > :nth-child(2) > .quick-btn { --qb: var(--c-green);  --qb-soft: var(--c-green-soft); }
.row > :nth-child(3) > .quick-btn { --qb: var(--c-violet); --qb-soft: var(--c-violet-soft); }
.row > :nth-child(4) > .quick-btn { --qb: var(--c-amber);  --qb-soft: var(--c-amber-soft); }
.row > :nth-child(5) > .quick-btn { --qb: var(--c-teal);   --qb-soft: var(--c-teal-soft); }
.row > :nth-child(6) > .quick-btn { --qb: var(--c-rose);   --qb-soft: var(--c-rose-soft); }

/* ---------- 影像 ---------- */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .8rem; }
.img-card { border: 1px solid var(--line); border-radius: .6rem; overflow: hidden; background: #fff; }
.img-card .thumb { aspect-ratio: 4 / 3; background: #eef2f9 center/cover no-repeat; cursor: zoom-in; }
.img-card .img-body { padding: .4rem; }
.paste-zone { border: 2px dashed #93c5fd; border-radius: .6rem; padding: 1rem; text-align: center; color: #1e40af; background: #eff6ff; }
.paste-zone.drag { border-color: var(--brand); background: rgba(var(--brand-rgb), .1); }

/* ---------- 登入 ---------- */
.blank-body { min-height: 100vh; background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #7c3aed 100%); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 420px; border: 0; border-radius: 1rem; box-shadow: 0 24px 60px rgba(15,23,42,.35); }
.login-card .login-head { background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff; border-radius: 1rem 1rem 0 0; padding: 1.6rem 1.5rem; }

/* ---------- 報表 ---------- */
.report-filter { background: #fff; border-radius: .8rem; padding: .9rem 1rem; margin-bottom: 1rem; box-shadow: 0 1px 3px rgba(15,23,42,.06); border-top: 3px solid var(--brand); }
.report-sheet { background: #fff; border-radius: .8rem; padding: 1.2rem; box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.report-title { text-align: center; font-weight: 800; font-size: 1.35rem; margin-bottom: .2rem; color: #1e3a8a; }
.report-sub { text-align: center; color: var(--muted); font-size: .88rem; margin-bottom: 1rem; }
.report-table { font-size: .86rem; }
.report-table th { background: #eff6ff !important; color: #1e40af; white-space: nowrap; }
.report-table .detail-row td { background: #fbfcfe; font-size: .8rem; color: #475569; border-top: 0; padding-top: .1rem; padding-bottom: .35rem; }
.report-table .group-row td { background: #eef2ff; font-weight: 700; }
.kpi { border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: .7rem; padding: .8rem 1rem; background: #fff; height: 100%; }
.row > :nth-child(4n+2) > .kpi { border-left-color: var(--c-green); }
.row > :nth-child(4n+3) > .kpi { border-left-color: var(--c-orange); }
.row > :nth-child(4n+4) > .kpi { border-left-color: var(--c-violet); }
.kpi .kpi-label { font-size: .8rem; color: var(--muted); }
.kpi .kpi-value { font-size: 1.35rem; font-weight: 800; color: var(--ink); }

.print-only { display: none; }
@media print {
  @page { margin: 10mm; }
  body { background: #fff !important; font-size: 11pt; }
  .sidebar, .topbar, .no-print, .report-filter, .dataTables_length, .dataTables_filter, .dataTables_paginate, .dataTables_info, .btn { display: none !important; }
  .content { padding: 0 !important; }
  .report-sheet, .page-card { box-shadow: none !important; padding: 0 !important; }
  .print-only { display: block !important; }
  a { text-decoration: none; color: #000; }
  .report-title { color: #000; }
  .report-table th { background: #eee !important; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .kpi { border-left-width: 1px; }
  body.paper-80 { width: 72mm; font-size: 9pt; }
  body.paper-80 .report-table { font-size: 8pt; }
}
