/* public/style.css */

:root {
  --bg: #0f172a;
  --panel: #111827;
  --card: #1f2937;
  --card-light: #273449;
  --text: #f9fafb;
  --muted: #9ca3af;
  --accent: #38bdf8;
  --accent-2: #6366f1;
  --danger: #ef4444;
  --success: #22c55e;
  --border: rgba(255,255,255,0.08);
  --shadow: 0 18px 45px rgba(0,0,0,0.35);
  --body-gradient: linear-gradient(135deg, var(--bg), #020617);
  --glass: rgba(31, 41, 55, 0.88);
  --topbar-bg: rgba(15, 23, 42, 0.85);
  --code-bg: #020617;
  --code-text: #d1d5db;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 22%, transparent), transparent 35%),
    var(--body-gradient);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.topbar {
  height: 86px;
  padding: 18px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
}

.status {
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-weight: 800;
  border: 1px solid var(--border);
}

.status.online {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.15);
}

.status.error {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.15);
}

.container {
  width: min(1200px, calc(100% - 32px));
  margin: 32px auto;
}

.hero {
  padding: 30px;
  border-radius: 26px;
  background: var(--glass);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero h2 {
  margin: 0 0 10px;
  font-size: 2rem;
}

.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

button,
.button-link {
  border: none;
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  background: var(--accent);
  color: #001018;
  font-weight: 900;
  font-size: 0.95rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, filter 0.15s ease;
}

button:hover,
.button-link:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

button.secondary,
.button-link.secondary {
  background: var(--card-light);
  color: var(--text);
  border: 1px solid var(--border);
}

.grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.card {
  min-height: 260px;
  padding: 22px;
  border-radius: 22px;
  background: var(--glass);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 16px;
}

pre {
  margin: 0;
  padding: 16px;
  border-radius: 16px;
  overflow: auto;
  min-height: 180px;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--border);
}

.file-list {
  color: var(--muted);
}

.file-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 13px 12px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  margin-bottom: 10px;
}

.file-row strong {
  color: var(--text);
}

.file-row small {
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.error-text {
  color: #fecaca;
}

.theme-select {
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-weight: 800;
  outline: none;
}

.theme-select:focus {
  border-color: var(--accent);
}

footer {
  width: min(1200px, calc(100% - 32px));
  margin: 26px auto;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

@media (max-width: 800px) {
  .topbar {
    height: auto;
    gap: 16px;
    align-items: flex-start;
    flex-direction: column;
  }

  .grid {
    grid-template-columns: 1fr;
  }

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

/* ===============================
   BOUTON LOGO / THEME
================================ */

.theme-logo-btn {
  border: none;
  padding: 0;
  cursor: pointer;
}

.theme-logo-btn:hover {
  transform: translateY(-1px) scale(1.03);
  filter: brightness(1.08);
}

/* ===============================
   MODALE THEME
================================ */

.theme-modal.hidden {
  display: none;
}

.theme-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.theme-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(50, 20, 20, 0.58);
  backdrop-filter: blur(9px);
}

.theme-modal-box {
  position: relative;
  width: min(620px, calc(100% - 32px));
  max-height: calc(100vh - 70px);
  overflow-y: auto;
  margin: 70px auto;
  padding: 30px;
  border-radius: 26px;
  background: #fff5ef;
  color: #2b160f;
  box-shadow: 0 30px 90px rgba(0,0,0,0.35);
}

.theme-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.theme-modal-header h2 {
  margin: 0;
  font-size: 1.45rem;
  font-family: Georgia, serif;
}

.theme-close-btn {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 50%;
  background: #f7c7b2;
  color: #2b160f;
  font-size: 2rem;
  line-height: 1;
}

.theme-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.theme-choice {
  width: 100%;
  min-height: 72px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-radius: 22px;
  background: rgba(255,255,255,0.45);
  color: #2b160f;
  border: 1px solid rgba(80, 40, 30, 0.22);
  font-size: 1.35rem;
  font-weight: 900;
  text-align: left;
}

.theme-choice:hover {
  background: rgba(255,255,255,0.75);
}

.theme-choice.active {
  outline: 3px solid rgba(43, 22, 15, 0.25);
}

.theme-pill {
  width: 76px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 999px;
  overflow: hidden;
  display: inline-flex;
}

.theme-pill::before,
.theme-pill::after {
  content: "";
  width: 50%;
  height: 100%;
}

.theme-pill.purple::before { background: #9575db; }
.theme-pill.purple::after { background: #6f3ed0; }

.theme-pill.pink::before { background: #db8dab; }
.theme-pill.pink::after { background: #c84a7b; }

.theme-pill.blue::before { background: #6fa7dc; }
.theme-pill.blue::after { background: #3282cf; }

.theme-pill.green::before { background: #77bf99; }
.theme-pill.green::after { background: #2fa26a; }

.theme-pill.peach::before { background: #e1a07d; }
.theme-pill.peach::after { background: #cc6d3e; }

.theme-pill.moka::before { background: #9c7b6e; }
.theme-pill.moka::after { background: #845b4c; }

.theme-pill.sun::before { background: #dfb657; }
.theme-pill.sun::after { background: #d4951c; }

.theme-pill.mint::before { background: #72c3b4; }
.theme-pill.mint::after { background: #269f88; }

.theme-pill.night::before { background: #31415f; }
.theme-pill.night::after { background: #506bd8; }

.theme-pill.gray::before { background: #aeb7c3; }
.theme-pill.gray::after { background: #475569; }

@media (max-width: 700px) {
  .theme-modal-box {
    margin: 30px auto;
    padding: 22px;
  }

  .theme-choice {
    font-size: 1.05rem;
  }
}