/* Variables principales */
:root {
  --bg: linear-gradient(135deg, #f5f7fa, #dfe9f3);
  --text: #1e1e1e;
  --accent: #ff7eb3;
  --accent-hover: #ff4d91;
  --secondary: #4f8cff;
  --border: rgba(255, 255, 255, 0.2);
  --card-bg: rgba(255, 255, 255, 0.8);
  --shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  --bg: linear-gradient(135deg, #141e30, #243b55);
  --text: #f1f1f1;
  --accent: #ff4d91;
  --accent-hover: #ff1a75;
  --secondary: #66aaff;
  --border: rgba(255, 255, 255, 0.1);
  --card-bg: rgba(30, 30, 30, 0.8);
  --shadow: rgba(0, 0, 0, 0.4);
}

/* Reset & base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.5s ease, color 0.3s ease;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 1rem 2rem;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 12px var(--shadow);
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Bouton thème */
#toggle-theme {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s ease, transform 0.15s ease;
}
#toggle-theme:hover {
  background: var(--accent-hover);
  transform: translateY(-2px) scale(1.05);
}

/* Main Layout */
main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem 2rem;
  flex: 1;
}

section {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: 0 6px 20px var(--shadow);
  padding: 1rem;
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}
section:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px var(--shadow);
}

section h2 {
  margin-bottom: 0.8rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--accent);
}

/* Zone de texte */
textarea {
  flex: 1;
  padding: 1rem;
  font-family: monospace;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: none;
  outline: none;
  transition: border 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
}
textarea:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 126, 179, 0.4);
}

/* Aperçu */
#preview {
  flex: 1;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-y: auto;
}

/* Footer */
footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 8px var(--shadow);
  padding: 1rem;
  gap: 0.5rem;
}

/* Boutons en ligne */
.footer-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

/* Boutons */
button {
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  font-size: 1rem;
  transition: background 0.2s ease, transform 0.15s ease;
}
button:hover {
  background: var(--accent-hover);
  transform: translateY(-2px) scale(1.05);
}

/* Crédit */
footer p {
  font-size: 0.9rem;
  opacity: 0.7;
}

/* Responsive */
@media (max-width: 768px) {
  main {
    grid-template-columns: 1fr;
  }
}
