:root {
  --bg: #fff9f5;
  --surface: #ffffff;
  --surface-soft: #fff2eb;
  --primary: #b83b5e;
  --primary-dark: #942947;
  --accent: #f08a5d;
  --text: #342628;
  --text-muted: #725d60;
  --border: #f0ded7;
  --danger: #c62828;
  --warning-bg: #fff8e1;
  --warning-border: #ffd54f;
  --success-bg: #edf7ed;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(102, 46, 61, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 249, 245, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 28px;
  line-height: 1;
}

.brand-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}

.brand-sub {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.hotline-pill {
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(184, 59, 94, 0.08);
}

/* Hero */
.hero {
  margin-top: 18px;
  background: linear-gradient(135deg, #fff0ea 0%, #fde2e4 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 22px;
}

.hero-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.hero h2 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.3;
  color: var(--text);
}

.hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  max-width: 720px;
}

/* Controls */
.controls {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 15px;
  color: var(--text);
  outline: none;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(184, 59, 94, 0.12);
}

.category-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.cat-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.cat-chip:hover {
  border-color: var(--primary);
}

.cat-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.catalog-meta {
  margin: 14px 0 12px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Grid */
.cake-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.cake-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.cake-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(102, 46, 61, 0.12);
}

.cake-thumb-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-soft);
  overflow: hidden;
}

.cake-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cake-cat-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
}

.cake-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.cake-name {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.cake-desc {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
  flex: 1;
}

.cake-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.cake-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
}

.cake-size-count {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface-soft);
  color: var(--primary);
  border: 1px solid var(--border);
}

.empty-state {
  text-align: center;
  padding: 40px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

/* Footer */
.footer {
  margin-top: 40px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 20px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-inner p {
  margin: 4px 0;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(34, 18, 22, 0.56);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-sheet {
  width: 100%;
  max-width: 680px;
  max-height: 92vh;
  background: var(--surface);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.modal-sheet-sm {
  max-width: 540px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.modal-category {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
}

.modal-header h3 {
  margin: 2px 0 0;
  font-size: 18px;
}

.icon-close {
  border: none;
  background: var(--surface);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  color: var(--text);
}

.modal-body {
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cake-summary-card {
  display: flex;
  gap: 14px;
  align-items: center;
  background: var(--bg);
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.cake-summary-card img {
  width: 92px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
}

.cake-summary-info p {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.album-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.section-label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
}

.req {
  color: var(--danger);
}

.size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 8px;
}

.size-option {
  border: 1.5px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.size-option.selected {
  border-color: var(--primary);
  background: var(--surface-soft);
}

.size-option-label {
  display: block;
  font-weight: 800;
  font-size: 14px;
  color: var(--text);
}

.size-option-note {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.size-option-price {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(184, 59, 94, 0.12);
}

.textarea {
  resize: vertical;
}

.accessories-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.acc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.acc-name {
  font-size: 13px;
  font-weight: 600;
}

.acc-price {
  display: block;
  font-size: 12px;
  color: var(--primary);
  font-weight: 700;
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stepper button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  color: var(--primary);
}

.stepper span {
  min-width: 22px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
}

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

.field {
  margin-bottom: 10px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.field-error {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--danger);
  min-height: 16px;
}

.early-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: #6d4c00;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 10px;
}

.submit-error {
  background: #ffebee;
  border: 1px solid #ef9a9a;
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.modal-footer {
  position: sticky;
  bottom: -18px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 0 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.price-breakdown {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.price-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
}

.price-total strong {
  font-size: 20px;
  color: var(--primary);
}

.btn-submit {
  padding: 12px 22px;
  font-size: 15px;
  white-space: nowrap;
}

/* Success Modal */
.order-code-box {
  text-align: center;
  background: var(--success-bg);
  border: 1px solid #a5d6a7;
  border-radius: 14px;
  padding: 16px;
}

.order-code-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #2e7d32;
}

.order-code-value {
  display: block;
  font-size: 28px;
  letter-spacing: 0.05em;
  color: #1b5e20;
  margin: 6px 0;
}

.order-code-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: #2e7d32;
}

.order-code-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border);
}

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

.bank-box {
  text-align: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.bank-box h4 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--primary);
}

.bank-box p {
  margin: 0 0 10px;
  font-size: 13px;
}

.bank-qr {
  width: 170px;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* Responsive Mobile */
@media (max-width: 640px) {
  .topbar-inner {
    flex-wrap: wrap;
  }

  .brand-title {
    font-size: 16px;
  }

  .hero {
    padding: 18px 16px;
  }

  .hero h2 {
    font-size: 18px;
  }

  .cake-grid {
    grid-template-columns: 1fr;
  }

  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal-sheet {
    max-height: 94vh;
    border-radius: 20px 20px 0 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .modal-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-submit {
    width: 100%;
  }
}
