/* Sangihe Translation Engine - Modern Glassmorphism Styling */
:root {
  --bg-primary: #090d16;
  --bg-surface: rgba(18, 24, 38, 0.75);
  --bg-surface-elevated: rgba(28, 36, 56, 0.85);
  --bg-hover: rgba(38, 48, 74, 0.6);
  --bg-input: rgba(12, 17, 28, 0.9);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(14, 165, 233, 0.5);
  --border-accent: rgba(56, 189, 248, 0.3);

  --primary: #0ea5e9;
  --primary-glow: rgba(14, 165, 233, 0.25);
  --primary-hover: #38bdf8;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-display: 'Outfit', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Charis SIL', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px -5px var(--primary-glow);
}

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

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(14, 165, 233, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(16, 185, 129, 0.08) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 0 18px rgba(14, 165, 233, 0.55);
  border: 1.5px solid rgba(56, 189, 248, 0.6);
  overflow: hidden;
  flex-shrink: 0;
}

.logo-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

.mini-sangiang-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 1px solid rgba(192, 132, 252, 0.6);
}

.logo-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-subtitle {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 400;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.model-picker-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
}

.model-picker-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.model-picker-select {
  background: transparent;
  color: var(--primary);
  border: none;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.model-picker-select option {
  background: #111827;
  color: #f3f4f6;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-amber);
  display: inline-block;
  transition: background-color 0.3s ease;
}

.status-dot.online {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.status-dot.error {
  background-color: var(--accent-rose);
}

.api-docs-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.api-docs-link:hover {
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary-hover);
}

/* Main Container */
.main-content {
  max-width: 1280px;
  width: 100%;
  margin: 1.75rem auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  flex: 1;
}

/* Card Utility */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-card);
  transition: border-color 0.25s ease;
}

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

/* Control Panel */
.control-panel {
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.lang-selector-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lang-badge {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: var(--radius-sm);
  color: #38bdf8;
}

.btn-icon {
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: rotate(180deg);
  box-shadow: var(--shadow-glow);
}

.sample-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pills-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 500;
}

.pill-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn:hover {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.3);
  color: var(--text-main);
  transform: translateY(-1px);
}

/* Translation Grid */
.translation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

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

.box-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.box-header {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.box-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Diacritic Toolbar */
.diacritic-toolbar {
  padding: 0.5rem 1.25rem;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toolbar-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
}

.diacritic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.dia-chip {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.dia-chip:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.1);
  color: white;
}

textarea {
  width: 100%;
  background: transparent;
  border: none;
  padding: 1.25rem;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.7;
  resize: vertical;
  min-height: 160px;
  outline: none;
}

textarea::placeholder {
  color: var(--text-dim);
  font-size: 0.95rem;
}

.output-display {
  padding: 1.25rem;
  font-size: 1.05rem;
  line-height: 1.7;
  min-height: 200px;
  flex: 1;
  white-space: pre-wrap;
  color: #e2e8f0;
}

.output-placeholder {
  color: var(--text-dim);
  font-style: italic;
}

.box-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.15);
}

.char-count, .latency-info {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.engine-badge {
  font-size: 0.75rem;
  padding: 0.22rem 0.65rem 0.22rem 0.35rem;
  border-radius: 999px;
  background: rgba(6, 182, 212, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.28);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-sangiang-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 20%;
  border: 1px solid rgba(56, 189, 248, 0.5);
}

.badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-weight: 500;
}

/* Buttons */
.btn-primary {
  font-family: var(--font-display);
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  color: white;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
  transition: all 0.25s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.5);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-subtle {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease;
}

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

.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
}

.btn-spinner.active {
  display: inline-block;
}

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

/* Inspector Section */
.inspector-section {
  padding: 1.25rem 1.5rem;
}

.inspector-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.85rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.tab-buttons {
  display: flex;
  gap: 0.4rem;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all 0.2s ease;
}

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

.tab-btn.active {
  background: rgba(14, 165, 233, 0.15);
  border-color: rgba(14, 165, 233, 0.4);
  color: #38bdf8;
  font-weight: 500;
}

.tab-counter {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Context List & Cards */
.context-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.context-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.context-card:hover {
  transform: translateY(-2px);
  border-color: rgba(14, 165, 233, 0.35);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lemma-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: #38bdf8;
}

.lemma-norm {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.match-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  text-transform: uppercase;
}

.gloss-body {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.5;
}

.sublemmas-wrap {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* Parallel TM Cards */
.parallel-card {
  grid-column: 1 / -1;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.parallel-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ref-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.sim-score {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.parallel-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.row-label {
  color: var(--text-dim);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.row-text {
  color: #e2e8f0;
}

/* Morphology Container */
.morph-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.morph-input-row {
  display: flex;
  gap: 0.75rem;
  max-width: 500px;
}

.morph-input-row input, .search-bar input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  outline: none;
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.morph-input-row input:focus, .search-bar input:focus {
  border-color: var(--border-focus);
}

.morph-result-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.morph-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.morph-item {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.morph-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
}

.morph-val {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: #38bdf8;
}

/* Dictionary Search Section */
.dictionary-search-section {
  padding: 1.25rem 1.5rem;
}

.search-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.search-bar {
  display: flex;
  gap: 0.6rem;
  min-width: 380px;
}

.dict-results-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}

.empty-state {
  color: var(--text-dim);
  font-size: 0.88rem;
  font-style: italic;
  padding: 1.5rem;
  text-align: center;
  grid-column: 1 / -1;
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 1.5rem;
  margin-top: auto;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* User Feedback & Correction Panel */
.feedback-panel {
  border-top: 1px dashed var(--border-subtle);
  padding: 0.75rem 1.15rem;
  background: rgba(15, 23, 42, 0.45);
}

.feedback-prompt-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.feedback-label {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.feedback-btn-group {
  display: flex;
  gap: 0.5rem;
}

.btn-feedback {
  font-size: 0.78rem;
  padding: 0.32rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-feedback-good:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.btn-feedback-edit:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.45);
  color: #38bdf8;
}

.feedback-correction-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feedback-correction-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: #38bdf8;
}

.feedback-dia-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.dia-chip-fb {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.82rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
}

.dia-chip-fb:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
}

.feedback-textarea {
  width: 100%;
  min-height: 54px;
  padding: 0.55rem 0.75rem;
  font-size: 0.92rem;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-main);
  resize: vertical;
}

.feedback-actions-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.btn-submit-corr {
  padding: 0.38rem 0.9rem;
  font-size: 0.82rem;
  background: rgba(14, 165, 233, 0.25);
  border-color: rgba(14, 165, 233, 0.5);
  color: #e0f2fe;
}

.feedback-status-msg {
  font-size: 0.82rem;
  color: #34d399;
  font-weight: 500;
}
