/* ==========================================================
   TurboCard – feuille de style (charte Turboself : rouge, gris, blanc – police Poppins)
   ========================================================== */

@font-face { font-family: 'Poppins'; font-weight: 300; font-display: swap; src: url('/static/fonts/Poppins-Light.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-weight: 400; font-display: swap; src: url('/static/fonts/Poppins-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-display: swap; src: url('/static/fonts/Poppins-Medium.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-weight: 600; font-display: swap; src: url('/static/fonts/Poppins-SemiBold.ttf') format('truetype'); }
@font-face { font-family: 'Poppins'; font-weight: 700; font-display: swap; src: url('/static/fonts/Poppins-Bold.ttf') format('truetype'); }

:root {
  --red: #E3262D;
  --red-dark: #C4161C;
  --red-soft: #fdeced;
  --ink: #1d1d1f;
  --text: #3a3a3c;
  --muted: #6b6b70;
  --line: #e4e4e7;
  --bg: #f3f3f4;
  --white: #fff;
  --ok: #1f8a4c;
  --radius: 14px;
  --shadow: 0 18px 48px rgba(0, 0, 0, .12);
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.5; font-size: 15px; }
a { color: var(--red); }
h1, h2 { color: var(--ink); line-height: 1.2; }
h1 { font-size: 26px; font-weight: 300; margin: 0 0 8px; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; }
h2 .icon { color: var(--red); }
h2.mt { margin-top: 28px; }
code { background: var(--bg); padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.icon { width: 20px; height: 20px; flex: none; }

/* ---------- Logos ---------- */
/* TurboCard : découpes du logo fourni (oiseau + mot) ; Turboself : logo officiel tel quel */
.logo { display: inline-flex; align-items: center; gap: 12px; }
.logo-bird { width: 40px; height: 40px; flex: none; border-radius: 50%; }
.logo-word-img { height: 16px; width: auto; display: block; }.logo-turboself { display: block; height: 44px; width: auto; }
.brand { text-decoration: none; display: inline-flex; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px; border: 1.5px solid transparent;
  font: inherit; font-weight: 600; font-size: 14px; text-decoration: none;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s, transform .15s;
  background: var(--ink); color: var(--white);
}
.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-dark); }
.btn-ghost { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-danger { background: var(--white); color: var(--red); border-color: #f3b9bb; }
.btn-danger:hover { background: var(--red-soft); }
.btn-small { padding: 6px 12px; font-size: 12px; }
.btn-small .icon { width: 16px; height: 16px; }
.btn-lg { padding: 16px 34px; font-size: 17px; box-shadow: 0 10px 24px rgba(227, 38, 45, .3); }
.btn-lg:hover { transform: translateY(-1px); }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn-link { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; font: inherit; font-size: 15px; color: var(--ink); cursor: pointer; padding: 8px; }
.btn-link:hover { color: var(--red); }
.btn:focus-visible, .btn-link:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(227, 38, 45, .35); outline-offset: 2px; }

/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span, .field-static > span { font-size: 13px; font-weight: 600; color: var(--ink); }
.field-static { display: flex; flex-direction: column; gap: 4px; margin: 0 0 14px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input:not([type]), select {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 15px; color: var(--ink); background: var(--white);
}
input:focus, select:focus { border-color: var(--red); outline: none; }
input::placeholder { color: #a9a9ae; }
input[readonly] { background: var(--bg); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 32px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check-danger { color: var(--red); }
.tag-print {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; vertical-align: 1px;
  background: var(--red-soft); color: var(--red); font-size: 10px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
}

.copy-field { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.copy-field input { flex: 1; min-width: 0; font-size: 13px; }

/* Zone d'envoi d'image */
.image-field { display: flex; gap: 20px; align-items: center; }
.image-preview {
  flex: none; background: var(--bg); border: 1.5px solid var(--line); overflow: hidden;
  display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center;
}
.image-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-preview-round { width: 110px; height: 110px; border-radius: 50%; }
.image-preview-wide { width: 220px; aspect-ratio: 1104 / 480; border-radius: 10px; }
.image-actions { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dropzone {
  position: relative; display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center;
  padding: 22px 16px; border: 2px dashed #cfcfd4; border-radius: var(--radius); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--red); background: var(--red-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone strong { color: var(--ink); font-weight: 400; }
.dropzone .muted { font-size: 12px; }

/* ---------- Messages ---------- */
.flash { border-radius: 12px; padding: 12px 16px; margin-bottom: 20px; border: 1px solid; }
.flash p { margin: 0; }
.flash-success { background: #eaf7ef; border-color: #b9e3c8; color: #17603a; }
.flash-error { background: var(--red-soft); border-color: #f3b9bb; color: #a3121a; }
.notice {
  display: flex; gap: 12px; align-items: flex-start; background: #f0f0f2; border-radius: 12px;
  padding: 14px 16px; margin: 0 0 20px; color: var(--ink); font-size: 14px;
}
.notice .icon { color: var(--red); margin-top: 1px; }
.notice p { margin: 0 0 4px; }
.notice p:last-child { margin-bottom: 0; }
.notice-warn { background: var(--red-soft); }

.badge {
  background: var(--red-soft); color: var(--red); font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em;
}

/* ==========================================================
   Pages de connexion
   ========================================================== */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; position: relative; }
.auth-bg { position: fixed; inset: 0; z-index: -1; }
.auth-bg .geo { width: 100%; height: 100%; }
.auth-box {
  width: 100%; max-width: 460px; background: var(--white); border-radius: 20px;
  padding: 32px; box-shadow: var(--shadow);
}
.auth-brand { display: flex; justify-content: center; margin-bottom: 22px; }
.auth-brand img { width: 190px; height: auto; }
.auth-box h1 { margin-bottom: 12px; }
.auth-box .btn-block { margin-top: 8px; }

/* ==========================================================
   Tableau de bord
   ========================================================== */
.app-header {
  position: sticky; top: 0; z-index: 10; height: 66px; background: var(--white);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
}
.app-user { display: flex; align-items: center; gap: 12px; }
.app-user-name { font-weight: 600; color: var(--ink); font-size: 14px; }
.app-user form { margin: 0; }

.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 66px); }
.app-nav { background: var(--white); border-right: 1px solid var(--line); padding: 20px 0; }
.app-nav a {
  display: flex; align-items: center; gap: 14px; padding: 13px 24px; color: var(--muted);
  text-decoration: none; font-size: 15px; border-right: 3px solid transparent;
}
.app-nav a:hover { color: var(--ink); background: var(--bg); }
.app-nav a.is-active { color: var(--red); border-right-color: var(--red); background: var(--red-soft); font-weight: 600; }
.nav-section { margin: 20px 24px 6px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #a9a9ae; }

.app-main { padding: 32px; max-width: 1040px; width: 100%; }
.page-head { margin-bottom: 24px; }
.page-head p { margin: 0; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.panel.narrow { max-width: 560px; }

/* Aperçu */
.overview { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
.card-code { font-family: ui-monospace, Consolas, monospace; font-size: 22px; color: var(--ink); margin: 0 0 8px; }
.phone {
  width: 380px; height: 760px; border: 10px solid var(--ink); border-radius: 42px; overflow: hidden;
  background: var(--bg); box-shadow: var(--shadow); position: sticky; top: 90px;
}
.phone iframe { width: 100%; height: 100%; border: 0; display: block; }

/* QR */
.qr-layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
.qr-panel { text-align: center; }
.qr-image { width: 100%; max-width: 260px; height: auto; }
.qr-panel .btn-row { justify-content: center; }

/* Utilisateurs */
.invite-row { display: grid; grid-template-columns: 1fr 200px auto; gap: 12px; align-items: end; }
.invite-row .btn { margin-bottom: 14px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-inactive td { opacity: .55; }
.table select { padding: 6px 10px; font-size: 13px; width: auto; }
.table form { margin: 0; display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.status { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.status-on { background: #eaf7ef; color: var(--ok); }
.status-off { background: var(--bg); color: var(--muted); }

/* ==========================================================
   Profil public (après le scan NFC / QR code)
   ========================================================== */
.profile-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 24px 16px; background: #ececef; }
.profile { width: 100%; max-width: 480px; background: var(--white); border-radius: 26px; overflow: hidden; box-shadow: var(--shadow); text-align: center; }

.profile-cover { position: relative; height: 210px; }
.profile-cover .geo { width: 100%; height: 100%; display: block; }
.profile-cover-logo {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%);
  background: var(--white); border-radius: 999px; padding: 12px 26px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .15);
}
.profile-cover-logo .logo-turboself { height: 58px; }

.profile-avatar {
  position: relative; width: 150px; height: 150px; margin: -75px auto 0; border-radius: 50%;
  border: 6px solid var(--white); background: var(--red); overflow: hidden; display: grid; place-items: center;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .18);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar span { color: var(--white); font-size: 48px; font-weight: 600; letter-spacing: .02em; }

.profile-id { padding: 18px 24px 0; }
.profile-id h1 { font-size: 32px; font-weight: 300; margin: 0; overflow-wrap: anywhere; }
.profile-id h1 strong { font-weight: 700; }
.profile-bar { width: 48px; height: 4px; border-radius: 2px; background: var(--red); margin: 14px auto; }
.profile-job { font-size: 19px; color: var(--muted); margin: 0 0 6px; font-weight: 300; }
.profile-company { margin: 10px 0 0; display: flex; justify-content: center; }
.profile-company .logo-turboself { height: 30px; }

.profile-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 24px 8px; }

.profile-social { display: flex; justify-content: center; gap: 18px; padding: 10px 0 4px; }
.profile-social a { color: #0a66c2; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; }
.profile-social a:hover { background: var(--bg); }
.profile-social .icon { width: 36px; height: 36px; }

.profile-links { list-style: none; margin: 16px 0 0; padding: 0 24px 16px; text-align: left; }
.profile-links a {
  display: flex; align-items: center; gap: 16px; padding: 12px 4px; color: var(--ink);
  text-decoration: none; border-top: 1px solid #f0f0f2; font-size: 15px;
}
.profile-links a > span:last-child { display: flex; flex-direction: column; overflow-wrap: anywhere; min-width: 0; }
.profile-links small { font-size: 12px; color: var(--muted); }
.profile-links a:hover > span:last-child { color: var(--red); }
.ci { width: 42px; height: 42px; border-radius: 50%; background: var(--red); color: var(--white); display: grid; place-items: center; flex: none; }
.ci .icon { width: 19px; height: 19px; }


.profile-powered { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin: 18px 0 0; }
.profile-powered .logo { gap: 6px; }
.profile-powered .logo-bird { width: 20px; height: 20px; }
.profile-powered .logo-word-img { height: 9px; }

/* ==========================================================
   Téléphone et petite tablette
   ========================================================== */
@media (max-width: 960px) {
  .overview, .qr-layout { grid-template-columns: 1fr; }
  .phone { position: static; width: 100%; max-width: 380px; margin: 0 auto; }
}

@media (max-width: 760px) {
  .app-header { padding: 0 16px; }
  .app-user-name, .hide-sm { display: none; }
  .app-header .logo-word-img { height: 13px; }
  .app-shell { grid-template-columns: 1fr; }
  .app-nav {
    display: flex; overflow-x: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--line);
    position: sticky; top: 66px; z-index: 9;
  }
  .app-nav a { flex: none; padding: 12px 16px; border-right: 0; border-bottom: 3px solid transparent; font-size: 14px; gap: 8px; }
  .app-nav a.is-active { border-bottom-color: var(--red); }
  .nav-section { display: none; }
  .app-main { padding: 20px 16px; }
  .grid-2, .invite-row { grid-template-columns: 1fr; }
  .image-field { flex-direction: column; align-items: stretch; }
  .image-preview-round { align-self: center; }
  .auth-box { padding: 24px 20px; }
}

/* Sur téléphone, le profil occupe tout l'écran */
@media (max-width: 520px) {
  .profile-page { padding: 0; background: var(--white); }
  .profile { border-radius: 0; box-shadow: none; }
  .profile-powered { margin-bottom: 18px; }
}
