/* ============================================================
   TP 03 — PORTAIL CAPTIF WI-FI "Infratech-Guest"
   Style Apple clair (+ thème sombre).

   Points du cahier des charges :
   - Double affichage : 2 colonnes sur desktop, 1 seule sur mobile
   - Sur mobile, l'illustration est masquée via display: none
   - Champs et bouton tactiles : hauteur minimale 44px
   - Police des inputs >= 16px sur mobile (évite le zoom auto iOS)
   - Typographie fluide avec clamp() sur le titre et les consignes
   ============================================================ */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e5e8;
  --line-soft: #f0f0f2;
  --field-bg: #ffffff;
  --accent: #0071e3;
  --accent-ink: #0058b9;
  --ok: #34c759;
  --illus-1: #0071e3;
  --illus-2: #003d82;
  --radius: 20px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
}

/* thème sombre */
html[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --ink: #f5f5f7;
  --muted: #98989d;
  --line: #2c2c2e;
  --line-soft: #2c2c2e;
  --field-bg: #2c2c2e;
  --accent: #0a84ff;
  --accent-ink: #409cff;
  --illus-1: #0a3a6b;
  --illus-2: #041c33;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 2.5rem);
  transition: background .4s ease, color .4s ease;
}

/* bouton thème flottant en haut à droite */
.theme-btn {
  position: fixed; top: 1.2rem; right: 1.2rem; z-index: 20;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; display: inline-grid; place-items: center; padding: 0;
  transition: border-color .2s, transform .15s, box-shadow .2s;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,113,227,.18); }
.theme-btn:active { transform: scale(.94); }
.theme-btn svg { width: 20px; height: 20px; display: block; }
.theme-btn .moon { display: none; }
html[data-theme="dark"] .theme-btn .sun { display: none; }
html[data-theme="dark"] .theme-btn .moon { display: block; }

/* ============================================================
   CARTE DU PORTAIL — 2 colonnes (illustration + formulaire)
   ============================================================ */
.portal {
  width: min(940px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.1);
  display: grid;
  grid-template-columns: 1fr 1fr;   /* 2 colonnes sur desktop */
}

/* ─── Colonne gauche : illustration corporate ─── */
.illus {
  background: linear-gradient(160deg, var(--illus-1), var(--illus-2));
  color: #fff;
  padding: clamp(2rem, 4vw, 3rem);
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 2rem;
  position: relative;
  overflow: hidden;
}
.illus::before {
  content: ''; position: absolute; width: 300px; height: 300px;
  background: rgba(255,255,255,.08); border-radius: 50%;
  top: -100px; right: -100px;
}
.illus .badge-wifi { display: inline-flex; align-items: center; gap: .6rem; font-size: .85rem; font-weight: 500; background: rgba(255,255,255,.15); padding: .5rem 1rem; border-radius: 99px; align-self: flex-start; }
.illus h2 {
  /* TYPO FLUIDE avec clamp() : min 1.5rem, idéal 3vw, max 2.2rem */
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 700; letter-spacing: -.02em; line-height: 1.15;
}
.illus .rules { display: flex; flex-direction: column; gap: 1rem; }
.illus .rule { display: flex; gap: .8rem; align-items: flex-start; }
.illus .rule .r-ico { font-size: 1.3rem; flex-shrink: 0; }
.illus .rule .r-txt {
  /* consignes en typo fluide aussi */
  font-size: clamp(.85rem, 1.6vw, 1rem);
  color: rgba(255,255,255,.9);
}
.illus .rule .r-txt strong { display: block; color: #fff; margin-bottom: .1rem; }

/* ─── Colonne droite : formulaire d'authentification ─── */
.auth {
  padding: clamp(2rem, 4vw, 3rem);
  display: flex; flex-direction: column; justify-content: center; gap: 1.4rem;
}
.auth .logo { display: flex; align-items: center; gap: .6rem; font-weight: 600; }
.auth .logo .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.auth h1 {
  /* TITRE du portail en clamp() */
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800; letter-spacing: -.03em; line-height: 1.1;
}
.auth .intro { color: var(--muted); font-size: clamp(.9rem, 2vw, 1rem); margin-top: -.6rem; }

.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .4rem; }
.field label { font-size: .85rem; font-weight: 500; color: var(--muted); }

/* CHAMPS TACTILES : hauteur >= 44px, police >= 16px (anti-zoom iOS) */
.field input {
  min-height: 44px;
  padding: .7rem 1rem;
  font-size: 16px;                 /* empêche le zoom auto sur iOS Safari */
  font-family: var(--font);
  background: var(--field-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: var(--muted); }
.field input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,113,227,.15);
}

/* case charte informatique */
.charte { display: flex; align-items: flex-start; gap: .6rem; font-size: .88rem; color: var(--muted); }
.charte input { width: 20px; height: 20px; min-width: 20px; margin-top: .1rem; accent-color: var(--accent); }
.charte a { color: var(--accent); text-decoration: none; }

/* BOUTON tactile : hauteur >= 44px */
.auth-form button {
  min-height: 48px;
  background: var(--accent);
  border: none; border-radius: 12px;
  color: #fff; font-family: var(--font);
  font-size: 1rem; font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.auth-form button:hover { background: var(--accent-ink); transform: translateY(-1px); }
.auth-form button:active { transform: translateY(0); }

.auth .help { font-size: .82rem; color: var(--muted); text-align: center; }
.auth .help a { color: var(--accent); text-decoration: none; }

/* petit statut réseau en bas */
.net-status { display: flex; align-items: center; justify-content: center; gap: .5rem; font-size: .8rem; color: var(--muted); }
.net-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }

/* ============================================================
   RESPONSIVE — LE CŒUR DU TP (Media Queries)
   ============================================================ */

/* Tablette et smartphone : une seule colonne */
@media (max-width: 800px) {
  .portal { grid-template-columns: 1fr; }   /* passe en 1 colonne */

  /* MASQUAGE de l'illustration sur mobile (économie de bande passante) */
  .illus { display: none; }
}

/* Très petit écran : on resserre un peu les marges internes */
@media (max-width: 400px) {
  .auth { padding: 1.6rem; }
}
