/* 汽車零組件管理系統 — 全域樣式 */

body {
    font-family: "Microsoft JhengHei", "微軟正黑體", "PingFang TC", sans-serif;
    overflow-x: hidden;
}

/* === Sidebar === */

.sidebar {
    width: 220px;
    min-height: 100vh;
    position: sticky;
    top: 0;
}

.sidebar-brand {
    font-weight: 700;
    font-size: 1.05rem;
}

.sidebar .nav-link {
    border-radius: 6px;
    margin-bottom: 2px;
    padding: 0.5rem 0.75rem;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    background-color: #24489a;
    color: #fff !important;
}

/* === 內容區 === */

.table th {
    white-space: nowrap;
}

.card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.form-label {
    font-weight: 500;
}

/* 庫存查詢：限制內容寬度，長文字在欄位內換行。 */
.stock-query-page { max-width: 1100px; }
.stock-query-controls { max-width: 760px; }
.stock-results, .stock-query-controls .form-control {
    font-family: Verdana, Arial, "Microsoft JhengHei", "PingFang TC", sans-serif;
}
.stock-results { table-layout: fixed; min-width: 620px; }
.stock-results th, .stock-results td { white-space: normal; overflow-wrap: anywhere; }
.stock-results th:first-child { width: 20%; }
.stock-results th:nth-last-child(2), .stock-results th:last-child { width: 16%; }
.stock-query-controls .input-group { flex-wrap: nowrap; }
.stock-query-controls .form-control { min-width: 0; }

.app-content { min-width: 0; }

.excel-file-picker { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; min-height: 100px; padding: 1rem; border: 2px dashed #adb5bd; border-radius: 0.5rem; background: #f8f9fa; text-align: center; }
.excel-file-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.excel-picker-title { color: #24489a; font-weight: 600; }
.excel-drop-hint { display: none; color: #6c757d; font-size: 0.875rem; }
.excel-file-picker:focus-within { outline: 3px solid #a7b6d7; outline-offset: 2px; }
.excel-upload-submit { align-self: flex-start; min-height: 44px; }
@media (min-width: 768px) and (pointer: fine) {
    .excel-file-picker.supports-drop .excel-drop-hint { display: block; }
    .excel-file-picker.is-dragover { border-color: #24489a; background: #edf1fa; }
}

@media (max-width: 767.98px) {
    .app-content > main, .app-content > header { padding: 1rem 0.75rem !important; }
    .navbar-brand { font-size: 1rem; white-space: normal; max-width: calc(100% - 64px); }
    .app-content > header > div { min-width: 0; overflow-wrap: anywhere; }
    .stock-query-page h2 { font-size: 1.5rem; }
    .stock-query-controls .card { padding: 0.875rem; }
    .stock-query-controls .input-group { flex-direction: column; gap: 0.5rem; }
    .stock-query-controls .input-group > .form-control,
    .stock-query-controls .input-group > .btn { width: 100%; min-height: 44px; margin-left: 0 !important; border-radius: 0.375rem !important; }
    .stock-query-controls .form-control { font-size: 16px; }
    .stock-query-page a[download] { width: 100%; min-height: 44px; }
    .excel-upload-submit { width: 100%; }
    .stock-results { display: block; min-width: 0; width: 100%; }
    .stock-results thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .stock-results tbody { display: block; }
    .stock-results tbody tr { display: block; margin-bottom: 0.875rem; border: 1px solid #dee2e6; border-radius: 0.5rem; padding: 0.5rem; background: #fff; }
    .stock-results tbody td { display: grid; grid-template-columns: 7.25rem minmax(0, 1fr); gap: 0.5rem; padding: 0.5rem 0.25rem; border: 0; box-shadow: none; --bs-table-bg-type: transparent; }
    .stock-results td::before { content: ""; font-weight: 600; color: #495057; }
    .stock-results td:first-child::before { content: "IBC 編號"; }
    .stock-results td:nth-child(2)::before { content: "OEM 號"; }
    .stock-results td:nth-child(3)::before { content: "英文品名"; }
    .stock-results td:nth-child(4)::before { content: "車型／年份"; }
    .stock-results td:nth-child(5)::before { content: "庫存數量 (PCS)"; }
    .stock-batch-results td:nth-child(2)::before { content: "英文品名"; }
    .stock-batch-results td:nth-child(3)::before { content: "車型／年份"; }
    .stock-batch-results td:nth-child(4)::before { content: "需求數量"; }
    .stock-results td:first-child { font-weight: 600; }
}

/* 主色：RGB(36, 72, 154)。 */
:root { --bs-primary: #24489a; --bs-primary-rgb: 36, 72, 154; --bs-link-color: #24489a; --bs-link-color-rgb: 36, 72, 154; --bs-link-hover-color: #1d3b7d; --bs-link-hover-color-rgb: 29, 59, 125; }
.btn-primary { --bs-btn-bg: #24489a; --bs-btn-border-color: #24489a; --bs-btn-hover-bg: #203f87; --bs-btn-hover-border-color: #203f87; --bs-btn-active-bg: #1d3b7d; --bs-btn-active-border-color: #1d3b7d; --bs-btn-disabled-bg: #24489a; --bs-btn-disabled-border-color: #24489a; --bs-btn-focus-shadow-rgb: 36, 72, 154; }
.btn-outline-primary { --bs-btn-color: #24489a; --bs-btn-border-color: #24489a; --bs-btn-hover-bg: #24489a; --bs-btn-hover-border-color: #24489a; --bs-btn-active-bg: #1d3b7d; --bs-btn-active-border-color: #1d3b7d; --bs-btn-disabled-color: #24489a; --bs-btn-disabled-border-color: #24489a; --bs-btn-focus-shadow-rgb: 36, 72, 154; }
.nav-pills { --bs-nav-pills-link-active-bg: #24489a; }
.form-control:focus, .form-select:focus { border-color: #a7b6d7; box-shadow: 0 0 0 0.25rem rgba(36, 72, 154, 0.25); }
.form-check-input:checked { background-color: #24489a; border-color: #24489a; }

/* 參考報帳系統：藍色頁首、白色選單、淺灰內容背景。 */
body { background-color: #f5f5f5; color: #262626; }
.sidebar.bg-dark, #sidebarOffcanvas.bg-dark { background-color: #fff !important; color: #262626 !important; }
.sidebar .nav-link.text-white, #sidebarOffcanvas .nav-link.text-white { color: #262626 !important; }
.sidebar .nav-link:hover, #sidebarOffcanvas .nav-link:hover { background-color: #f5f5f5; }
.sidebar .nav-link.active, #sidebarOffcanvas .nav-link.active { background-color: #edf1fa; color: #24489a !important; }
.sidebar-brand, .navbar.bg-dark, .app-content > header.bg-white { background-color: #24489a !important; color: #fff !important; }
.app-content > header .text-muted { color: rgba(255, 255, 255, 0.85) !important; }
.app-content > header .btn { --bs-btn-color: #fff; --bs-btn-border-color: #fff; --bs-btn-hover-color: #24489a; --bs-btn-hover-bg: #fff; --bs-btn-hover-border-color: #fff; --bs-btn-active-color: #24489a; --bs-btn-active-bg: #edf1fa; --bs-btn-active-border-color: #fff; }
.sidebar .border-secondary, #sidebarOffcanvas .border-secondary { border-color: #f0f0f0 !important; }
#sidebarOffcanvas .btn-close-white { filter: none; }
.card { border-color: #f0f0f0; }

/* 桌面版兩段頁首共用高度，避免文字與按鈕造成下緣落差。 */
@media (min-width: 768px) {
    .sidebar-brand, .app-content > header { height: 64px; min-height: 64px; flex-shrink: 0; }
    .sidebar-brand { display: flex !important; align-items: center; }
}

/* Labels follow each cell, including optional boss warehouse columns. */
@media (max-width: 767.98px) {
    .stock-results.stock-results td[data-label]::before { content: attr(data-label); }
}
