/* Core Stylesheet for GM Soundscape Control */

/* Reset & Base variables */
:root {
  --color-bg-darkest: #070a12;
  --color-bg-panel: rgba(18, 25, 41, 0.65);
  --color-bg-card: rgba(26, 36, 59, 0.45);
  --color-bg-card-hover: rgba(212, 175, 55, 0.08);
  --color-bg-card-active: rgba(212, 175, 55, 0.15);
  
  --color-border-card: rgba(212, 175, 55, 0.18);
  --color-border-card-hover: rgba(212, 175, 55, 0.5);
  --color-border-card-active: rgba(212, 175, 55, 1);
  
  --color-gold: #d4af37;
  --color-gold-glow: rgba(212, 175, 55, 0.4);
  --color-gold-muted: #bda043;
  --color-text-light: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-text-gold: #f3e5ab;
  --color-red: #ef4444;
  --color-red-glow: rgba(239, 68, 68, 0.3);
  
  --font-serif: 'Cinzel', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg-darkest);
  /* Magic circle radial glow effect */
  background-image: radial-gradient(circle at 50% 50%, #151e33 0%, #070a12 100%);
  color: var(--color-text-light);
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Container Layout */
.App-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* Global Header */
.App-header {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem 2rem;
  background-color: rgba(7, 10, 18, 0.8);
  border-bottom: 2px solid rgba(212, 175, 55, 0.3);
  backdrop-filter: blur(12px);
  z-index: 10;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.Header-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.Header-logo h1 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--color-text-gold);
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

.gold-glow-icon {
  color: var(--color-gold);
  font-size: 1.6rem;
  filter: drop-shadow(0 0 5px var(--color-gold-glow));
}

/* Panels Container Split Layout */
.Panels-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  height: 100%;
  gap: 2px;
  background-color: rgba(212, 175, 55, 0.25); /* golden vertical split line */
  box-sizing: border-box;
}

.Panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: rgba(7, 10, 18, 0.4);
}

.Panel-header {
  padding: 1.2rem;
  text-align: center;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  background-color: rgba(7, 10, 18, 0.85);
  backdrop-filter: blur(12px);
  z-index: 5;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.Panel-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--color-text-gold);
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
}

/* Main Viewport and Scroll Snap Stack */
.App-main {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.Stack {
  height: 100%;
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  grid-template-rows: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: none;
  scrollbar-width: none; /* Firefox */
}

.Stack::-webkit-scrollbar {
  display: none; /* Safari/Chrome */
}

@media (prefers-reduced-motion: no-preference) {
  .Stack {
    scroll-behavior: smooth;
  }
}

.Stack-view {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  width: 100%;
  height: 100%;
  display: block;
}

.Stack-viewContent {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 2rem;
  box-sizing: border-box;
  background: linear-gradient(135deg, rgba(13, 20, 36, 0.92), rgba(8, 12, 22, 0.96));
  position: relative;
}

/* View Header (Inner views only) */
.View-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  animation: fadeIn 0.4s ease-out;
}

.View-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--color-text-gold);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  position: relative;
}

.View-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--color-gold);
  box-shadow: 0 0 8px var(--color-gold-glow);
}

/* Tactile Back Card Button styles */
.card-back {
  border-color: rgba(212, 175, 55, 0.2);
}

.card-back:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: var(--color-border-card-hover);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.15);
}

.card-back .card-icon-wrapper {
  background: rgba(212, 175, 55, 0.05);
}

.card-back:hover .card-icon-wrapper {
  background: rgba(212, 175, 55, 0.1);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.15);
}

.card-back .card-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--color-text-gold);
}

.card-back .card-subtitle {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: -0.5rem;
}

/* Buttons Grid Layout */
.View-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
  justify-content: center;
  gap: 1.5rem;
  padding-bottom: 3rem; /* Allow space so scrolling feels complete */
  animation: fadeIn 0.5s ease-out;
}

/* Base Card Button (Category and SFX trigger elements share this exact visual footprint) */
.card-btn {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-card);
  border-radius: 12px;
  padding: 2.2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  cursor: pointer;
  position: relative;
  text-align: center;
  transition: var(--transition-smooth);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  min-height: 190px;
}

/* Decorative corner runes for fantasy aesthetic */
.card-btn::before, .card-btn::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  transition: var(--transition-smooth);
}

.card-btn::before {
  top: 6px;
  left: 6px;
  border-right: none;
  border-bottom: none;
}

.card-btn::after {
  bottom: 6px;
  right: 6px;
  border-left: none;
  border-top: none;
}

/* Hover effects */
.card-btn:hover {
  background: var(--color-bg-card-hover);
  border-color: var(--color-border-card-hover);
  box-shadow: 0 12px 30px rgba(212, 175, 55, 0.15);
  transform: translateY(-5px);
}

.card-btn:hover::before, .card-btn:hover::after {
  border-color: var(--color-gold);
  width: 10px;
  height: 10px;
}

.card-btn:active {
  transform: translateY(-2px) scale(0.98);
}

/* Icon inside cards */
.card-icon-wrapper {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(22, 28, 45, 0.6);
  border: 1px solid rgba(212, 175, 55, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.card-icon-wrapper i {
  font-size: 1.8rem;
  color: var(--color-gold-muted);
  transition: var(--transition-smooth);
}

.card-btn:hover .card-icon-wrapper {
  border-color: var(--color-gold);
  background: rgba(212, 175, 55, 0.05);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}

.card-btn:hover .card-icon-wrapper i {
  color: var(--color-gold);
  transform: scale(1.1);
}

/* Category card visual specifics */
.card-category .card-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--color-text-gold);
}

.card-category .card-subtitle {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: -0.5rem;
}

/* SFX / Sound Pad card visual specifics */
.card-sound {
  border-color: rgba(212, 175, 55, 0.12);
}

.card-sound .card-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--color-text-light);
}

.card-sound .card-duration {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-family: monospace;
}

/* Sound active / playing state */
.card-sound.is-playing {
  background: var(--color-bg-card-active);
  border-color: var(--color-border-card-active);
  box-shadow: 0 0 20px var(--color-gold-glow);
  transform: translateY(-2px) scale(1.02);
}

.card-sound.is-playing .card-icon-wrapper {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--color-gold);
  box-shadow: 0 0 12px var(--color-gold-glow);
  animation: pulseGlow 1.8s infinite alternate;
}

.card-sound.is-playing .card-icon-wrapper i {
  color: var(--color-gold);
  animation: spinSlow 8s linear infinite;
}

.card-sound.is-playing .card-title {
  color: var(--color-gold);
  text-shadow: 0 0 8px var(--color-gold-glow);
}

/* Panel-Specific Player Footer Dashboard */
.Panel-player {
  padding: 0.8rem 1.2rem;
  background-color: rgba(7, 10, 18, 0.95);
  border-top: 1px solid rgba(212, 175, 55, 0.25);
  backdrop-filter: blur(12px);
  z-index: 5;
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.4);
}

.Player-display {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-serif);
}

.Player-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  letter-spacing: 1px;
}

.Player-track {
  font-size: 1rem;
  color: var(--color-gold);
  font-weight: 600;
  text-shadow: 0 0 8px var(--color-gold-glow);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.Player-counter {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
  font-family: 'Courier New', Courier, monospace;
  white-space: nowrap;
  margin-left: -2px;
}

/* Audio Visualizer */
.Audio-visualizer {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
  margin-left: 0.5rem;
}

.Audio-visualizer span {
  display: block;
  width: 2.5px;
  height: 2px;
  background-color: var(--color-gold);
  border-radius: 2px;
}

.Audio-visualizer.is-active span {
  animation: bounceBars 0.8s ease infinite alternate;
}

.Audio-visualizer.is-active span:nth-child(1) { animation-delay: 0.1s; }
.Audio-visualizer.is-active span:nth-child(2) { animation-delay: 0.3s; }
.Audio-visualizer.is-active span:nth-child(3) { animation-delay: 0.0s; }
.Audio-visualizer.is-active span:nth-child(4) { animation-delay: 0.4s; }

.Player-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.Volume-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.control-btn {
  font-family: var(--font-serif);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-card);
  color: var(--color-text-light);
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-smooth);
  backdrop-filter: blur(8px);
}

.control-btn:hover {
  background: var(--color-bg-card-hover);
  border-color: var(--color-border-card-hover);
  color: var(--color-gold);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

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

.stop-btn {
  border-color: rgba(220, 53, 69, 0.4);
}

.stop-btn:hover {
  background: rgba(220, 53, 69, 0.1);
  border-color: #dc3545;
  color: #ff6b6b;
  box-shadow: 0 0 10px rgba(220, 53, 69, 0.3);
}

.loop-btn {
  padding: 0.35rem 0.5rem;
  font-size: 0.85rem;
  border-radius: 4px;
  line-height: 1;
}

.loop-btn.is-active {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--color-gold);
  color: var(--color-gold);
  text-shadow: 0 0 8px var(--color-gold-glow);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.25);
}

.volume-slider {
  -webkit-appearance: none;
  width: 90px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-gold);
  border: 1px solid var(--color-border-card);
  box-shadow: 0 0 8px var(--color-gold-glow);
  transition: var(--transition-smooth);
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: var(--color-text-light);
}

.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-gold);
  border: 1px solid var(--color-border-card);
  box-shadow: 0 0 8px var(--color-gold-glow);
  transition: var(--transition-smooth);
}

.volume-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  background: var(--color-text-light);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseGlow {
  from {
    box-shadow: 0 0 5px rgba(212, 175, 55, 0.2);
  }
  to {
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
  }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes bounceBars {
  0% { height: 3px; }
  100% { height: 20px; }
}

/* Parallax stack slide animations (Baseline Newly Available View Transitions API support) */
@supports (animation-timeline: view()) {
  .Stack-viewContent {
    animation: parallax linear both;
    animation-timeline: view(inline);
    animation-range: exit 0% exit 100%;
  }

  .Stack-view:not(:first-child) .Stack-viewContent {
    animation: parallax linear both, shadow-fade linear both;
    animation-timeline: view(inline), view(inline);
    animation-range: exit 0% exit 100%, entry 0% exit 100%;
  }

  @keyframes parallax {
    to {
      transform: translateX(35%);
      filter: brightness(0.5) blur(1px);
    }
  }

  @keyframes shadow-fade {
    0%, 100% { box-shadow: -15px 0 30px rgba(0, 0, 0, 0); }
    25%, 75% { box-shadow: -15px 0 30px rgba(0, 0, 0, 0.6); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .Stack-viewContent, .Stack-view:not(:first-child) .Stack-viewContent {
    animation: none !important;
    transform: none !important;
    filter: none !important;
    box-shadow: none !important;
  }
}
