/* ══════════════════════════════════════════════
   style.css — Lingala Express v2
   Design : moderne, épuré, mobile-first
   Accent : vert émeraude + bleu pour le traducteur
══════════════════════════════════════════════ */

/* ─── RESET & VARIABLES ─────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:        #10b981;
  --green-dark:   #059669;
  --green-light:  #d1fae5;
  --blue:         #3b82f6;
  --blue-light:   #dbeafe;
  --amber-light:  #fef3c7;
  --bg:           #f8fafc;
  --surface:      #ffffff;
  --border:       #e2e8f0;
  --text-main:    #1e293b;
  --text-sub:     #64748b;
  --text-light:   #94a3b8;
  --red:          #ef4444;
  --red-light:    #fee2e2;
  --radius:       12px;
  --shadow:       0 2px 12px rgba(0,0,0,0.07);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.12);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── EN-TÊTE ───────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 8px; }
.logo-icon { font-size: 1.5rem; }
.logo-text { font-size: 1.35rem; color: var(--text-main); letter-spacing: -0.5px; }
.logo-text strong { color: var(--green); }

.lang-toggle {
  padding: 7px 18px;
  border: 2px solid var(--green);
  border-radius: 999px;
  background: transparent;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
  white-space: nowrap;
}
.lang-toggle:hover { background: var(--green); color: white; }

/* ─── NAVIGATION PAR ONGLETS ────────────────── */
.tabs-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}
.tabs-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
}
.tab-btn {
  padding: 14px 20px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text-light);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--text-sub); }
.tab-btn.active { color: var(--green); border-bottom-color: var(--green); }

/* ─── VISIBILITÉ DES ONGLETS ────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── MOT DU JOUR ───────────────────────────── */
.wod-section {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 16px;
}
.wod-card {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  border-radius: 16px;
  padding: 28px;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 8px 32px rgba(16,185,129,0.25);
}
.wod-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.8;
}
.wod-lingala  { font-size: 2rem; font-weight: 800; letter-spacing: -0.5px; }
.wod-phonetic { font-size: 0.85rem; opacity: 0.75; font-style: italic; }
.wod-divider  { width: 40px; height: 2px; background: rgba(255,255,255,0.4); border-radius: 2px; margin: 4px 0; }
.wod-translation { font-size: 1.1rem; font-weight: 500; opacity: 0.95; }
.wod-category {
  display: inline-block;
  margin-top: 4px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.2);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  width: fit-content;
}

/* ─── PHRASEBOOK — RECHERCHE ────────────────── */
.search-section {
  padding: 20px 16px 12px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}
.search-wrapper { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 14px; font-size: 1rem; pointer-events: none; }
#searchInput {
  width: 100%;
  padding: 12px 16px 12px 42px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--text-main);
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s;
}
#searchInput::placeholder { color: var(--text-light); }
#searchInput:focus { border-color: var(--green); }

/* ─── PHRASEBOOK — CATÉGORIES ───────────────── */
.categories-section {
  padding: 0 16px 14px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}
.categories-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.categories-scroll::-webkit-scrollbar { display: none; }
.cat-btn {
  padding: 7px 16px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-sub);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: var(--font);
  flex-shrink: 0;
}
.cat-btn:hover  { border-color: var(--green); color: var(--green); }
.cat-btn.active { background: var(--green); border-color: var(--green); color: white; }

.results-count {
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  padding: 0 16px 10px;
  font-size: 0.78rem;
  color: var(--text-light);
}

/* ─── PHRASEBOOK — GRILLE DE CARTES ─────────── */
main {
  flex: 1;
  padding: 0 16px 40px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform 0.18s, box-shadow 0.18s;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.card-lingala    { font-size: 1.2rem; font-weight: 700; color: var(--text-main); }
.card-phonetic   { font-size: 0.77rem; color: var(--text-light); font-style: italic; }
.card-divider    { width: 28px; height: 2px; background: var(--green); border-radius: 2px; margin: 4px 0; }
.card-translation{ font-size: 0.93rem; color: var(--text-sub); font-weight: 500; }
.card-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  background: var(--green-light);
  color: var(--green-dark);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: fit-content;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.no-results span { font-size: 2.5rem; }

/* ─── TRADUCTEUR LIVE ───────────────────────── */
.translator-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}
.translator-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.translator-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.translator-header h2 { font-size: 1.1rem; font-weight: 700; color: var(--text-main); }
.api-badge {
  padding: 3px 10px;
  background: var(--blue-light);
  color: var(--blue);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.translator-controls { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.lang-select-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}
.lang-select-group label { font-size: 0.8rem; font-weight: 600; color: var(--text-sub); white-space: nowrap; }
.lang-select {
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: var(--font);
  color: var(--text-main);
  background: var(--surface);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.lang-select:focus { border-color: var(--blue); }

.translator-input-row { display: flex; gap: 10px; margin-bottom: 20px; }
#translateInput {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--text-main);
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s;
}
#translateInput::placeholder { color: var(--text-light); }
#translateInput:focus { border-color: var(--blue); }
#translateInput:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-translate {
  padding: 12px 24px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}
.btn-translate:hover   { background: #2563eb; }
.btn-translate:active  { transform: scale(0.97); }
.btn-translate:disabled{ opacity: 0.6; cursor: not-allowed; }

/* ─── RÉSULTAT DE TRADUCTION ────────────────── */
.translation-result { display: none; }
.translation-result.visible { display: block; }

.result-box { border-radius: var(--radius); padding: 20px; margin-bottom: 12px; }
.result-box.success { background: var(--green-light); border: 1px solid #6ee7b7; }
.result-box.error   { background: var(--red-light);   border: 1px solid #fca5a5; }

.result-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 8px;
}
.result-lingala    { font-size: 1.6rem; font-weight: 800; color: var(--green-dark); letter-spacing: -0.3px; }
.result-error-text { font-size: 0.95rem; color: var(--red); font-weight: 500; }
.result-meta       { margin-top: 8px; font-size: 0.78rem; color: var(--text-light); }

.result-quality {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-top: 6px;
}
.quality-high { background: var(--green-light); color: var(--green-dark); }
.quality-low  { background: var(--amber-light); color: #92400e; }

/* ─── SPINNER ───────────────────────────────── */
.spinner-wrap {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  color: var(--text-sub);
  font-size: 0.88rem;
}
.spinner-wrap.visible { display: flex; }
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── INFO API ──────────────────────────────── */
.api-info {
  padding: 14px 16px;
  background: var(--blue-light);
  border-radius: var(--radius);
  border: 1px solid #bfdbfe;
  font-size: 0.82rem;
  color: #1e40af;
  line-height: 1.6;
}

/* ─── HISTORIQUE ────────────────────────────── */
.history-section { margin-top: 24px; }
.history-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-sub);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
  gap: 12px;
}
.history-source  { color: var(--text-sub); flex: 1; }
.history-arrow   { color: var(--text-light); font-size: 0.75rem; }
.history-lingala { font-weight: 700; color: var(--green-dark); flex: 1; text-align: right; }

/* ─── PIED DE PAGE ──────────────────────────── */
footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 16px;
  font-size: 0.78rem;
  color: var(--text-light);
}

/* ─── RESPONSIVE ────────────────────────────── */
@media (max-width: 480px) {
  .logo-text { font-size: 1.15rem; }
  .cards-grid { grid-template-columns: 1fr; }
  .translator-input-row { flex-direction: column; }
  .btn-translate { width: 100%; }
  .wod-lingala { font-size: 1.6rem; }
  .tab-btn { padding: 12px 14px; font-size: 0.8rem; }
}
