/* =====================================================================
   DAP TUNE - base styles (shared by public site and admin)
   Palette: ~80% black/graphite, ~15% white/gray, ~5% red
   ===================================================================== */
:root {
  --bg: #070707;
  --bg-2: #101010;
  --card: #111111;
  --card-2: #151515;
  --border: #282828;
  --border-soft: #1c1c1c;
  --text: #f5f5f5;
  --text-2: #9a9a9a;
  --text-3: #6b6b6b;
  --red: #e10600;
  --red-hover: #c40500;
  --red-soft: rgba(225, 6, 0, 0.12);
  --green: #3fb950;
  --amber: #d29922;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Barlow Condensed', 'Barlow', system-ui, 'Segoe UI', Arial, sans-serif;
  --container: 1840px;
  --header-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.1; font-weight: 700; }
p { margin: 0 0 0.9em; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
::selection { background: var(--red); color: #fff; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 clamp(16px, 3vw, 40px); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.small { font-size: 0.875rem; }
.hidden, [hidden] { display: none !important; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: var(--font-display); font-size: 1rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  cursor: pointer; white-space: nowrap; transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: #444; background: #141414; }
.btn-dark { background: #161616; border-color: var(--border); color: var(--text); }
.btn-dark:hover { background: #1d1d1d; }
.btn-danger { background: #2a0b0a; border-color: #5c1210; color: #ff6b66; }
.btn-danger:hover { background: #3a0e0c; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn .ico { width: 18px; height: 18px; flex: none; }

/* ---------------- Forms ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > span, .field-label { font-size: 0.8rem; color: var(--text-2); font-weight: 600; letter-spacing: 0.02em; }
.input, select.input, textarea.input {
  width: 100%; background: #0c0c0c; border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm);
  padding: 10px 12px; font: inherit; font-size: 0.95rem; min-height: 42px;
}
textarea.input { resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: #555; box-shadow: 0 0 0 3px rgba(225, 6, 0, 0.15); }
.input::placeholder { color: #555; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.92rem; }
.check input { width: 17px; height: 17px; accent-color: var(--red); }

/* ---------------- Stars ---------------- */
.stars { position: relative; display: inline-block; font-size: 0.95em; letter-spacing: 1px; line-height: 1; vertical-align: -1px; }
.stars-bg { color: #333; }
.stars-fg { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; color: #f5c518; }

/* ---------------- Modal ---------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, 0.72); display: flex;
  align-items: center; justify-content: center; padding: 16px; animation: fade 0.15s ease;
}
.modal {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px; padding: 24px; width: 100%; max-width: 460px;
  max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow);
}
.modal-wide { max-width: 760px; }
.modal-title { font-family: var(--font-display); font-size: 1.5rem; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 8px; }
.modal-text { color: var(--text-2); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.order-msg { font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------------- Toasts ---------------- */
#toasts { position: fixed; z-index: 2000; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  background: #1a1a1a; color: var(--text); border: 1px solid var(--border); border-left: 3px solid #666; padding: 12px 16px; border-radius: 10px;
  box-shadow: var(--shadow); font-size: 0.92rem; opacity: 0; transform: translateY(10px); transition: all 0.25s;
}
.toast.show { opacity: 1; transform: none; }
.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }

/* ---------------- States ---------------- */
.state { text-align: center; padding: 48px 20px; color: var(--text-2); border: 1px dashed var(--border); border-radius: var(--radius); background: rgba(255, 255, 255, 0.01); }
.state h3 { color: var(--text); font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.04em; font-size: 1.3rem; margin-bottom: 6px; }
.state-error { border-color: #4a1412; }
.spinner { width: 28px; height: 28px; border: 3px solid #2a2a2a; border-top-color: var(--red); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #121212 0%, #1a1a1a 50%, #121212 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }

.preview-banner {
  position: fixed; left: 12px; bottom: 12px; z-index: 900; background: #1a1400; color: #e7c54a; border: 1px solid #4d4000;
  padding: 6px 10px; border-radius: 8px; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.03em; max-width: 280px; pointer-events: none; opacity: 0.92;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
