/* =========================================
   MuggsOfDialect - Celtic Modern Dark Theme
   Matching the Muggs ecosystem design language
========================================= */
@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700&family=Cormorant+Garamond:wght@400;500;600&display=swap');

:root {
  /* Colors */
  --gold: #d4a726;
  --gold-light: #f0d78a;
  --gold-glow: rgba(212, 167, 38, 0.4);

  --green-900: #071a0e;
  --green-800: #0d2818;
  --green-700: #143d24;
  --green-600: #1a5231;

  --glass: rgba(255, 255, 255, 0.03);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.06);

  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-muted: rgba(255, 255, 255, 0.4);

  --success: #66bb6a;
  --warning: #ffd54f;
  --error: #ff6b6b;
  --info: #64b5f6;

  /* Spacing & Sizing */
  --radius: 12px;
  --radius-lg: 20px;

  /* Transitions */
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Body & Background */
body {
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--text-primary);
  background: var(--green-900);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, var(--green-700) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(212, 167, 38, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 30% at 10% 80%, var(--green-600) 0%, transparent 40%);
  z-index: -2;
}

/* Top Navigation */
.top-nav {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--glass-border);
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: var(--transition);
  border: 1px solid transparent;
}

.top-nav a:hover {
  color: var(--gold);
  background: var(--glass);
  border-color: var(--glass-border);
}

.top-nav a.active {
  color: var(--gold);
  background: var(--glass);
  border-color: rgba(212, 167, 38, 0.3);
}

.nav-brand {
  font-family: 'Cinzel Decorative', serif;
  color: var(--gold) !important;
  font-weight: 700;
}

.nav-spacer {
  flex: 1;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.hero-logo {
  width: 100px;
  height: auto;
  margin-bottom: 1rem;
  filter: drop-shadow(0 4px 20px rgba(212, 167, 38, 0.3));
  animation: logoFloat 6s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

h1 {
  font-family: 'Cinzel Decorative', serif;
  color: var(--gold);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.hero-tagline {
  font-size: 1.25rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Cards */
.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  width: 100%;
  transition: var(--transition);
}

.card:hover {
  border-color: rgba(212, 167, 38, 0.2);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Grid Layouts */
.card-grid {
  display: grid;
  gap: 1rem;
  width: 100%;
}

.card-grid.two-col {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--gold);
  color: var(--green-900);
}

.btn-primary:hover {
  background: var(--gold-light);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--glass-hover);
  border-color: rgba(212, 167, 38, 0.25);
}

.btn-success {
  background: var(--success);
  color: var(--green-900);
}

.btn-danger {
  background: transparent;
  border: 1px solid var(--error);
  color: var(--error);
}

.btn-danger:hover {
  background: rgba(255, 107, 107, 0.1);
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem;
  transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow);
}

.form-textarea {
  min-height: 150px;
  resize: vertical;
}

.form-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Join Code Input */
.join-code-input {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-success {
  background: rgba(102, 187, 106, 0.2);
  color: var(--success);
}

.badge-warning {
  background: rgba(255, 213, 79, 0.2);
  color: var(--warning);
}

.badge-error {
  background: rgba(255, 107, 107, 0.2);
  color: var(--error);
}

.badge-info {
  background: rgba(100, 181, 246, 0.2);
  color: var(--info);
}

/* Recording Interface */
.recording-display {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
}

.recording-text {
  font-size: 1.4rem;
  line-height: 1.8;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.recording-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.record-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--error);
  border: 4px solid rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
}

.record-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.record-btn.recording {
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7); }
  50% { box-shadow: 0 0 0 15px rgba(255, 107, 107, 0); }
}

.recording-timer {
  font-size: 2rem;
  font-weight: 600;
  color: var(--gold);
  margin-top: 1rem;
}

/* Audio Player */
.audio-player {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius);
}

.audio-player audio {
  flex: 1;
  height: 40px;
}

/* Flagged Words Display */
.flagged-text {
  font-size: 1.2rem;
  line-height: 2;
}

.flagged-word {
  padding: 0.1em 0.3em;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.flagged-word.error {
  background: rgba(255, 107, 107, 0.3);
  border-bottom: 2px solid var(--error);
}

.flagged-word.warning {
  background: rgba(255, 213, 79, 0.2);
  border-bottom: 2px solid var(--warning);
}

.flagged-word.improved {
  background: rgba(102, 187, 106, 0.2);
  border-bottom: 2px solid var(--success);
}

.flagged-word:hover {
  opacity: 0.8;
}

/* Phoneme Groups */
.phoneme-group {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.phoneme-group-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.phoneme-group-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold);
}

.phoneme-group-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.phoneme-words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.practice-word {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.practice-word .listen-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 0.75rem;
}

.practice-word .voices-btn {
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 4px;
}

.practice-word .voices-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* Forvo Voices Panel */
.voices-panel {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  min-width: 260px;
  background: var(--green-800);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  margin-top: 0.25rem;
}

.voices-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--glass-border);
}

.voices-title {
  font-weight: 600;
  color: var(--gold);
}

.voices-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
}

.voices-close:hover {
  color: var(--text-primary);
}

.voices-list {
  max-height: 200px;
  overflow-y: auto;
}

.voice-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: none;
  border: none;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  transition: var(--transition);
}

.voice-item:last-child {
  border-bottom: none;
}

.voice-item:hover {
  background: var(--glass-hover);
}

.voice-flag {
  font-size: 1.1rem;
}

.voice-info {
  flex: 1;
  color: var(--text-secondary);
}

.voice-rating {
  font-size: 0.75rem;
}

.voices-footer {
  padding: 0.4rem 0.75rem;
  border-top: 1px solid var(--glass-border);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}

.voices-footer a {
  color: var(--gold);
  text-decoration: none;
}

.voices-footer a:hover {
  text-decoration: underline;
}

/* Teacher Review Queue */
.queue-item {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.queue-item:hover {
  border-color: rgba(212, 167, 38, 0.2);
}

.queue-item-info {
  flex: 1;
}

.queue-item-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.queue-item-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Teacher Nudge */
.teacher-nudge {
  background: rgba(212, 167, 38, 0.1);
  border-left: 3px solid var(--gold);
  padding: 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1rem 0;
}

.teacher-nudge-label {
  font-size: 0.85rem;
  color: var(--gold);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

/* Progress Indicators */
.progress-bar {
  height: 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* List Items */
.list-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--glass-border);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:hover {
  background: var(--glass);
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Loading States */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Alerts */
.alert {
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.alert-success {
  background: rgba(102, 187, 106, 0.15);
  border: 1px solid rgba(102, 187, 106, 0.3);
  color: var(--success);
}

.alert-warning {
  background: rgba(255, 213, 79, 0.15);
  border: 1px solid rgba(255, 213, 79, 0.3);
  color: var(--warning);
}

.alert-error {
  background: rgba(255, 107, 107, 0.15);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: var(--error);
}

.alert-info {
  background: rgba(100, 181, 246, 0.15);
  border: 1px solid rgba(100, 181, 246, 0.3);
  color: var(--info);
}

/* Footer */
.site-footer {
  width: 100%;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

/* Responsive */
@media (max-width: 600px) {
  h1 {
    font-size: 1.75rem;
  }

  .hero-tagline {
    font-size: 1rem;
  }

  .main-content {
    padding: 1rem;
  }

  .card {
    padding: 1rem;
  }

  .recording-text {
    font-size: 1.1rem;
  }

  .btn-lg {
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
  }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none; }
