/* =====================================================================
   Need4Viz Support Portal (osTicket 1.17) — PAGE DE CONNEXION UNIQUEMENT
   Portée : body:has(#clientLogin):not(:has(a[href*="logout.php"]))
   => page d'accueil des visiteurs NON connectés uniquement ;
   aucun effet une fois connecté (même sur index.php).
   À charger APRÈS theme.css et tes CSS de custo.
   ===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Plus+Jakarta+Sans:wght@700;800&display=swap');

/* ---------- Variables (portée limitée à la page de login) ---------- */
body:has(#clientLogin):not(:has(a[href*="logout.php"])) {
  --n4v-accent: #008cb2;        /* teal principal (identique au wiki) */
  --n4v-accent-dark: #00668c;   /* teal foncé (hero du wiki) */
  --n4v-yellow: #f2a900;        /* jaune des CTA du wiki */
  --n4v-text: #0f2433;
  --n4v-muted: #5b6b78;
  --n4v-bg: #f4f7f9;
  --n4v-border: #e1e8ee;
  --n4v-danger: #c62828;
  --n4v-danger-soft: #fdecec;
  --n4v-warn-soft: #fff6e0;
  --n4v-radius: 16px;
  --n4v-radius-sm: 10px;
  --n4v-shadow: 0 1px 2px rgba(15,36,51,.04), 0 4px 16px rgba(15,36,51,.06);
  --n4v-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --n4v-font-title: 'Plus Jakarta Sans', var(--n4v-font);
}

/* ---------- Base ---------- */
html:has(#clientLogin):not(:has(a[href*="logout.php"])),
body:has(#clientLogin):not(:has(a[href*="logout.php"])) { background: var(--n4v-bg) !important; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) {
  font-family: var(--n4v-font);
  color: var(--n4v-text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #container {
  width: auto !important;
  max-width: none;
  margin: 0;
  background: transparent;
  box-shadow: none;
  border: 0;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content a { color: var(--n4v-accent); }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content a:hover { color: var(--n4v-accent-dark); }

/* ---------- En-tête (blanc, comme le wiki) ---------- */
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #header {
  height: auto;
  min-height: 64px;
  padding: 0 max(24px, calc((100vw - 1100px) / 2));
  background: #fff !important;
  border-bottom: 1px solid var(--n4v-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-direction: row-reverse;   /* logo à gauche, liens à droite */
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #header #logo { height: 64px; display: flex; align-items: center; margin: 0; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #header #logo img { max-height: 40px; width: auto; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #header #logo .valign-helper { display: none; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #header .pull-right { float: none; display: flex; align-items: center; gap: 16px; margin: 0; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #header .pull-right p { margin: 0; padding: 0 !important; line-height: 1; display: flex; align-items: center; gap: 8px; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #header .pull-right a:not(.flag) {
  color: var(--n4v-accent) !important;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #header .flag { opacity: .55; transition: opacity .15s; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #header .flag:hover { opacity: 1; }

/* ---------- Contenu ---------- */
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content {
  max-width: 760px;
  margin: 48px auto 64px;
  padding: 0 24px;
  background: transparent;
  border: 0;
  box-shadow: none;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content > p:empty { display: none; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content h1 {
  font-family: var(--n4v-font-title);
  font-weight: 800;
  font-size: clamp(26px, 3.2vw, 34px);
  line-height: 1.2;
  color: var(--n4v-text);
  margin: 0 0 12px;
  letter-spacing: -.01em;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content h1 strong { font-weight: inherit; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content > p { color: var(--n4v-muted); margin: 0 0 8px; }

/* ---------- Bandeaux (texte rouge saisi dans « Page de connexion ») ---------- */
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content > p:has(span[style*="red"]) {
  margin: 12px 0;
  padding: 12px 16px 12px 44px;
  position: relative;
  border-radius: var(--n4v-radius-sm);
  background: var(--n4v-warn-soft);
  border: 1px solid #f6dfa6;
  font-size: 14px;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content > p:has(span[style*="red"])::before {
  content: "\f05a";                       /* FontAwesome info-circle */
  font-family: FontAwesome;
  position: absolute; left: 16px; top: 12px;
  color: var(--n4v-yellow);
  font-size: 16px;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content > p span[style*="red"] { color: var(--n4v-text) !important; font-weight: 500; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content > p strong { font-weight: 600; }

/* Ligne « Plus d'infos ⇒ Article KB » fusionnée avec le bandeau précédent */
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content > p:has(span[style*="red"]):has(+ p span[style*="red"] a) {
  margin-bottom: 0;
  border-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content > p:has(span[style*="red"] a) {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content > p:has(span[style*="red"] a)::before { content: none; }

/* Dernier bandeau (« IMPORTANT ») en rouge */
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content > p:has(span[style*="red"]):not(:has(a)):not(:has(+ p span[style*="red"])) {
  background: var(--n4v-danger-soft);
  border-color: #f5c2c2;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content > p:has(span[style*="red"]):not(:has(a)):not(:has(+ p span[style*="red"]))::before {
  content: "\f071";                       /* FontAwesome warning */
  color: var(--n4v-danger);
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content > p:has(span[style*="red"]):not(:has(a)):not(:has(+ p span[style*="red"])) span {
  color: var(--n4v-danger) !important;
}

/* ---------- Carte de connexion ---------- */
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin {
  margin: 28px 0 0;
  padding: 32px;
  background: #fff !important;
  border: 1px solid var(--n4v-border) !important;
  border-radius: var(--n4v-radius);
  box-shadow: var(--n4v-shadow);
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin > div { display: block !important; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin > div > div { display: block !important; padding: 0 !important; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin .login-box {
  width: auto !important;
  max-width: 360px;
  margin: 0 auto;
  padding: 0;
  float: none;
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin .login-box::before {
  content: "Connexion à votre espace support";
  font-family: var(--n4v-font-title);
  font-weight: 700;
  font-size: 18px;
  color: var(--n4v-text);
  text-align: center;
  margin-bottom: 4px;
}
/* titre de la carte en anglais quand le bandeau indique EN */
body:has(#clientLogin):not(:has(a[href*="logout.php"])):has(.n4v-topnav[data-lang="en"]) #clientLogin .login-box::before { content: "Sign in to your support space"; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin .login-box > strong:empty { display: none; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin .login-box > div { margin: 0; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin input[type="text"],
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin input[type="password"] {
  width: 100% !important;
  box-sizing: border-box;
  height: 44px;
  padding: 0 14px;
  font: 15px var(--n4v-font);
  color: var(--n4v-text);
  background: #fff;
  border: 1px solid var(--n4v-border) !important;
  border-radius: var(--n4v-radius-sm);
  box-shadow: none;
  transition: border-color .15s, box-shadow .15s;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin input::placeholder { color: #94a3af; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin input[type="text"]:focus,
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin input[type="password"]:focus {
  outline: none;
  border-color: var(--n4v-accent) !important;
  box-shadow: 0 0 0 3px rgba(0,140,178,.18);
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin .login-box > p {
  margin: 4px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin input.btn[type="submit"] {
  width: 100%;
  height: 44px;
  margin: 0;
  font: 600 15px var(--n4v-font);
  color: #fff !important;
  background: var(--n4v-accent) !important;
  border: 0 !important;
  border-radius: var(--n4v-radius-sm);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,140,178,.25);
  transition: background .15s;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin input.btn[type="submit"]:hover { background: var(--n4v-accent-dark) !important; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin .login-box > p a { font-size: 13px; font-weight: 500; padding: 0 !important; }

/* Bloc « Je suis un Technicien » masqué (accès agents : /scp/ directement) */
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin > div > div + div { display: none !important; }

/* ---------- Pied de page ---------- */
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #footer {
  background: transparent !important;
  color: var(--n4v-muted) !important;
  border-top: 1px solid var(--n4v-border);
  padding: 20px 24px;
  margin: 0;
  text-align: center;
  font-size: 13px;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #footer p { margin: 0 0 4px; color: inherit; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #footer a,
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #footer #poweredBy { color: var(--n4v-muted) !important; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  body:has(#clientLogin):not(:has(a[href*="logout.php"])) #content { margin-top: 28px; }
  body:has(#clientLogin):not(:has(a[href*="logout.php"])) #clientLogin { padding: 24px 18px; }
}

/* ---------- Bandeau de droite façon Help Portal (Help / Support / FR-EN) ----------
   Nécessite le bloc <nav class="n4v-topnav"> ajouté dans include/client/header.inc.php.
   Masqué partout, sauf sur la page d'accueil non connectée. */
.n4v-topnav { display: none; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #header .pull-right { display: none !important; }   /* ancien bloc Connexion + drapeaux */
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #header .n4v-topnav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-family: var(--n4v-font);
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) .n4v-topnav__link {
  color: var(--n4v-accent) !important;
  font-weight: 500;
  font-size: 15px;
  text-decoration: none;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) .n4v-topnav__link:hover { color: var(--n4v-accent-dark) !important; text-decoration: underline; }
body:has(#clientLogin):not(:has(a[href*="logout.php"])) .n4v-lang {
  display: inline-flex;
  border: 1px solid var(--n4v-border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) .n4v-lang__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 34px;
  padding: 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--n4v-text) !important;
  text-decoration: none;
}
body:has(#clientLogin):not(:has(a[href*="logout.php"])) .n4v-lang__btn:hover { background: #f0f5f8; }
/* langue active : classe is-active posée côté PHP */
body:has(#clientLogin):not(:has(a[href*="logout.php"])) .n4v-lang__btn.is-active {
  background: var(--n4v-accent);
  color: #fff !important;
}
/* Libellé « Support Portal » à côté du logo, comme « Help Portal » sur le wiki */
body:has(#clientLogin):not(:has(a[href*="logout.php"])) #header #logo::after {
  content: "Support Portal";
  display: inline-block;
  margin-left: 18px;
  padding-left: 18px;
  border-left: 1px solid var(--n4v-border);
  font-family: var(--n4v-font);
  font-weight: 500;
  font-size: 15px;
  line-height: 28px;
  color: var(--n4v-text);
}