/*-----------------------------------*\
  style.css — Texte en Parole
  Rodson_desu
\*-----------------------------------*/

/* ---- RESET ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
li { list-style: none; }
a { text-decoration: none; }
button, select, input, textarea { font: inherit; background: none; border: none; }
button, select { cursor: pointer; }
input, textarea { width: 100%; }

/* ---- FONTS ---- */
:root {
  --ff-sans: 'Space Grotesk', sans-serif;
  --ff-body: 'Inter', sans-serif;

  --fs-xs:  0.75rem;
  --fs-sm:  0.8125rem;
  --fs-md:  0.875rem;
  --fs-base: 1rem;
  --fs-lg:  1.125rem;
  --fs-xl:  1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: 2.75rem;

  --fw-400: 400;
  --fw-500: 500;
  --fw-600: 600;
  --fw-700: 700;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 99px;

  --transition: 0.2s ease;
  --section-gap: 1.5rem;
}

/* ---- THEMES ---- */
body.dark_theme {
  --bg-page:      hsl(0, 0%, 10%);
  --bg-card:      hsl(0, 0%, 15%);
  --bg-input:     hsl(0, 0%, 13%);
  --bg-hover:     hsl(0, 0%, 18%);
  --bg-processed: hsl(215, 40%, 14%);

  --text-primary:   hsl(0, 0%, 95%);
  --text-secondary: hsl(0, 0%, 60%);
  --text-tertiary:  hsl(0, 0%, 40%);

  --border-default: hsla(0, 0%, 100%, 0.08);
  --border-hover:   hsla(0, 0%, 100%, 0.15);
  --border-focus:   hsl(219, 79%, 62%);

  --accent:       hsl(219, 79%, 62%);
  --accent-dark:  hsl(219, 79%, 50%);
  --accent-light: hsla(219, 79%, 62%, 0.12);

  --success: hsl(152, 70%, 45%);
  --error:   hsl(0, 70%, 60%);
  --warning: hsl(38, 95%, 54%);

  --shadow-card: 0 4px 24px hsla(0, 0%, 0%, 0.35);
}

body.light_theme {
  --bg-page:      hsl(0, 0%, 94%);
  --bg-card:      hsl(0, 0%, 100%);
  --bg-input:     hsl(0, 0%, 96%);
  --bg-hover:     hsl(0, 0%, 92%);
  --bg-processed: hsl(215, 60%, 96%);

  --text-primary:   hsl(0, 0%, 10%);
  --text-secondary: hsl(0, 0%, 40%);
  --text-tertiary:  hsl(0, 0%, 60%);

  --border-default: hsla(0, 0%, 0%, 0.08);
  --border-hover:   hsla(0, 0%, 0%, 0.16);
  --border-focus:   hsl(219, 79%, 55%);

  --accent:       hsl(219, 79%, 55%);
  --accent-dark:  hsl(219, 79%, 42%);
  --accent-light: hsla(219, 79%, 55%, 0.10);

  --success: hsl(152, 70%, 38%);
  --error:   hsl(0, 70%, 50%);
  --warning: hsl(38, 90%, 42%);

  --shadow-card: 0 4px 24px hsla(0, 0%, 0%, 0.08);
}

/* ---- BASE ---- */
html { font-family: var(--ff-body); scroll-behavior: smooth; }

body {
  background: var(--bg-page);
  color: var(--text-primary);
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
  padding-inline: 1rem;
}

/* ---- HEADER ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-default);
  padding-block: 14px;
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo-text {
  font-family: var(--ff-sans);
  font-size: var(--fs-lg);
  font-weight: var(--fw-700);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.logo-dot { color: var(--accent); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-btn {
  width: 40px;
  height: 24px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  padding: 2px;
  transition: var(--transition);
  display: flex;
  align-items: center;
}

.theme-btn:hover { border-color: var(--border-hover); }

.theme-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: inset 7px -5px var(--text-primary);
  transition: var(--transition);
  transform: translateX(0);
  flex-shrink: 0;
}

.theme-btn.active .theme-icon {
  transform: translateX(16px);
  box-shadow: inset 18px -18px var(--warning);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  font-size: var(--fs-sm);
  font-weight: var(--fw-500);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

.btn-back {
  font-size: var(--fs-sm);
  font-weight: var(--fw-500);
  color: var(--text-secondary);
  padding: 6px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

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

/* ---- MAIN ---- */
.main-wrapper {
  flex: 1;
  padding-block: 2.5rem 3rem;
}

/* ---- HERO ---- */
.hero-section {
  text-align: center;
  margin-bottom: 2rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-600);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  margin-bottom: 14px;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

.hero-title {
  font-family: var(--ff-sans);
  font-size: clamp(var(--fs-2xl), 5vw, var(--fs-3xl));
  font-weight: var(--fw-700);
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.15;
}

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

.hero-subtitle {
  font-size: var(--fs-base);
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 500px;
  margin-inline: auto;
}

/* ---- APP CARD ---- */
.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

/* ---- MODE TABS ---- */
.mode-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 1.5rem;
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-500);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.mode-tab svg { flex-shrink: 0; opacity: 0.7; }

.mode-tab:hover { color: var(--text-primary); background: var(--bg-hover); }

.mode-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  box-shadow: 0 1px 4px hsla(0,0%,0%,0.1);
}

.mode-tab.active svg { opacity: 1; color: var(--accent); }

/* ---- SECTION BLOCKS ---- */
.section-block { margin-bottom: 1.25rem; }

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

.section-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-600);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
}

.char-count {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

/* ---- TEXTAREA ---- */
.main-textarea {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: var(--fs-md);
  line-height: 1.7;
  resize: vertical;
  min-height: 130px;
  transition: border-color var(--transition);
}

.main-textarea::placeholder { color: var(--text-tertiary); }
.main-textarea:focus { outline: none; border-color: var(--border-focus); }

/* ---- AI PANEL ---- */
.ai-panel {
  background: var(--accent-light);
  border: 1px solid hsla(219, 79%, 62%, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.ai-panel .section-label { margin-bottom: 8px; color: var(--accent); display: block; }

.ai-input-row {
  display: flex;
  gap: 8px;
}

.ai-input {
  flex: 1;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: var(--fs-sm);
  transition: border-color var(--transition);
}

.ai-input::placeholder { color: var(--text-tertiary); }
.ai-input:focus { outline: none; border-color: var(--border-focus); }

.btn-generate {
  padding: 9px 18px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-600);
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  white-space: nowrap;
  transition: background var(--transition);
}

.btn-generate:hover { background: var(--accent-dark); }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; }

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.pill-btn, .quick-btn {
  font-size: var(--fs-xs);
  font-weight: var(--fw-500);
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-hover);
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
}

.pill-btn:hover, .quick-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

/* ---- PROCESSED BOX ---- */
.processed-box {
  display: none;
  background: var(--bg-processed);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 1rem;
  animation: fadeIn 0.3s ease;
}

.processed-box.visible { display: block; }

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

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

.processed-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-600);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
}

.processed-actions { display: flex; gap: 6px; }

.processed-text {
  font-size: var(--fs-md);
  color: var(--text-primary);
  line-height: 1.7;
}

/* ---- DIVIDER ---- */
.divider {
  height: 1px;
  background: var(--border-default);
  margin-block: 1.25rem;
}

/* ---- VOICE CONTROLS ---- */
.voice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 1.25rem;
}

.control-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-500);
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.select-field {
  width: 100%;
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 9px 10px;
  font-size: var(--fs-sm);
  transition: border-color var(--transition);
  appearance: auto;
}

.select-field:focus { outline: none; border-color: var(--border-focus); }

/* ---- SLIDERS ---- */
.sliders-block { display: flex; flex-direction: column; gap: 10px; }

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  width: 52px;
  flex-shrink: 0;
}

.slider {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.slider-val {
  font-size: var(--fs-xs);
  font-weight: var(--fw-600);
  color: var(--text-primary);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* ---- PLAYBACK ---- */
.playback-block { margin-bottom: 1rem; }

.btn-speak {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  font-size: var(--fs-base);
  font-weight: var(--fw-600);
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-md);
  transition: background var(--transition), transform 0.1s;
  margin-bottom: 8px;
}

.btn-speak:hover { background: var(--accent-dark); }
.btn-speak:active { transform: scale(0.99); }
.btn-speak:disabled { opacity: 0.5; cursor: not-allowed; }

.playback-secondary {
  display: flex;
  gap: 8px;
}

.btn-control {
  flex: 1;
  padding: 9px 12px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-500);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.btn-control:hover { background: var(--bg-hover); border-color: var(--border-hover); }
.btn-control:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- STATUS BAR ---- */
.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
  transition: background 0.3s;
}

.status-dot.active  { background: var(--success); animation: pulse-dot 1.5s infinite; }
.status-dot.loading { background: var(--accent);  animation: pulse-dot 0.8s infinite; }
.status-dot.error   { background: var(--error);   animation: none; }

.status-text {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

/* ---- HISTORY ---- */
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.history-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.history-play {
  color: var(--accent);
  flex-shrink: 0;
  opacity: 0.7;
}

.history-item:hover .history-play { opacity: 1; }

.history-content { flex: 1; min-width: 0; }

.history-excerpt {
  font-size: var(--fs-sm);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.history-meta {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.history-remove {
  font-size: 16px;
  color: var(--text-tertiary);
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: var(--transition);
  flex-shrink: 0;
}

.history-remove:hover { color: var(--error); background: hsla(0,70%,60%,0.12); }

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 1.5rem;
  color: var(--text-tertiary);
  font-size: var(--fs-sm);
}

/* ---- FOOTER ---- */
.footer {
  padding-block: 1.25rem;
  border-top: 1px solid var(--border-default);
  background: var(--bg-card);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-text {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
}

.footer-link {
  font-size: var(--fs-xs);
  font-weight: var(--fw-500);
  color: var(--accent);
  transition: var(--transition);
}

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

/* ════════════════════════════════════
   RESPONSIVE — Mobile First
   ════════════════════════════════════ */

/* ── Tablette (≤768px) ── */
@media (max-width: 768px) {
  :root {
    --fs-3xl: 2.2rem;
    --fs-2xl: 1.75rem;
  }

  .container { padding-inline: 1rem; }

  .main-wrapper { padding-block: 1.75rem 2.5rem; }

  .hero-section { margin-bottom: 1.5rem; }

  .hero-subtitle { font-size: var(--fs-md); }

  .app-card { padding: 1.25rem; }

  .history-card { padding: 1rem; }
}

/* ── Mobile large (≤560px) ── */
@media (max-width: 560px) {

  /* HEADER */
  .header { padding-block: 10px; }

  .header-inner { gap: 8px; }

  .header-nav { display: none; }

  .btn-back {
    font-size: var(--fs-xs);
    padding: 5px 10px;
  }

  .logo-text { font-size: var(--fs-base); }

  /* HERO */
  .hero-section { margin-bottom: 1.25rem; }

  .hero-title {
    font-size: clamp(1.6rem, 8vw, 2rem);
    letter-spacing: -0.02em;
  }

  .hero-subtitle {
    font-size: var(--fs-sm);
    line-height: 1.55;
  }

  .hero-badge {
    font-size: 10px;
    padding: 4px 12px;
    margin-bottom: 10px;
  }

  /* APP CARD */
  .app-card {
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
  }

  /* TABS MODE */
  .mode-tabs { padding: 3px; gap: 3px; margin-bottom: 1rem; }

  .mode-tab {
    padding: 8px 6px;
    font-size: 11px;
    gap: 4px;
    flex-direction: column;
    line-height: 1.2;
  }

  .mode-tab svg { width: 16px; height: 16px; }

  /* TEXTAREA */
  .main-textarea {
    min-height: 110px;
    font-size: var(--fs-sm);
    padding: 10px 12px;
  }

  /* AI PANEL */
  .ai-input-row { flex-direction: column; gap: 8px; }

  .btn-generate {
    width: 100%;
    padding: 11px;
    text-align: center;
  }

  .quick-prompts { gap: 5px; }

  .quick-btn, .pill-btn {
    font-size: 11px;
    padding: 5px 10px;
    /* Zone de tap plus grande sur mobile */
    min-height: 32px;
  }

  /* VOICE CONTROLS */
  .voice-grid { grid-template-columns: 1fr; gap: 10px; }

  .select-field {
    font-size: var(--fs-sm);
    padding: 10px;
    /* Empêche le zoom iOS sur les select */
    font-size: 16px;
  }

  /* SLIDERS */
  .sliders-block { gap: 14px; }

  .slider-row { gap: 8px; }

  .slider-label {
    width: 48px;
    font-size: 11px;
  }

  .slider {
    height: 6px; /* plus épais pour les doigts */
  }

  /* PLAYBACK */
  .btn-speak {
    padding: 14px;
    font-size: var(--fs-base);
  }

  .playback-secondary { gap: 6px; }

  .btn-control {
    padding: 10px 8px;
    font-size: 12px;
    min-height: 40px;
  }

  /* STATUS */
  .status-bar { padding: 10px 12px; }

  /* PROCESSED */
  .processed-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  .processed-actions { gap: 6px; }

  /* HISTORY */
  .history-card {
    padding: 1rem;
    border-radius: var(--radius-md);
  }

  .history-list { max-height: 260px; }

  .history-item { padding: 10px; gap: 8px; }

  .history-excerpt { font-size: 12px; }

  /* FOOTER */
  .footer-inner { flex-direction: column; text-align: center; gap: 4px; }
}

/* ── Mobile petit (≤380px) ── */
@media (max-width: 380px) {

  .container { padding-inline: 0.75rem; }

  .app-card, .history-card { padding: 0.875rem; }

  .hero-title { font-size: 1.5rem; }

  .mode-tab {
    font-size: 10px;
    padding: 7px 4px;
  }

  .mode-tab svg { display: none; }

  .btn-speak { padding: 13px 10px; font-size: var(--fs-md); }

  .playback-secondary { flex-wrap: wrap; }

  .btn-control { flex-basis: calc(50% - 3px); flex-grow: 0; }

  .slider-label { width: 42px; }
}

/* ── Éviter le zoom sur les inputs iOS ── */
@media (max-width: 560px) {
  input[type="text"],
  input[type="email"],
  input[type="search"],
  textarea {
    font-size: 16px !important;
  }
}

/* ── Hauteur viewport réduite (paysage mobile) ── */
@media (max-height: 600px) and (max-width: 768px) {
  .hero-section { margin-bottom: 0.75rem; }
  .hero-badge   { display: none; }
  .hero-subtitle { display: none; }
  .main-wrapper { padding-block: 1rem 1.5rem; }
  .app-card { margin-bottom: 0.75rem; }
}
