/* ========================================
   手機庫存管理系統 - 深色主題樣式
   ======================================== */

/* CSS 變數 */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #334155;
  --bg-hover: #475569;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --accent-primary: #3b82f6;
  --accent-secondary: #60a5fa;
  --accent-success: #22c55e;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-info: #06b6d4;
  
  --border-color: #475569;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  --transition: all 0.2s ease;
}

/* 基礎樣式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent-secondary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-primary);
}

/* ========================================
   導覽列
   ======================================== */
.navbar {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-brand::before {
  content: '📱';
  font-size: 1.25rem;
}

.navbar-nav {
  display: flex;
  gap: 0.5rem;
  list-style: none;
}

.nav-link {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

/* ========================================
   主容器
   ======================================== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.page-subtitle {
  color: var(--text-muted);
}

/* ========================================
   卡片
   ======================================== */
.card {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 1.5rem;
}

/* ========================================
   統計卡片
   ======================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.stat-icon.blue { background-color: rgba(59, 130, 246, 0.2); }
.stat-icon.green { background-color: rgba(34, 197, 94, 0.2); }
.stat-icon.yellow { background-color: rgba(245, 158, 11, 0.2); }
.stat-icon.purple { background-color: rgba(168, 85, 247, 0.2); }
.stat-icon.red { background-color: rgba(239, 68, 68, 0.2); }
.stat-icon.cyan { background-color: rgba(6, 182, 212, 0.2); }

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ========================================
   按鈕
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--accent-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-secondary);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-hover);
}

.btn-success {
  background-color: var(--accent-success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background-color: #16a34a;
}

.btn-danger {
  background-color: var(--accent-danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
}

/* ========================================
   表單
   ======================================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ========================================
   表格
   ======================================== */
.table-container {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: var(--bg-card);
}

.table tbody tr {
  transition: var(--transition);
}

.table tbody tr:hover {
  background-color: var(--bg-card);
}

.table td {
  font-size: 0.875rem;
  color: var(--text-primary);
}

/* ========================================
   狀態標籤
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background-color: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.badge-danger {
  background-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.badge-info {
  background-color: rgba(6, 182, 212, 0.2);
  color: #67e8f9;
}

.badge-secondary {
  background-color: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

/* 機況等級 */
.grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.875rem;
}

.grade-a {
  background-color: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.grade-b {
  background-color: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.grade-c {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

.grade-d {
  background-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* ========================================
   搜尋與工具列
   ======================================== */
.toolbar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.search-box input {
  width: 100%;
  padding: 0.625rem 0.875rem 0.625rem 2.5rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.search-box::before {
  content: '🔍';
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  opacity: 0.6;
}

.filter-select {
  min-width: 150px;
}

/* ========================================
   分頁
   ======================================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.page-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

.page-btn.active {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0 1rem;
}

/* ========================================
   圖表容器
   ======================================== */
.chart-container {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.chart-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* 簡易長條圖 */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bar-label {
  min-width: 80px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.bar-track {
  flex: 1;
  height: 24px;
  background-color: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-sm);
  transition: width 0.5s ease;
}

.bar-value {
  min-width: 40px;
  text-align: right;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ========================================
   載入與空狀態
   ======================================== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-card);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* ========================================
   模態框
   ======================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95);
  transition: var(--transition);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.modal-close:hover {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: 60vh;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ========================================
   圖片上傳區域
   ======================================== */
.image-upload-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.image-preview-area {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 4/3;
  background-color: var(--bg-secondary);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: var(--transition);
}

.image-preview-area:hover {
  border-color: var(--accent-primary);
}

.image-preview-area.has-image {
  border-style: solid;
  border-color: var(--accent-primary);
}

.image-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}

.placeholder-icon {
  font-size: 3rem;
  opacity: 0.5;
}

.placeholder-text {
  font-size: 0.875rem;
}

.image-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.5rem;
}

.image-upload-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.image-file-input {
  display: none;
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ========================================
   表單區塊樣式
   ======================================== */
.form-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.form-section:last-of-type {
  border-bottom: none;
}

.form-section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ========================================
   各平台上架狀態
   ======================================== */
.platform-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.platform-status-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}

.platform-status-item:hover {
  background-color: var(--bg-hover);
}

.platform-status-item:has(.platform-checkbox:checked) {
  border-color: var(--accent-success);
  background-color: rgba(34, 197, 94, 0.1);
}

.platform-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.platform-name {
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.platform-status {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.platform-status-item:has(.platform-checkbox:checked) .platform-status {
  color: var(--accent-success);
  font-weight: 500;
}

/* 三星專用欄位 */
.samsung-only {
  background: linear-gradient(135deg, rgba(20, 40, 120, 0.3), rgba(20, 40, 120, 0.1));
  border: 1px solid rgba(20, 40, 120, 0.5);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 1rem;
}

.samsung-only .form-label {
  color: #60a5fa;
}

/* 上架文章內容區塊 */
.platform-content-item {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
  border-left: 4px solid var(--accent-primary);
}

.platform-content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.platform-content-title {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.platform-content-textarea {
  width: 100%;
  min-height: 150px;
  padding: 0.75rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  line-height: 1.6;
  resize: vertical;
}

.platform-content-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* ========================================
   批量匯入頁面樣式
   ======================================== */
.template-info {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 1rem;
}

.template-info h4 {
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.field-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 0.5rem;
}

.field-list li {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.field-list li strong {
  color: var(--accent-primary);
}

.upload-area {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background-color: var(--bg-secondary);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--accent-primary);
  background-color: rgba(59, 130, 246, 0.1);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.upload-text {
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.upload-hint {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-top: 1rem;
}

.file-name {
  font-weight: 500;
  color: var(--text-primary);
}

.validation-summary {
  display: flex;
  gap: 2rem;
  margin-top: 1rem;
  padding: 1rem;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.validation-summary p {
  margin: 0;
}

.import-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.progress-bar-container {
  margin: 1.5rem 0;
}

.progress-bar {
  width: 100%;
  height: 24px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  border-radius: var(--radius-md);
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  text-align: center;
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.progress-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 1rem;
}

.progress-log {
  max-height: 200px;
  overflow-y: auto;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.8125rem;
}

.progress-log p {
  margin: 0.25rem 0;
}

.log-success {
  color: var(--accent-success);
}

.log-update {
  color: var(--accent-info);
}

.log-fail {
  color: var(--accent-danger);
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.result-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  background-color: var(--bg-secondary);
}

.result-item.success {
  border: 1px solid var(--accent-success);
}

.result-item.fail {
  border: 1px solid var(--accent-danger);
}

.result-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.result-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.result-value {
  font-size: 2rem;
  font-weight: 700;
}

.result-item.success .result-value {
  color: var(--accent-success);
}

.result-item.fail .result-value {
  color: var(--accent-danger);
}

.result-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.invalid-row {
  background-color: rgba(239, 68, 68, 0.1) !important;
}

/* ========================================
   響應式設計 - 手機版優化
   ======================================== */
@media (max-width: 768px) {
  .container {
    padding: 0.75rem;
  }
  
  .navbar {
    padding: 0.75rem;
  }
  
  .navbar-content {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .navbar-brand {
    font-size: 1.25rem;
  }
  
  .navbar-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
  }
  
  .nav-link {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
  }
  
  .page-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .page-title {
    font-size: 1.5rem;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }
  
  .stat-value {
    font-size: 1.25rem;
  }
  
  .stat-label {
    font-size: 0.75rem;
  }
  
  .toolbar {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .search-box {
    min-width: 100%;
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .form-group {
    margin-bottom: 0;
  }
  
  .form-label {
    font-size: 0.875rem;
  }
  
  .form-input,
  .form-select,
  .form-textarea {
    padding: 0.625rem 0.875rem;
    font-size: 16px; /* 防止 iOS 縮放 */
  }
  
  .card {
    border-radius: var(--radius-md);
  }
  
  .card-body {
    padding: 1rem;
  }
  
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table {
    min-width: 600px;
  }
  
  .table th,
  .table td {
    padding: 0.625rem 0.5rem;
    font-size: 0.8125rem;
  }
  
  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }
  
  .chart-grid {
    grid-template-columns: 1fr;
  }
  
  .image-preview-area {
    max-width: 100%;
    aspect-ratio: 1/1;
  }
  
  .modal-content {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
  }
  
  .pagination {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .page-info {
    width: 100%;
    text-align: center;
    margin: 0.5rem 0;
  }
}

/* 超小手機螢幕 */
@media (max-width: 375px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .navbar-brand {
    font-size: 1.125rem;
  }
  
  .nav-link {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
  }
}

/* ========================================
   工具類
   ======================================== */
.text-success { color: var(--accent-success); }
.text-danger { color: var(--accent-danger); }
.text-warning { color: var(--accent-warning); }
.text-info { color: var(--accent-info); }
.text-muted { color: var(--text-muted); }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

.hidden { display: none !important; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }