/* ===============================================
   VARIABLES
   =============================================== */
:root {
  --base-width: 600px;

  /* Colors */
  --neuro-bg: #e8e8e8;
  --neuro-surface: #f0f0f0;
  --neuro-elevated: #ebebeb;
  --gold: #b69121;
  --gold-light: #c9a227;
  --gold-dark: #a47e1b;
  --gold-deeper: #705515;
  --gold-accent: #dbb42c;
  --text-primary: #2a2a2a;
  --text-secondary: #4a4a4a;
  --text-muted: #7a7a7a;
  --text-light: #9a9a9a;
  --text-white: #ffffff;

  /* Spacing */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 12px;
  --sp-lg: 16px;
  --sp-xl: 20px;

  /* Typography */
  --font-s: 0.75rem;
  --font-m: 0.875rem;
  --font-l: 1.25rem;
  --font-xl: 1.5rem;
  --font-2xl: 1.75rem;

  /* Border radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  /* Shadows */
  --shadow-raised: 3px 3px 6px rgba(0,0,0,0.1), -3px -3px 6px rgba(255,255,255,0.9);
  --shadow-raised-lg: 8px 8px 16px rgba(0,0,0,0.12), -8px -8px 16px rgba(255,255,255,0.85);
  --shadow-hover: 4px 4px 8px rgba(0,0,0,0.12), -4px -4px 8px rgba(255,255,255,1);
  --shadow-inset: inset 3px 3px 6px rgba(0,0,0,0.1), inset -3px -3px 6px rgba(255,255,255,0.8);
  --shadow-pressed: inset 3px 3px 6px rgba(0,0,0,0.15), inset -2px -2px 4px rgba(255,255,255,0.5);
  --shadow-btn: 4px 4px 8px rgba(0,0,0,0.15), -3px -3px 6px rgba(255,255,255,0.9), inset 1px 1px 2px rgba(255,255,255,0.3), inset -1px -1px 2px rgba(0,0,0,0.1);
  --shadow-btn-hover: 6px 6px 12px rgba(0,0,0,0.18), -4px -4px 8px rgba(255,255,255,1), inset 1px 1px 2px rgba(255,255,255,0.4), inset -1px -1px 2px rgba(0,0,0,0.1);

  /* Gradients */
  --grad-gold: linear-gradient(135deg, var(--gold-dark), var(--gold-light));
  --grad-gold-hover: linear-gradient(135deg, var(--gold), var(--gold-accent));

  /* Transitions */
  --ease: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===============================================
   RESET & BASE
   =============================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { overflow-x: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--neuro-bg);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===============================================
   HEADER
   =============================================== */
.site-header {
  position: sticky;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: var(--sp-xs) var(--sp-md);
  background: var(--neuro-surface);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  width: 100%;
  z-index: 100;
}

.header-logo {
  height: 62px;
  width: auto;
}

.header-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--font-l);
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .header-logo { height: 32px; }
  .header-title {
    position: static;
    transform: none;
    font-size: var(--font-m);
    margin-left: var(--sp-md);
  }
}

/* ===============================================
   LAYOUT
   =============================================== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--sp-lg);
  flex: 1;
}

.map-section,
.config-section {
  width: var(--base-width);
  background: var(--neuro-surface);
  border-radius: var(--r-xl);
  padding: var(--sp-lg);
  margin-bottom: var(--sp-lg);
  box-shadow: var(--shadow-raised-lg);
  border: 1px solid rgba(255,255,255,0.6);
  animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.map-section { height: calc(var(--base-width) * 1.33 + 10px); }

.map-section,
.config-section { justify-self: center; }

/* ===============================================
   FORMS & INPUTS
   =============================================== */
.config-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  background: var(--neuro-elevated);
  padding: var(--sp-md);
  border-radius: var(--r-lg);
  border: 1px solid rgba(255,255,255,0.6);
  box-shadow: 6px 6px 12px rgba(0,0,0,0.1), -6px -6px 12px rgba(255,255,255,0.9);
}

.form-label,
.price-label {
  font-size: var(--font-s);
  font-weight: 650;
  color: var(--gold-deeper);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.config-summary h3 {
  font-size: var(--font-s);
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: var(--sp-xs);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-input,
#location-search {
  padding: var(--sp-sm) var(--sp-md);
  font-size: var(--font-m);
  border: none;
  border-radius: var(--r-md);
  transition: var(--ease);
  background: var(--neuro-bg);
  color: var(--text-primary);
  box-shadow: var(--shadow-inset);
  margin-top: var(--sp-xs);
}

.form-input { width: 100%; }
#location-search { flex: 1; background: var(--neuro-elevated); }

.form-input::placeholder,
#location-search::placeholder { color: var(--text-light); }

.form-input:focus,
#location-search:focus {
  outline: none;
  box-shadow: var(--shadow-inset), 0 0 0 2px var(--gold-light);
}

/* Shared subtitle text style */
.subtitle,
.radio-subtitle,
.form-hint,
.price-details,
.map-hint {
  font-size: var(--font-s);
  color: var(--text-muted);
}

.price-details { margin-bottom: var(--sp-sm); text-align: center; }

/* ===============================================
   BUTTONS
   =============================================== */
.btn,
.btn-cta {
  padding: var(--sp-sm) var(--sp-md);
  background: var(--grad-gold);
  color: var(--text-white);
  border: none;
  border-radius: var(--r-md);
  font-size: var(--font-m);
  font-weight: 600;
  cursor: pointer;
  transition: var(--ease);
  white-space: nowrap;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: var(--shadow-btn);
}

.btn:hover,
.btn-cta:hover {
  background: var(--grad-gold-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-btn-hover);
}

.btn:active,
.btn-cta:active {
  transform: translateY(0);
  box-shadow: var(--shadow-pressed);
}

/* Button variants */
.btn-remove { background: linear-gradient(135deg, #8a280f, #a12905); }

.btn-cta {
  flex: 1;
  padding: var(--sp-sm) var(--sp-lg);
  font-size: var(--font-l);
  position: relative;
  overflow: hidden;
}

.btn-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  left: -100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.13), transparent);
  transition: left 0.5s;
}

.btn-cta:hover::before { left: 100%; }

/* Secondary button (different style) */
.btn-secondary {
  padding: var(--sp-xs) var(--sp-md);
  background: var(--neuro-elevated);
  color: var(--text-secondary);
  border: none;
  border-radius: var(--r-md);
  font-size: var(--font-s);
  font-weight: 600;
  cursor: pointer;
  transition: var(--ease);
  margin-top: var(--sp-xs);
  box-shadow: var(--shadow-raised);
}

.btn-secondary:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.btn-secondary:active {
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.1), inset -2px -2px 4px rgba(255,255,255,0.8);
  transform: translateY(0);
}

/* ===============================================
   SEARCH
   =============================================== */
.search-container,
.marker-address-row {
  display: flex;
  gap: var(--sp-sm);
  align-items: center;
}

.marker-address-row .form-input { flex: 1; }

/* ===============================================
   HIDDEN RADIO INPUTS (shared)
   =============================================== */
.marker-shape-option input[type="radio"],
.marker-color-option input[type="radio"],
.radio-card input[type="radio"],
.frame-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* ===============================================
   SELECTABLE CARDS (radio/frame/marker)
   =============================================== */
.marker-shape-option,
.marker-color-option,
.radio-card,
.frame-option {
  position: relative;
  cursor: pointer;
}

.marker-shape-selector,
.marker-color-selector {
  display: flex;
  gap: var(--sp-md);
  margin-bottom: var(--sp-sm);
  margin-top: var(--sp-xs);
}

.marker-shape-option,
.marker-color-option { flex: 1; }

.marker-color-option {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Card previews */
.marker-shape-preview,
.radio-content,
.frame-preview {
  display: flex;
  flex-direction: column;
  padding: var(--sp-sm);
  background: var(--neuro-bg);
  border-radius: var(--r-md);
  transition: var(--ease);
  box-shadow: var(--shadow-raised);
}

.radio-content,
.frame-preview { border: 1px solid rgba(255,255,255,0.6); }
.radio-content { padding: var(--sp-sm) var(--sp-md); }
.frame-preview { align-items: center; gap: var(--sp-xs); }
.marker-shape-preview { align-items: center; gap: 4px; color: var(--text-secondary); }

/* Card hover states */
.marker-shape-option:hover .marker-shape-preview,
.radio-card:hover .radio-content,
.frame-option:hover .frame-preview {
  box-shadow: var(--shadow-hover);
}

/* Card checked states */
.marker-shape-option input:checked + .marker-shape-preview,
.radio-card input:checked + .radio-content,
.frame-option input:checked + .frame-preview {
  background: var(--neuro-elevated);
  box-shadow: var(--shadow-inset), 0 0 0 2px var(--gold);
}

.marker-shape-option input:checked + .marker-shape-preview { color: var(--gold-dark); }
.marker-shape-preview svg { color: var(--text-secondary); transition: var(--ease); }

/* Card labels */
.marker-shape-preview span,
.marker-color-option span,
.frame-name {
  font-size: var(--font-s);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.marker-color-option span { color: var(--text-muted); margin-top: 4px; text-align: center; }
.frame-name { color: var(--text-secondary); }

/* Color preview */
.marker-color-preview {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: var(--ease);
  box-shadow: 3px 3px 6px rgba(0,0,0,0.15), -2px -2px 4px rgba(255,255,255,0.8);
}

.marker-color-option:hover .marker-color-preview { transform: scale(1.1); }

.marker-color-option input:checked + .marker-color-preview {
  box-shadow: 0 0 0 3px var(--gold), 4px 4px 8px rgba(0,0,0,0.2), -3px -3px 6px rgba(255,255,255,0.9);
  transform: scale(1.05);
}

/* Radio card text */
.radio-title { font-size: var(--font-m); font-weight: 700; color: var(--text-primary); }

.radio-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-md);
}

/* Frame selector */
.frame-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-md);
}

.frame-color-sample {
  width: 50px;
  height: 50px;
  border-radius: var(--r-md);
  box-shadow: 3px 3px 6px rgba(0,0,0,0.15), -2px -2px 4px rgba(255,255,255,0.8);
}

.recommended-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--grad-gold);
  color: var(--text-white);
  font-size: var(--font-s);
  font-weight: 700;
  padding: 3px 6px;
  border-radius: var(--r-sm);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: var(--shadow-btn);
  z-index: 10;
}

/* ===============================================
   CHECKBOX
   =============================================== */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  cursor: pointer;
  padding: var(--sp-xs);
  border-radius: var(--r-sm);
  transition: var(--ease);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.checkbox-label:hover { background: rgba(255, 209, 0, 0.08); }
.checkbox-text { font-size: var(--font-m); font-weight: 600; color: var(--text-secondary); }

.neumorphic-checkbox { position: relative; }
.neumorphic-checkbox .form-checkbox { position: absolute; opacity: 0; width: 0; height: 0; }

.checkbox-custom {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  background: var(--neuro-bg);
  box-shadow: inset 3px 3px 6px rgba(0,0,0,0.12), inset -3px -3px 6px rgba(255,255,255,0.9);
  transition: var(--ease);
  position: relative;
  flex-shrink: 0;
}

.checkbox-custom::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold-accent));
  transition: var(--ease);
  box-shadow: 2px 2px 4px rgba(0,0,0,0.15), -1px -1px 2px rgba(255,255,255,0.8);
}

.neumorphic-checkbox .form-checkbox:checked + .checkbox-custom {
  box-shadow: inset 4px 4px 8px rgba(0,0,0,0.15), inset -4px -4px 8px rgba(255,255,255,0.7);
}

.neumorphic-checkbox .form-checkbox:checked + .checkbox-custom::after {
  transform: translate(-50%, -50%) scale(1);
}

.neumorphic-checkbox:hover .checkbox-custom {
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.1), inset -2px -2px 4px rgba(255,255,255,0.95), 0 0 0 2px rgba(182, 145, 33, 0.2);
}

/* ===============================================
   MAP PREVIEW
   =============================================== */
.map-preview-wrapper {
  position: relative;
  width: 540px;
  height: 720px;
  margin: 0 auto var(--sp-sm);
  box-shadow: 12px 12px 24px rgba(0,0,0,0.15), -6px -6px 12px rgba(255,255,255,0.8);
  border-radius: var(--r-sm);
  flex-shrink: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.map-frame {
  width: 100%;
  height: 100%;
  padding: 24px;
  position: relative;
  border-radius: var(--r-sm);
  box-shadow: rgba(14, 30, 37, 0.12) 0px 2px 4px 0px, rgba(14, 30, 37, 0.32) 0px 2px 16px 0px;
}

.map-plywood {
  position: relative;
  width: 100%;
  height: 100%;
  background-image: url("https://www.malagi.cz/user/documents/upload/img/plywood07_big.png");
  background-size: cover;
  background-position: center;
  box-shadow: inset 0px 0px 12px rgb(41, 41, 41), inset 0px 0px 2px rgb(54, 54, 54);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 6px;
}

/* Smaller format (20x30) sizing */
.map-preview-wrapper.small-format {
  width: 400px;
  height: 600px;
}

.map-preview-wrapper.small-format .map-frame {
  padding: 18px;
}

.map-preview-wrapper.small-format .map-plywood {
  padding: 12px;
  gap: 4px;
}

.map-section:has(.small-format) {
  height: auto;
}

.map-section:has(.small-format) .map-hint {
  width: 420px;
  margin: 0 auto;
}

.map-preview-wrapper.small-format .map {
  min-height: 300px;
}

.map-boundary { position: relative; flex: 1; min-height: 0; }
.map { width: 100%; height: 100%; min-height: 400px; z-index: 8; }

.map-border {
  position: absolute;
  inset: 0;
  border: 2px solid #2a2a2a;
  box-shadow: inset 0 0 8px rgba(79, 72, 67, 0.3);
  pointer-events: none;
  z-index: 10;
}

.frame-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  z-index: 15;
  transition: var(--ease);
  border-radius: var(--r-sm);
}

.engraved-text-preview {
  position: relative;
  z-index: 12;
  text-align: left;
  pointer-events: none;
}

.preview-text {
  font-family: 'Tinos', serif;
  font-size: var(--font-s);
  font-weight: 600;
  color: rgba(79, 58, 43, 0.85);
  text-shadow: 0 1px 1px rgba(255,255,255,0.3), inset 0 -1px 1px rgba(0,0,0,0.2);
  margin: 0;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
  min-height: 1.1em;
}

.preview-text:empty::before { content: '\00a0'; visibility: hidden; }
#preview-text1 { font-size: var(--font-xl); min-height: 1.65rem; }
#preview-text2 { min-height: 0.85rem}

.map-hint {
  text-align: center;
  padding: var(--sp-xs) var(--sp-sm);
  background: rgba(255,255,255,0.4);
  border-radius: var(--r-md);
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.06), inset -2px -2px 4px rgba(255,255,255,0.7);
}

/* ===============================================
   PRICE & CTA
   =============================================== */
.price-cta-container {
  display: flex;
  gap: var(--sp-md);
  align-items: stretch;
  margin-bottom: var(--sp-xs);
}

.price-display {
  background: var(--neuro-elevated);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--r-lg);
  border: 1px solid rgba(255,255,255,0.6);
  flex: 0.6;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: inset 4px 4px 8px rgba(0,0,0,0.08), inset -4px -4px 8px rgba(255,255,255,0.9);
}

.price-amount {
  font-size: var(--font-2xl);
  font-weight: 700;
  color: var(--gold-dark);
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.price-currency { font-size: var(--font-l); font-weight: 700; margin-left: 3px; }

/* ===============================================
   CONFIG SUMMARY
   =============================================== */
.config-summary {
  padding: var(--sp-xs) var(--sp-sm);
  border-top: 1px solid rgba(0,0,0,0.06);
  opacity: 0.7;
}

.config-summary ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--sp-md);
}

.config-summary li {
  font-size: var(--font-s);
  color: var(--text-muted);
  display: inline;
  line-height: 1.5;
}

.config-summary li strong { color: var(--text-muted); font-weight: 500; }
.config-summary span { color: var(--text-secondary); }

/* ===============================================
   FOOTER
   =============================================== */
.footer {
  position: relative;
  left: 0;
  background: var(--neuro-surface);
  color: var(--text-muted);
  text-align: center;
  padding: var(--sp-lg);
  margin-top: auto;
  border-top: 1px solid rgba(255, 209, 0, 0.15);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.06);
  width: 100%;
}

.footer p { font-size: var(--font-s); opacity: 0.8; }

/* ===============================================
   MAPBOX
   =============================================== */
.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right { display: none; }
.mapboxgl-ctrl-logo { margin: 4px !important; opacity: 0.5; }
.mapboxgl-popup { z-index: 20; }

.mapboxgl-popup-content {
  padding: var(--sp-sm);
  border-radius: var(--r-md);
  background: var(--neuro-surface);
  border: 1px solid rgba(255, 209, 0, 0.2);
  color: var(--text-primary);
  box-shadow: var(--shadow-btn-hover);
}

/* ===============================================
   MARKERS
   =============================================== */
.custom-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--ease);
  filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.3));
}

.custom-marker svg { display: block; }
.custom-marker:hover { filter: drop-shadow(3px 3px 5px rgba(0,0,0,0.4)); }

.custom-marker-pin,
.custom-marker-house,
.custom-marker-heart { transform-origin: center bottom; }

.custom-marker:hover { transform: scale(1.2) translateY(-2px); }

/* ===============================================
   RESPONSIVE
   =============================================== */
@media (max-width: 632px) {
  .container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: var(--sp-lg) 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    --scale-factor: calc(100vw / (var(--base-width) + 2 * var(--sp-lg)));
  }

  .map-section,
  .config-section {
    width: var(--base-width);
    transform: scale(var(--scale-factor));
    transform-origin: top center;
    margin-left: 0;
    margin-right: 0;
    touch-action: manipulation;
  }

  /* Fix touch areas for interactive elements when scaled */
  .config-section input,
  .config-section button,
  .config-section label {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .map-section {
    --section-height: calc(var(--base-width) * 1.33 + 10px);
    --total-space: calc(var(--section-height) + var(--sp-lg) * 3);
    height: var(--section-height);
    margin-bottom: calc(var(--total-space) * (1 - var(--scale-factor)) * -1 + 40px);
  }

  .map-section:has(.small-format) {
    --section-height: 630px;
  }

  .config-section {
    --config-height: 880px;
    margin-bottom: calc(var(--config-height) * (1 - var(--scale-factor)) * -1 + var(--sp-lg));
  }
}

@media (min-width: 600px) {
  .radio-group { grid-template-columns: repeat(2, 1fr); }
  .preview-text { font-size: var(--font-m); }
  #preview-text1 { font-size: var(--font-2xl); }
}

@media (min-width: 992px) {
  .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-xl);
    align-items: start;
    padding: var(--sp-lg);
  }
  .map-section { position: sticky; top: var(--sp-md); }
  .map-preview-wrapper { max-width: 100%; }
}

/* ===============================================
   ANIMATIONS & ACCESSIBILITY
   =============================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

*:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--neuro-bg); }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: var(--r-sm); border: 2px solid var(--neuro-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }
