/* GotoAndPlay - Guitar Stems Companion Styles */

:root {
  --bg-page: #0d131f;
  --bg-header: rgba(13, 19, 31, 0.85);
  --bg-card: #162032;
  --bg-card-highlight: #1b283f;
  --bg-subtle: #1f2d47;
  --bg-input: #0f172a;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: #d87c79;
  
  --brand-primary: #d87c79;
  --brand-hover: #cd5955;
  --brand-accent: #ff6b6b;
  --brand-glow: rgba(216, 124, 121, 0.3);
  
  --text-main: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4), 0 2px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-active: 0 0 0 2px var(--brand-primary), 0 8px 30px -4px var(--brand-glow);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background ambient light effect */
body::before {
  content: "";
  position: fixed;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(circle, rgba(216, 124, 121, 0.12) 0%, rgba(13, 19, 31, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

/* App Wrapper: Single narrow column for mobile & desktop */
.app-container {
  width: 100%;
  max-width: 520px;
  padding: 0 16px 80px 16px;
  position: relative;
  z-index: 1;
}

/* Sticky Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.header-inner {
  width: 100%;
  max-width: 520px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-logo {
  height: 28px;
  width: auto;
  display: block;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(216, 124, 121, 0.15);
  color: var(--brand-primary);
  border: 1px solid rgba(216, 124, 121, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Intro Section */
.page-intro {
  margin-bottom: 24px;
  text-align: center;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 6px;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Feed Container */
.stems-feed {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Stem Card */
.stem-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
  scroll-margin-top: 80px;
}

.stem-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.stem-card.is-active {
  box-shadow: var(--shadow-active);
  border-color: var(--brand-primary);
}

.stem-card.is-target {
  animation: pulse-target 1.8s ease-in-out;
}

@keyframes pulse-target {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(216, 124, 121, 0.7); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(216, 124, 121, 0); }
  100% { transform: scale(1); }
}

/* Card Header Section */
.card-header {
  padding: 16px 18px 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stem-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
  width: 58px;
  height: 58px;
}

.stem-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-full);
  border: 2px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.stem-meta {
  flex-grow: 1;
  min-width: 0;
}

.stem-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.stem-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stem-year {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stem-artist {
  font-size: 0.92rem;
  color: var(--brand-primary);
  font-weight: 600;
}

/* Deep link button */
.btn-share {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background-color 0.2s;
  flex-shrink: 0;
}

.btn-share:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

/* Tags & Notes */
.stem-tags {
  padding: 0 18px 12px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stem-tag {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.01em;
}

.stem-notes {
  margin: 0 18px 14px 18px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-left: 3px solid var(--brand-primary);
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Player Body */
.player-container {
  background: rgba(0, 0, 0, 0.28);
  border-top: 1px solid var(--border-color);
  padding: 14px 18px 16px 18px;
}

/* Waveform display */
.waveform-box {
  width: 100%;
  height: 54px;
  position: relative;
  cursor: pointer;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.15);
  margin-bottom: 12px;
  overflow: hidden;
}

.waveform-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.6);
  z-index: 2;
  transition: opacity 0.3s ease;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(216, 124, 121, 0.3);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Player Controls Bar */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.controls-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Play/Pause Button */
.btn-play {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--brand-primary);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 12px rgba(216, 124, 121, 0.35);
  flex-shrink: 0;
}

.btn-play:hover {
  background: var(--brand-hover);
  transform: scale(1.05);
}

.btn-play:active {
  transform: scale(0.96);
}

.btn-play svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Repeat Toggle Button */
.btn-repeat {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-repeat:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.btn-repeat.is-active {
  background: rgba(216, 124, 121, 0.18);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.btn-repeat svg {
  width: 18px;
  height: 18px;
}

/* Time Indicator */
.time-display {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.time-current {
  color: var(--text-main);
  font-weight: 600;
}

/* Toast Notification (e.g., Link copied) */
.toast-notice {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--brand-primary);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-notice.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* PASSWORD GATE OVERLAY */
.gate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 20, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 999;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.gate-overlay.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gate-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  position: relative;
}

.gate-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px auto;
  background: rgba(216, 124, 121, 0.12);
  border: 1px solid rgba(216, 124, 121, 0.25);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-primary);
}

.gate-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.gate-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 22px;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gate-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 1.05rem;
  color: #fff;
  text-align: center;
  letter-spacing: 0.15em;
  font-weight: 700;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.gate-input:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

.gate-input.is-invalid {
  border-color: #ef4444;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.gate-submit {
  width: 100%;
  background: var(--brand-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.gate-submit:hover {
  background: var(--brand-hover);
}

.gate-submit:active {
  transform: scale(0.98);
}

.gate-hint {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Footer Section */
.site-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.site-footer a {
  color: var(--brand-primary);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}
