/* ===== 全域設定 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2c2c2c;
  --accent: #c8a97e;
  --accent-light: #f5ede0;
  --white: #ffffff;
  --gray-light: #f8f8f8;
  --gray: #888;
  --danger: #e74c3c;
  --success: #27ae60;
  --line-green: #06c755;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --transition: 0.3s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  color: var(--primary);
  background: var(--white);
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ===== 按鈕 ===== */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
}
.btn-primary { background: var(--accent); color: var(--white); }
.btn-primary:hover { background: #b8935e; }
.btn-outline { background: transparent; color: var(--white); border-color: var(--white); }
.btn-outline:hover { background: var(--white); color: var(--primary); }
.btn-dark { background: var(--primary); color: var(--white); }
.btn-dark:hover { background: #444; }
.btn-line { background: var(--line-green); color: var(--white); }
.btn-line:hover { background: #05a847; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #c0392b; }
.btn-success { background: var(--success); color: var(--white); }
.btn-sm { padding: 8px 18px; font-size: 13px; }

/* ===== 導覽列 ===== */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  background: var(--primary);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 64px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.nav-brand { display: flex; align-items: center; gap: 10px; color: var(--white); font-size: 18px; font-weight: 700; }
.brand-icon { font-size: 22px; }
.nav-links { display: flex; list-style: none; gap: 8px; }
.nav-links a {
  color: rgba(255,255,255,0.85); padding: 8px 14px; border-radius: 8px;
  font-size: 14px; transition: var(--transition);
}
.nav-links a:hover, .nav-links a.active { background: rgba(255,255,255,0.15); color: var(--white); }
.nav-toggle { display: none; background: none; border: none; color: var(--white); font-size: 22px; cursor: pointer; }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)), url('../images/hero-bg.jpg') center/cover no-repeat;
  min-height: 520px; display: flex; align-items: center;
  padding: 60px 24px; gap: 40px;
  justify-content: center;
}
.hero-content { color: var(--white); max-width: 500px; }
.hero-content h1 { font-size: clamp(28px, 5vw, 46px); line-height: 1.3; margin-bottom: 16px; }
.hero-content p { font-size: 17px; opacity: 0.85; margin-bottom: 32px; }
.hero-buttons { display: flex; gap: 16px; flex-wrap: wrap; }
.hero-image { flex-shrink: 0; }
.hero-frame-demo {
  width: 220px; height: 220px;
  background: rgba(255,255,255,0.1);
  border: 3px solid var(--accent);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.hero-frame-demo .frame-demo-inner { text-align: center; color: rgba(255,255,255,0.5); }
.hero-frame-demo .frame-demo-inner i { font-size: 56px; margin-bottom: 12px; }

/* ===== Section 通用 ===== */
.section { padding: 72px 0; }
.section-title { text-align: center; font-size: 28px; margin-bottom: 12px; }
.section-subtitle { text-align: center; color: var(--gray); margin-bottom: 48px; }

/* ===== 尺寸價格 ===== */
.pricing-section { background: var(--gray-light); }
.price-grid { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.price-card {
  background: var(--white); border-radius: var(--radius);
  padding: 20px 24px; display: flex; align-items: center; gap: 20px;
  box-shadow: var(--shadow); min-width: 200px;
  transition: var(--transition);
}
.price-card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,0.12); }
.price-frame {
  border: 3px solid var(--accent); border-radius: 6px;
  background: var(--accent-light); flex-shrink: 0;
}
.price-size { display: block; font-weight: 600; font-size: 15px; }
.price-tag { display: block; color: var(--accent); font-size: 20px; font-weight: 700; margin-top: 4px; }

/* ===== 步驟 ===== */
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.step-card {
  text-align: center; padding: 36px 20px;
  border-radius: var(--radius); background: var(--gray-light);
  position: relative;
}
.step-number {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: var(--white);
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.step-icon { font-size: 36px; color: var(--accent); margin-bottom: 16px; }
.step-card h3 { margin-bottom: 8px; }
.step-card p { color: var(--gray); font-size: 14px; }

/* ===== 特色 ===== */
.features-section { background: var(--primary); }
.features-section .section-title { color: var(--white); }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.feature-card { text-align: center; padding: 32px 20px; color: var(--white); }
.feature-card i { font-size: 40px; color: var(--accent); margin-bottom: 16px; }
.feature-card h3 { margin-bottom: 8px; }
.feature-card p { opacity: 0.75; font-size: 14px; }

/* ===== 實品展示條 ===== */
.product-banner { background: linear-gradient(135deg, #8A5F00 0%, #6B4800 100%); padding: 28px 24px; }
.product-banner-inner { max-width: 900px; margin: 0 auto; display: flex; align-items: center; gap: 40px; flex-wrap: wrap; }
.product-banner-imgs { display: flex; gap: 12px; flex-shrink: 0; align-items: stretch; }
.product-banner-img-box { flex: 0 0 auto; width: 120px; border-radius: 14px; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
.product-banner-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-banner-img { width: 100%; display: block; object-fit: cover; }
.product-banner-text { flex: 1 1 220px; }
.product-banner-text h2 { font-size: clamp(22px, 4vw, 32px); font-weight: 800; color: #fff; margin-bottom: 12px; }
.product-banner-text p { font-size: 15px; color: rgba(255,255,255,0.85); line-height: 2; margin: 0; }
@media (max-width: 600px) {
  .product-banner-inner { flex-direction: column; text-align: center; }
  .product-banner-img-box { width: 100%; max-width: 320px; }
}

/* ===== 關於工作室 ===== */
.studio-section { background: #fff; }
.studio-wrap { display: flex; align-items: center; gap: 48px; flex-wrap: wrap; }
.studio-img-box { flex: 1 1 320px; max-width: 480px; border-radius: 20px; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,0.15); }
.studio-photo { width: 100%; height: 100%; object-fit: cover; display: block; }
.studio-text { flex: 1 1 260px; }
.studio-title { font-size: clamp(24px, 5vw, 36px); font-weight: 800; color: var(--primary); margin-bottom: 20px; }
.studio-desc { font-size: 15px; color: #555; line-height: 2; margin: 0; }
@media (max-width: 680px) {
  .studio-wrap { flex-direction: column; }
  .studio-img-box { max-width: 100%; }
}

/* ===== 聯繫 ===== */
.contact-section { background: linear-gradient(135deg, #C49000 0%, #AA7700 100%); }
.contact-box {
  display: flex; align-items: center; gap: 24px;
  background: var(--white); border-radius: var(--radius);
  padding: 32px 36px; box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.contact-line-icon { font-size: 48px; color: var(--line-green); flex-shrink: 0; }
.contact-box h3 { font-size: 20px; margin-bottom: 6px; color: #2c2c2c; }
.contact-box p { color: #666; font-size: 14px; }
.contact-box .btn { margin-left: auto; }

/* ===== Footer ===== */
.footer { background: var(--primary); color: rgba(255,255,255,0.65); text-align: center; padding: 32px 20px; font-size: 13px; }
.footer p + p { margin-top: 6px; }

/* ===== 登入頁 ===== */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gray-light); padding: 40px 20px; }
.auth-card { background: var(--white); border-radius: var(--radius); padding: 48px 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.auth-card h2 { text-align: center; margin-bottom: 8px; font-size: 24px; }
.auth-card .auth-subtitle { text-align: center; color: var(--gray); font-size: 14px; margin-bottom: 32px; }
.auth-tabs { display: flex; border-bottom: 2px solid #eee; margin-bottom: 28px; }
.auth-tab { flex: 1; padding: 10px; text-align: center; cursor: pointer; font-weight: 600; color: var(--gray); transition: var(--transition); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.auth-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===== 表單 ===== */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #555; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 16px;
  border: 2px solid #e8e8e8; border-radius: 8px;
  font-size: 15px; transition: var(--transition);
  font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--accent);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-submit { width: 100%; padding: 14px; font-size: 16px; border: none; border-radius: 8px; background: var(--accent); color: var(--white); font-weight: 700; cursor: pointer; transition: var(--transition); }
.form-submit:hover { background: #b8935e; }
.form-switch { text-align: center; margin-top: 16px; font-size: 14px; color: var(--gray); }
.form-switch a { color: var(--accent); font-weight: 600; }

/* ===== 成品展示 ===== */
.gallery-page { padding-top: 80px; }
.gallery-header { text-align: center; padding: 48px 20px 32px; }
.gallery-header h1 { font-size: 32px; margin-bottom: 8px; }
.gallery-header p { color: var(--gray); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; padding: 0 20px 60px; max-width: 1200px; margin: 0 auto; }
.gallery-card { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: var(--transition); background: var(--white); }
.gallery-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.12); }
.gallery-img { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--gray-light); display: flex; align-items: center; justify-content: center; font-size: 48px; color: #ccc; }
.gallery-img img { width: 100%; height: 100%; object-fit: cover; }
.gallery-info { padding: 16px 20px; }
.gallery-info h3 { font-size: 16px; margin-bottom: 6px; }
.gallery-info p { font-size: 13px; color: var(--gray); }
.gallery-back { text-align: center; padding: 20px; }

/* ===== 後台 ===== */
.admin-page { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; background: var(--primary); color: var(--white);
  padding: 24px 0; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto;
}
.admin-sidebar .sidebar-brand { padding: 0 24px 24px; font-size: 17px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.1); }
.admin-sidebar ul { list-style: none; padding: 16px 0; }
.admin-sidebar ul li a { display: block; padding: 12px 24px; color: rgba(255,255,255,0.75); font-size: 14px; transition: var(--transition); }
.admin-sidebar ul li a:hover, .admin-sidebar ul li a.active { background: rgba(255,255,255,0.1); color: var(--white); }
.admin-main { margin-left: 240px; flex: 1; padding: 32px; background: var(--gray-light); min-height: 100vh; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.admin-header h1 { font-size: 24px; }
.admin-card { background: var(--white); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); margin-bottom: 24px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { background: var(--gray-light); padding: 12px 16px; text-align: left; font-weight: 600; }
.admin-table td { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; }
.admin-table tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-paid { background: #d1e7dd; color: #0f5132; }
.badge-shipped { background: #cfe2ff; color: #084298; }

/* ===== 線上製作頁 ===== */
.create-page { padding-top: 80px; }
.create-container { max-width: 900px; margin: 0 auto; padding: 40px 20px 80px; }
.create-step-bar { display: flex; justify-content: center; gap: 0; margin-bottom: 48px; }
.create-step-item { display: flex; align-items: center; }
.create-step-dot { width: 32px; height: 32px; border-radius: 50%; background: #ddd; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #999; transition: var(--transition); }
.create-step-dot.active { background: var(--accent); color: var(--white); }
.create-step-dot.done { background: var(--success); color: var(--white); }
.create-step-line { width: 60px; height: 3px; background: #ddd; }
.create-step-line.done { background: var(--success); }

/* 尺寸選擇 */
.size-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.size-card {
  border: 2px solid #e8e8e8; border-radius: var(--radius);
  padding: 16px; cursor: pointer; text-align: center;
  transition: var(--transition); background: var(--white);
}
.size-card:hover { border-color: var(--accent); }
.size-card.selected { border-color: var(--accent); background: var(--accent-light); }
.size-card .size-preview-box { margin: 0 auto 12px; border: 2px solid var(--accent); background: rgba(200,169,126,0.15); }
.size-card .size-label { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.size-card .size-price { font-size: 18px; font-weight: 700; color: var(--accent); }
.orientation-btns { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.orientation-btn { padding: 4px 10px; font-size: 11px; border: 1px solid var(--accent); border-radius: 20px; cursor: pointer; background: transparent; color: var(--accent); transition: var(--transition); }
.orientation-btn.active { background: var(--accent); color: var(--white); }

/* 照片上傳 */
.upload-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin-bottom: 24px; }
.upload-slot {
  aspect-ratio: 1; border: 2px dashed #ccc; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition); position: relative; overflow: hidden;
  background: var(--gray-light);
}
.upload-slot:hover { border-color: var(--accent); background: var(--accent-light); }
.upload-slot.has-image { border-style: solid; border-color: var(--accent); }
.upload-slot img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.upload-slot .slot-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; opacity: 0; transition: var(--transition); }
.upload-slot:hover .slot-overlay { opacity: 1; }
.upload-slot .slot-num { font-size: 13px; color: #aaa; margin-top: 8px; }
.upload-slot i { font-size: 28px; color: #bbb; }

/* 預覽畫布 */
.preview-canvas-wrap { position: relative; margin: 0 auto 24px; overflow: hidden; border: 3px solid var(--primary); border-radius: 8px; cursor: move; }
.preview-img { position: absolute; transform-origin: center; user-select: none; }
.fold-overlay { position: absolute; inset: 0; pointer-events: none; }

/* 配件 */
.addon-list { display: flex; flex-direction: column; gap: 12px; }
.addon-item {
  display: flex; align-items: center; gap: 16px;
  border: 2px solid #e8e8e8; border-radius: var(--radius);
  padding: 16px 20px; transition: var(--transition);
}
.addon-item.selected { border-color: var(--accent); background: var(--accent-light); }
.addon-item input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.addon-name { flex: 1; font-size: 14px; font-weight: 600; }
.addon-price { color: var(--accent); font-weight: 700; font-size: 16px; }
.addon-qty { display: flex; align-items: center; gap: 8px; }
.qty-btn { width: 28px; height: 28px; border: 2px solid var(--accent); border-radius: 50%; background: transparent; color: var(--accent); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.qty-num { min-width: 24px; text-align: center; font-weight: 600; }

/* 價格摘要 */
.price-summary { background: var(--gray-light); border-radius: var(--radius); padding: 20px 24px; }
.price-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.price-row.total { font-size: 20px; font-weight: 700; color: var(--accent); border-top: 2px solid #ddd; margin-top: 8px; padding-top: 12px; }

/* 匯款頁 */
.payment-page { padding-top: 80px; }
.payment-container { max-width: 600px; margin: 0 auto; padding: 48px 20px; }
.payment-card { background: var(--white); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow); margin-bottom: 24px; }
.payment-card h2 { font-size: 20px; margin-bottom: 24px; display: flex; align-items: center; gap: 10px; }
.bank-info { display: flex; flex-direction: column; gap: 14px; }
.bank-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.bank-row:last-child { border-bottom: none; }
.bank-label { color: var(--gray); font-size: 13px; }
.bank-value { font-weight: 700; font-size: 16px; }
.copy-btn { background: none; border: 1px solid #ddd; border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--gray); }
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.linepay-box { text-align: center; padding: 20px; }
.linepay-qr { width: 180px; height: 180px; background: var(--gray-light); border: 2px dashed #ccc; border-radius: 12px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; font-size: 13px; color: #aaa; }
.warning-box { background: #fff3cd; border-left: 4px solid #ffc107; border-radius: 8px; padding: 14px 18px; font-size: 13px; color: #856404; margin-top: 20px; }

/* ===== 警告 Modal ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: var(--transition); }
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal-box { background: var(--white); border-radius: var(--radius); padding: 36px; max-width: 400px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.2); transform: scale(0.9); transition: var(--transition); }
.modal-overlay.show .modal-box { transform: scale(1); }
.modal-icon { font-size: 48px; text-align: center; margin-bottom: 16px; }
.modal-box h3 { text-align: center; margin-bottom: 12px; font-size: 18px; }
.modal-box p { text-align: center; color: var(--gray); font-size: 14px; line-height: 1.7; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }

/* ===== 客服小編浮動按鈕 ===== */
.cs-btn {
  position: fixed;
  bottom: 28px;
  right: 20px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
  animation: cs-bounce 2.4s ease-in-out infinite;
}
@keyframes cs-bounce {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.cs-bubble {
  background: #fff;
  border: 2px solid var(--line-green);
  border-radius: 20px 20px 20px 4px;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 700;
  color: #06a847;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(6,199,85,.25);
  margin-bottom: 6px;
  text-align: center;
  line-height: 1.5;
}
.cs-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffe0f0 0%, #ffc8e8 100%);
  border: 3px solid var(--line-green);
  box-shadow: 0 4px 18px rgba(6,199,85,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  position: relative;
  transition: transform .2s;
}
.cs-btn:hover .cs-avatar { transform: scale(1.1); }
.cs-online {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: var(--line-green);
  border-radius: 50%;
  border: 2px solid #fff;
}

/* ===== Toast 通知 ===== */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--primary); color: var(--white); padding: 14px 22px; border-radius: 10px; font-size: 14px; z-index: 10000; transform: translateY(80px); opacity: 0; transition: var(--transition); }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ===== 手機版 RWD ===== */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    background: var(--primary); flex-direction: column;
    padding: 16px; gap: 4px;
  }
  .nav-links.open { display: flex; }
  .hero { flex-direction: column; text-align: center; padding: 48px 20px; }
  .hero-buttons { justify-content: center; }
  .hero-image { display: none; }
  .contact-box { flex-direction: column; text-align: center; }
  .contact-box .btn { margin-left: 0; }
  .admin-sidebar { width: 100%; height: auto; position: relative; }
  .admin-main { margin-left: 0; }
  .admin-page { flex-direction: column; }
  .price-grid { gap: 12px; }
  .price-card { min-width: 160px; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
}
