:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --text: #1e293b;
  --text-muted: #64748b;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
  --nav-bg: #1e293b;
  --nav-text: #cbd5e1;
  --nav-active: #2563eb;
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  background: var(--nav-bg);
  color: #fff;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

header .logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

header .logo span { color: var(--primary); }

nav { display: flex; gap: 0.25rem; flex-wrap: wrap; }

nav a {
  color: var(--nav-text);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  transition: background .15s, color .15s;
}

nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
nav a.active { background: var(--primary); color: #fff; }

/* ── Layout ── */
main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1.25rem;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.card h2 .icon { font-size: 1.2rem; }

/* ── Home grid ── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  text-align: center;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  box-shadow: var(--shadow);
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  border-color: var(--primary);
}

.tool-card .tool-icon { font-size: 2rem; }
.tool-card .tool-name { font-weight: 600; font-size: .95rem; }
.tool-card .tool-desc { font-size: .78rem; color: var(--text-muted); }

.category-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin: 1.75rem 0 .5rem;
}

.category-title:first-child { margin-top: 0; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }

label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: .35rem;
  color: var(--text);
}

input[type="text"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: .9rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

textarea { resize: vertical; min-height: 120px; font-family: 'Consolas', monospace; font-size: .85rem; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border: none;
  border-radius: 7px;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.btn:active { transform: scale(.97); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }

.btn-group { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }

/* ── Results ── */
.result-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 1rem;
  margin-top: 1rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .4rem 0;
  border-bottom: 1px solid var(--border);
}

.result-row:last-child { border-bottom: none; }
.result-label { font-size: .85rem; color: var(--text-muted); }
.result-value { font-weight: 600; font-size: 1rem; font-family: 'Consolas', monospace; }
.result-value.big { font-size: 1.4rem; color: var(--primary); }

/* ── Inline rows ── */
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row .form-group { flex: 1; min-width: 120px; }

/* ── Time inputs ── */
.time-inputs { display: flex; gap: .5rem; align-items: flex-end; }
.time-inputs input { text-align: center; }
.time-sep { padding-bottom: .6rem; font-weight: 700; color: var(--text-muted); }

/* ── Presets ── */
.presets { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .75rem; }
.preset-btn {
  padding: .3rem .7rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  font-size: .8rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.preset-btn:hover, .preset-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Code / JSON ── */
.code-output {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 7px;
  padding: 1rem;
  font-family: 'Consolas', monospace;
  font-size: .85rem;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
  margin-top: .75rem;
}

.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-danger  { background: #fee2e2; color: #dc2626; }

/* ── Password strength ── */
.strength-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  margin-top: .5rem;
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s, background .3s;
}

/* ── Meteo ── */
.meteo-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.meteo-icon { font-size: 4rem; }
.meteo-temp { font-size: 3rem; font-weight: 700; color: var(--primary); }
.meteo-detail { font-size: .9rem; color: var(--text-muted); margin-top: .25rem; }

/* ── Subnav jeux ── */
nav.subnav {
  background: #0f172a;
  padding: .3rem 1.5rem;
  display: flex;
  gap: .2rem;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255,255,255,.07);
}
nav.subnav a {
  color: #94a3b8;
  text-decoration: none;
  padding: .3rem .6rem;
  border-radius: 5px;
  font-size: .8rem;
  transition: background .15s, color .15s;
}
nav.subnav a:hover { background: rgba(255,255,255,.08); color: #fff; }
nav.subnav a.active { background: var(--primary); color: #fff; }

/* ── Footer ── */
footer {
  text-align: center;
  padding: 1rem;
  font-size: .78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ── IMC meter ── */
.imc-scale {
  display: flex;
  border-radius: 6px;
  overflow: hidden;
  height: 12px;
  margin: .75rem 0 .25rem;
}
.imc-scale div { flex: 1; }
.imc-needle {
  position: relative;
  height: 20px;
}
.imc-pointer {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  width: 3px;
  height: 20px;
  background: var(--text);
  border-radius: 2px;
  transition: left .4s;
}

/* ── Tabs ── */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; }
.tab-btn {
  padding: .5rem 1rem;
  border: none;
  background: none;
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Copy btn ── */
.copy-btn {
  font-size: .75rem;
  padding: .25rem .6rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  transition: background .15s;
}
.copy-btn:hover { background: var(--border); }

/* ── Responsive ── */
@media (max-width: 600px) {
  header { gap: 1rem; }
  nav a { padding: .35rem .5rem; font-size: .8rem; }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .row { flex-direction: column; }
  .time-inputs { flex-wrap: wrap; }
}
