/* ═══════════════════════════════════════════
   GymFloor Designer — Warm Light Theme
   ═══════════════════════════════════════════ */

:root {
  --bg:        #f5f3f0;
  --bg2:       #ffffff;
  --bg3:       #eae7e3;
  --border:    #dbd7d1;
  --border2:   #c4bfb8;
  --text:      #100e0c;
  --text2:     #363028;
  --text3:     #635d56;
  --accent:    #c98a10;
  --accent2:   #a87008;
  --red:       #d43030;
  --green:     #2a9960;
  --blue:      #2272c8;
  --radius:    6px;
  --radius-lg: 12px;
  --font-head: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --shadow:    0 4px 24px rgba(0,0,0,.09);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── NAV ─────────────────────────────────── */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(245,243,240,.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 56px;
  display: flex; align-items: center;
}
.topnav-inner {
  width: 100%; max-width: 1200px; margin: auto;
  display: flex; align-items: center; gap: 1.5rem;
}
.brand {
  display: flex; align-items: center; gap: .5rem;
  text-decoration: none; color: var(--text);
}
.brand-icon { font-size: 1.1rem; filter: grayscale(1); }
.brand-text  { font-family: var(--font-head); font-size: 1.4rem; letter-spacing: .1em; }
.brand-text .accent { color: var(--accent); }
.tagline { color: var(--text3); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }

/* Nav links */
.nav-links {
  display: flex; align-items: center; gap: .25rem; margin-left: auto;
}
.nav-link {
  padding: .35rem .75rem; font-size: .82rem;
  color: var(--text2); text-decoration: none;
  border-radius: var(--radius); transition: all .2s;
}
.nav-link:hover { color: var(--text); background: var(--bg3); }

/* Dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown-btn {
  padding: .35rem .75rem; font-size: .82rem;
  background: transparent; border: none;
  color: var(--text2); cursor: pointer;
  border-radius: var(--radius); transition: all .2s;
  font-family: var(--font-body);
}
.nav-dropdown-btn:hover,
.nav-dropdown:hover .nav-dropdown-btn { color: var(--accent); background: rgba(201,138,16,.08); }
.nav-dropdown-menu {
  display: none;
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); padding: .4rem;
  min-width: 190px; box-shadow: var(--shadow);
  z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu { display: flex; flex-direction: column; gap: 2px; }
.nav-dropdown-item {
  padding: .5rem .85rem; font-size: .85rem;
  color: var(--text2); text-decoration: none;
  border-radius: var(--radius); transition: all .15s;
  white-space: nowrap;
}
.nav-dropdown-item:hover { color: var(--text); background: var(--bg3); }

/* ── CONTAINERS ──────────────────────────── */
.container       { max-width: 960px;  margin: auto; padding: 0 1.5rem; }
.container.wide  { max-width: 1280px; margin: auto; padding: 0 1.5rem; }

/* ── HERO / STEP 1 ────────────────────────── */
.hero {
  position: relative;
  padding: 5rem 0 6rem;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 39px, var(--border2) 39px, var(--border2) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, var(--border2) 39px, var(--border2) 40px);
  opacity: .6;
}
.hero > .container { position: relative; z-index: 1; }
.hero-copy { text-align: center; margin-bottom: 3rem; }

.eyebrow {
  font-size: .72rem; letter-spacing: .18em;
  color: var(--accent); text-transform: uppercase;
  margin-bottom: .75rem;
}
h1 {
  font-family: var(--font-head);
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 1;
  letter-spacing: .02em;
  margin-bottom: 1rem;
}
h2 {
  font-family: var(--font-head);
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: .04em;
}
.accent { color: var(--accent); }
.subtitle { color: var(--text2); font-size: 1.05rem; max-width: 520px; margin: auto; }

/* ── DIMENSION CARD ───────────────────────── */
.dim-card {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  max-width: 620px;
  margin: auto;
  box-shadow: var(--shadow);
}
.dim-card-header {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem;
}
.step-dot {
  font-family: var(--font-head);
  font-size: 2rem; color: var(--accent);
  line-height: 1;
}
.dim-card-header h2 { font-size: 1.6rem; }

.dim-unit-toggle {
  display: flex; gap: .5rem; margin-bottom: 1.5rem;
}
.unit-btn {
  flex: 1; padding: .5rem 1.2rem;
  background: transparent; border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text2);
  font-family: var(--font-body); font-size: .9rem; cursor: pointer;
  transition: all .2s;
}
.unit-btn.active {
  background: var(--accent); color: #000;
  border-color: var(--accent); font-weight: 600;
}
.unit-btn:not(.active):hover { border-color: var(--accent); color: var(--text); }

.dim-inputs {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem;
}
.dim-field { flex: 1; }
.dim-field label { display: block; font-size: .8rem; color: var(--text3); text-transform: uppercase; letter-spacing: .1em; margin-bottom: .4rem; }
.input-wrap { position: relative; }
.input-wrap input {
  width: 100%; padding: .75rem 3rem .75rem 1rem;
  background: var(--bg3); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); font-size: 1.4rem;
  outline: none; transition: border .2s;
}
.input-wrap input:focus { border-color: var(--accent); }
.input-wrap input::placeholder { color: var(--text3); }
.unit-label {
  position: absolute; right: .85rem; top: 50%; transform: translateY(-50%);
  font-size: .8rem; color: var(--text3); pointer-events: none;
}
.dim-divider {
  font-family: var(--font-head); font-size: 2rem;
  color: var(--text3); padding-top: 1.5rem;
  flex-shrink: 0;
}

.area-preview {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .6rem 1rem;
  font-size: .9rem; color: var(--text2);
  margin-bottom: 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
}
.area-tag {
  font-size: .75rem; padding: .2rem .6rem;
  border-radius: 20px; background: var(--bg);
  border: 1px solid var(--border2);
}

/* ── CTA BUTTON ───────────────────────────── */
.cta-btn {
  width: 100%; padding: .9rem 1.5rem;
  background: var(--accent); color: #000;
  border: none; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 1rem; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .6rem;
  transition: all .2s;
}
.cta-btn:hover { background: var(--accent2); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(168,112,8,.25); }
.cta-btn:active { transform: translateY(0); }

.secondary-btn {
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--border2); margin-top: .75rem;
}
.secondary-btn:hover { background: var(--bg3); box-shadow: none; transform: none; border-color: var(--accent); }

/* ── SECTION HEADER ───────────────────────── */
.section-header { text-align: center; padding: 4rem 0 3rem; }
.section-header .subtitle { margin-top: .75rem; }

/* ── LAYOUTS GRID ─────────────────────────── */
.layouts-section { background: var(--bg2); border-top: 1px solid var(--border); }
.layouts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  padding-bottom: 4rem;
}
.layout-card {
  background: var(--bg); border: 2px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  cursor: pointer; transition: all .25s;
  position: relative;
}
.layout-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,0,0,.12); }
.layout-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,138,16,.22); }

.card-preview {
  width: 100%; aspect-ratio: 4/3; background: var(--bg2);
  overflow: hidden; position: relative;
}
.card-preview svg { width: 100%; height: 100%; }

.card-body { padding: 1.25rem; }
.card-badge {
  font-size: .7rem; letter-spacing: .12em; text-transform: uppercase;
  padding: .2rem .65rem; border-radius: 20px;
  background: rgba(201,138,16,.12); color: var(--accent);
  border: 1px solid rgba(201,138,16,.28); margin-bottom: .6rem;
  display: inline-block;
}
.card-title { font-family: var(--font-head); font-size: 1.4rem; letter-spacing: .04em; margin-bottom: .3rem; }
.card-desc { font-size: .85rem; color: var(--text2); line-height: 1.5; margin-bottom: 1rem; }
.card-select-btn {
  width: 100%; padding: .6rem;
  background: transparent; border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); font-size: .9rem; cursor: pointer;
  transition: all .2s;
}
.layout-card.selected .card-select-btn {
  background: var(--accent); color: #000;
  border-color: var(--accent); font-weight: 600;
}
.card-select-btn:hover { border-color: var(--accent); }

/* ── EDITOR ───────────────────────────────── */
.editor-section {
  background: var(--bg); border-top: 1px solid var(--border);
  padding-bottom: 5rem;
}
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
}

/* Canvas */
.canvas-wrap {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); overflow: hidden;
}
.canvas-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.canvas-title { font-family: var(--font-head); font-size: 1.2rem; letter-spacing: .05em; }
.canvas-actions { display: flex; gap: .5rem; }
.tool-btn {
  padding: .35rem .75rem; font-size: .78rem;
  background: transparent; border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text2);
  cursor: pointer; transition: all .2s; font-family: var(--font-body);
}
.tool-btn:hover, .tool-btn.active { border-color: var(--accent); color: var(--accent); }

.canvas-outer { padding: 1.5rem; overflow: auto; }
#floor-canvas { display: block; }

.canvas-scale-bar {
  padding: .5rem 1.5rem .75rem;
  display: flex; align-items: center; gap: .75rem;
}
.scale-line {
  height: 3px; width: 80px;
  background: linear-gradient(90deg, var(--accent), var(--accent)) center/100% 1px no-repeat,
              linear-gradient(90deg, var(--accent), var(--accent)) left/1px 100% no-repeat,
              linear-gradient(90deg, var(--accent), var(--accent)) right/1px 100% no-repeat;
}
#scale-label { font-size: .75rem; color: var(--text3); }

/* Controls Panel */
.controls-panel {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--border);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  overflow-y: auto;
  max-height: calc(100vh - 90px);
  position: sticky; top: 70px;
}
.panel-section {
  background: var(--bg2); padding: 1.25rem;
}
.panel-title {
  font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text3); margin-bottom: 1rem;
}

.zone-color-row {
  display: flex; align-items: center; gap: .75rem;
  margin-bottom: .6rem;
}
.zone-color-row label { flex: 1; font-size: .85rem; color: var(--text2); }
.zone-color-row input[type=color] {
  width: 36px; height: 28px; padding: 0;
  border: 1px solid var(--border2); border-radius: var(--radius);
  background: transparent; cursor: pointer;
}

.zone-label-row { margin-bottom: .6rem; }
.zone-label-row label { display: block; font-size: .75rem; color: var(--text3); margin-bottom: .25rem; }
.zone-label-row input[type=text] {
  width: 100%; padding: .4rem .7rem;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); font-size: .85rem; outline: none;
}
.zone-label-row input:focus { border-color: var(--accent); }

.info-row { margin-bottom: .75rem; }
.info-row label { display: block; font-size: .75rem; color: var(--text3); margin-bottom: .25rem; text-transform: uppercase; letter-spacing: .08em; }
.panel-input {
  width: 100%; padding: .5rem .8rem;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); font-size: .88rem; outline: none;
}
.panel-input:focus { border-color: var(--accent); }
select.panel-input { cursor: pointer; }
select.panel-input option { background: var(--bg3); }

.download-section .cta-btn + .secondary-btn { margin-top: .75rem; }
.export-note { font-size: .75rem; color: var(--text3); margin-top: .75rem; line-height: 1.5; }

/* ── LOADING ──────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(245,243,240,.75); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.loading-box {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); padding: 2.5rem 3rem;
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.loading-box p { color: var(--text2); }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── CIRCLES PANEL ───────────────────────── */
.panel-hint {
  font-size: .76rem; color: var(--text3); margin-bottom: .75rem; line-height: 1.5;
}
.circle-presets {
  display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem;
}
.preset-btn {
  flex: 1; min-width: 0; padding: .35rem .5rem;
  font-size: .78rem; white-space: nowrap;
  background: transparent; border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text2);
  cursor: pointer; transition: all .2s; font-family: var(--font-body);
}
.preset-btn:hover { border-color: var(--accent); color: var(--accent); }

.circle-item {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .6rem .75rem;
  margin-bottom: .5rem;
}
.circle-item-header {
  display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem;
}
.circle-item-header input[type=color] {
  width: 28px; height: 22px; padding: 0; border: 1px solid var(--border2);
  border-radius: 3px; background: transparent; cursor: pointer; flex-shrink: 0;
}
.circle-item-header input[type=text] {
  flex: 1; padding: .25rem .5rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); font-size: .78rem; outline: none;
}
.circle-item-header input[type=text]:focus { border-color: var(--accent); }
.circle-delete-btn {
  background: transparent; border: none; color: var(--text3);
  cursor: pointer; font-size: .9rem; padding: 0 2px; flex-shrink: 0;
  transition: color .2s;
}
.circle-delete-btn:hover { color: var(--red); }

/* ── HOLE ITEMS (same style as circle items) ─ */
.hole-item {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .6rem .75rem;
  margin-bottom: .5rem;
}
.hole-item-header {
  display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem;
}
.hole-item-header input[type=text] {
  flex: 1; padding: .25rem .5rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: var(--font-body); font-size: .78rem; outline: none;
}
.hole-item-header input[type=text]:focus { border-color: var(--red); }
.hole-delete-btn {
  background: transparent; border: none; color: var(--text3);
  cursor: pointer; font-size: .9rem; padding: 0 2px;
  transition: color .2s; flex-shrink: 0;
}
.hole-delete-btn:hover { color: var(--red); }

/* ── FOOTER ───────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--text3); font-size: .8rem;
}

/* ══════════════════════════════════════════════
   MOBILE / RESPONSIVE
   ══════════════════════════════════════════════ */

/* ── Tablet (≤768px) ──────────────────────── */
@media (max-width: 768px) {
  /* Nav */
  .topnav { padding: 0 1rem; }
  .tagline { display: none; }

  /* Hero */
  .hero { padding: 3rem 0 4rem; }
  .hero-copy { margin-bottom: 2rem; }
  .subtitle { font-size: .95rem; }

  /* Dimension card */
  .dim-card { padding: 1.5rem; }
  .dim-card-header { margin-bottom: 1.25rem; }
  .dim-card-header h2 { font-size: 1.3rem; }

  /* Section header */
  .section-header { padding: 2.5rem 0 2rem; }

  /* Layouts grid — 2 columns on tablet */
  .layouts-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }

  /* Editor */
  .editor-layout { gap: 1rem; }

  /* Canvas toolbar — allow wrapping */
  .canvas-toolbar { flex-wrap: wrap; gap: .5rem; padding: .6rem 1rem; }
  .canvas-actions { flex-wrap: wrap; gap: .35rem; }
  .tool-btn { padding: .4rem .6rem; font-size: .72rem; }
  .canvas-title { font-size: 1rem; }

  /* Canvas */
  .canvas-outer { padding: .75rem; }

  /* Controls panel — not sticky on mobile (it sits below canvas) */
  .controls-panel {
    position: static;
    max-height: none;
    overflow-y: visible;
  }
}

/* ── Phone (≤480px) ───────────────────────── */
@media (max-width: 480px) {
  /* Nav */
  .topnav { height: 50px; }

  /* Hero */
  .hero { padding: 2rem 0 2.5rem; }
  .hero-copy { margin-bottom: 1.5rem; }
  h1 { font-size: clamp(2.2rem, 10vw, 3.5rem); }
  h2 { font-size: clamp(1.6rem, 6vw, 2.2rem); }

  /* Containers */
  .container, .container.wide { padding: 0 1rem; }

  /* Dimension card */
  .dim-card { padding: 1.25rem 1rem; }

  /* Stack width × length inputs vertically on small phones */
  .dim-inputs { flex-direction: column; gap: .75rem; }
  .dim-divider { padding-top: 0; font-size: 1.2rem; align-self: center; }
  .input-wrap input { font-size: 1.2rem; }

  /* Layouts grid — single column */
  .layouts-grid { grid-template-columns: 1fr; }
  .section-header { padding: 2rem 0 1.5rem; }

  /* Canvas toolbar */
  .canvas-toolbar { padding: .5rem .75rem; }
  .canvas-title { width: 100%; font-size: .95rem; }
  .canvas-actions { width: 100%; }
  .tool-btn { flex: 1; text-align: center; font-size: .68rem; padding: .4rem .3rem; }

  /* Canvas outer — horizontal scroll if needed */
  .canvas-outer { padding: .5rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Panel sections */
  .panel-section { padding: 1rem; }

  /* Bigger touch targets for buttons */
  .cta-btn { padding: 1rem 1.5rem; font-size: 1rem; min-height: 48px; }
  .unit-btn { min-height: 44px; }
  .preset-btn { min-height: 40px; padding: .5rem .6rem; }

  /* Loading box */
  .loading-box { padding: 2rem 1.5rem; }
}

/* ── Very small phones (≤360px) ────────────── */
@media (max-width: 360px) {
  .dim-card { padding: 1rem; }
  .canvas-actions { gap: .25rem; }
  .tool-btn { font-size: .62rem; padding: .35rem .2rem; }
}

/* ══════════════════════════════════════════════
   SPORT GROUND DESIGNER
   ══════════════════════════════════════════════ */
.sport-hero {
  position: relative; padding: 4rem 0 3rem;
  overflow: hidden; border-bottom: 1px solid var(--border);
}
.sport-hero .hero-bg {
  position: absolute; inset: 0; opacity: .55;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 39px, var(--border2) 39px, var(--border2) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, var(--border2) 39px, var(--border2) 40px);
}
.sport-editor { background: var(--bg); padding-bottom: 5rem; }
.sport-editor-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
  padding-top: 2rem;
}
.sport-canvas-wrap {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--radius-lg); overflow: hidden;
}
.sport-canvas-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
/* Mobile sport editor */
@media (max-width: 900px) {
  .sport-editor-layout { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .sport-hero { padding: 2rem 0 2rem; }
  .sport-editor-layout { gap: 1rem; padding-top: 1rem; }
  .sport-canvas-toolbar { flex-wrap: wrap; gap: .5rem; }
}

/* Nav mobile */
@media (max-width: 640px) {
  .nav-links { gap: 0; }
  .nav-link   { padding: .3rem .5rem; font-size: .78rem; }
  .nav-dropdown-btn { padding: .3rem .5rem; font-size: .78rem; }
  .nav-dropdown-menu { right: -20px; min-width: 170px; }
}
@media (max-width: 420px) {
  .nav-link span { display: none; }
  .nav-dropdown-btn { font-size: .72rem; }
}

/* ── FADE IN ──────────────────────────────── */
.fade-in { animation: fadeIn .4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ── SVG floor zone text ─────────────────── */
.zone-text-icon { font-size: 22px; dominant-baseline: middle; text-anchor: middle; }
.zone-text-label { font-family: 'Bebas Neue', sans-serif; font-size: 15px; dominant-baseline: middle; text-anchor: middle; fill: rgba(255,255,255,.9); letter-spacing: 1px; }
.zone-text-area  { font-family: 'DM Sans', sans-serif; font-size: 11px; dominant-baseline: middle; text-anchor: middle; fill: rgba(255,255,255,.55); }
