/* =====================================================
   SECOND PLACE SHOP — Shared Stylesheet
   Used by: index.html, staff/index.html
   ===================================================== */

:root {
  --bg: #eef4f0;
  --surface: #f9fcfa;
  --ink: #1e3932;
  --muted: #4a6b60;
  --accent: #00704a;
  --border: #c0d9cc;
  --shadow: rgba(30,57,50,0.12);
  --success: #1e3932;

  /* Tag preview dimensions (1" × 3.3" at 96px/in, scaled 1.8×) */
  --tag-w: 570px;
  --tag-h: 173px;
  --tag-r: 10px;
  --tag-pad-x: 35px;
  --name-max-px: 130px;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 999; opacity: 0.4;
}

/* ---- HEADER ---- */
header {
  padding: 24px 20px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.header-inner {
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  max-width: 1120px; margin: 0 auto;
}
header h1 { font-family: 'DM Serif Display', serif; font-size: 1.9rem; }
header span { font-size: 0.8rem; color: var(--muted); font-weight: 300; letter-spacing: 0.12em; text-transform: uppercase; }

/* ---- LAYOUT ---- */
.app {
  flex: 1;
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 36px;
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
  padding: 36px 20px;
  align-items: start;
}

/* ---- CONTROLS ---- */
.controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px;
  display: flex; flex-direction: column; gap: 22px;
  box-shadow: 0 4px 24px var(--shadow);
  animation: slideIn 0.5s ease both;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-label {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 8px;
}
.field-group { display: flex; flex-direction: column; gap: 8px; }
label { font-size: 0.82rem; font-weight: 500; color: var(--muted); }

input[type="text"] {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.95rem; font-family: 'DM Sans', sans-serif;
  background: var(--bg); color: var(--ink);
  transition: border-color 0.2s; outline: none;
}
input[type="text"]:focus { border-color: var(--accent); }

.char-counter { font-size: 0.72rem; color: var(--muted); text-align: right; margin-top: -4px; }
.char-counter.warn { color: var(--accent); font-weight: 600; }

/* ---- FONTS ---- */
.font-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.font-option {
  border: 2px solid var(--border); border-radius: 8px;
  padding: 10px 12px; cursor: pointer; text-align: center;
  transition: all 0.15s; background: var(--bg); line-height: 1.2;
}
.font-option:hover { border-color: var(--muted); }
.font-option.active { border-color: var(--accent); background: #eef6f1; }
.font-option .font-name { font-size: 0.62rem; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.08em; }

/* ---- COLOR ---- */
.color-row { display: flex; gap: 12px; }
.color-swatch {
  flex: 1; height: 52px; border-radius: 10px; cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em;
}
.color-swatch:hover { transform: scale(1.04); }
.color-swatch.active { border-color: var(--accent); }
.color-swatch.black-swatch { background: #111111; color: #ffffff; }
.color-swatch.white-swatch { background: #ffffff; color: #111111; border: 3px solid var(--border); }
.color-swatch.white-swatch.active { border-color: var(--accent); }

/* ---- ICONS ---- */
.icon-categories { display: flex; flex-direction: column; gap: 8px; }
.icon-accordion { border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden; }
.icon-accordion-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 12px; cursor: pointer; background: var(--bg);
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink);
  transition: background 0.15s; user-select: none;
}
.icon-accordion-header:hover { background: #ddeee6; }
.icon-accordion-header.open  { background: #ddeee6; }
.accordion-arrow { font-size: 0.6rem; color: var(--muted); transition: transform 0.2s; display: inline-block; }
.icon-accordion-header.open .accordion-arrow { transform: rotate(90deg); }
.icon-accordion-body { display: none; padding: 8px; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.icon-accordion-body.open { display: grid; }

.icon-option {
  aspect-ratio: 1; border: 2px solid var(--border); border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s; background: var(--bg); gap: 3px;
  padding: 5px 3px;
}
.icon-option:hover { border-color: var(--muted); transform: scale(1.06); }
.icon-option.active { border-color: var(--accent); background: #eef6f1; }
.icon-option svg { width: 26px; height: 26px; flex-shrink: 0; }
.icon-option .icon-lbl { font-size: 0.5rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; text-align: center; line-height: 1.2; }
.icon-option.active svg { color: var(--accent); }

.icon-none-row {
  aspect-ratio: unset; flex-direction: row;
  justify-content: flex-start; padding: 9px 12px;
  font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  border-radius: 8px;
}
.icon-none-row.active { border-color: var(--accent); background: #eef6f1; }

/* ---- POSITION ---- */
.position-row { display: flex; gap: 8px; }
.pos-btn {
  flex: 1; padding: 9px; font-size: 0.78rem;
  border: 2px solid var(--border); border-radius: 8px;
  background: var(--bg); cursor: pointer; transition: all 0.15s;
  font-family: 'DM Sans', sans-serif; color: var(--ink); font-weight: 500;
}
.pos-btn:hover { border-color: var(--muted); }
.pos-btn.active { border-color: var(--accent); background: #eef6f1; }

.divider { height: 1px; background: var(--border); }

.action-row {
  display: flex; flex-direction: column; gap: 10px;
  padding-top: 4px; border-top: 1px solid var(--border);
}

/* ---- BUTTONS ---- */
.btn-primary {
  width: 100%; padding: 14px;
  background: var(--accent); color: white; border: none; border-radius: 10px;
  font-family: 'DM Sans', sans-serif; font-size: 0.95rem; font-weight: 600;
  cursor: pointer; letter-spacing: 0.03em;
  transition: background 0.2s, transform 0.1s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:hover { background: #005c3a; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { background: #bbb; cursor: not-allowed; }

.btn-secondary {
  width: 100%; padding: 11px;
  background: transparent; color: var(--ink);
  border: 1.5px solid var(--border); border-radius: 10px;
  font-family: 'DM Sans', sans-serif; font-size: 0.88rem; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-secondary:hover { border-color: var(--ink); background: var(--bg); }

/* Shared wide button (checkout / submit) */
.btn-wide {
  padding: 14px 28px; background: var(--accent); color: white;
  border: none; border-radius: 10px;
  font-family: 'DM Sans', sans-serif; font-size: 1rem; font-weight: 600;
  cursor: pointer; letter-spacing: 0.03em;
  transition: background 0.2s, transform 0.1s; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-wide:hover { background: #005c3a; }
.btn-wide:active { transform: scale(0.98); }
.btn-wide:disabled { background: #aaa; cursor: not-allowed; }

/* ---- TOAST ---- */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink); color: white;
  padding: 12px 24px; border-radius: 30px;
  font-size: 0.88rem; font-weight: 500; z-index: 1000;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
  opacity: 0; pointer-events: none; white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error   { background: #c0392b; }

/* ---- PREVIEW ---- */
.preview-area {
  display: flex; flex-direction: column; align-items: center; gap: 24px;
  animation: fadeIn 0.6s ease both 0.15s;
  position: sticky; top: 24px;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.preview-label { font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.preview-stage { perspective: 1000px; width: 100%; display: flex; justify-content: center; }
.tag-wrapper { transition: transform 0.35s ease; transform-style: preserve-3d; }
.tag-wrapper:hover { transform: rotateY(-5deg) rotateX(2deg) scale(1.015); }

.name-tag {
  width: var(--tag-w); height: var(--tag-h);
  border-radius: var(--tag-r);
  position: relative; overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.2) inset,
    0 -1px 0 rgba(0,0,0,0.12) inset,
    0 16px 48px rgba(0,0,0,0.28),
    0 4px 10px rgba(0,0,0,0.14);
  transition: background 0.35s;
  display: flex; align-items: center; justify-content: center;
  padding: 0 var(--tag-pad-x);
}
.name-tag::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0) 100%);
  border-radius: var(--tag-r) var(--tag-r) 0 0; pointer-events: none; z-index: 2;
}
.clip-bar {
  position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  width: 50px; height: 8px; background: rgba(128,128,128,0.35);
  border-radius: 0 0 5px 5px; z-index: 3;
}
.tag-content {
  position: relative; z-index: 2; width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 0;
}
.tag-icon { display: none; line-height: 1; flex-shrink: 0; }
.tag-name { white-space: nowrap; line-height: 1; font-weight: normal; transition: font-size 0.2s, color 0.3s; }

.size-note { display: flex; align-items: center; gap: 8px; font-size: 0.72rem; color: var(--muted); }
.size-note::before, .size-note::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---- CART / REQUEST LIST ---- */
.cart-section {
  max-width: 1120px; margin: 0 auto 48px;
  width: 100%; padding: 0 20px; display: none;
}
.cart-section.has-items { display: block; }

.cart-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 26px;
  box-shadow: 0 4px 24px var(--shadow);
}
.cart-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.cart-header h2 { font-family: 'DM Serif Display', serif; font-size: 1.3rem; }
.cart-items { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }

.cart-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.cart-item-tag {
  width: 160px; height: 48px; border-radius: 5px; background: #111;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.cart-item-tag::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 100%);
  border-radius: 5px 5px 0 0; pointer-events: none;
}
.cart-item-details { flex: 1; min-width: 0; }
.cart-item-title { font-size: 0.9rem; font-weight: 600; color: var(--ink); margin-bottom: 3px; }
.cart-item-sub   { font-size: 0.75rem; color: var(--muted); }
.cart-item-remove {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  width: 30px; height: 30px; cursor: pointer; font-size: 1.1rem; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.cart-item-remove:hover { border-color: var(--accent); color: var(--accent); background: #eef6f1; }

.cart-footer {
  border-top: 1px solid var(--border); padding-top: 18px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}

.item-badge {
  display: inline-block; background: #d4e9e2; color: var(--ink);
  border-radius: 20px; font-size: 0.68rem; font-weight: 600;
  padding: 2px 8px; letter-spacing: 0.04em;
}

/* ---- SPINNER ---- */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: white;
  border-radius: 50%; animation: spin 0.7s linear infinite; display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- RESPONSIVE ---- */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; padding: 20px 14px; }
  header { padding: 18px 18px 14px; }
  :root { --tag-w: 430px; --tag-h: 130px; }
  .preview-area { position: static; }
}
@media (max-width: 500px) {
  :root { --tag-w: 320px; --tag-h: 97px; }
  .cart-item-tag { width: 120px; height: 36px; }
}
@media (min-width: 821px) {
  .controls     { order: 1; }
  .preview-area { order: 2; }
}
