/* ==========================================
   變數與基礎設定
   ========================================== */
:root {
  --font-primary: 'Outfit', 'Noto Sans TC', sans-serif;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  --accent-color: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  --accent-hover: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --card-bg: rgba(30, 41, 59, 0.45);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --green-glow: #10b981;
  --blue-glow: #0ea5e9;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* ==========================================
   背景裝飾
   ========================================== */
.background-decor {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
}

.circle-1 {
  width: 500px;
  height: 500px;
  background: #6366f1;
  top: -100px;
  right: -50px;
  animation: float 20s infinite alternate;
}

.circle-2 {
  width: 400px;
  height: 400px;
  background: #f59e0b;
  bottom: -50px;
  left: -100px;
  animation: float 15s infinite alternate-reverse;
}

@keyframes float {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(40px) scale(1.1); }
}

/* ==========================================
   主容器與 Header 樣式
   ========================================== */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  position: relative;
  z-index: 10;
}

.app-header {
  text-align: center;
  margin-bottom: 3rem;
  animation: fadeInDown 0.8s ease-out;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.logo-icon {
  font-size: 2.5rem;
  background: var(--accent-color);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.4));
}

.logo h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo h1 span {
  font-weight: 300;
  color: #94a3b8;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 300;
  letter-spacing: 2px;
}

/* ==========================================
   兩欄式佈局
   ========================================== */
.main-layout {
  display: grid;
  grid-template-columns: 1.1fr 1.2fr;
  gap: 2.5rem;
  align-items: start;
}

/* ==========================================
   卡片與毛玻璃效果 (Glassmorphism)
   ========================================== */
.card {
  border-radius: 24px;
  padding: 2rem;
  transition: var(--transition);
}

.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 1rem;
}

.header-icon {
  font-size: 1.5rem;
  color: #f59e0b;
}

.card-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
}

/* ==========================================
   表單控制項
   ========================================== */
.order-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-row {
  display: flex;
  gap: 1.5rem;
}

.half-width {
  flex: 1;
}

.form-group label {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-group label i {
  font-size: 0.9rem;
}

/* 文字輸入框 */
input[type="text"] {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 1rem;
  transition: var(--transition);
}

input[type="text"]:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
  background: rgba(15, 23, 42, 0.85);
}

/* 下拉選單 */
select {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.2rem;
  padding-right: 2.5rem;
}

select:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

select option {
  background: #1e1b4b;
  color: var(--text-primary);
}

/* 飲料瓷磚選卡 */
.drink-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

.drink-tile {
  cursor: pointer;
}

.drink-tile input[type="radio"] {
  display: none;
}

.tile-content {
  background: rgba(15, 23, 42, 0.45);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  transition: var(--transition);
}

.drink-tile input[type="radio"]:checked + .tile-content {
  background: rgba(245, 158, 11, 0.1);
  border-color: #f59e0b;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.1);
  transform: translateY(-2px);
}

.drink-tile:hover .tile-content {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(15, 23, 42, 0.6);
}

.drink-title {
  font-weight: 600;
  font-size: 1rem;
}

.drink-price {
  color: #f59e0b;
  font-size: 0.9rem;
  font-weight: 500;
}

/* 數量控制器 */
.quantity-controller {
  display: flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow: hidden;
  height: 48px;
}

.qty-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 40px;
  height: 100%;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

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

.quantity-controller input[type="number"] {
  background: transparent;
  border: none;
  color: var(--text-primary);
  width: 50px;
  height: 100%;
  text-align: center;
  font-family: var(--font-primary);
  font-size: 1.1rem;
  font-weight: 600;
  appearance: textfield;
}

.quantity-controller input[type="number"]::-webkit-outer-spin-button,
.quantity-controller input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.quantity-controller input[type="number"]:focus {
  outline: none;
}

/* 總價摘要區 */
.summary-group {
  justify-content: flex-end;
}

.price-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  height: 48px;
}

.price-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.price-amount {
  font-size: 1.8rem;
  font-weight: 800;
  color: #f59e0b;
  line-height: 1;
}

/* 送出按鈕 */
.submit-btn {
  background: var(--accent-color);
  border: none;
  border-radius: 12px;
  color: #0f172a;
  font-family: var(--font-primary);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  transition: var(--transition);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.submit-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
  transform: translateY(-1px);
}

.submit-btn:active {
  transform: translateY(1px);
}

/* ==========================================
   即時訂單看板區
   ========================================== */
.list-card {
  min-height: 520px;
  display: flex;
  flex-direction: column;
}

.list-header {
  justify-content: space-between;
  align-items: center;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.refresh-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  transform: rotate(45deg);
}

.orders-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 骨架屏 */
.skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.skeleton-item {
  height: 90px;
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 16px;
}

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

/* 空狀態 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  flex: 1;
}

.empty-icon {
  font-size: 3.5rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.empty-state span {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* 列表渲染 */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* 客製化滾動條 */
.orders-list::-webkit-scrollbar {
  width: 6px;
}
.orders-list::-webkit-scrollbar-track {
  background: transparent;
}
.orders-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.orders-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 訂單卡片單元 */
.order-item {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
  animation: fadeInUp 0.4s ease-out;
}

.order-item:hover {
  background: rgba(15, 23, 42, 0.5);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(3px);
}

.order-info-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.order-meta-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.order-customer {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

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

.order-drink-details {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.drink-badge {
  font-weight: 600;
  font-size: 1.05rem;
  color: #fff;
}

.option-badge {
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 6px;
  font-weight: 500;
}

.badge-sweetness {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-ice {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.25);
}

.badge-qty {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* 價格單元 */
.order-price-block {
  text-align: right;
}

.order-price {
  font-size: 1.35rem;
  font-weight: 800;
  color: #f59e0b;
}

/* ==========================================
   Toast 與特效
   ========================================== */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 15px rgba(16, 185, 129, 0.1);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 999;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.toast-icon {
  color: var(--green-glow);
  font-size: 1.2rem;
}

.toast.hidden {
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
}

/* Helper Classes */
.hidden {
  display: none !important;
}

/* ==========================================
   Animations
   ========================================== */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* ==========================================
   響應式設計
   ========================================== */
@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .app-container {
    padding: 1.5rem 1rem;
  }
  
  .drink-options {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .drink-options {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    flex-direction: column;
    gap: 1.2rem;
  }
  
  .price-summary {
    align-items: flex-start;
    height: auto;
    margin-top: 0.5rem;
  }
}
