/* ============================================================
   STORE.CSS — Beat grid, audio player bar, checkout modal
   ============================================================ */

/* ── Store hero strip ── */
.store-hero {
  padding-top: calc(var(--nav-h) + 3rem);
  padding-bottom: 2.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.store-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 12vw, 9rem);
  line-height: 0.88;
  letter-spacing: 0.01em;
  color: var(--text);
  animation: fade-in 0.5s var(--ease-out) both;
}

.store-hero__sub {
  font-size: 0.85rem;
  color: var(--text-2);
  margin-top: 0.75rem;
  letter-spacing: 0.04em;
  animation: fade-in 0.5s var(--ease-out) 0.15s both;
}

/* ── Filter bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.filter-bar__label {
  font-family: var(--font-heading);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-right: 0.5rem;
  white-space: nowrap;
}

.filter-bar__options {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  flex-wrap: wrap;
  min-width: 0;
}

.filter-btn {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.45em 0.9em;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  min-height: 36px;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.filter-btn:hover { color: var(--text-2); border-color: var(--border-2); }

.filter-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: rgba(76,201,240,0.35);
}

.filter-bar__count {
  font-size: 0.72rem;
  color: var(--text-3);
  margin-left: auto;
  font-family: var(--font-body);
  white-space: nowrap;
}

/* ── Beat grid ── */
.store-main {
  padding-block: 2.5rem 6rem; /* bottom padding for player bar */
}

.beat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.store-empty-state {
  grid-column: 1 / -1;
  margin: 0;
  padding-block: 3rem;
  color: var(--text-3);
  font-size: 0.9rem;
  text-align: center;
}

/* Beat card overrides for store */
.beat-grid .beat-card__name {
  display: block;
  min-height: 0;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  word-break: normal;
  font-size: clamp(0.74rem, 0.68rem + 0.24vw, 0.84rem);
  line-height: 1.22;
}

.beat-grid .beat-card {
  position: relative;
}

.beat-card__pricing {
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.beat-card__actions {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  flex-shrink: 0;
}

.beat-card__cart-btn {
  min-height: 30px;
  padding-inline: 0.58rem;
  font-size: 0.58rem;
  letter-spacing: 0.05em;
  line-height: 1;
  white-space: nowrap;
  border-radius: var(--r-sm);
  border: none;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-heading);
  font-weight: 700;
  text-transform: uppercase;
  transition: color 160ms ease, background 160ms ease, transform 160ms var(--ease-out);
}

.beat-card__cart-btn:hover {
  transform: translateY(-1px);
}

.beat-card__cart-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

@media (max-width: 1180px) {
  .beat-card__pricing {
    align-items: flex-start;
    flex-direction: column;
  }

  .beat-card__actions {
    width: 100%;
  }

  .beat-card__cart-btn {
    flex: 1;
    justify-content: center;
  }
}

/* Playing indicator — pulsing accent border */
.beat-grid .beat-card.is-playing {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-glow);
}

.beat-card__playing-indicator {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  display: none;
}

.beat-card.is-playing .beat-card__playing-indicator {
  display: flex;
}

/* ── Sticky audio player bar ── */
.player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 950;
  height: 72px;
  background: rgba(14,14,14,0.97);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-top: 1px solid var(--border-2);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-inline: var(--gutter);
  transform: translateY(100%);
  transition: transform 350ms var(--ease-spring);
  will-change: transform;
}

.player-bar.visible {
  transform: translateY(0);
}

/* Track info */
.player-bar__info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
  max-width: 220px;
}

.player-bar__art {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
}

.player-bar__track {
  min-width: 0;
}

@keyframes player-marquee {
  0%, 10%    { transform: translateX(0); }
  90%, 100%  { transform: translateX(var(--marquee-dist, -100px)); }
}

.player-bar__name {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.player-bar__name.marquee {
  text-overflow: clip;
}

.player-bar__marquee-inner {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
  animation: player-marquee var(--marquee-dur, 6s) linear infinite;
}

.player-bar__meta {
  font-size: 0.68rem;
  color: var(--text-3);
  margin-top: 1px;
}

/* Controls */
.player-bar__controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.player-ctrl {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, transform 160ms var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.player-ctrl:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.player-ctrl:active { transform: scale(0.9); }
.player-ctrl svg { width: 16px; height: 16px; }

.player-ctrl--play {
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: var(--bg);
}

.player-ctrl--play:hover {
  background: #fff;
  color: var(--bg);
}

/* Progress */
.player-bar__progress-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  max-width: 480px;
}

.player-bar__time-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.62rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.player-bar__progress {
  position: relative;
  height: 3px;
  background: var(--surface-3);
  border-radius: 2px;
  cursor: pointer;
  touch-action: none;
}

.player-bar__progress:hover { height: 5px; margin-block: -1px; }

.player-bar__progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.25s linear;
  pointer-events: none;
}

.player-bar__progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 160ms ease;
  pointer-events: none;
}

.player-bar__progress:hover .player-bar__progress-thumb,
.player-bar__progress.seeking .player-bar__progress-thumb {
  transform: translate(-50%, -50%) scale(1);
}

/* Volume */
.player-bar__volume {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.player-bar__volume svg {
  width: 16px;
  height: 16px;
  color: var(--text-3);
  flex-shrink: 0;
}

.player-bar__volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 72px;
  height: 3px;
  background: var(--surface-3);
  border-radius: 2px;
  cursor: pointer;
  outline: none;
}

.player-bar__volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-2);
  cursor: pointer;
  transition: background 160ms ease;
}

.player-bar__volume-slider:hover::-webkit-slider-thumb {
  background: var(--text);
}

/* Close player */
.player-bar__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  transition: color 160ms ease;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.player-bar__close:hover { color: var(--text); }
.player-bar__close svg { width: 14px; height: 14px; }

/* "Preview not available" state */
.player-bar.no-audio .player-bar__progress-fill {
  background: var(--text-3);
}

.player-bar__preview-notice {
  display: none;
  font-size: 0.72rem;
  color: var(--text-3);
  font-style: italic;
}

.player-bar.no-audio .player-bar__preview-notice { display: block; }
.player-bar.no-audio .player-bar__progress-wrap   { display: none; }

/* ── Checkout modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms var(--ease-out);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateY(16px) scale(0.98);
  opacity: 0;
  transition:
    transform 320ms var(--ease-spring),
    opacity   280ms var(--ease-out);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
  line-height: 1;
}

.modal__close:hover { background: var(--surface-3); color: var(--text); }

/* Modal beat header */
.modal__beat-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.modal__beat-art {
  width: 56px;
  height: 56px;
  border-radius: var(--r-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
}

.modal__beat-name {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.modal__beat-sub {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 2px;
}

/* Steps */
.modal__step { padding: 1.5rem; }

/* Step indicator */
.modal__steps-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.modal__step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-2);
  transition: background 250ms ease, transform 250ms ease;
}

.modal__step-dot.active {
  background: var(--accent);
  transform: scale(1.4);
}

.modal__step-dot.done {
  background: var(--accent);
  opacity: 0.4;
}

.modal__step-line {
  height: 1px;
  flex: 1;
  background: var(--border);
}

/* Step heading */
.modal__step h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 1.25rem;
}

/* License cards */
.license-cards {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.license-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 1rem 1.1rem 1rem 3rem;
  cursor: pointer;
  transition: border-color 200ms ease, background 200ms ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  min-height: 82px;
}

.license-card:hover { border-color: var(--border-2); background: var(--surface-2); }

.license-card.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.license-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
  min-width: 0;
}

.license-card__name {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text);
  min-width: 0;
}

.license-card__price {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-alt);
  flex-shrink: 0;
  line-height: 1.1;
  text-align: right;
  white-space: nowrap;
}

.license-card__features {
  font-size: 0.72rem;
  color: var(--text-2);
  line-height: 1.5;
}

.license-card__radio {
  position: absolute;
  top: 1rem;
  left: 1.1rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  transition: border-color 200ms ease;
}

.license-card.selected .license-card__radio {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--surface);
}

/* Form fields */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-family: var(--font-heading);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
}

.form-group input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 0.7em 0.9em;
  font-size: 0.9rem;
  width: 100%;
  transition: border-color 200ms ease, background 200ms ease;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-group input:focus {
  border-color: var(--accent);
  background: rgba(76,201,240,0.04);
}

.form-group input.error { border-color: var(--accent-alt); }

.form-error {
  font-size: 0.72rem;
  color: var(--accent-alt);
  display: none;
}

.form-group.has-error .form-error { display: block; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* Modal CTA row */
.modal__actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.modal__actions .btn { flex: 1; justify-content: center; }

/* Processing spinner */
.btn-processing {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}

.btn-processing::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: var(--bg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Success step */
.modal__success {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.5rem 1.5rem;
  gap: 1rem;
}

.modal__success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(76,201,240,0.12);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__success-icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: check-draw 0.5s var(--ease-out) 0.2s forwards;
}

.modal__success h3 {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
}

.modal__success p {
  font-size: 0.88rem;
  color: var(--text-2);
  max-width: 32ch;
  line-height: 1.6;
}

.modal__success strong { color: var(--accent); }

/* ── Mobile player bar — Spotify-style compact ── */
@media (max-width: 640px) {
  /* Slim progress line at very top (Spotify style) */
  .player-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--surface-3);
    pointer-events: none;
  }

  .player-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 2px;
    width: var(--mobile-progress, 0%);
    background: var(--accent);
    pointer-events: none;
    transition: width 0.25s linear;
  }

  .player-bar {
    /* Tighter, compact layout */
    height: auto;
    min-height: 64px;
    padding: 8px 10px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
  }

  /* Album art — slightly larger for scannability */
  .player-bar__art {
    width: 46px;
    height: 46px;
    border-radius: 6px;
    flex-shrink: 0;
  }

  /* Track info — fills space, text truncated to single line */
  .player-bar__info {
    flex: 1;
    min-width: 0;
    max-width: none;
    gap: 0;
  }

  .player-bar__name {
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .player-bar__name.marquee {
    text-overflow: clip;
  }

  /* Hide BPM/key/tag meta — too cluttered on mobile */
  .player-bar__meta { display: none; }

  /* EQ bars — hide on mobile, not readable at small size */
  #player-eq { display: none; }

  /* Progress bar — hidden on mobile (using top line instead) */
  .player-bar__progress-wrap { display: none; }

  /* Volume — hidden on mobile */
  .player-bar__volume { display: none; }

  /* Controls: prev + play + next — all with 44px minimum touch targets */
  .player-bar__controls {
    flex-shrink: 0;
    gap: 2px;
  }

  .player-ctrl {
    width: 44px;
    height: 44px;
  }

  .player-ctrl svg {
    width: 18px;
    height: 18px;
  }

  /* Play button — prominent, 48px for easy tapping */
  .player-ctrl--play {
    width: 48px;
    height: 48px;
    border-radius: 50%;
  }

  .player-ctrl--play svg {
    width: 20px;
    height: 20px;
  }

  /* Close — 44px touch target */
  .player-bar__close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .player-bar__close svg {
    width: 16px;
    height: 16px;
  }

  /* Preview notice — compact single line */
  .player-bar__preview-notice {
    font-size: 0.7rem;
    font-style: normal;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
  }

  /* Modal — bottom sheet on mobile */
  .modal {
    max-width: 100%;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 92dvh;
    border-bottom: none;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-overlay.open .modal {
    transform: translateY(0) scale(1);
  }

  .modal-overlay .modal {
    transform: translateY(40px) scale(1);
  }
}

@media (max-width: 768px) {
  .beat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .beat-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .beat-grid { grid-template-columns: repeat(3, 1fr); }
}
/* ============================================================
   CHECKOUT SYSTEM VISIBILITY & PROPORTIONS SAFE-GUARD
   ============================================================ */

/* Forces the browser's hidden state rules to absolutely overrule any custom display styles */
.modal__step[hidden],
[hidden] {
  display: none !important;
}

/* Elegant, responsive sizing for your step 3 action buttons row layout */
.modal .modal__step .modal__actions {
  display: flex !important;
  gap: 0.75rem !important;
  width: 100% !important;
  overflow: visible !important;
}

/* Restores perfect uniform proportions and height lines to checkout action buttons */
.modal .modal__step .modal__actions .btn,
.modal .modal__step .modal__actions button#confirm-payment-btn {
  flex: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;

  /* Restores the native design height limits */
  height: 46px !important;
  min-height: 46px !important;
  max-height: 46px !important;

  /* Text and inner spacing mechanics */
  padding: 0 12px !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;

  white-space: normal !important;
  line-height: 1.2 !important;
  box-sizing: border-box !important;
}
