/* THRASS Interactive - Modern Web App Styles */
:root {
  --primary: #1a5f7a;
  --primary-light: #2d8ba8;
  --accent: #ff6b35;
  --bg: #f8f9fa;
  --card-bg: #ffffff;
  --text: #2c3e50;
  --text-muted: #6c757d;
  --border: #dee2e6;
  --phoneme-consonant: #e3f2fd;
  --phoneme-vowel: #fff3e0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 1rem 2rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.logo h1 {
  margin: 0;
  font-size: 1.75rem;
}

.subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

.main-nav {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.nav-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,0.2);
  color: white;
  cursor: pointer;
  font-size: 0.95rem;
  transition: background 0.2s;
}

.nav-btn:hover {
  background: rgba(255,255,255,0.3);
}

.nav-btn.active {
  background: white;
  color: var(--primary);
}

/* Content */
.content {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.section {
  display: none;
}

.section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* THRASS Chart */
.chart-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.phoneme-filter select {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: 1rem;
}

.view-toggle {
  display: flex;
  gap: 0.25rem;
}

.view-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  cursor: pointer;
}

.view-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.thrass-chart {
  display: grid;
  gap: 0.75rem;
}

.thrass-chart.grid-view {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.thrass-chart.list-view {
  grid-template-columns: 1fr;
}

.phoneme-box {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid var(--border);
}

.phoneme-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.phoneme-box.consonant {
  background: var(--phoneme-consonant);
  border-color: #90caf9;
}

.phoneme-box.vowel {
  background: var(--phoneme-vowel);
  border-color: #ffcc80;
}

.phoneme-box .box-number {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.phoneme-box .box-phoneme {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);
}

.phoneme-box .box-keyword {
  font-size: 0.9rem;
  color: var(--text);
  margin-top: 0.25rem;
}

.phoneme-box .box-graphemes {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Phoneme Detail Modal */
.phoneme-detail {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.phoneme-detail.hidden {
  display: none;
}

.detail-content {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
}

.phoneme-big {
  font-size: 3rem;
  font-weight: bold;
  color: var(--primary);
}

.ipa-big {
  font-size: 1.5rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.keyword-big {
  font-size: 1.5rem;
  margin: 0.5rem 0 1rem;
}

.graphemes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.grapheme-tag {
  padding: 0.25rem 0.75rem;
  background: var(--phoneme-consonant);
  border-radius: 20px;
  font-weight: 500;
}

.close-btn {
  margin-top: 1.5rem;
  padding: 0.5rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

/* Word Chart */
.wordchart-tool, .reading-tool, .spelling-tool {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.word-display {
  min-height: 60px;
  padding: 1rem;
  font-size: 2rem;
  letter-spacing: 0.2em;
  border: 2px dashed var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
  background: #fafafa;
}

.grapheme-picker {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.grapheme-picker input {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}

.add-btn, .clear-btn {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.add-btn {
  background: var(--primary);
  color: white;
}

.clear-btn {
  background: var(--text-muted);
  color: white;
}

.quick-graphemes {
  margin-top: 1.5rem;
}

.quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.quick-btn {
  padding: 0.5rem 1rem;
  background: var(--phoneme-consonant);
  border: 1px solid #90caf9;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}

.quick-btn:hover {
  background: #bbdefb;
}

/* Reading */
.reading-words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.reading-word {
  padding: 0.75rem 1.25rem;
  background: var(--phoneme-consonant);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.2s;
}

.reading-word:hover {
  background: #bbdefb;
}

.word-breakdown {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #f0f7fa;
  border-radius: 8px;
}

.word-breakdown.hidden {
  display: none;
}

.breakdown-graphemes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.breakdown-grapheme {
  padding: 0.5rem 1rem;
  background: white;
  border: 2px solid var(--primary);
  border-radius: 6px;
  font-weight: 600;
}

/* Spelling */
.spelling-prompt {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 1rem;
  min-height: 3rem;
}

.spelling-input {
  width: 100%;
  max-width: 400px;
  padding: 1rem;
  font-size: 1.25rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.spelling-buttons {
  display: flex;
  gap: 1rem;
}

.check-btn {
  background: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.next-btn {
  background: var(--text-muted);
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.spelling-feedback {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
}

.spelling-feedback.hidden {
  display: none;
}

.spelling-feedback.correct {
  background: #d4edda;
  color: #155724;
}

.spelling-feedback.incorrect {
  background: #f8d7da;
  color: #721c24;
}

/* Footer */
.footer {
  text-align: center;
  padding: 1rem;
  background: var(--text);
  color: white;
  font-size: 0.9rem;
}

.instruction {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
