/* ============================================
   SA Wear Outfit Creator — Style System
   Colors: #425575 (primary), #83A47E (accent), #403836 (dark)
   Font: Work Sans
   ============================================ */

:root {
  /* SA Wear brand colors */
  --clr-primary: #425575;
  --clr-primary-light: #5a7199;
  --clr-primary-dark: #2e3d55;
  --clr-accent: #83A47E;
  --clr-accent-light: #9cba97;
  --clr-accent-dark: #6b8d66;
  --clr-brown: #403836;

  /* UI colors */
  --clr-bg: #0f1118;
  --clr-surface: #1a1d28;
  --clr-surface-2: #242836;
  --clr-surface-3: #2e3345;
  --clr-text: #f0f0f5;
  --clr-text-muted: #8a8fa0;
  --clr-text-dim: #5c6175;
  --clr-border: rgba(255, 255, 255, 0.08);
  --clr-danger: #e05555;
  --clr-success: #83A47E;

  /* Glass */
  --glass-bg: rgba(26, 29, 40, 0.85);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-blur: 20px;

  /* Spacing */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;
  --sp-2xl: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 30px rgba(66, 85, 117, 0.3);

  /* Transitions */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --duration: 0.3s;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  color: var(--clr-text);
  background: var(--clr-bg);
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Subtle background gradient */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(66, 85, 117, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(131, 164, 126, 0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ============================================
   Splash Screen
   ============================================ */
.splash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--clr-bg);
  z-index: 1000;
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.splash.fade-out {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

.splash-logo {
  width: 180px;
  margin-bottom: var(--sp-lg);
  animation: fadeInUp 0.8s var(--ease) both;
}

.splash-tagline {
  font-size: 0.875rem;
  font-weight: 300;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--clr-text-muted);
  animation: fadeInUp 0.8s var(--ease) 0.2s both;
}

.splash-loader {
  display: flex;
  gap: 6px;
  margin-top: var(--sp-xl);
  animation: fadeInUp 0.8s var(--ease) 0.4s both;
}

.splash-loader div {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--clr-primary);
  animation: bounce 1.2s infinite ease-in-out;
}

.splash-loader div:nth-child(2) {
  animation-delay: 0.15s;
}

.splash-loader div:nth-child(3) {
  animation-delay: 0.3s;
}

/* ============================================
   Login Screen
   ============================================ */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--clr-bg);
  z-index: 900;
  padding: var(--sp-lg);
}

.login-screen.hidden {
  display: none;
}

.login-card {
  text-align: center;
  max-width: 340px;
  width: 100%;
  animation: fadeInUp 0.5s var(--ease) both;
}

.login-logo {
  width: 140px;
  margin-bottom: var(--sp-lg);
}

.login-title {
  font-size: 1rem;
  font-weight: 300;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--clr-text-muted);
  margin-bottom: var(--sp-xl);
}

.login-desc {
  font-size: 0.9rem;
  color: var(--clr-text-dim);
  margin-bottom: var(--sp-xl);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

.pin-inputs {
  display: flex;
  gap: var(--sp-md);
  justify-content: center;
}

.pin-digit {
  width: 56px;
  height: 64px;
  border-radius: var(--radius-md);
  border: 2px solid var(--clr-border);
  background: var(--clr-surface);
  color: var(--clr-text);
  font-family: 'Work Sans', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  transition: all var(--duration) var(--ease);
  -webkit-appearance: none;
}

.pin-digit:focus {
  outline: none;
  border-color: var(--clr-primary);
  box-shadow: 0 0 16px rgba(66, 85, 117, 0.3);
}

.pin-digit.error {
  border-color: var(--clr-danger);
  animation: shake 0.4s ease-in-out;
}

.login-error {
  font-size: 0.85rem;
  color: var(--clr-danger);
}

.login-error.hidden {
  display: none;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-6px);
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

/* ============================================
   App Container
   ============================================ */
.app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: var(--sp-2xl);
}

.app.hidden {
  display: none;
}

/* ============================================
   Header
   ============================================ */
.header {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  height: 32px;
  width: auto;
}

.header-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--clr-text-muted);
}

/* ============================================
   Steps Navigation
   ============================================ */
.steps {
  display: flex;
  align-items: center;
  padding: var(--sp-lg) var(--sp-lg) var(--sp-md);
  gap: 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-xs);
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  flex-shrink: 0;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--clr-text-dim);
  background: var(--clr-surface-2);
  border: 2px solid var(--clr-border);
  transition: all var(--duration) var(--ease);
}

.step.active .step-num {
  background: var(--clr-primary);
  border-color: var(--clr-primary-light);
  color: white;
  box-shadow: 0 0 16px rgba(66, 85, 117, 0.4);
}

.step.completed .step-num {
  background: var(--clr-accent);
  border-color: var(--clr-accent-light);
  color: white;
}

.step-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--clr-text-dim);
  transition: color var(--duration) var(--ease);
}

.step.active .step-label {
  color: var(--clr-text);
}

.step.completed .step-label {
  color: var(--clr-accent);
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--clr-border);
  margin: 0 var(--sp-xs);
  margin-bottom: 18px;
  transition: background var(--duration) var(--ease);
}

.step-line.active {
  background: linear-gradient(90deg, var(--clr-accent), var(--clr-primary));
}

/* ============================================
   Sections
   ============================================ */
.section {
  padding: var(--sp-md) var(--sp-lg);
  display: none;
  animation: fadeInUp 0.4s var(--ease) both;
}

.section.active {
  display: block;
}

.section-header {
  margin-bottom: var(--sp-lg);
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: var(--sp-xs);
}

.section-desc {
  font-size: 0.9rem;
  color: var(--clr-text-muted);
  line-height: 1.5;
}

.section-actions {
  display: flex;
  gap: var(--sp-md);
  margin-top: var(--sp-xl);
  padding-top: var(--sp-lg);
  border-top: 1px solid var(--clr-border);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  padding: 12px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background var(--duration) var(--ease);
}

.btn:active::after {
  background: rgba(255, 255, 255, 0.1);
}

.btn-primary {
  background: var(--clr-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--clr-primary-light);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: var(--clr-surface-3);
  color: var(--clr-text-dim);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-accent {
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-accent-dark));
  box-shadow: var(--shadow-md), 0 0 30px rgba(131, 164, 126, 0.2);
}

.btn-accent:hover {
  box-shadow: var(--shadow-lg), 0 0 40px rgba(131, 164, 126, 0.3);
}

.btn-secondary {
  background: var(--clr-surface-2);
  color: var(--clr-text);
  border: 1px solid var(--clr-border);
}

.btn-secondary:hover {
  background: var(--clr-surface-3);
  border-color: rgba(255, 255, 255, 0.12);
}

.btn-ghost {
  background: transparent;
  color: var(--clr-text-muted);
}

.btn-ghost:hover {
  color: var(--clr-text);
}

.btn-lg {
  padding: 16px 24px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.btn-icon,
.btn-icon-right,
.btn-icon-left {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ============================================
   Add Buttons
   ============================================ */
.add-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-md);
  margin-bottom: var(--sp-lg);
}

/* ============================================
   Camera Preview
   ============================================ */
.camera-preview {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: black;
  display: flex;
  flex-direction: column;
}

.camera-preview.hidden {
  display: none;
}

.camera-preview video {
  flex: 1;
  object-fit: cover;
  width: 100%;
}

.camera-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-xl);
  padding: var(--sp-xl);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
}

.btn-capture {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid white;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s var(--ease);
}

.btn-capture:active {
  transform: scale(0.9);
}

.btn-capture-inner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: white;
  transition: transform 0.15s var(--ease);
}

.btn-capture:active .btn-capture-inner {
  transform: scale(0.85);
}

.btn-cancel-camera {
  background: none;
  border: none;
  color: white;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  padding: var(--sp-md);
}

/* ============================================
   Items Grid
   ============================================ */
.items-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-md);
  margin-bottom: var(--sp-md);
}

.item-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 3/4;
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  animation: fadeInScale 0.3s var(--ease) both;
}

.item-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration) var(--ease);
  line-height: 1;
}

.item-delete:hover {
  background: var(--clr-danger);
}

.item-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  font-size: 0.7rem;
  color: white;
  font-weight: 600;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  text-align: center;
  padding: var(--sp-2xl) var(--sp-lg);
  color: var(--clr-text-dim);
}

.empty-state.hidden {
  display: none;
}

.empty-icon {
  width: 64px;
  height: 64px;
  fill: var(--clr-text-dim);
  opacity: 0.4;
  margin-bottom: var(--sp-md);
}

.empty-state p {
  font-size: 1rem;
  margin-bottom: var(--sp-xs);
}

.empty-hint {
  font-size: 0.8rem;
  color: var(--clr-text-dim);
}

/* ============================================
   Color Items (Step 2)
   ============================================ */
.color-items {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.color-item {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md);
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  animation: fadeInUp 0.3s var(--ease) both;
}

.color-item-thumb {
  width: 56px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

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

.color-item-name {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: var(--sp-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.color-input-group {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.color-swatch-wrapper {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.color-swatch {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-sm);
  border: 2px solid var(--clr-border);
  cursor: pointer;
  transition: border-color var(--duration) var(--ease);
}

.color-picker-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  padding: 0;
  border: none;
}

.hex-input {
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--clr-text);
  font-family: 'Work Sans', monospace;
  font-size: 0.85rem;
  width: 110px;
  transition: border-color var(--duration) var(--ease);
}

.hex-input:focus {
  outline: none;
  border-color: var(--clr-primary);
}

.hex-input::placeholder {
  color: var(--clr-text-dim);
}

.color-original-label {
  font-size: 0.7rem;
  color: var(--clr-text-dim);
  margin-top: var(--sp-xs);
  margin-bottom: var(--sp-sm);
}

/* -- Color section label -- */
.color-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--clr-text-muted);
  margin-bottom: var(--sp-xs);
}

.color-label-accent {
  color: var(--clr-accent-light);
}

/* -- Multicolor expanded section -- */
.multicolor-section {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: max-height 0.35s var(--ease), opacity 0.3s var(--ease);
  margin-top: var(--sp-xs);
  padding-left: var(--sp-sm);
  border-left: 2px solid rgba(131, 164, 126, 0.25);
}

.multicolor-section.expanded {
  max-height: 200px;
  opacity: 1;
  pointer-events: all;
  padding-bottom: var(--sp-xs);
}

/* -- Multi-color toggle button -- */
.btn-multicolor-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  margin-top: var(--sp-sm);
  padding: 6px 10px;
  font-size: 0.72rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--clr-accent);
  background: rgba(131, 164, 126, 0.08);
  border: 1px solid rgba(131, 164, 126, 0.2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.btn-multicolor-toggle:hover {
  background: rgba(131, 164, 126, 0.15);
  border-color: rgba(131, 164, 126, 0.4);
}

.btn-multicolor-toggle svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ============================================
   Model Selection (Step 3)
   ============================================ */
.model-selection {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-lg);
}

.model-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-xl) var(--sp-lg);
  background: var(--clr-surface);
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  position: relative;
  font-family: inherit;
  color: var(--clr-text);
}

.model-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--clr-surface-2);
}

.model-card.selected {
  border-color: var(--clr-primary);
  background: rgba(66, 85, 117, 0.15);
  box-shadow: 0 0 20px rgba(66, 85, 117, 0.2);
}

.model-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--clr-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration) var(--ease);
}

.model-card.selected .model-icon {
  background: var(--clr-primary);
}

.model-icon svg {
  width: 48px;
  height: 48px;
  fill: var(--clr-text-dim);
  transition: fill var(--duration) var(--ease);
}

.model-card.selected .model-icon svg {
  fill: white;
}

.model-label {
  font-size: 1rem;
  font-weight: 600;
}

.model-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--clr-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  opacity: 0;
  transform: scale(0.5);
  transition: all var(--duration) var(--ease);
}

.model-card.selected .model-check {
  opacity: 1;
  transform: scale(1);
}

/* ============================================
   Generate Loading
   ============================================ */
.generate-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-2xl) 0;
  text-align: center;
}

.generate-loading.hidden {
  display: none;
}

.generate-spinner {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: var(--sp-xl);
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border: 3px solid var(--clr-surface-3);
  border-top-color: var(--clr-primary);
  border-right-color: var(--clr-accent);
  border-radius: 50%;
  animation: spin 1.5s linear infinite;
}

.spinner-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: auto;
}

.generate-text {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--sp-xs);
}

.generate-subtext {
  font-size: 0.85rem;
  color: var(--clr-text-muted);
}

/* ============================================
   Result
   ============================================ */
.result-container {}

.result-container.hidden {
  display: none;
}

.result-image-wrapper {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin-bottom: var(--sp-lg);
  border: 1px solid var(--clr-border);
  position: relative;
}

.result-image {
  width: 100%;
  display: block;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

/* ============================================
   Error State
   ============================================ */
.generate-error {
  text-align: center;
  padding: var(--sp-2xl) 0;
}

.generate-error.hidden {
  display: none;
}

.error-icon {
  width: 56px;
  height: 56px;
  fill: var(--clr-danger);
  margin-bottom: var(--sp-md);
}

.error-text {
  font-size: 1rem;
  color: var(--clr-danger);
  margin-bottom: var(--sp-lg);
}

/* ============================================
   Modal
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s var(--ease) both;
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--clr-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  animation: slideUp 0.35s var(--ease) both;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-lg);
  border-bottom: 1px solid var(--clr-border);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--clr-surface-2);
  color: var(--clr-text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration) var(--ease);
}

.modal-close:hover {
  background: var(--clr-surface-3);
  color: var(--clr-text);
}

.modal-body {
  padding: var(--sp-lg);
}

.modal-footer {
  display: flex;
  gap: var(--sp-md);
  justify-content: flex-end;
  padding: var(--sp-md) var(--sp-lg) var(--sp-lg);
  border-top: 1px solid var(--clr-border);
}

/* ============================================
   Form Elements
   ============================================ */
.form-group {
  margin-bottom: var(--sp-lg);
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--clr-text-muted);
  margin-bottom: var(--sp-sm);
}

.form-input {
  width: 100%;
  padding: 12px var(--sp-md);
  background: var(--clr-surface-2);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  color: var(--clr-text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color var(--duration) var(--ease);
}

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

.form-input::placeholder {
  color: var(--clr-text-dim);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
  position: fixed;
  top: var(--sp-lg);
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  width: calc(100% - var(--sp-xl) * 2);
  max-width: 420px;
  pointer-events: none;
}

.toast {
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  animation: toastIn 0.35s var(--ease) both;
  pointer-events: auto;
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: var(--shadow-md);
}

.toast.out {
  animation: toastOut 0.3s var(--ease) both;
}

.toast-success {
  background: rgba(131, 164, 126, 0.9);
  color: white;
}

.toast-error {
  background: rgba(224, 85, 85, 0.9);
  color: white;
}

.toast-info {
  background: rgba(66, 85, 117, 0.9);
  color: white;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.85);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

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

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* ============================================
   Responsive fine-tuning
   ============================================ */
@media (max-width: 360px) {
  .add-buttons {
    grid-template-columns: 1fr;
  }

  .items-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-header h2 {
    font-size: 1.3rem;
  }
}

@media (min-width: 481px) {
  .app {
    padding-top: var(--sp-md);
  }

  .modal-content {
    border-radius: var(--radius-xl);
    margin-bottom: var(--sp-xl);
  }
}

/* Safe area for iPhone notch */
@supports (padding-top: env(safe-area-inset-top)) {
  .header {
    padding-top: calc(var(--sp-md) + env(safe-area-inset-top));
  }

  .modal-content {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ============================================
   Visitor Help Popup
   ============================================ */
.btn-visitor-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-sm);
  padding: 7px 14px;
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--clr-accent);
  background: rgba(131, 164, 126, 0.10);
  border: 1px solid rgba(131, 164, 126, 0.25);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}

.btn-visitor-help:hover {
  background: rgba(131, 164, 126, 0.2);
}

.visitor-help-popup {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-lg);
}

.visitor-help-popup.hidden {
  display: none;
}

.visitor-help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
}

.visitor-help-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--clr-surface);
  border-radius: var(--radius-xl);
  padding: var(--sp-xl) var(--sp-lg);
  overflow-y: auto;
  max-height: 90vh;
  animation: slideUp 0.3s var(--ease) both;
}

.visitor-help-header {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-lg);
}

.visitor-help-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.visitor-help-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--clr-surface-2);
  color: var(--clr-text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.visitor-help-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--sp-lg);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.visitor-help-steps li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-md);
}

.help-step-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--clr-accent);
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.visitor-help-steps li div strong {
  font-size: 0.95rem;
  color: var(--clr-text);
}

.visitor-help-steps li div p {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--clr-text-muted);
  line-height: 1.5;
}

/* ============================================
   Role Selection Screen
   ============================================ */
.role-selection-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-lg);
  background: var(--clr-bg);
}

.role-selection-screen.hidden {
  display: none;
}

.role-selection-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-lg);
  animation: fadeInUp 0.5s var(--ease) both;
}

.role-title {
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
}

.role-desc {
  font-size: 0.95rem;
  color: var(--clr-text-muted);
  text-align: center;
}

.role-buttons {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.role-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-xl) var(--sp-lg);
  width: 100%;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--duration) var(--ease);
  text-align: center;
}

.role-btn-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.role-btn-sub {
  font-size: 0.82rem;
  opacity: 0.75;
}

.role-btn-visitor {
  background: linear-gradient(135deg, var(--clr-accent-dark), var(--clr-accent));
  color: white;
}

.role-btn-visitor:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(131, 164, 126, 0.35);
}

.role-btn-sales {
  background: var(--clr-surface-2);
  color: var(--clr-text);
  border-color: var(--clr-border);
}

.role-btn-sales:hover {
  background: var(--clr-surface-3);
  border-color: var(--clr-primary);
}

/* ============================================
   Logo Overlay Module
   ============================================ */
.logo-overlay-container {
  position: absolute;
  inset: 0;
  pointer-events: none; /* Only the logo itself should catch events */
  overflow: hidden;
  z-index: 10;
}

.logo-overlay-container:not(.hidden) {
  display: block;
}

.client-logo-drag {
  position: absolute;
  cursor: grab;
  user-select: none;
  pointer-events: auto;
  /* Sizing and position controlled via JS: left, top, width, height */
  border: 2px solid transparent;
  transition: border-color var(--duration) var(--ease);
}

/* Verberg het gebroken afbeeldingsicoontje als er nog geen bron is ingesteld */
.client-logo-drag:not([src]),
.client-logo-drag[src=""] {
  display: none;
}

.client-logo-drag:active {
  cursor: grabbing;
}

.client-logo-drag.is-editing {
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: var(--shadow-md);
  background: rgba(255,255,255,0.05); /* slight backdrop to see edges */
}

/* Controls bar below the image */
.logo-controls-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  margin-top: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  background: var(--clr-surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--clr-border);
  animation: fadeInUp 0.3s var(--ease) both;
}

.logo-controls-bar.hidden {
  display: none;
}

.logo-slider-group {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.logo-slider-group label {
  font-size: 0.8rem;
  color: var(--clr-text-muted);
}

.logo-slider {
  flex: 1;
  accent-color: var(--clr-primary);
}

.btn-remove-logo {
  background: transparent;
  border: none;
  color: var(--clr-danger);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background var(--duration);
}

.btn-remove-logo:hover {
  background: rgba(224, 85, 85, 0.1);
}