/* ============================================
   ON Brand Design System
   Matching on.com actual styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --on-black: #000000;
  --on-white: #ffffff;
  --on-bg: #f5f5f5;
  --on-gray-200: #e5e5e5;
  --on-gray-400: #a3a3a3;
  --on-gray-500: #737373;
  --on-gray-600: #525252;
  --on-orange: #c45500;
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  font-family: var(--font-primary);
  background: var(--on-white);
  color: var(--on-black);
  line-height: 1.5;
  overflow-x: hidden;
}

/* ============================================
   Header
   ============================================ */

.on-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  background: var(--on-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  z-index: 100;
  box-sizing: border-box;
}

.on-logo {
  display: flex;
  align-items: center;
  color: var(--on-black);
}

.on-logo svg {
  display: block;
}

.on-nav {
  display: flex;
  gap: 40px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.on-nav a {
  color: var(--on-black);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.on-nav a:hover {
  opacity: 0.7;
}

.on-header-actions {
  display: flex;
  align-items: center;
  gap: 24px;
}

.on-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--on-black);
}

.on-icon-btn:hover {
  opacity: 0.7;
}

@media (max-width: 900px) {
  .on-header {
    padding: 0 16px;
    height: 60px;
  }
  .on-nav {
    display: none;
  }
  .on-header-actions {
    gap: 16px;
  }
}

@media (max-width: 900px) {
  .on-product-page {
    padding-top: 60px;
  }
}

/* ============================================
   Product Page Layout
   ============================================ */

.on-product-page {
  padding-top: 72px;
  min-height: 100vh;
  background: var(--on-white);
  overflow-x: hidden;
}

.on-product-container {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  max-width: 100vw;
}

@media (min-width: 1024px) {
  .on-product-container {
    grid-template-columns: 1fr 400px;
  }
}

@media (min-width: 1200px) {
  .on-product-container {
    grid-template-columns: 1fr 440px;
  }
}

/* ============================================
   Gallery
   ============================================ */

.on-gallery {
  position: relative;
  background: var(--on-bg);
  min-height: calc(100vh - 72px);
  overflow: hidden;
}

.on-gallery-scroll {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  height: calc(100vh - 72px);
  width: 100%;
}

.on-gallery-scroll::-webkit-scrollbar {
  display: none;
}

.on-gallery-item {
  flex: 0 0 100%;
  min-width: 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .on-gallery-item {
    padding: 40px;
  }
}

.on-gallery-item img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.on-gallery-controls {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.on-gallery-arrow {
  width: 44px;
  height: 44px;
  border: 1px solid var(--on-gray-200);
  border-radius: 4px;
  background: var(--on-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-black);
  pointer-events: auto;
}

.on-gallery-arrow:hover {
  background: var(--on-bg);
}

.on-gallery-prev {
  margin-right: 8px;
}

.on-gallery-counter {
  font-size: 14px;
  color: var(--on-black);
  letter-spacing: 0.05em;
  margin-left: 16px;
}

@media (max-width: 1023px) {
  .on-gallery {
    min-height: auto;
  }
  .on-gallery-scroll {
    height: auto;
    aspect-ratio: 1;
  }
  .on-gallery-controls {
    bottom: 16px;
  }
}

/* ============================================
   Product Info
   ============================================ */

.on-product-info {
  padding: 24px 16px 40px;
  background: var(--on-white);
  overflow-x: hidden;
}

@media (min-width: 768px) {
  .on-product-info {
    padding: 32px 32px 60px;
  }
}

@media (min-width: 1024px) {
  .on-product-info {
    padding: 40px 48px 80px;
    overflow-y: auto;
    max-height: calc(100vh - 72px);
  }
}

.on-breadcrumb {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--on-gray-500);
  margin-bottom: 16px;
}

.on-breadcrumb a {
  color: var(--on-gray-500);
  text-decoration: none;
}

.on-breadcrumb a:hover {
  color: var(--on-black);
}

.on-breadcrumb-sep {
  margin: 0 8px;
}

.on-product-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.on-product-header .on-product-title {
  flex: 1;
  min-width: 0;
}

.on-product-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

@media (min-width: 768px) {
  .on-product-title {
    font-size: 32px;
  }
}

@media (min-width: 1200px) {
  .on-product-title {
    font-size: 40px;
  }
}

.on-wishlist-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--on-black);
  flex-shrink: 0;
}

.on-wishlist-btn:hover {
  opacity: 0.6;
}

.on-product-badge {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  margin-bottom: 8px;
}

.on-badge-highlight {
  color: var(--on-orange);
}

.on-badge-text {
  color: var(--on-black);
  margin-left: 8px;
}

.on-product-price {
  font-size: 16px;
  font-weight: 400;
  margin-bottom: 8px;
}

.on-product-price small {
  font-size: 13px;
  color: var(--on-gray-500);
  font-weight: 400;
  margin-left: 8px;
}

.on-product-description {
  font-size: 15px;
  color: var(--on-black);
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 340px;
}

/* Color Section */
.on-color-section {
  margin-bottom: 32px;
}

.on-color-label {
  font-size: 14px;
  margin-bottom: 12px;
}

.on-color-swatch-wrap {
  display: flex;
  gap: 8px;
}

.on-color-swatch {
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  position: relative;
}

.on-color-swatch img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;
}

.on-color-swatch.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--on-black);
}

/* Custom Fit Section */
.on-custom-fit {
  background: var(--on-white);
  border: 1px solid var(--on-gray-200);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 768px) {
  .on-custom-fit {
    padding: 24px;
  }
}

.on-custom-fit-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

@media (min-width: 768px) {
  .on-custom-fit-header {
    gap: 16px;
    margin-bottom: 16px;
  }
}

.on-custom-fit-icon {
  width: 40px;
  height: 40px;
  background: var(--on-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.on-custom-fit-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--on-black);
}

.on-custom-fit-title {
  font-size: 16px;
  font-weight: 600;
}

.on-custom-fit-desc {
  font-size: 14px;
  color: var(--on-gray-600);
  line-height: 1.5;
  margin-bottom: 16px;
}

@media (min-width: 768px) {
  .on-custom-fit-desc {
    line-height: 1.6;
    margin-bottom: 20px;
  }
}

/* Buttons */
.on-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: none;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  text-decoration: none;
}

.on-btn-primary {
  background: var(--on-black);
  color: var(--on-white);
  width: 100%;
  height: 56px;
  padding: 0 24px;
  border-radius: 4px;
}

.on-btn-primary:hover {
  opacity: 0.85;
}

.on-btn-primary:active {
  opacity: 0.7;
}

.on-btn-primary svg {
  stroke: currentColor;
  fill: none;
}

/* Notify text */
.on-notify-text {
  font-size: 13px;
  color: var(--on-gray-600);
  line-height: 1.5;
}

.on-notify-link {
  color: var(--on-black);
  text-decoration: underline;
  font-weight: 500;
}

.on-notify-link:hover {
  opacity: 0.7;
}

/* ============================================
   Scanner Flow Overlay
   ============================================ */

.on-scanner-overlay-full {
  position: fixed;
  inset: 0;
  background: var(--on-white);
  z-index: 1000;
  overflow: hidden;
}

/* ============================================
   Name Input Page
   ============================================ */

.on-name-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.on-name-card {
  width: 100%;
  max-width: 380px;
}

.on-name-icon {
  width: 72px;
  height: 72px;
  background: var(--on-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 32px;
}

.on-name-icon svg {
  width: 36px;
  height: 36px;
  stroke: var(--on-black);
  fill: none;
}

.on-name-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.on-name-subtitle {
  font-size: 14px;
  color: var(--on-gray-600);
  margin-bottom: 32px;
  line-height: 1.6;
}

.on-form-group {
  margin-bottom: 20px;
  text-align: left;
}

.on-form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--on-gray-600);
  margin-bottom: 8px;
}

.on-form-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--on-gray-200);
  border-radius: 4px;
  font-family: var(--font-primary);
  font-size: 15px;
  transition: border-color 0.2s;
}

.on-form-input:focus {
  outline: none;
  border-color: var(--on-black);
}

.on-form-input::placeholder {
  color: var(--on-gray-400);
}

.on-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
  color: var(--on-gray-600);
  text-decoration: none;
  font-size: 14px;
}

.on-back-link:hover {
  color: var(--on-black);
}

.on-back-link svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   Scanner Capture Page
   ============================================ */

.on-capture-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--on-white);
}

.on-capture-header {
  height: 60px;
  background: var(--on-white);
  border-bottom: 1px solid var(--on-gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}

.on-capture-back {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-black);
  cursor: pointer;
  padding: 0;
  font-family: var(--font-primary);
}

.on-capture-back svg {
  width: 20px;
  height: 20px;
}

.on-capture-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}

.on-capture-step {
  font-size: 12px;
  font-weight: 500;
  color: var(--on-gray-500);
}

.on-progress-dots {
  display: flex;
  gap: 4px;
}

.on-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--on-gray-200);
}

.on-progress-dot.completed {
  background: var(--on-black);
}

.on-progress-dot.current {
  background: var(--on-orange);
}

/* Camera Area */
.on-capture-camera {
  flex: 1;
  position: relative;
  background: #1a1a1a;
  overflow: hidden;
}

.on-capture-camera video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.on-capture-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 260px;
  height: 260px;
  pointer-events: none;
  z-index: 10;
}

.on-capture-overlay img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.6;
}

.on-capture-overlay canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.on-capture-instructions {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--on-white);
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  text-align: center;
  max-width: calc(100% - 40px);
  z-index: 20;
}

.on-capture-instructions h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--on-black);
}

.on-capture-instructions p {
  font-size: 13px;
  color: var(--on-gray-600);
  margin: 0;
}

/* Controls */
.on-capture-controls {
  background: var(--on-white);
  padding: 20px;
  border-top: 1px solid var(--on-gray-200);
  flex-shrink: 0;
}

.on-capture-status {
  text-align: center;
  font-size: 13px;
  color: var(--on-gray-500);
  margin-bottom: 16px;
  min-height: 1.5em;
}

.on-shutter {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  height: 52px;
  background: var(--on-gray-200);
  color: var(--on-gray-500);
  border: none;
  border-radius: 4px;
  font-family: var(--font-primary);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: not-allowed;
  transition: all 0.2s;
}

.on-shutter.ready {
  background: var(--on-black);
  color: var(--on-white);
  cursor: pointer;
}

.on-shutter.ready:hover {
  opacity: 0.85;
}

.on-shutter.ready:active {
  opacity: 0.7;
}

/* ============================================
   Explanation Page
   ============================================ */

.on-explain-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--on-white);
}

.on-explain-header {
  height: 60px;
  background: var(--on-white);
  border-bottom: 1px solid var(--on-gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}

.on-explain-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.on-explain-image {
  max-width: 260px;
  margin-bottom: 32px;
}

.on-explain-image img {
  width: 100%;
  height: auto;
}

.on-explain-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
  max-width: 360px;
  line-height: 1.4;
}

.on-explain-subtitle {
  font-size: 14px;
  color: var(--on-gray-600);
}

.on-explain-footer {
  padding: 20px;
  border-top: 1px solid var(--on-gray-200);
}

.on-explain-footer .on-btn {
  max-width: 300px;
  margin: 0 auto;
  display: flex;
}

/* ============================================
   Preview/Processing Page
   ============================================ */

.on-preview-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--on-white);
}

.on-preview-card {
  text-align: center;
  max-width: 360px;
  width: 100%;
}

.on-preview-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--on-gray-200);
  border-top-color: var(--on-black);
  border-radius: 50%;
  margin: 0 auto 32px;
  animation: on-spin 1s linear infinite;
}

@keyframes on-spin {
  to { transform: rotate(360deg); }
}

.on-preview-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
}

.on-preview-status {
  font-size: 14px;
  color: var(--on-gray-600);
  margin-bottom: 32px;
}

.on-preview-image {
  max-width: 100%;
  border-radius: 8px;
  margin-bottom: 32px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Complete Page
   ============================================ */

.on-complete-page {
  min-height: 100%;
  background: var(--on-white);
  overflow-y: auto;
}

.on-complete-header {
  height: 60px;
  background: var(--on-white);
  border-bottom: 1px solid var(--on-gray-200);
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.on-complete-content {
  max-width: 440px;
  margin: 0 auto;
  padding: 32px 24px;
}

.on-success-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #dcfce7;
  color: #166534;
  padding: 8px 16px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 24px;
}

.on-success-badge svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
}

.on-complete-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

.on-complete-subtitle {
  font-size: 14px;
  color: var(--on-gray-600);
  margin-bottom: 32px;
  line-height: 1.6;
}

/* Cart Summary */
.on-cart-summary {
  background: var(--on-bg);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.on-cart-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--on-gray-200);
}

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

.on-cart-item-image {
  width: 72px;
  height: 72px;
  background: var(--on-white);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.on-cart-item-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.on-cart-item-details {
  flex: 1;
  min-width: 0;
}

.on-cart-item-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.on-cart-item-variant {
  font-size: 13px;
  color: var(--on-gray-600);
  margin-bottom: 8px;
}

.on-cart-item-price {
  font-weight: 600;
  font-size: 14px;
}

.on-cart-item.insole {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  margin: 12px -20px;
  padding: 16px 20px;
  border-radius: 8px;
  border: none;
}

.on-cart-item.insole .on-cart-item-image {
  background: var(--on-white);
}

.on-insole-badge {
  display: inline-block;
  background: var(--on-black);
  color: var(--on-white);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 2px;
  margin-bottom: 4px;
}

.on-cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  margin-top: 8px;
  border-top: 2px solid var(--on-gray-200);
}

.on-cart-total-label {
  font-weight: 600;
  font-size: 14px;
}

.on-cart-total-price {
  font-size: 18px;
  font-weight: 700;
}

.on-btn-secondary {
  background: var(--on-white);
  color: var(--on-black);
  border: 1px solid var(--on-black);
  width: 100%;
  height: 52px;
  border-radius: 4px;
}

.on-btn-secondary:hover {
  background: var(--on-bg);
}

/* ============================================
   Utilities
   ============================================ */

.on-hidden {
  display: none !important;
}
