/* -------------------------------------------------------------
 * 晨曦茶事 ChicTea - 智慧點餐系統 樣式表
 * 採用現代奢華明亮美學 (Light Luxury Elegance) 搭配精緻玻璃擬態 (Glassmorphism)
 * ------------------------------------------------------------- */

/* 1. 核心變數與設計系統 */
:root {
  /* 明亮奢華色調 */
  --bg-color: #f7f9fc;
  --panel-bg: rgba(255, 255, 255, 0.85);
  --panel-border: rgba(0, 0, 0, 0.06);
  
  --primary-tea: #b08053;      /* 經典溫潤茶色 (適合明亮背景的琥珀茶金) */
  --primary-tea-rgb: 176, 128, 83;
  --primary-hover: #966b42;    /* 懸停加深茶色 */
  
  --text-primary: #2d3748;     /* 質感炭灰色 */
  --text-secondary: #5a6a85;   /* 優雅灰 */
  --text-muted: #94a3b8;       /* 淡雅灰 */
  
  --accent-green: #059669;     /* 翡翠綠 (代表茶葉、已完成) */
  --accent-amber: #d97706;     /* 焦糖琥珀 (代表準備中) */
  
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.04), 0 5px 15px rgba(0, 0, 0, 0.02);
  --shadow-glow: 0 0 20px rgba(176, 128, 83, 0.12);
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --border-radius-lg: 16px;
  --border-radius-sm: 8px;
}

/* 2. 基礎重設與排版 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Outfit', 'Noto Sans TC', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* 裝飾性背景光暈 (改為柔和茶金色明亮暈染) */
.glow-bg {
  position: absolute;
  top: -10%;
  right: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(176, 128, 83, 0.08) 0%, rgba(247, 249, 252, 0) 70%);
  z-index: 0;
  pointer-events: none;
}

/* 主應用程式容器 */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* 3. 頂部導覽列 */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  border-radius: var(--border-radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
}

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

.logo-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 4px 10px rgba(176, 128, 83, 0.25));
}

.logo-text h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.brand-en {
  font-family: 'Outfit', sans-serif;
  color: var(--primary-tea);
  font-weight: 800;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.03);
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 55%;
}

.status-dot.green {
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* 4. 主要排版 (格線系統) */
.main-content {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  flex: 1;
}

@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

/* 5. 通用面板樣式 */
.order-panel, .board-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(20px);
  border-radius: var(--border-radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

/* 區塊標題 */
.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.step-num {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-tea);
  background: rgba(176, 128, 83, 0.1);
  padding: 4px 10px;
  border-radius: 6px;
}

.section-title h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.margin-top-md {
  margin-top: 32px;
}

/* 6. 飲料選擇卡片 */
.drink-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.drink-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-smooth);
  outline: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.01);
}

.drink-card:hover {
  background: #fafbfc;
  border-color: rgba(176, 128, 83, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.02);
}

.drink-card.active {
  background: rgba(176, 128, 83, 0.07);
  border-color: var(--primary-tea);
  box-shadow: var(--shadow-glow);
}

.drink-emoji {
  font-size: 2.2rem;
  margin-bottom: 12px;
  transition: var(--transition-smooth);
}

.drink-card:hover .drink-emoji {
  transform: scale(1.15) rotate(3deg);
}

.drink-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.drink-card.active .drink-title {
  color: var(--primary-tea);
}

.drink-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* 7. 客製化選項 (甜度/冰塊) */
.option-group {
  margin-bottom: 24px;
}

.option-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.selected-val-badge {
  font-size: 0.8rem;
  background: rgba(176, 128, 83, 0.08);
  color: var(--primary-tea);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 600;
}

.pill-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 480px) {
  .pill-buttons {
    grid-template-columns: repeat(2, 1fr);
  }
}

.pill-btn {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
  padding: 12px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition-smooth);
  outline: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01);
}

.pill-btn:hover {
  background: #fafbfc;
  color: var(--text-primary);
  border-color: rgba(0, 0, 0, 0.1);
}

.pill-btn.active {
  background: var(--primary-tea);
  border-color: var(--primary-tea);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(176, 128, 83, 0.25);
}

/* 顧客暱稱輸入框樣式 */
.text-input {
  width: 100%;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-primary);
  padding: 14px 18px;
  border-radius: var(--border-radius-sm);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-smooth);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01);
}

.text-input:hover {
  background: #fafbfc;
  border-color: rgba(0, 0, 0, 0.12);
}

.text-input:focus {
  background: #ffffff;
  border-color: var(--primary-tea);
  box-shadow: var(--shadow-glow);
}

/* 8. 數量控制與送出按鈕 */
.checkout-area {
  margin-top: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
}

@media (max-width: 600px) {
  .checkout-area {
    flex-direction: column;
    align-items: stretch;
  }
}

.quantity-selector {
  display: flex;
  align-items: center;
  gap: 16px;
}

.quantity-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.quantity-controls {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: var(--border-radius-sm);
  padding: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01);
}

.quantity-btn {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition-smooth);
}

.quantity-btn:hover {
  background: rgba(0, 0, 0, 0.03);
}

.quantity-btn:active {
  transform: scale(0.9);
}

.quantity-value {
  width: 32px;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
}

.submit-order-btn {
  flex: 1;
  background: linear-gradient(135deg, var(--primary-tea) 0%, #9c6c40 100%);
  border: none;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  padding: 16px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 15px rgba(176, 128, 83, 0.2);
}

.submit-order-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(176, 128, 83, 0.3);
}

.submit-order-btn:active:not(:disabled) {
  transform: translateY(0);
}

.submit-order-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 9. 訂單看板面板 */
.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding-bottom: 16px;
}

.board-title-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.board-icon {
  font-size: 1.4rem;
}

.board-header h2 {
  font-size: 1.2rem;
  font-weight: 600;
}

.refresh-btn {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01);
}

.refresh-btn:hover {
  background: #fafbfc;
  color: var(--text-primary);
  border-color: rgba(0, 0, 0, 0.1);
}

.refresh-icon {
  font-size: 0.85rem;
  transition: transform 0.6s ease;
}

.refresh-btn:hover .refresh-icon {
  transform: rotate(180deg);
}

.orders-board-container {
  flex: 1;
  min-height: 400px;
  max-height: 600px;
  overflow-y: auto;
  position: relative;
  padding-right: 4px;
}

/* 滾動條美化 */
.orders-board-container::-webkit-scrollbar {
  width: 6px;
}

.orders-board-container::-webkit-scrollbar-track {
  background: transparent;
}

.orders-board-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
}

.orders-board-container::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.12);
}

/* 10. 訂單卡片列表 */
.orders-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-item-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition-smooth);
  animation: slideIn 0.3s ease-out;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01);
}

.order-item-card:hover {
  background: #fafbfc;
  border-color: rgba(0, 0, 0, 0.08);
  transform: translateX(4px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.02);
}

.order-card-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.order-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-item-drink {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.order-item-qty {
  font-size: 0.75rem;
  background: rgba(176, 128, 83, 0.1);
  color: var(--primary-tea);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
}

/* 顧客標籤樣式 */
.order-item-customer-info {
  margin-top: 4px;
  display: flex;
}

.customer-name-tag {
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.order-item-custom {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.custom-badge {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid rgba(0, 0, 0, 0.04);
  padding: 2px 8px;
  border-radius: 4px;
}

.order-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.order-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: 'Outfit', sans-serif;
}

.status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-badge.preparing {
  background: rgba(217, 119, 6, 0.08);
  color: var(--accent-amber);
  border: 1px solid rgba(217, 119, 6, 0.12);
}

.status-badge.preparing::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-amber);
  animation: pulse-breathing 1.5s infinite;
}

.status-badge.completed {
  background: rgba(5, 150, 105, 0.08);
  color: var(--accent-green);
  border: 1px solid rgba(5, 150, 105, 0.12);
}

.status-badge.completed::before {
  content: '✓';
  font-size: 0.7rem;
}

/* 11. 各種狀態介面 (Loading, Empty, Shimmer) */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  text-align: center;
  animation: fadeIn 0.4s ease;
}

.empty-emoji {
  font-size: 3rem;
  margin-bottom: 12px;
  filter: grayscale(0.5);
  opacity: 0.5;
}

.empty-state p {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.empty-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.loading-state {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shimmer-card {
  height: 70px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.01) 25%, rgba(0, 0, 0, 0.03) 50%, rgba(0, 0, 0, 0.01) 75%);
  background-size: 200% 100%;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.02);
  animation: shimmer 1.5s infinite linear;
}

/* 12. 頁尾 */
.main-footer {
  text-align: center;
  padding: 32px 0 16px 0;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  margin-top: 40px;
}

.main-footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* 13. 通知訊息 (Toast) */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--primary-tea);
  color: var(--text-primary);
  padding: 16px 24px;
  border-radius: var(--border-radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1), toast-fade-out 0.3s cubic-bezier(0.16, 1, 0.3, 1) 2.7s forwards;
  backdrop-filter: blur(10px);
}

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

.toast.error {
  border-color: #ef4444;
}

/* 14. 動畫效果與微互動 */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes toast-slide-in {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toast-fade-out {
  to {
    transform: translateY(-10px);
    opacity: 0;
  }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes pulse-breathing {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.5;
  }
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spinner 0.8s infinite linear;
}

.hidden {
  display: none !important;
}

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