/* ============================================================
   BlackLab Mastering - Main Stylesheet
   Black & Yellow Theme | Production Build
   ============================================================ */

/* 1. Font Import
   ------------------------------------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700;800&display=swap');

/* 2. CSS Variables
   ------------------------------------------------------------ */
:root {
  /* Background */
  --bg-primary: #0A0A0A;
  --bg-secondary: #111111;
  --bg-surface: #1A1A1A;
  --bg-surface-hover: #252525;
  --bg-border: #2A2A2A;

  /* Accent - Yellow */
  --accent: #F7C948;
  --accent-hover: #E5B83A;
  --accent-light: #FFD666;
  --accent-soft: rgba(247, 201, 72, 0.15);
  --accent-muted: rgba(247, 201, 72, 0.4);

  /* Text */
  --text-primary: #FFFFFF;
  --text-secondary: #A0A0A0;
  --text-muted: #666666;
  --text-on-accent: #0A0A0A;

  /* States */
  --success: #22C55E;
  --success-soft: rgba(34, 197, 94, 0.15);
  --error: #EF4444;
  --error-soft: rgba(239, 68, 68, 0.15);
  --warning: #F59E0B;
  --warning-soft: rgba(245, 158, 11, 0.15);
  --info: #3B82F6;
  --info-soft: rgba(59, 130, 246, 0.15);

  /* Gray Scale */
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #E5E5E5;
  --gray-300: #D4D4D4;
  --gray-400: #A3A3A3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;

  /* Design Tokens - Border Radius */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Design Tokens - Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-accent: 0 4px 20px rgba(247, 201, 72, 0.2);

  /* Design Tokens - Typography */
  --font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Design Tokens - Transitions */
  --transition: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* 3. Reset
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

ul, ol {
  list-style: none;
}

/* 4. Links
   ------------------------------------------------------------ */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

/* 5. Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-family);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: var(--shadow-accent);
}

.btn-secondary {
  background-color: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-secondary:hover {
  background-color: var(--accent-soft);
  border-color: var(--accent-hover);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

.btn-danger {
  background-color: var(--error);
  color: var(--text-primary);
  border-color: var(--error);
}

.btn-danger:hover {
  background-color: #DC2626;
  border-color: #DC2626;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.0625rem;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* 6. Cards
   ------------------------------------------------------------ */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--transition);
}

.card:hover {
  border-color: var(--accent-muted);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--bg-border);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* 7. Forms
   ------------------------------------------------------------ */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.input {
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-family);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.input::placeholder {
  color: var(--text-muted);
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23A0A0A0' d='M6 8.825L0.375 3.2l.85-.85L6 7.125 10.775 2.35l.85.85z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
  cursor: pointer;
}

select.input option {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

textarea.input {
  resize: vertical;
  min-height: 100px;
}

/* 8. Badges
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-full);
  white-space: nowrap;
  background-color: var(--bg-surface-hover);
  color: var(--text-secondary);
}

.badge-success {
  background-color: var(--success-soft);
  color: var(--success);
}

.badge-error {
  background-color: var(--error-soft);
  color: var(--error);
}

.badge-warning {
  background-color: var(--warning-soft);
  color: var(--warning);
}

.badge-accent {
  background-color: var(--accent-soft);
  color: var(--accent);
}

.badge-info {
  background-color: var(--info-soft);
  color: var(--info);
}

/* 9. Layout
   ------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.container-sm {
  max-width: 480px;
}

.container-md {
  max-width: 800px;
}

/* 10. Navbar
   ------------------------------------------------------------ */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bg-border);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.navbar-brand {
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.navbar-brand span,
.navbar-brand .accent {
  color: var(--accent);
}

.navbar-links,
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-links a,
.navbar-nav a {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background-color var(--transition);
}

.navbar-links a:hover,
.navbar-links a.active,
.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--text-primary);
  background-color: var(--bg-surface);
}

.nav-auth,
.nav-user,
.navbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.nav-user .username {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.btn-outline {
  background-color: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-outline:hover {
  background-color: var(--accent-soft);
  border-color: var(--accent-hover);
}

.credits-pill,
.navbar-credits {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  background-color: var(--accent-soft);
  border-radius: var(--radius-full);
}

/* 11. Hero
   ------------------------------------------------------------ */
.hero {
  position: relative;
  padding: 120px 24px 100px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(247, 201, 72, 0.08) 0%, transparent 60%);
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}

.hero h1 .accent {
  color: var(--accent);
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* 12. Features
   ------------------------------------------------------------ */
.features {
  padding: 100px 24px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 60px;
}

.feature-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  transition: border-color var(--transition), transform var(--transition);
}

.feature-card:hover {
  border-color: var(--accent-muted);
  transform: translateY(-2px);
}

.feature-card .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  font-size: 1.5rem;
  background-color: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius);
}

.feature-card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.feature-card p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 13. Pricing
   ------------------------------------------------------------ */
.pricing {
  padding: 100px 24px;
  background-color: var(--bg-secondary);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 60px;
  align-items: start;
}

.pricing-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: 36px;
  text-align: center;
  transition: border-color var(--transition), transform var(--transition);
}

.pricing-card:hover {
  transform: translateY(-2px);
}

.pricing-card.featured {
  border-color: var(--accent);
  position: relative;
  box-shadow: var(--shadow-accent);
}

.pricing-card .price {
  font-size: 3rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin: 20px 0;
}

.pricing-card .price span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.pricing-badge {
  display: inline-block;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-on-accent);
  background-color: var(--accent);
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.pricing-card ul {
  text-align: left;
  margin: 24px 0;
}

.pricing-card ul li {
  padding: 8px 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--bg-border);
}

.pricing-card ul li:last-child {
  border-bottom: none;
}

/* 14. Section Titles
   ------------------------------------------------------------ */
.section-title {
  font-size: 2.25rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 12px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

/* 15. Mastering Page
   ------------------------------------------------------------ */
.main-content {
  padding: 40px 0 80px;
}

.mastering-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

.mastering-left {
  position: sticky;
  top: 96px;
}

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  min-height: 320px;
  border: 2px dashed var(--bg-border);
  border-radius: var(--radius-lg);
  background-color: var(--bg-surface);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background-color var(--transition);
}

.upload-zone:hover {
  border-color: var(--accent-muted);
  background-color: var(--bg-surface-hover);
}

.upload-zone.drag-over {
  border-color: var(--accent);
  background-color: var(--accent-soft);
}

.upload-zone.has-file {
  border-style: solid;
  border-color: var(--accent);
}

.upload-zone .upload-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
}

.upload-zone h2 {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.upload-zone p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.upload-zone .upload-formats {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin-top: 16px;
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.file-info .file-info-details {
  flex: 1;
  min-width: 0;
}

.file-info .file-name {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-info .file-size {
  display: block;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 2px;
}

.mastering-right .card-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.master-action {
  margin-top: 16px;
}

/* Reference file upload */
.ref-upload {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
}

.ref-file-name {
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ref-file-name.has-file {
  color: var(--text-primary);
  font-weight: 600;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 8px;
}

.settings-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 32px;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.preset-item {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.preset-item:hover {
  border-color: var(--accent-muted);
  color: var(--text-primary);
}

.preset-item.active {
  background-color: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* 16. Progress
   ------------------------------------------------------------ */
.progress-container {
  margin: 32px 0;
}

.progress-bar-wrapper {
  width: 100%;
  height: 8px;
  background-color: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.progress-text span:last-child {
  font-weight: 700;
  color: var(--accent);
}

/* 17. Results
   ------------------------------------------------------------ */
.results-container {
  margin-top: 40px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.metric-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.metric-card .label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.metric-card .value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.metric-card .unit {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 4px;
}

.metric-card .change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.metric-card .change.up {
  color: var(--success);
  background-color: var(--success-soft);
}

.metric-card .change.down {
  color: var(--error);
  background-color: var(--error-soft);
}

/* 17b. Results - Comparison Grid (AudioMasterizer style)
   ------------------------------------------------------------ */
.results-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 20px;
}

.results-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* Two-panel comparison grid */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 0;
}

.comparison-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--transition);
}

.comparison-panel.panel-after {
  border-color: rgba(247, 201, 72, 0.3);
}

.comparison-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--bg-border);
}

.comparison-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.comparison-dot.before {
  background-color: #4a5568;
}

.comparison-dot.after {
  background-color: var(--accent);
  box-shadow: 0 0 8px rgba(247, 201, 72, 0.4);
}

.comparison-panel-label {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.comparison-metrics {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comparison-row {
  display: grid;
  grid-template-columns: 48px 90px 1fr;
  align-items: center;
  gap: 12px;
}

.comparison-metric-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.comparison-metric-value {
  font-size: 0.9375rem;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.comparison-bar-track {
  height: 6px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.comparison-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  width: 0%;
}

.comparison-bar.before {
  background-color: #4a5568;
}

.comparison-bar.after {
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
}

/* Audio Players (Before/After) */
.audio-players-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 24px;
}

.audio-players-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.audio-players-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.audio-player-panel {
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.audio-player-panel.panel-after {
  border-color: rgba(247, 201, 72, 0.25);
}

.audio-player-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.audio-player-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.waveform {
  min-height: 80px;
  margin-bottom: 12px;
}

.audio-player-controls {
  display: flex;
  justify-content: center;
}

.play-icon {
  font-size: 1rem;
}

/* Spectrum differential chart */
.diff-chart-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 24px;
}

.diff-chart-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.diff-chart-wrapper {
  width: 100%;
  min-height: 200px;
}

.diff-chart-wrapper canvas {
  display: block;
  width: 100%;
}

/* 18. Waveform
   ------------------------------------------------------------ */
.waveform-container {
  margin-top: 32px;
}

.waveform-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.waveform-wrapper {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 120px;
  overflow: hidden;
}

/* 19. Dashboard
   ------------------------------------------------------------ */
.dashboard-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.dashboard-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card .label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th {
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  color: var(--text-muted);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--bg-border);
}

.history-table th:first-child {
  border-radius: var(--radius-sm) 0 0 0;
}

.history-table th:last-child {
  border-radius: 0 var(--radius-sm) 0 0;
}

.history-table td {
  padding: 14px 16px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--bg-border);
}

.history-table tr:hover td {
  background-color: var(--bg-surface);
}

/* 20. Auth Pages
   ------------------------------------------------------------ */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  padding: 40px 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: 40px;
}

.auth-card h1 {
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
}

.auth-card p {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 32px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--accent);
  font-weight: 600;
}

.auth-link {
  text-align: center;
  margin-top: 24px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.auth-link a {
  color: var(--accent);
  font-weight: 600;
}

.auth-error {
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.875rem;
  color: var(--error);
  background-color: var(--error-soft);
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
}

.auth-success {
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.875rem;
  color: var(--success);
  background-color: var(--success-soft);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
}

.form-hint.success {
  color: var(--success);
  font-weight: 600;
}

.form-hint.error {
  color: var(--error);
  font-weight: 600;
}

.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background-color: var(--bg-border);
}

/* 21. Payment Modal
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: rgba(0, 0, 0, 0.7);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  position: relative;
  transform: translateY(20px);
  transition: transform var(--transition-slow);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 1.25rem;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--transition), background-color var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

/* 22. Toast Notifications
   ------------------------------------------------------------ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
  max-width: 440px;
  padding: 14px 20px;
  background-color: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: auto;
  animation: slideIn 0.3s ease forwards;
}

.toast.toast-success {
  border-left: 3px solid var(--success);
}

.toast.toast-error {
  border-left: 3px solid var(--error);
}

.toast.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast.toast-info {
  border-left: 3px solid var(--info);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 23. Footer
   ------------------------------------------------------------ */
.footer {
  padding: 40px 24px;
  border-top: 1px solid var(--bg-border);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer a {
  color: var(--text-secondary);
}

.footer a:hover {
  color: var(--accent);
}

/* 24. Spinner
   ------------------------------------------------------------ */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--bg-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* 25. Responsive
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.25rem;
  }

  .hero p {
    font-size: 1.0625rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }

  .mastering-layout {
    grid-template-columns: 1fr;
  }

  .mastering-left {
    position: static;
  }

  .settings-panel {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .comparison-grid {
    grid-template-columns: 1fr;
  }

  .comparison-row {
    grid-template-columns: 40px 80px 1fr;
    gap: 8px;
  }

  .audio-players-grid {
    grid-template-columns: 1fr;
  }

  .navbar {
    padding: 0 16px;
  }

  .navbar-links,
  .navbar-nav {
    display: none;
  }

  .auth-card {
    padding: 28px;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .history-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .section-title {
    font-size: 1.75rem;
  }

  .toast {
    min-width: unset;
    max-width: calc(100vw - 48px);
  }
}

/* 26. Utilities
   ------------------------------------------------------------ */
.text-accent {
  color: var(--accent);
}

.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

/* Invitation Page Styles */
.invitation-code-display {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  padding: 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
}

.invitation-code {
  flex: 1;
  font-size: 1.5rem;
  font-weight: 800;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-align: center;
}

.invitation-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}

.stat-card {
  text-align: center;
  padding: 20px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.referred-users-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.referred-user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--bg-border);
}

.referred-user-item:last-child {
  border-bottom: none;
}

.referred-user-name {
  font-weight: 600;
  color: var(--text-primary);
}

.referred-user-date {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.text-error {
  color: var(--error);
}

.text-muted {
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .invitation-stats-grid {
    grid-template-columns: 1fr;
  }

  .invitation-code-display {
    flex-direction: column;
  }
}

/* Stats Grid for Admin */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

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

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.text-accent {
  color: var(--accent);
}

.stat-detail {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 8px;
}
