/* ============================================
   SOPHiSCA 菓風小舖 - Clean & Professional Design
   Inspired by graduation-bouquets.lumi.ing
   ============================================ */

/* ═══════════════════════════════════════════════════════════════
   CSS VARIABLES
   ═══════════════════════════════════════════════════════════════ */

:root {
  --primary: #F4A7B9;
  --primary-dark: #E891A3;
  --primary-light: #FFD6DE;
  --bg: #FFF5F7;
  --card-bg: #FFFFFF;
  --text: #4A4A4A;
  --text-secondary: #888888;
  --text-muted: #AAAAAA;
  --success: #7BC67E;
  --warning: #F5A623;
  --danger: #E74C3C;
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --touch-min: 44px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ═══════════════════════════════════════════════════════════════
   PAGE LAYOUT
   ═══════════════════════════════════════════════════════════════ */

.page {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════════
   HERO HEADER
   ═══════════════════════════════════════════════════════════════ */

.hero-header {
  text-align: center;
  padding: 32px 16px;
  margin-bottom: 8px;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-emoji {
  font-size: 48px;
  margin-bottom: 8px;
}

.hero-brand {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: 3px;
  margin-bottom: 4px;
}

.hero-slogan {
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

/* Page Header (for lookup/success) */
.page-header {
  text-align: center;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header-emoji {
  font-size: 40px;
  margin-bottom: 8px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
}

/* ═══════════════════════════════════════════════════════════════
   PRODUCT SECTION
   ═══════════════════════════════════════════════════════════════ */

.product-section {
  margin-bottom: 24px;
}

.section-header {
  text-align: center;
  margin-bottom: 20px;
}

.section-main-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Product Grid */
.product-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--card-bg);
  border: 2px solid transparent;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
}

.product-card input {
  display: none;
}

.product-card:active {
  transform: scale(0.98);
}

.product-card:has(input:checked) {
  border-color: var(--primary);
  box-shadow: var(--shadow-md), 0 0 0 3px rgba(244, 167, 185, 0.15);
}

.product-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
}

.product-visual {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 10px;
  flex-shrink: 0;
}

.product-emoji {
  font-size: 28px;
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.product-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.product-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
}

/* ═══════════════════════════════════════════════════════════════
   FORM SECTIONS
   ═══════════════════════════════════════════════════════════════ */

.form-section {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}

/* Form Groups */
.form-group {
  margin-bottom: 12px;
}

.form-group:last-child {
  margin-bottom: 0;
}

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

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #E5E5E5;
  border-radius: var(--border-radius);
  font-size: 16px;
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  font-family: inherit;
  min-height: 60px;
}

/* ═══════════════════════════════════════════════════════════════
   COLOR GRID
   ═══════════════════════════════════════════════════════════════ */

.color-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.color-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  border: 2px solid #E5E5E5;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--card-bg);
  -webkit-user-select: none;
  user-select: none;
}

.color-card input {
  display: none;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin-bottom: 6px;
  border: 2px solid rgba(0, 0, 0, 0.08);
}

.color-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.color-card:active {
  transform: scale(0.95);
}

.color-card:has(input:checked) {
  border-color: var(--primary);
  background: rgba(244, 167, 185, 0.08);
}

/* ═══════════════════════════════════════════════════════════════
   SNACK GRID
   ═══════════════════════════════════════════════════════════════ */

.snack-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.snack-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.snack-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.snack-emoji {
  font-size: 18px;
}

.snack-name {
  font-weight: 500;
  color: var(--text);
  font-size: 14px;
}

.snack-options {
  display: flex;
  gap: 8px;
}

.snack-btn {
  padding: 8px 14px;
  border: 1px solid #E5E5E5;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--card-bg);
  color: var(--text);
  -webkit-user-select: none;
  user-select: none;
}

.snack-btn input {
  display: none;
}

.snack-btn:active {
  transform: scale(0.95);
}

.snack-btn:has(input:checked) {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ═══════════════════════════════════════════════════════════════
   PAYMENT GRID
   ═══════════════════════════════════════════════════════════════ */

.payment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.payment-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  border: 2px solid #E5E5E5;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--card-bg);
  -webkit-user-select: none;
  user-select: none;
}

.payment-card input {
  display: none;
}

.payment-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.payment-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.payment-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.payment-card:active {
  transform: scale(0.98);
}

.payment-card:has(input:checked) {
  border-color: var(--primary);
  background: rgba(244, 167, 185, 0.08);
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: var(--border-radius);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  min-height: var(--touch-min);
  transition: all 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:active {
  transform: scale(0.97);
  background: var(--primary-dark);
}

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

.btn-secondary:active {
  transform: scale(0.97);
  background: var(--bg);
}

.btn-submit {
  width: 100%;
  padding: 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--border-radius-lg);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  min-height: 52px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
}

.btn-submit:active {
  transform: scale(0.98);
  background: var(--primary-dark);
}

/* ═══════════════════════════════════════════════════════════════
   SUCCESS PAGE
   ═══════════════════════════════════════════════════════════════ */

.success-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 24px 16px;
}

.success-card {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  width: 100%;
  max-width: 400px;
}

.success-icon {
  font-size: 56px;
  margin-bottom: 12px;
}

.success-card h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.success-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.order-info-card {
  background: var(--bg);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-bottom: 20px;
}

.order-no-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.order-no-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.order-no-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: 1px;
}

.order-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.detail-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.detail-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.detail-value.price {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
}

.payment-instruction {
  text-align: left;
  background: var(--bg);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-bottom: 20px;
}

.payment-instruction h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.payment-steps {
  padding-left: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

.payment-steps li {
  margin-bottom: 4px;
}

.order-reminder {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(245, 166, 35, 0.1);
  border-radius: 8px;
  font-size: 12px;
  color: var(--warning);
}

.reminder-icon {
  font-size: 16px;
}

.success-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.success-actions .btn {
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   LOOKUP PAGE
   ═══════════════════════════════════════════════════════════════ */

.lookup-form {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

/* Order Detail Card */
.order-detail-card {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.order-no-display {
  display: flex;
  flex-direction: column;
}

.order-card-body {
  padding: 16px;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.detail-row:last-child {
  border-bottom: none;
}

.price-tag {
  font-weight: 700;
  color: var(--primary-dark);
}

.snack-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.snack-tag {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--bg);
  border-radius: 12px;
  color: var(--text-secondary);
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pending         { background: #FFF3CD; color: #856404; }
.status-confirmed       { background: #D4EDDA; color: #155724; }
.status-awaiting_payment { background: #CCE5FF; color: #004085; }
.status-paid            { background: #D4EDDA; color: #155724; }
.status-making          { background: #E2D5F1; color: #5B2C8E; }
.status-preparing       { background: #FFE0B2; color: #E65100; }
.status-ready           { background: #D1ECF1; color: #0C5460; }
.status-picked_up       { background: #B2DFDB; color: #004D40; }
.status-completed       { background: #C3E6CB; color: #1E6A32; }
.status-cancelled       { background: #F5C6CB; color: #721C24; }
.status-payment_failed  { background: #F5C6CB; color: #721C24; }

/* ═══════════════════════════════════════════════════════════════
   UPLOAD SECTION
   ═══════════════════════════════════════════════════════════════ */

.upload-section {
  padding: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.upload-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.upload-area {
  border: 2px dashed var(--primary);
  border-radius: var(--border-radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(244, 167, 185, 0.04);
}

.upload-area:active {
  background: rgba(244, 167, 185, 0.1);
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.upload-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.upload-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.upload-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.upload-progress {
  text-align: center;
  padding: 12px;
  color: var(--primary-dark);
  font-weight: 500;
}

.screenshot-preview {
  text-align: center;
}

.screenshot-preview img {
  max-width: 100%;
  border-radius: var(--border-radius);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.upload-status {
  margin-top: 8px;
  color: var(--success);
  font-weight: 500;
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════════ */

.alert {
  padding: 12px 16px;
  border-radius: var(--border-radius);
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
}

.alert-error {
  background: #FDE8E8;
  color: #B71C1C;
  border: 1px solid #F5C6CB;
}

/* ═══════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════ */

.main-footer {
  text-align: center;
  padding: 20px 0;
}

.footer-link {
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  padding: 10px 16px;
  display: inline-block;
}

/* ═══════════════════════════════════════════════════════════════
   CONFETTI ANIMATION
   ═══════════════════════════════════════════════════════════════ */

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confetti-fall 3s linear forwards;
}

@keyframes confetti-fall {
  0% { 
    transform: translateY(-10vh) rotate(0deg); 
    opacity: 1; 
  }
  100% { 
    transform: translateY(110vh) rotate(720deg); 
    opacity: 0; 
  }
}

/* ═══════════════════════════════════════════════════════════════
   ERROR PAGE
   ═══════════════════════════════════════════════════════════════ */

.error-page {
  text-align: center;
  padding-top: 40px;
}

.error-card {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  padding: 36px 20px;
  box-shadow: var(--shadow);
}

.error-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.error-card h1 {
  color: var(--text);
  margin-bottom: 6px;
  font-size: 20px;
}

.error-card p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.login-card {
  background: var(--card-bg);
  border-radius: var(--border-radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
}

.login-card h1 {
  color: var(--primary-dark);
  margin-bottom: 20px;
  font-size: 20px;
}

.login-form {
  text-align: left;
}

.login-form .form-group {
  margin-bottom: 14px;
}

.login-form .btn {
  width: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 480px) {
  .page {
    max-width: 480px;
    margin: 0 auto;
  }
  
  .product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  
  .product-card {
    flex-direction: column;
    text-align: center;
    padding: 20px 16px;
  }
  
  .product-visual {
    width: 72px;
    height: 72px;
  }
  
  .product-emoji {
    font-size: 36px;
  }
  
  .success-actions {
    flex-direction: row;
  }
}

/* ═══════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════ */

.hidden {
  display: none !important;
}
.hero-logo { max-width: 280px; width: 90%; height: auto; margin: 0 auto; display: block; }
