/* ================================================================
   Panel Crème — Tokens, reset, login, compte
   Ce fichier contient le CSS DE BASE (reset + login + compte + utils).
   Le layout commun (sidebar, main, cards) est dans shell.css.
   ================================================================ */

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

/* ================================================================
   Bannière "MODE DÉMO" — visible sur toutes les pages
   ================================================================ */
.demo-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  background: #ffea29;
  color: #171412;
  border-bottom: 2.5px solid #171412;
  font-family: Labil, Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.05);
}
.demo-banner-dot {
  width: 8px; height: 8px;
  background: #d1322d;
  border-radius: 50%;
  animation: demo-pulse 1.4s ease-in-out infinite;
}
@keyframes demo-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.7); }
}
body { padding-top: 36px; }
/* La sidebar et les headers sticky doivent commencer sous la bannière */
.sidebar { top: 36px !important; height: calc(100vh - 36px) !important; }
.main-header-brand { top: 36px !important; }
@media (max-width: 600px) {
  .demo-banner { font-size: 0.68rem; padding: 0.4rem 0.6rem; }
  body { padding-top: 30px; }
  .sidebar { top: auto !important; }
  .main-header-brand { top: 30px !important; }
}

/* ================================================================
   Root font-size fluide — la base `rem` s'adapte à la hauteur de
   l'écran pour que toute l'interface tienne sans scroll sur les
   laptops (1366×768 + scaling Windows). Référence : 16px à 900vh.
   Clamp 11→16px pour éviter les extrêmes.
   ================================================================ */
html {
  font-size: clamp(11px, calc(100vh / 56.25), 16px);
}
/* Désactive le scaling sous 600px de large (vrai mobile / portrait) :
   on préfère garder la lisibilité absolue que faire tenir à tout prix. */
@media (max-width: 600px) {
  html { font-size: 16px; }
}

:root {
  --primary:    #3905c8;
  --secondary:  #ffea29;
  --green:      #00c26b;
  --orange:     #fc6b44;
  --pink:       #ff66bc;
  --blue:       #43c1f9;
  --purple:     #ca74ff;
  --red:        #d1322d;
  --bg:         #fbf9ef;
  --bg-alt:     #f5f2ea;
  --base:       #171412;
  --grey:       #8e827c;
  --line:       #e5e2da;
  --card:       #ffffff;

  --shadow-sm:  3px 3px 0 var(--base);
  --shadow-md:  5px 5px 0 var(--base);
  --shadow-lg:  7px 7px 0 var(--base);
  --shadow-xl:  10px 10px 0 var(--base);

  --radius-sm:  0.5rem;
  --radius-md:  0.85rem;
  --radius-lg:  1.1rem;

  --ease:       cubic-bezier(0.22, 1, 0.36, 1);
}

html, body {
  font-family: Labil, Arial, sans-serif;
  background: var(--bg-alt);
  color: var(--base);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

body { min-height: 100vh; overflow-x: hidden; }

/* ---- Decor background (login) ---- */
body.has-bg-decor { background: var(--bg); position: relative; }
body.has-bg-decor::before,
body.has-bg-decor::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
}
body.has-bg-decor::before {
  top: -10%; right: -8%;
  width: 55vw; height: 55vw;
  background: rgba(57, 5, 200, 0.1);
}
body.has-bg-decor::after {
  bottom: -8%; left: -6%;
  width: 40vw; height: 40vw;
  background: rgba(255, 234, 41, 0.15);
}

/* ================================================================
   FORM ELEMENTS (shared)
   ================================================================ */

.field { display: flex; flex-direction: column; gap: 0.45rem; }
.field label {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.input {
  width: 100%;
  font-family: Labil, Arial, sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--base);
  background: #fff;
  border: 2.5px solid var(--base);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  outline: none;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 4px 4px 0 var(--primary);
  transform: translate(-1px, -1px);
}
.input::placeholder { color: rgba(23,20,18,0.3); font-weight: 600; }
.input:disabled { background: var(--bg-alt); color: var(--grey); cursor: not-allowed; }

textarea.input {
  min-height: 90px;
  line-height: 1.45;
  resize: vertical;
}

input[type="checkbox"] {
  width: 20px; height: 20px;
  border: 2.5px solid var(--base);
  border-radius: 5px;
  appearance: none;
  -webkit-appearance: none;
  background: #fff;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease;
  vertical-align: middle;
}
input[type="checkbox"]:hover { transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--base); }
input[type="checkbox"]:checked {
  background: var(--primary);
  box-shadow: 2px 2px 0 var(--base);
}
input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
  font-weight: 900;
  font-size: 15px;
}

/* ================================================================
   BUTTONS
   ================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  font-family: Labil, Arial, sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.95rem 1.5rem;
  border-radius: var(--radius-md);
  border: 2.5px solid var(--base);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translate(2px, 2px) !important; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.btn-primary:hover {
  transform: translate(-2px, -3px);
  box-shadow: 7px 8px 0 var(--base);
  background: #4a0fde;
}
.btn-primary:active { box-shadow: 2px 2px 0 var(--base); }

.btn-secondary {
  background: var(--secondary);
  color: var(--base);
  box-shadow: var(--shadow-md);
}
.btn-secondary:hover {
  transform: translate(-2px, -3px);
  box-shadow: 7px 8px 0 var(--base);
}

.btn-ghost {
  background: #fff;
  border: 2.5px solid var(--base);
  color: var(--base);
  box-shadow: var(--shadow-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.75rem 1.1rem;
  font-size: 0.78rem;
}
.btn-ghost:hover {
  transform: translate(-1px, -2px);
  box-shadow: 4px 5px 0 var(--base);
  background: var(--bg);
}

.btn-danger {
  background: #fff;
  color: var(--red);
  border: 2.5px solid var(--red);
  box-shadow: 3px 3px 0 var(--red);
  padding: 0.75rem 1.1rem;
  font-size: 0.78rem;
}
.btn-danger:hover {
  transform: translate(-1px, -2px);
  box-shadow: 5px 5px 0 var(--red);
  background: var(--red);
  color: #fff;
}

.btn-block { width: 100%; }
.btn-small { padding: 0.45rem 0.85rem; font-size: 0.7rem; border-width: 2px; }

/* ================================================================
   FILTER CHIP (boutons toggle pill — tri, audience, etc.)
   ================================================================ */

.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  background: #fff;
  color: var(--base);
  border: 2px solid var(--base);
  border-radius: 999px;
  box-shadow: 2px 2px 0 var(--base);
  font-family: Labil, Arial, sans-serif;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}
.filter-chip:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--base);
}
.filter-chip.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: 3px 3px 0 var(--base);
}

/* ================================================================
   ALERTS
   ================================================================ */

.alert {
  padding: 0.9rem 1.1rem;
  border: 2.5px solid var(--base);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.45;
}
.alert-success { background: color-mix(in srgb, var(--green) 25%, #fff); }
.alert-error   { background: color-mix(in srgb, var(--red)   18%, #fff); }
.alert-info    { background: color-mix(in srgb, var(--primary) 12%, #fff); }

/* ================================================================
   LOADER
   ================================================================ */

.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  padding: 2rem;
  position: relative;
}
.loader::before {
  content: "";
  width: 18px; height: 18px;
  border: 3px solid var(--primary);
  border-top-color: transparent;
  border-radius: 50%;
  margin-right: 0.75rem;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   LOGIN / SIGNUP PAGE
   ================================================================ */

.login-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 2rem 1.1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.login-logo {
  width: 180px; height: 180px;
  object-fit: contain;
  border: none;
  background: none;
  margin-bottom: 1.5rem;
}

.login-title {
  font-size: clamp(1.8rem, 5.5vw, 2.2rem);
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}
.login-title .hl {
  display: inline;
  background-image: linear-gradient(transparent 62%, var(--secondary) 62%, var(--secondary) 88%, transparent 88%);
  padding: 0 0.15em;
}
.login-sub {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--grey);
  text-align: center;
  margin-bottom: 2rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.login-switch {
  margin-top: 1.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--grey);
  text-align: center;
}
.login-switch a, .login-switch button {
  color: var(--primary);
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  margin-left: 0.35rem;
  padding: 0;
}
.login-switch a:hover, .login-switch button:hover { text-decoration: underline; }

/* Tabs login / signup */
.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  background: #fff;
  border: 2.5px solid var(--base);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 4px;
  width: 100%;
}
.auth-tab {
  flex: 1;
  padding: 0.7rem 1rem;
  font-family: Labil, Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: transparent;
  color: var(--grey);
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.auth-tab.is-active {
  background: var(--primary);
  color: #fff;
}

.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 420px) {
  .field-grid-2 { grid-template-columns: 1fr; }
}

/* ================================================================
   HINT / CALLOUT
   ================================================================ */

.hint {
  font-size: 0.75rem;
  color: var(--grey);
  font-weight: 700;
  line-height: 1.5;
  margin-top: 0.5rem;
}
.hint b { color: var(--base); }
.hint code {
  background: var(--bg-alt);
  border: 1.5px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.92em;
}

.callout {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  background: var(--bg-alt);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--grey);
  line-height: 1.5;
  margin-top: 0.85rem;
}
.callout-emoji { font-size: 1.1rem; flex-shrink: 0; }
.callout b { color: var(--base); }

/* ================================================================
   ANIMATIONS
   ================================================================ */

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { opacity: 0; animation: fade-in-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.fade-d1  { animation-delay: 0.05s; }
.fade-d2  { animation-delay: 0.14s; }
.fade-d3  { animation-delay: 0.28s; }

.hidden { display: none !important; }

/* ================================================================
   PAGE HEADER (main-header)
   Utilisé dans toutes les pages du panel après login
   ================================================================ */

.page-badge {
  display: inline-block;
  background: var(--secondary);
  color: var(--base);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 5px 14px;
  border: 2.5px solid var(--base);
  border-radius: 6px;
  box-shadow: 3px 3px 0 var(--base);
  transform: rotate(-2.5deg);
  margin-bottom: 0.85rem;
}

.page-title {
  font-size: clamp(1.75rem, 7vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.02;
}
.page-title .hl {
  display: inline;
  background-image: linear-gradient(transparent 58%, var(--secondary) 58%, var(--secondary) 90%, transparent 90%);
  padding: 0 0.1em;
}
.page-subtitle {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--grey);
  margin-top: 0.5rem;
  line-height: 1.4;
}

.main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}
.main-header > div:first-child { flex: 1; min-width: 0; }

/* ================================================================
   CARDS
   ================================================================ */

.card {
  background: #fff;
  border: 2.5px solid var(--base);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  position: relative;
}
.card + .card { margin-top: 1.25rem; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.card-title {
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.card-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: var(--primary);
  color: var(--secondary);
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 7px;
  border: 2px solid var(--base);
  box-shadow: 2px 2px 0 var(--base);
  transform: rotate(-5deg);
  flex-shrink: 0;
}

/* ================================================================
   CARD VARIANTS
   ================================================================ */

.card-compact { padding: 1.1rem 1.15rem 1.25rem; }
.card-compact .card-header { margin-bottom: 0.75rem; }

/* ================================================================
   EMPTY STATE
   ================================================================ */

.empty-state {
  background: #fff;
  border: 2.5px dashed var(--base);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  margin-top: 1.5rem;
  position: relative;
}
.empty-state .empty-emoji {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
  display: inline-block;
  transform: rotate(-8deg);
}
.empty-state h2 {
  font-size: clamp(1.3rem, 5vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.empty-state p {
  color: var(--grey);
  font-weight: 700;
  margin-bottom: 1.5rem;
  line-height: 1.5;
  font-size: 0.88rem;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

/* Extra animation delays */
.fade-d2b { animation-delay: 0.19s; }
.fade-d2c { animation-delay: 0.24s; }
.fade-d4  { animation-delay: 0.36s; }

/* ================================================================
   DESKTOP (min-width: 900px)
   ================================================================ */

@media (min-width: 900px) {
  body { overflow-x: auto; }
  .card { padding: 1.85rem; }
  .main-header { margin-bottom: 2.25rem; }
  .page-badge { margin-bottom: 1rem; }
}
