/* ---- Caffework : base, DA lo-fi cosy moderne (expression nuit), variables ---- */
:root {
  /* Neutres chauds — fond cosy sombre, texte cremeux (DA) */
  --espresso: #1d1712;
  --espresso-2: #251e18;
  --espresso-3: #2f2620;
  --cream: #f7f1e6;
  --cream-dim: #c3b5a4;
  /* Couleurs de marque (DA) */
  --clay: #c96a4b;
  --clay-deep: #a4502f;
  --sage: #8fa587;
  --honey: #e6b25c;
  --on-accent: #fff6ee;
  --line: rgba(247, 241, 230, 0.10);
  --line-strong: rgba(247, 241, 230, 0.18);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --radius-sm: 12px;
  --accent: var(--clay);
  --accent-deep: var(--clay-deep);
  --font-display: 'Bricolage Grotesque', 'Hanken Grotesk', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* Lettre accentuee du wordmark "caffework" */
.ff { color: var(--accent); }

/* Les ambiances de room sont appliquées en CSS inline (variables) depuis les couleurs
   du thème renvoyées par l'API — voir room.js / lobby.js. */

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

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  color: var(--cream);
  background: var(--espresso);
  -webkit-font-smoothing: antialiased;
  position: relative;
  min-height: 100%;
}

/* Grain / texture douce sans degrade plat */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  z-index: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 4px 4px;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }

a { color: inherit; text-decoration: none; }

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  color: inherit;
  background: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  background: var(--accent);
  color: var(--on-accent);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: rgba(244, 234, 215, 0.06); }

.icon { width: 18px; height: 18px; display: inline-block; vertical-align: middle; }

/* ---- Inputs : style global homogene et cosy (toute l'app) ---- */
input[type='text'],
input[type='email'],
input[type='password'],
input[type='search'],
input[type='url'],
input[type='number'],
textarea,
select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.4;
  color: var(--cream);
  background: var(--espresso-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { resize: vertical; min-height: 84px; line-height: 1.5; }

select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c3b5a4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

input[type='text']:focus,
input[type='email']:focus,
input[type='password']:focus,
input[type='search']:focus,
input[type='url']:focus,
input[type='number']:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 106, 75, 0.12);
}

input::placeholder,
textarea::placeholder { color: var(--cream-dim); opacity: 0.55; }

/* Slider */
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--line-strong);
  cursor: pointer;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--espresso);
  cursor: pointer;
}
input[type='range']::-moz-range-thumb {
  width: 16px; height: 16px;
  border: 2px solid var(--espresso);
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
input[type='range']::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--line-strong);
}

/* Selecteur de couleur */
input[type='color'] {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--espresso-3);
  cursor: pointer;
  padding: 3px;
}
input[type='color']::-webkit-color-swatch-wrapper { padding: 0; }
input[type='color']::-webkit-color-swatch { border: none; border-radius: 8px; }
input[type='color']::-moz-color-swatch { border: none; border-radius: 8px; }

/* Modale identite */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 5, 3, 0.7);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.modal-backdrop.open { display: flex; }

.modal {
  width: 100%;
  max-width: 440px;
  background: var(--espresso-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  animation: pop 0.25s ease;
}
@keyframes pop {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.modal h2 { font-size: 26px; margin-bottom: 4px; }
.modal p.sub { color: var(--cream-dim); font-size: 14px; margin-bottom: 20px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--cream-dim); margin-bottom: 8px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.swatch:hover { transform: scale(1.1); }
.swatch.selected { border-color: var(--cream); }

/* Avatar : initiale sur fond perso */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  color: #1a1208;
  text-transform: uppercase;
  user-select: none;
}
