/* ==========================================================================
   Lorem Zen — Feuille de style contemporaine, épurée et zen
   ========================================================================== */

:root {
  /* Palette Lumineuse Zen */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  
  --border-subtle: #e2e8f0;
  --border-focus: #94a3b8;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --accent-primary: #0f172a;
  --accent-hover: #334155;
  --accent-light: #f1f5f9;
  
  --zen-emerald: #059669;
  --zen-emerald-bg: #ecfdf5;
  --zen-emerald-border: #a7f3d0;
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-subtle: 0 1px 3px 0 rgba(0, 0, 0, 0.02), 0 10px 30px -5px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.03), 0 1px 2px 0 rgba(15, 23, 42, 0.02);
  --shadow-floating: 0 20px 40px -10px rgba(15, 23, 42, 0.08);

  --transition-smooth: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Prise en charge automatique du mode sombre zen */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-app: #0b0f17;
    --bg-card: #131b26;
    --bg-card-subtle: #1a2332;
    --bg-input: #101620;
    
    --border-subtle: #242f40;
    --border-focus: #475569;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-primary: #f8fafc;
    --accent-hover: #cbd5e1;
    --accent-light: #1e293b;

    --zen-emerald: #10b981;
    --zen-emerald-bg: #064e3b;
    --zen-emerald-border: #047857;

    --shadow-subtle: 0 4px 24px -2px rgba(0, 0, 0, 0.4);
    --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
  }
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 3.5rem 1.5rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Mise en page Zen
   ========================================================================== */
.zen-layout {
  width: 100%;
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ==========================================================================
   En-tête minimaliste
   ========================================================================== */
.zen-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  padding-bottom: 0.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Cercle Enso / Zen minimaliste */
.zen-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid var(--text-primary);
  border-right-color: transparent;
  transform: rotate(-35deg);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.zen-header:hover .zen-circle {
  transform: rotate(325deg);
}

.brand-title {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 0.98rem;
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 440px;
}

/* ==========================================================================
   Cartes & Conteneurs
   ========================================================================== */
.zen-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.zen-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease;
}

/* ==========================================================================
   Panneau des contrôles
   ========================================================================== */
.controls-card {
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.counter-field {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.label-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.char-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card-subtle);
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-sm);
}

.inputs-composite {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Curseur range zen */
.zen-slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.zen-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-primary);
  border: 3px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.zen-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.zen-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-primary);
  border: 3px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: grab;
  transition: transform 0.15s ease;
}

/* Saisie numérique directe */
.direct-input-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 155px;
}

.zen-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.45rem 3.4rem 0.45rem 0.75rem;
  outline: none;
  transition: var(--transition-smooth);
}

.zen-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.15);
}

.input-suffix {
  position: absolute;
  right: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  pointer-events: none;
}

/* Raccourcis pills */
.presets-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.presets-caption {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.presets-list {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.preset-pill {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.28rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.preset-pill:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
  background: var(--bg-card-subtle);
}

.preset-pill.active {
  background: var(--text-primary);
  color: var(--bg-card);
  border-color: var(--text-primary);
}

/* Barre d'options secondaires */
.options-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
}

/* Switch iOS / Zen toggle */
.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
}

.switch-control input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  width: 38px;
  height: 22px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  position: relative;
  transition: background 0.2s ease;
}

.switch-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.switch-control input:checked + .switch-slider {
  background: var(--text-primary);
}

.switch-control input:checked + .switch-slider::before {
  transform: translateX(16px);
}

.switch-label {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.switch-label em {
  font-style: italic;
  color: var(--text-primary);
}

/* Bouton Régénérer */
.btn-refresh {
  background: transparent;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}

.btn-refresh:hover {
  color: var(--text-primary);
  background: var(--bg-card-subtle);
}

.btn-refresh:hover .icon-refresh {
  transform: rotate(90deg);
}

.icon-refresh {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Carte d'affichage & Lecture
   ========================================================================== */
.output-card {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Barre d'état supérieure */
.output-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.text-metrics {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.metric {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
}

.metric-value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1rem;
}

.metric-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.metric-dot {
  color: var(--border-subtle);
}

/* Bouton Copier Zen */
.btn-copy-zen {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.5rem 1.15rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: var(--transition-smooth);
}

.btn-copy-content {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-copy-zen:hover {
  background: var(--bg-card-subtle);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.btn-copy-zen:active {
  transform: translateY(0);
}

/* État copié */
.btn-copy-zen.copied {
  background: var(--zen-emerald);
  border-color: var(--zen-emerald);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

/* Zone du texte */
.output-content-container {
  min-height: 160px;
}

.zen-text {
  font-size: 1.125rem;
  line-height: 1.85;
  color: var(--text-primary);
  font-weight: 400;
  letter-spacing: -0.008em;
  text-align: left;
  outline: none;
}

.zen-text p {
  margin-bottom: 1.25rem;
}

.zen-text p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Toast Notification Zen
   ========================================================================== */
.zen-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  opacity: 0;
  background: var(--text-primary);
  color: var(--bg-card);
  border-radius: var(--radius-full);
  padding: 0.65rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: var(--shadow-floating);
  pointer-events: none;
  z-index: 100;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.zen-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   Pied de page épuré
   ========================================================================== */
.zen-footer {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 1rem 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 640px) {
  body {
    padding: 2rem 1rem;
  }

  .controls-card {
    padding: 1.25rem;
  }

  .output-card {
    padding: 1.25rem;
  }

  .inputs-composite {
    flex-direction: column;
    align-items: stretch;
  }

  .direct-input-box {
    width: 100%;
  }

  .options-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .output-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-copy-zen {
    justify-content: center;
    width: 100%;
  }

  .zen-text {
    font-size: 1.05rem;
    line-height: 1.75;
  }
}
