/* ==========================================================================
   無印風格設計系統 (MUJI-Style Design System)
   ========================================================================== */
:root {
  /* 無印良品配色：溫暖的米色、大自然木質色調、經典無印紅 */
  --bg-main: #faf8f5;       /* 溫暖的自然米白紙色 */
  --bg-card: #ffffff;       /* 純白卡片 */
  --bg-input: #f5f3ef;      /* 溫和的棉麻灰 */
  --border-color: #e6e2da;  /* 極細的溫和邊框 */
  --border-hover: #b8b0a5;  /* 亞麻灰褐色 */
  
  /* 主色與輔助色 */
  --primary: #7f2d2f;       /* 無印良品經典紅 (MUJI Red) */
  --primary-hover: #6c2224;
  --primary-glow: rgba(127, 45, 47, 0.05);
  
  --secondary: #f0ede6;     /* 棉麻原色 */
  --secondary-hover: #e5e0d5;
  
  --accent-success: #5a6b5c; /* 榻榻米綠 (沉穩綠) */
  --accent-danger: #9c3b3d;  /* 磚紅 */
  
  /* 文字色彩 */
  --text-main: #33302c;      /* 暖深灰 (非死黑) */
  --text-muted: #7c756c;     /* 棉麻褐 */
  --text-light: #a39c93;     /* 淡沙色 */
  
  /* 字型設定 */
  --font-family: 'Outfit', 'Noto Sans TC', system-ui, -apple-system, sans-serif;
  
  /* 無印極簡陰影與直角微圓 */
  --shadow-sm: 0 2px 6px rgba(127, 120, 110, 0.04);
  --shadow-lg: 0 8px 24px rgba(127, 120, 110, 0.08);
  --glass-shadow: none;      /* 無印風格不使用毛玻璃效果 */
  --radius-lg: 6px;          /* 偏向直角的極簡微圓角 */
  --radius-md: 4px;
  --radius-sm: 3px;
  
  /* 樸實自然的轉場效果 */
  --transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ==========================================================================
   基礎重設與排版
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.7;
  letter-spacing: 0.03em; /* 稍微加寬字距，符合日系留白感 */
}

/* 隱藏極光背景光暈（無印風格不需要科幻光暈） */
.bg-glow {
  display: none !important;
}

/* ==========================================================================
   容器與版面佈局 (Minimal Container)
   ========================================================================== */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 60px 24px;
  position: relative;
  z-index: 1;
}

/* 頁首區塊 */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 24px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background-color: var(--primary); /* 單色無印紅 */
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: none;
  animation: none; /* 關閉科幻呼吸動畫 */
}

.logo-text h1 {
  font-size: 22px;
  font-weight: 500; /* 無印風格不使用過粗的字體 */
  color: var(--text-main);
  background: none;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: initial;
}

.logo-text p {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
  text-transform: uppercase;
}

/* ==========================================================================
   數據概覽面板 (Simple Stats Panel)
   ========================================================================== */
.stats-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: none; /* 無印風格不進行 3D 浮動 */
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-muted);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.stat-value {
  font-size: 26px;
  font-weight: 500;
  color: var(--text-main);
}

/* ==========================================================================
   控制與篩選列 (Controls & Search)
   ========================================================================== */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

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

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.search-box input {
  width: 100%;
  padding: 11px 16px 11px 42px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13.5px;
  outline: none;
  transition: var(--transition);
}

.search-box input::placeholder {
  color: var(--text-light);
}

.search-box input:focus {
  border-color: var(--border-hover);
  box-shadow: none; /* 去除霓虹發光 */
}

/* ==========================================================================
   按鈕樣式 (Minimal Buttons)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  font-family: var(--font-family);
}

.btn-primary {
  background-color: var(--primary); /* 無印經典紅 */
  color: #fff;
  box-shadow: none;
}

.btn-primary:hover {
  transform: none;
  background-color: var(--primary-hover);
  box-shadow: none;
}

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

.btn-secondary:hover {
  background-color: var(--secondary);
  border-color: var(--border-hover);
}

/* ==========================================================================
   內容載入與狀態 (Loading & Empty States)
   ========================================================================== */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
  gap: 16px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--border-color);
  border-top: 2px solid var(--text-muted);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-container p {
  font-size: 13px;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  padding: 80px 24px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  max-width: 500px;
  margin: 40px auto;
}

.empty-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.empty-icon {
  font-size: 24px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-main);
}

.empty-state p {
  color: var(--text-muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   設備卡片網格與卡片設計 (Minimalistic Cards)
   ========================================================================== */
.equipment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.equipment-card {
  background: var(--bg-card);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  transition: var(--transition);
  position: relative;
}

.equipment-card::before {
  display: none; /* 移除彩色左邊條 */
}

.equipment-card:hover {
  transform: none; /* 無印風格保持扁平，僅微調邊框與陰影 */
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.card-top {
  margin-bottom: 14px;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--bg-main);
  padding-bottom: 10px;
}

.card-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.4;
}

.card-badge {
  background: var(--secondary);
  color: var(--text-main);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--border-color);
}

.card-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.card-detail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.card-detail-item i {
  width: 14px;
  text-align: center;
  color: var(--text-light);
}

.card-detail-item .value {
  color: var(--text-main);
}

.card-time {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-color);
  font-size: 11px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.card-actions button {
  flex: 1;
  padding: 8px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-color);
  font-family: var(--font-family);
  font-weight: 500;
}

.btn-edit {
  background: var(--bg-card);
  color: var(--text-main);
}

.btn-edit:hover {
  background: var(--secondary);
  border-color: var(--border-hover);
}

.btn-delete {
  background: var(--bg-card);
  color: var(--accent-danger);
  border: 1px solid var(--border-color);
}

.btn-delete:hover {
  background: #fbf1f1;
  border-color: var(--accent-danger);
}

/* ==========================================================================
   互動視窗樣式 (Minimal Modal Overlay & Form)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(43, 40, 36, 0.4); /* 溫暖的棉麻色半透明遮罩 */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  animation: fadeIn 0.2s forwards ease-out;
}

.modal-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 460px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px);
  animation: slideUp 0.25s forwards ease-out;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-main);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-light);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-close:hover {
  color: var(--text-main);
}

/* 表單控制項 */
.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group label i {
  margin-right: 4px;
  color: var(--text-light);
}

.form-group input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  font-family: var(--font-family);
  transition: var(--transition);
}

.form-group input::placeholder {
  color: var(--text-light);
}

.form-group input:focus {
  border-color: var(--border-hover);
  background: #fff;
}

.required {
  color: var(--primary);
  margin-left: 2px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.modal-actions button {
  padding: 8px 16px;
}

/* ==========================================================================
   通知氣泡 (Organic Toast Alert)
   ========================================================================== */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--primary);
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideInRight 0.25s forwards ease-out;
  max-width: 320px;
}

.toast-success {
  border-left-color: var(--accent-success);
}

.toast-error {
  border-left-color: var(--accent-danger);
}

/* ==========================================================================
   動畫效果集 (Simple Keyframes)
   ========================================================================== */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
  to { opacity: 1; }
}

@keyframes slideUp {
  to { transform: translateY(0); }
}

@keyframes slideInRight {
  from {
    transform: translateX(30px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ==========================================================================
   響應式斷點設計 (Responsive Breakpoints)
   ========================================================================== */
@media (max-width: 768px) {
  .container {
    padding: 30px 16px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  #btn-open-add {
    width: 100%;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    width: 100%;
  }

  .btn-secondary {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* ==========================================================================
   會員登入加值功能樣式 (Auth Addon Styles)
   ========================================================================== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-btn-group, .auth-user-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background-color: var(--secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-main);
  font-weight: 500;
}

.user-badge i {
  color: var(--primary);
}

