/**
 * 專案自訂樣式。
 *
 * 版面主體由 Bootstrap 5 提供，這裡只補 Bootstrap 沒有的部分：
 *   1. Sidebar 在桌機的固定行為
 *   2. 觸控目標高度（規格書 §28 要求至少約 44px，Bootstrap 預設約 38px）
 *   3. 報表／工程／保險狀態標籤的橘色（Bootstrap 沒有 orange 語意色）
 *   4. 圖表容器高度
 *
 * 注意：內容安全政策為 style-src 'self'，因此樣板不得使用 inline style 屬性。
 */

/* ── 單欄置中版面（登入、錯誤頁）──────────────────────────────── */
.card-login { max-width: 26rem; }
/* Google 登入按鈕容器（Phase 21）：GIS 畫出按鈕前先保留高度，避免版面跳動 */
.google-signin-box { min-height: 44px; }
.card-error { max-width: 32rem; }

/* ── Sidebar ───────────────────────────────────────────────── */
@media (min-width: 992px) {
    .app-sidebar {
        position: sticky;
        top: 56px;                      /* 導覽列高度 */
        height: calc(100vh - 56px);
        overflow-y: auto;
    }
}

/* ── 觸控目標（§28：按鈕高度建議至少約 44px）──────────────────── */
.btn:not(.btn-sm):not(.btn-close),
.form-control:not(.form-control-sm),
.form-select:not(.form-select-sm) {
    min-height: 44px;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.15rem;
}

.form-check-label {
    padding-left: 0.25rem;
    min-height: 1.75rem;
}

/* 表格內的操作連結不需要 44px，避免列高過大 */
.table .btn-sm {
    min-height: 32px;
}

/* ── 狀態標籤：Bootstrap 沒有 orange 語意色 ────────────────────── */
.text-bg-orange {
    background-color: #fd7e14;
    color: #fff;
}

/* ── 統計圖表 ──────────────────────────────────────────────── */
.chart-box {
    position: relative;
    height: 320px;
}

.chart-box-sm {
    height: 240px;
}

/* ── 報表表單：大型文字區與勾選項目 ───────────────────────────── */
.textarea-lg {
    min-height: 9rem;
    line-height: 1.7;
}

.item-row {
    background-color: var(--bs-tertiary-bg);
    border-radius: var(--bs-border-radius);
}

/* 數值欄位對齊，方便核對金額與進度 */
.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* 變更前後對照（稽核紀錄） */
.change-old {
    color: var(--bs-danger);
    text-decoration: line-through;
}

.change-new {
    color: var(--bs-success-text-emphasis);
}

/* 保留換行的長文字 */
.text-block {
    white-space: pre-wrap;
    margin-bottom: 0;
}

/* 簽章處的章：系統依簽核紀錄產生（姓名＋員工編號，紅框；框下為民國時間） */
.seal {
    display: inline-block;
}

.seal-box {
    border: 2px solid #c00;
    color: #c00;
    font-weight: 700;
    text-align: center;
    padding: 0.25rem 0.875rem;
    line-height: 1.3;
}

.seal-name {
    font-size: 1.125rem;
    letter-spacing: 0.1em;
}

.seal-number {
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}

.seal-time {
    text-align: center;
    font-size: 0.75rem;
    padding-top: 0.15rem;
    font-variant-numeric: tabular-nums;
}

/* ── 右下角浮水印（views/partials/footer-watermark.php）──────────── */
.footer-watermark {
    position: fixed;
    bottom: 5px;
    right: 10px;
    font-size: 8pt;
    color: #adb5bd;
    opacity: 0.7;
    z-index: 9999;
    user-select: none;
    pointer-events: none;
}

/* 列印時隱藏 */
@media print {
    .no-print {
        display: none !important;
    }
}


/* ══════════════════════════════════════════════════════════════════
   2026-10-21 ppts20 併入：側邊選單群組、主題、案件狀態標籤、採購時程甘特圖
   ══════════════════════════════════════════════════════════════════ */

/* 側邊選單群組標題與分隔 */
.nav-group-label { letter-spacing: 0.08em; font-size: 0.75rem; }
.nav-group-gap { list-style: none; }

/* Bootstrap 沒有 purple 語意色（案件狀態「未開工」） */
.text-bg-purple { background-color: #6f42c1; color: #fff; }

/* 深色模式：Sidebar 與卡片跟著 Bootstrap 變數走，這裡只補白底寫死的地方 */
[data-bs-theme="dark"] .app-sidebar { background-color: var(--bs-body-bg) !important; }
[data-bs-theme="dark"] .table-light { --bs-table-bg: var(--bs-tertiary-bg); --bs-table-color: var(--bs-body-color); }
[data-bs-theme="dark"] .card-header.bg-light,
[data-bs-theme="dark"] .bg-light:not([class*="text-bg-"]) { background-color: var(--bs-tertiary-bg) !important; color: var(--bs-body-color); }
[data-bs-theme="dark"] .alert-light { background-color: var(--bs-tertiary-bg); color: var(--bs-body-color); border-color: var(--bs-border-color); }

/* 採購時程甘特圖（App\Support\ProcurementGantt；SVG 以百分比定位，符合 CSP） */
.pg { --pg-text: var(--bs-body-color); --pg-muted: var(--bs-secondary-color); --pg-line: var(--bs-border-color);
      --pg-plan: #b4c0d0; --pg-ok: #16a34a; --pg-late: #dc2626; --pg-doing: #d97706; --pg-today: #dc2626;
      font-size: 0.8rem; color: var(--pg-text); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pg-row { display: grid; grid-template-columns: 4.5em 1fr 12.5em; align-items: center; }
.pg-label { font-weight: 600; white-space: nowrap; }
.pg-track { position: relative; height: 20px; border-left: 1px solid var(--pg-line); }
.pg-row + .pg-row .pg-track { border-top: 1px dotted var(--pg-line); }
.pg-axis .pg-track { height: 16px; border-left-color: transparent; }
.pg-svg { display: block; overflow: visible; }
.pg-tick { font-size: 10px; fill: var(--pg-muted); }
.pg-axis .pg-dates { color: var(--pg-muted); font-size: 10px; }
.pg-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding-left: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pg-dates em { font-style: normal; font-size: 10px; color: var(--pg-late); margin-left: 3px; }
.pg-dates em.pg-wip { color: var(--pg-doing); }
.pg-grid { stroke: var(--pg-line); stroke-width: 1; }
.pg-today { stroke: var(--pg-today); stroke-width: 1.5; stroke-dasharray: 4 3; }
.pg-bar, .pg-mark { stroke: none; }
.pg-mark { transform-box: fill-box; transform-origin: center; rotate: 45deg; }
.pg-plan { fill: var(--pg-plan); background: var(--pg-plan); }
.pg-ok { fill: var(--pg-ok); background: var(--pg-ok); }
.pg-late { fill: var(--pg-late); background: var(--pg-late); }
.pg-doing { fill: var(--pg-doing); background: var(--pg-doing); opacity: 0.85; }
.pg-doing.pg-overdue { fill: var(--pg-late); background: var(--pg-late); }
.pg-legend { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 6px 0 0 4.5em; font-size: 11px; color: var(--pg-muted); }
.pg-legend i { display: inline-block; width: 14px; height: 6px; border-radius: 3px; margin-right: 4px; vertical-align: middle; }
.pg-legend i.pg-today-key { width: 0; height: 10px; border-radius: 0; border-left: 1.5px dashed var(--pg-today); background: none; }

/* 採購時程表單（9 個階段 × 預定／實際） */
.ms-table { min-width: 1100px; }
.ms-table th, .ms-table td { text-align: center; vertical-align: middle; }
.ms-table tbody th { width: 4rem; }
.ms-table input[type=date] { min-width: 9.5rem; }

/* 進度紀錄時間軸 */
.timeline-item { border-left: 2px solid var(--bs-primary); padding-left: 1rem; margin-bottom: 1.25rem; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: -6px; top: 0.25rem; width: 10px; height: 10px; background: var(--bs-primary); border-radius: 50%; }
.timeline-content { background: var(--bs-tertiary-bg); padding: 0.75rem 1rem; border-radius: var(--bs-border-radius); line-height: 1.6; white-space: pre-wrap; }

/* 進度條 */
.progress-thin { height: 0.5rem; }

/* 案件總覽提醒清單 */
.case-alert-list .list-group-item { background: transparent; }

/* 表單區段標題 */
.section-title { color: var(--bs-primary); border-bottom: 1px solid var(--bs-border-color); padding-bottom: 0.375rem; margin: 1.5rem 0 1rem; font-size: 1.05rem; }

/* 隱藏欄位（需要監造關閉時） */
.d-none-important { display: none !important; }

/* 案件設定頁 */
.w-order { width: 5.5rem; }
.w-show { width: 5rem; }

/* 監造報表明細：送簽失敗時標示需補填的區段（2026-10-21） */
.section-invalid { border-width: 2px; scroll-margin-top: 4.5rem; }

/* 密碼強度條（password-strength.js，2026-10-23） */
.pw-meter { margin-top: 0.375rem; }
.pw-meter .progress { height: 4px; }

/* 即時搜尋（live-search.js）：載入中的結果區淡化 */
[data-live-region] { transition: opacity 0.15s; }
[data-live-region][aria-busy="true"] { opacity: 0.5; }
