/* =====================================================================
   報價與派車系統 - 頂級玻璃擬態全新 CSS 設計系統 (style.css)
   ===================================================================== */

:root {
  --bg-gradient: linear-gradient(135deg, #0b0f19 0%, #111827 50%, #1f2937 100%);
  --glass-bg: rgba(17, 24, 39, 0.65);
  --glass-bg-hover: rgba(31, 41, 55, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-focus: rgba(59, 130, 246, 0.4);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  
  --primary-glow: 0 0 15px rgba(59, 130, 246, 0.5);
  --success-glow: 0 0 15px rgba(16, 185, 129, 0.5);
  --danger-glow: 0 0 15px rgba(239, 68, 68, 0.5);
  --warning-glow: 0 0 15px rgba(245, 158, 11, 0.5);
  --info-glow: 0 0 15px rgba(6, 182, 212, 0.5);

  --font-family: 'Outfit', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ==========================================
   全域樣式與捲軸
   ========================================== */
body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  font-family: var(--font-family);
  color: #f3f4f6;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ==========================================
   動畫效果
   ========================================== */
@keyframes pulseGlow {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; transform: scale(1.02); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.hover-scale {
  transition: transform 0.2s ease-in-out !important;
}
.hover-scale:hover {
  transform: scale(1.08) !important;
}

/* ==========================================
   玻璃擬態基礎組件 (Glassmorphism Core)
   ========================================== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px) saturate(160%);
  -webkit-backdrop-filter: blur(12px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideIn 0.4s ease-out;
}
.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
}

.bg-glass-dark {
  background: rgba(0, 0, 0, 0.4) !important;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* 頂部導覽 */
.glass-nav {
  background: rgba(11, 15, 25, 0.75) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

/* Logo 霓虹發光 */
.logo-glow {
  font-size: 1.4rem;
  filter: drop-shadow(0 0 6px #06b6d4);
  animation: pulseGlow 3s infinite ease-in-out;
}

.text-gradient {
  background: linear-gradient(90deg, #3b82f6, #06b6d4, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
  letter-spacing: 1px;
}

/* 載入動畫遮罩 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(20px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}
.glass-spinner-container {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  padding: 40px 60px;
  border-radius: 20px;
  box-shadow: var(--glass-shadow);
  text-align: center;
}

/* ==========================================
   客製化表單輸入框
   ========================================== */
.form-control, .form-select {
  background-color: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid var(--glass-border) !important;
  color: #f3f4f6 !important;
  border-radius: 8px !important;
  padding: 8px 12px;
  transition: all 0.25s ease !important;
}
.form-control:focus, .form-select:focus {
  background-color: rgba(255, 255, 255, 0.08) !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
  outline: none;
}
.form-control::placeholder {
  color: rgba(243, 244, 246, 0.35) !important;
}
.form-select option {
  background-color: #111827;
  color: #f3f4f6;
}

/* PC直編型輸入框 */
.inline-input {
  border: 1px solid transparent;
  background: transparent;
  color: #ffffff !important; /* 強制純白字型，防止在白底時看不清 */
  width: 100%;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.2s;
  font-size: 0.85rem;
  font-weight: 600;
}
.inline-input:hover {
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.06);
}
.inline-input:focus {
  border-color: #38bdf8 !important; /* 亮青藍色 focus 框 */
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
  outline: none;
}
.inline-select {
  border: 1px solid transparent;
  background: transparent;
  color: #ffffff !important; /* 強制純白字型 */
  width: 100%;
  padding: 4px 2px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.inline-select:hover {
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.06);
}
.inline-select:focus {
  border-color: #38bdf8 !important;
  background: #0f172a !important; /* 深 Slate 背景，防止底色透明 */
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
  outline: none;
}
.inline-select option {
  background-color: #0f172a !important; /* 下拉選項強制深色背景 */
  color: #ffffff !important; /* 下拉選項強制白字 */
}

/* ==========================================
   業務報價端 UI 組件
   ========================================== */

/* 搜尋盒子 */
.search-box-custom {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding-left: 12px;
  overflow: hidden;
  transition: all 0.25s;
}
.search-box-custom:focus-within {
  border-color: #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}
.search-box-custom .search-icon {
  color: rgba(243, 244, 246, 0.4);
  font-size: 1rem;
}
.search-box-custom input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 10px 12px !important;
}
.year-select-custom {
  max-width: 130px;
  border: none !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border-left: 1px solid var(--glass-border) !important;
  border-radius: 0 !important;
  padding: 10px 24px 10px 12px !important;
  cursor: pointer;
}

/* 玻璃頁籤 (Glass Tabs) */
.nav-tabs-glass {
  border: none;
  background: rgba(0, 0, 0, 0.2);
  padding: 5px;
  border-radius: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.nav-tabs-glass .nav-link {
  border: none !important;
  color: rgba(243, 244, 246, 0.55) !important;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px !important;
  background: transparent !important;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}
.nav-tabs-glass .nav-link:hover {
  color: #f3f4f6 !important;
  background: rgba(255, 255, 255, 0.04) !important;
}
.nav-tabs-glass .nav-link.active {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
}

/* 玻璃泡泡徽章 */
.badge-glass-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.25); border-radius: 20px; font-weight: bold; }
.badge-glass-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.25); border-radius: 20px; font-weight: bold; }
.badge-glass-success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.25); border-radius: 20px; font-weight: bold; }
.badge-glass-secondary { background: rgba(156, 163, 175, 0.15); color: #cbd5e1; border: 1px solid rgba(156, 163, 175, 0.25); border-radius: 20px; font-weight: bold; }
.badge-glass-light { background: rgba(255, 255, 255, 0.08); color: #f3f4f6; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 20px; }

/* 案件合約卡片 (PC / Mobile) */
.contract-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
}
.contract-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 6px 25px rgba(0,0,0,0.18);
  transform: translateY(-2px);
}
.contract-header {
  background: rgba(255, 255, 255, 0.03);
  padding: 15px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-border);
  transition: background 0.2s;
}
.contract-header:hover {
  background: rgba(255, 255, 255, 0.06);
}
.contract-header i.bi-chevron-down {
  transition: transform 0.3s;
}
.contract-header.open i.bi-chevron-down {
  transform: rotate(180deg);
}

.contract-body {
  padding: 20px;
  display: none;
  background: rgba(0, 0, 0, 0.1);
}
.contract-body.show {
  display: block;
}

/* ==========================================
   表格客製化 (Tables)
   ========================================== */
.glass-table-wrap {
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  overflow-x: auto !important; /* 啟用水平橫向滾動，防堵與 table-responsive 的 overflow 衝突 */
  background: rgba(0, 0, 0, 0.45);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}
.table {
  color: #ffffff !important;
  background-color: transparent !important;
}
.table th, .table td {
  background-color: rgba(15, 23, 42, 0.92) !important; /* 強制深 Slate 灰藍背景，徹底阻斷白底干擾 */
  color: #ffffff !important; /* 純白內容，極致對比度 */
  border-color: rgba(255, 255, 255, 0.08) !important;
  padding: 8px 10px !important;
}
.table-bordered {
  border-color: rgba(255, 255, 255, 0.08) !important;
}
.item-table th {
  background: rgba(30, 41, 59, 0.98) !important; /* 更深的表頭 */
  color: #38bdf8 !important; /* 亮青藍色表頭文字，極清晰 */
  font-weight: 700;
  text-align: center;
  vertical-align: middle;
  border-bottom: 2px solid rgba(56, 189, 248, 0.4) !important;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}
.item-table td {
  padding: 6px 8px !important;
  vertical-align: middle;
}

/* 狀態底色 */
.tr-unquoted {
  background-color: rgba(239, 68, 68, 0.03) !important;
}
.tr-quoted {
  background-color: rgba(16, 185, 129, 0.03) !important;
}
.tr-invalid {
  text-decoration: line-through;
  color: #6b7280 !important;
  background-color: rgba(107, 114, 128, 0.03) !important;
}
.tr-invalid input, .tr-invalid select {
  text-decoration: line-through;
  color: #6b7280 !important;
  pointer-events: none;
}

/* ==========================================
   按鈕與互動樣式 (Buttons)
   ========================================== */
.btn-glass-primary {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #3b82f6;
  border-radius: 8px;
  transition: all 0.2s;
}
.btn-glass-primary:hover {
  background: rgba(59, 130, 246, 0.25);
  box-shadow: var(--primary-glow);
  color: #ffffff;
}

.btn-glass-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
  border-radius: 8px;
}
.btn-glass-success:hover {
  background: rgba(16, 185, 129, 0.25);
  box-shadow: var(--success-glow);
  color: #ffffff;
}

.btn-glass-warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
  border-radius: 8px;
}
.btn-glass-warning:hover {
  background: rgba(245, 158, 11, 0.25);
  box-shadow: var(--warning-glow);
  color: #ffffff;
}

.btn-glass-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: #d1d5db;
  border-radius: 8px;
}
.btn-glass-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* ==========================================
   主管端 (Manager App) 特殊組件
   ========================================== */
.glow-icon {
  filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5));
}
.letter-spacing-lg {
  letter-spacing: 0.3em;
}

/* 主管核價手機端卡片 */
.item-card {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  border-left: 5px solid #ef4444; /* 未報價紅邊 */
  transition: all 0.2s;
}
.item-card.approved {
  border-left-color: #10b981; /* 已核准綠邊 */
}
.item-card:hover {
  background: rgba(255,255,255,0.03);
}

.info-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(255,255,255,0.06);
  padding-bottom: 6px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.info-label {
  color: rgba(243, 244, 246, 0.4);
  font-weight: 500;
}
.info-value {
  color: #f3f4f6;
  font-weight: 600;
}

/* ==========================================
   派車調度端 (Dispatch App) 特殊組件
   ========================================== */
.form-label-custom {
  color: rgba(243, 244, 246, 0.6);
  font-weight: 600;
}
.small-text-row {
  font-size: 0.85rem;
}

/* ==========================================
   彈出框玻璃擬態 (Modal styling)
   ========================================== */
.glass-modal .modal-content {
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  color: #f3f4f6;
}
.glass-modal .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.glass-modal .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ==========================================
   狀態指示框 (Toast / Sync Indicators)
   ========================================== */
.glass-toast {
  background: rgba(16, 185, 129, 0.85) !important;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
  border-radius: 12px;
}

.glass-sync {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(10px);
  color: #06b6d4;
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 10px 24px;
  border-radius: 30px;
  z-index: 9999;
  font-size: 0.9rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
}

/* ==========================================
   限制最大高度
   ========================================== */
.max-height-300 {
  max-height: 300px;
}
.overflow-y-auto {
  overflow-y: auto;
}

/* ==========================================
   導航微型按鈕 (Nav Pills Custom)
   ========================================== */
.nav-pills-custom .nav-link {
  background: transparent;
  color: rgba(243, 244, 246, 0.6) !important;
  border: 1px solid transparent;
  border-radius: 20px;
  font-weight: 600;
  transition: all 0.25s;
  font-size: 0.95rem;
}
.nav-pills-custom .nav-link:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.04);
}
.nav-pills-custom .nav-link.active {
  color: #06b6d4 !important;
  background: rgba(6, 182, 212, 0.12) !important;
  border-color: rgba(6, 182, 212, 0.35) !important;
  box-shadow: var(--info-glow);
}

/* ==========================================
   派車調度端精美玻璃擬態組件 (Dispatch Responsive Components)
   ========================================== */
.group-header {
  background: rgba(255, 255, 255, 0.02) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.3s, color 0.3s;
}
.group-header:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #38bdf8 !important;
}

.dest-header {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s;
  border-radius: 6px;
}
.dest-header:hover {
  background: rgba(255, 255, 255, 0.06) !important;
}

/* 民國日期橫向滑動帶 */
.date-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 4px 10px 4px;
  scrollbar-width: thin;
}
.btn-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: rgba(243, 244, 246, 0.7);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.btn-date:hover {
  border-color: rgba(255, 255, 255, 0.25) !important;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.btn-date.selected {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
  font-weight: 700;
  box-shadow: var(--success-glow);
  transform: scale(1.03);
}

/* 時間格點與多選樣式 */
.time-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  padding: 4px;
}
.btn-time {
  padding: 10px 0;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(255, 255, 255, 0.03);
  color: rgba(243, 244, 246, 0.7);
  border-radius: 8px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.btn-time:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: #fff;
}
.btn-time.selected {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  color: #ffffff !important;
  border-color: #3b82f6 !important;
  font-weight: 700;
  box-shadow: var(--primary-glow);
  transform: translateY(-1px);
}
