/* ==========================================================================
   全域變數與重設 (Reset & CSS Variables)
   ========================================================================== */
:root {
  --font-main: 'Noto Sans TC', sans-serif;
  --font-alt: 'Outfit', sans-serif;

  /* 高質感配色：深色科幻/神祕感調性 */
  --bg-dark: #0a0b10;
  --bg-card: rgba(20, 22, 33, 0.65);
  --bg-modal: rgba(13, 15, 24, 0.95);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(124, 58, 237, 0.6); /* 霓虹紫 */

  /* 文字配色 */
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-highlight: #a78bfa;

  /* 主題色與漸層 */
  --primary-color: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-gradient: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  --primary-glow: rgba(139, 92, 246, 0.3);
  --secondary-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);

  /* 其他 */
  --transition-speed: 0.3s;
  --border-radius-lg: 20px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
}

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

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

/* ==========================================================================
   背景光暈效果 (Background Decorative Glow)
   ========================================================================== */
.bg-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.25;
  pointer-events: none;
}

.glow-1 {
  background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
  top: -10%;
  left: -10%;
  animation: float-slow 20s infinite alternate ease-in-out;
}

.glow-2 {
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
  bottom: -10%;
  right: -10%;
  animation: float-slow 25s infinite alternate-reverse ease-in-out;
}

@keyframes float-slow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(80px, 50px) scale(1.1); }
}

/* ==========================================================================
   網頁容器與佈局 (App Layout)
   ========================================================================== */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* 頁首樣式 */
.app-header {
  text-align: center;
  margin-bottom: 40px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 10px;
}

.logo-emoji {
  font-size: 2.8rem;
  filter: drop-shadow(0 0 10px var(--primary-glow));
  animation: pulse-light 3s infinite ease-in-out;
}

.logo h1 {
  font-family: var(--font-alt);
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.subtitle {
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--text-muted);
}

.tagline {
  color: var(--text-muted);
  font-size: 1.1rem;
  font-weight: 300;
}

/* 主要區塊排版 */
.app-main {
  display: grid;
  grid-template-columns: 1.7fr 1.3fr;
  gap: 30px;
  flex: 1;
}

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

/* 區塊標題 */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--primary-gradient);
  border-radius: 2px;
}

/* ==========================================================================
   飲料菜單元件 (Menu Section Component)
   ========================================================================== */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

/* 飲料卡片 (Glassmorphism Effect) */
.drink-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--border-radius-lg);
  padding: 25px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

.drink-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity var(--transition-speed);
}

.drink-card:hover {
  transform: translateY(-8px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 40px 0 rgba(139, 92, 246, 0.15);
}

.drink-card:hover::before {
  opacity: 1;
}

.drink-emoji {
  font-size: 2.2rem;
  margin-bottom: 12px;
  display: inline-block;
  transition: transform var(--transition-speed) ease;
}

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

.drink-info {
  margin-bottom: 20px;
}

.drink-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}

.drink-price {
  font-family: var(--font-alt);
  font-size: 1.15rem;
  color: var(--text-highlight);
  font-weight: 600;
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 50px 0;
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ==========================================================================
   購物車元件 (Cart Component)
   ========================================================================== */
.cart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--border-radius-lg);
  padding: 30px 25px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 280px);
  min-height: 450px;
  position: sticky;
  top: 40px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

@media (max-width: 968px) {
  .cart-card {
    height: auto;
    position: static;
  }
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 20px;
  padding-right: 5px;
}

/* 購物車滾動條樣式 */
.cart-items::-webkit-scrollbar {
  width: 6px;
}
.cart-items::-webkit-scrollbar-track {
  background: transparent;
}
.cart-items::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.cart-items::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* 購物車為空時的提示 */
.empty-cart-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 40px 0;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 15px;
  opacity: 0.6;
}

/* 購物車品項卡片 */
.cart-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--border-radius-md);
  padding: 15px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: slide-in 0.25s ease-out;
  transition: transform var(--transition-speed);
}

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

.cart-item-details {
  flex: 1;
  padding-right: 15px;
}

.cart-item-name {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 3px;
}

.cart-item-customs {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
}

.cart-item-customs span {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 4px;
}

.cart-item-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.cart-item-price {
  font-family: var(--font-alt);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-highlight);
  min-width: 65px;
  text-align: right;
}

/* 購物車中的數量微調器 */
.cart-item-counter {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.cart-counter-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-speed);
}

.cart-counter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.cart-item-qty {
  font-family: var(--font-alt);
  width: 32px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
}

/* 移除按鈕 */
.delete-btn {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--transition-speed), transform var(--transition-speed);
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-btn:hover {
  color: #ef4444; /* 紅色 */
  transform: scale(1.15);
}

/* 購物車底部結帳區 */
.cart-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.total-amount-row {
  color: var(--text-main);
  margin-bottom: 20px;
}

.summary-value {
  font-family: var(--font-alt);
  font-size: 1.1rem;
  font-weight: 600;
}

.summary-value.highlight {
  font-size: 1.6rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

/* ==========================================================================
   按鈕樣式 (Button Styles)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 24px;
  border-radius: var(--border-radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 15px 0 var(--primary-glow);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #7c3aed 0%, #db2777 100%);
  opacity: 0;
  z-index: -1;
  transition: opacity var(--transition-speed);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(139, 92, 246, 0.4);
}

.btn-primary:hover:not(:disabled)::after {
  opacity: 1;
}

.btn-primary:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn:disabled {
  background: #374151;
  color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn:disabled::after {
  display: none;
}

/* ==========================================================================
   客製化選擇彈窗 (Modal Styles)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 5, 8, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-card {
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 50px 0 rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay:not(.hidden) .modal-card {
  transform: scale(1) translateY(0);
}

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

.modal-header h3 {
  font-size: 1.35rem;
  font-weight: 700;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-speed), transform var(--transition-speed);
}

.close-btn:hover {
  color: var(--text-main);
  transform: rotate(90deg);
}

.modal-body {
  padding: 25px;
}

.option-group {
  margin-bottom: 22px;
}

.group-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-highlight);
}

/* 磁磚式單選按鈕 (Radio Tiles Layout) */
.radio-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
  gap: 8px;
}

.tile-radio {
  cursor: pointer;
}

.tile-radio input {
  display: none; /* 隱藏原生 input */
}

.tile-label {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--border-radius-sm);
  padding: 10px 5px;
  font-size: 0.9rem;
  text-align: center;
  font-weight: 500;
  transition: all var(--transition-speed);
}

.tile-radio input:checked + .tile-label {
  background: rgba(139, 92, 246, 0.15);
  border-color: var(--border-focus);
  color: white;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

.tile-radio:hover input:not(:checked) + .tile-label {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

/* 數量微調器 (Modal) */
.qty-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 12px 18px;
  border-radius: var(--border-radius-md);
}

.qty-group .group-label {
  margin-bottom: 0;
}

.qty-counter {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.counter-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-speed);
}

.counter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.qty-counter input[type="number"] {
  font-family: var(--font-alt);
  width: 50px;
  height: 36px;
  background: transparent;
  border: none;
  color: var(--text-main);
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  outline: none;
}

/* 隱藏原生 number input 的微調鍵 */
.qty-counter input[type="number"]::-webkit-outer-spin-button,
.qty-counter input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.qty-counter input[type="number"] {
  -moz-appearance: textfield;
}

/* 彈窗底部 */
.modal-footer {
  padding: 20px 25px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.price-preview {
  font-family: var(--font-alt);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-highlight);
}

/* ==========================================================================
   頁尾與特效 (Footer & Animations)
   ========================================================================== */
.app-footer {
  text-align: center;
  margin-top: 50px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
}

@keyframes pulse-light {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.2)); }
  50% { filter: drop-shadow(0 0 18px rgba(139, 92, 246, 0.6)); }
}
