@font-face {
  font-family: 'Sen';
  font-style: normal;
  font-weight: 500 900;
  src: local('Sen'), url('../Sen/Sen-VariableFont_wght.ttf') format('truetype');
}

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

:root {
  --primary: #884488;
  --primary-dark: #663366;
  --bg: #faf9f8;
  --bg-alt: #f5f3f1;
  --text: #2d2d2d;
  --text-light: #6b6b6b;
  --border: #e5e1dd;
  --success: #10b981;
  --error: #dc2626;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 24px rgba(0,0,0,0.12);
}

body {
  font-family: 'Sen', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-top: 32px;
}

/* Header Menu Bar */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: white;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.brand-logo {
  height: 36px;
  width: auto;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  margin: 0;
  letter-spacing: -0.02em;
}

.header-nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--primary);
}

/* Header hidden state (during checkout) */
.header.hidden {
  display: none;
}

/* Container */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 20px;
}

/* Container hidden state (during checkout) */
.container.checkout-mode {
  max-width: 600px;
  padding-top: 0;
}

/* Product Section */
.product-section {
  text-align: center;
  margin-bottom: 48px;
}

.product-section.hidden {
  display: none;
}

.hero-title {
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}

.product-viewer {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 0 auto 24px;
  aspect-ratio: 1;
  background: url('assets/brain_life_white.png') center/cover no-repeat;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.product-viewer:hover {
  transform: scale(1.02);
}

/* Viewer Overlay with Arrow and Size Pill */
.viewer-overlay {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.viewer-arrow {
  width: 40px;
  height: 20px;
  opacity: 0;
  object-fit: contain;
  transition: opacity 0.3s ease;
}

.product-viewer:hover .viewer-arrow,
.product-viewer:active .viewer-arrow {
  opacity: 0.9;
}

.viewer-size-pill {
  height: 20px;
  display: inline-block;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  color: rgba(0, 0, 0, 0.7);
  opacity: 0.4;
}

/* Order Now Button */
.btn-order-now {
  width: 100%;
  max-width: 500px;
  padding: 18px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: var(--shadow-md);
}

.btn-order-now:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-order-now:active {
  transform: translateY(0);
}

/* Order Card */
.order-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-bottom: 32px;
}

.order-card-inner {
  padding: 32px;
}

/* Checkout mode - full page takeover */
body.checkout-active {
  padding-top: 32px;
}

body.checkout-active .order-card {
  box-shadow: none;
  border-radius: 0;
  margin-bottom: 0;
}

.order-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
}

.order-step {
  display: none;
  animation: fadeIn 0.4s ease;
}

.order-step.active {
  display: block;
}

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

.step-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

/* Upload Zone */
.upload-zone {
  display: block;
  padding: 48px 24px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--bg);
}

.upload-zone:hover {
  border-color: var(--primary);
  background: var(--bg-alt);
}

.upload-zone.has-file {
  border-color: var(--success);
  border-style: solid;
}

.upload-icon {
  color: var(--primary);
  margin-bottom: 16px;
}

.upload-primary {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

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

/* Mini Upload Zone (for scan cards) */
.upload-zone-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--bg);
}

.upload-zone-mini:hover {
  border-color: var(--primary);
  background: var(--bg-alt);
}

.upload-zone-mini.has-file {
  border-color: var(--success);
  border-style: solid;
}

.upload-icon-mini {
  color: var(--primary);
  flex-shrink: 0;
}

.upload-text-mini {
  font-size: 14px;
  color: var(--text);
  text-align: left;
}

.upload-text-mini strong {
  color: var(--success);
  font-weight: 600;
}

.upload-text-mini small {
  font-size: 12px;
  color: var(--text-light);
}

.file-info {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-alt);
  border-radius: 8px;
  font-size: 14px;
  color: var(--success);
  font-weight: 600;
}

/* Form Inputs */
.select-input,
.text-input,
.number-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  background: white;
  transition: all 0.2s;
}

.select-input:focus,
.text-input:focus,
.number-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(136, 68, 136, 0.1);
}

.price-preview {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  margin: 20px 0;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
}

/* Buttons */
.btn-expand {
  width: 100%;
  padding: 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 24px;
}

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

.btn-primary {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-add {
  padding: 8px 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-add:hover {
  background: var(--bg);
  border-color: var(--primary);
}

.btn-remove {
  width: 32px;
  height: 32px;
  padding: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 24px;
  font-weight: 400;
  line-height: 1;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-remove:hover {
  background: var(--error);
  border-color: var(--error);
  color: white;
}

/* Advanced Builder */
.advanced-builder {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 2px solid var(--border);
}

.advanced-builder.hidden {
  display: none;
}

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

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.items-grid {
  display: grid;
  gap: 12px;
}

.item-card {
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s;
}

.item-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

/* Summary */
.summary-box {
  padding: 20px;
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

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

.summary-row.total {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  padding-top: 16px;
  margin-top: 8px;
  border-top: 2px solid var(--primary);
}

/* Status */
.status-message {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
}

.status-message.success {
  background: #d1fae5;
  color: var(--success);
}

.status-message.error {
  background: #fee2e2;
  color: var(--error);
}

/* Trust Links */
.trust-links {
  margin-top: 24px;
  text-align: center;
  font-size: 13px;
}

.trust-link {
  color: var(--primary);
  text-decoration: none;
  margin: 0 12px;
  transition: opacity 0.2s;
}

.trust-link:hover {
  opacity: 0.7;
  text-decoration: underline;
}

/* Footer */
.footer {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-light);
  font-size: 13px;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: var(--radius);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-light);
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

#modal-body h2 {
  color: var(--primary);
  margin-bottom: 16px;
}

#modal-body p {
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 20px;
}

#modal-body p:last-child {
  margin-bottom: 0;
}

/* Country Dropdown */
.country-select-wrapper {
  position: relative;
  margin-bottom: 24px;
}

.country-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: var(--shadow-md);
  z-index: 10;
}

.country-dropdown.hidden {
  display: none;
}

.country-option {
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 15px;
}

.country-option:hover {
  background: var(--bg);
}

.country-option.selected {
  background: var(--primary);
  color: white;
}

/* Order Summary */
.order-summary {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg);
  border-radius: 8px;
}

.summary-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

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

.summary-item-label {
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 4px;
}

.summary-item-details {
  color: var(--text);
}

/* Back Button */
.btn-back {
  margin-bottom: 20px;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-back:hover {
  background: var(--bg);
  border-color: var(--primary);
  color: var(--primary);
}

/* Simple Config */
.simple-config {
  display: block;
}

.simple-config.hidden {
  display: none;
}

.simple-field {
  display: flex;
  flex-direction: column;
  width: 100%;
  align-items: center;
  margin-bottom: 16px;
}

.simple-fieldset {
  background-color: #f6eef6;
  border: none;
  border-radius: 12px;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  margin: 0;
}

.field-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 8px;
  margin-right: auto;
  color: var(--text);
}

.radio-input {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin: 4px 0;
}

.radio-label {
  width: 100%;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

input[type="radio"] {
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
  margin-right: 10px;
  width: 18px;
  height: 18px;
}

input[type="radio"]:checked + .radio-label {
  color: var(--primary);
  font-weight: 700;
  background-color: #eeddee;
}

/* Desktop radio styles */
@media (min-width: 768px) {
  .radio-label {
    padding: 12px 16px;
  }
}

/* Mobile radio styles - hide radio, full width labels */
@media (max-width: 767px) {
  input[type="radio"] {
    display: none;
  }

  .radio-label {
    padding: 12px 0 12px 16px;
  }

  input[type="radio"]:checked + .radio-label {
    box-shadow: inset 0 0 0 100px rgba(136, 68, 136, 0.1);
  }
}

/* Responsive - Tablet & Up */
@media (min-width: 768px) {
  .header-nav {
    gap: 24px;
  }

  .nav-link {
    font-size: 15px;
  }
}

/* Responsive - Mobile */
@media (max-width: 767px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .order-card-inner {
    padding: 24px;
  }

  .upload-zone {
    padding: 32px 20px;
  }

  .header-nav {
    gap: 12px;
  }

  .nav-link {
    font-size: 13px;
  }

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

  .brand-logo {
    height: 28px;
  }
}

/* Portrait Mobile - Stacked Menu */
@media (max-width: 480px) and (orientation: portrait) {
  body {
    padding-top: 120px;
    font-size: 20px;
  }

  body.checkout-active {
    padding-top: 32px;
  }

  .header-inner {
    flex-direction: column;
    padding: 16px 20px;
    gap: 12px;
  }

  .header-brand {
    width: 100%;
    justify-content: center;
  }

  .header-nav {
    width: 100%;
    justify-content: center;
    gap: 16px;
  }

  .nav-link {
    font-size: 18px;
  }

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

  .brand-logo {
    height: 32px;
  }

  .hero-title {
    font-size: 40px;
  }

  .order-title {
    font-size: 32px;
  }

  .step-title {
    font-size: 26px;
  }

  .field-title {
    font-size: 20px;
  }

  .radio-label {
    font-size: 20px;
    padding: 16px 0 16px 18px;
  }

  .text-input,
  .select-input,
  .number-input {
    font-size: 20px;
    padding: 16px 18px;
  }

  .btn-primary {
    font-size: 24px;
    padding: 22px;
  }

  .btn-expand {
    font-size: 20px;
    padding: 18px;
  }

  .upload-primary {
    font-size: 24px;
  }

  .upload-secondary {
    font-size: 18px;
  }

  .price-preview {
    font-size: 44px;
  }

  .btn-order-now {
    font-size: 22px;
    padding: 20px;
  }

  .summary-row {
    font-size: 18px;
  }

  .summary-row.total {
    font-size: 28px;
  }
}

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