/* =========================================================
   WELLosite - UI pro (plein écran) + inputs compacts
   Compatible avec:
   - public/partials/header.php (classes: .header .header-inner)
   - public/partials/nav.php    (classes: .topnav .nav-link .dropdown-menu ...)
   ========================================================= */

/* -------------------------
   THEME
------------------------- */
:root{
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #fbfcfd;
  --text: #1f2937;
  --muted: #6b7280;

  --accent: #A9022F;
  --accent-2: #8f0228;

  --border: #e5e7eb;
  --border-2: #d1d5db;

  --shadow: 0 10px 30px rgba(16,24,40,.08);

  --radius: 14px;
  --radius-sm: 10px;

  --max: 1400px;
}

/* -------------------------
   RESET / BASE
------------------------- */
*{ box-sizing:border-box; }

html, body{ height:100%; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  line-height: 1.35;
}

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

img{ max-width:100%; display:block; }

/* -------------------------
   LAYOUT GLOBAL
------------------------- */
.page{
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px 18px 28px;
}

.container{
  max-width: var(--max);
  margin: 0 auto;
  padding: 0;
}

/* Sections / cards */
.card{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card.compact{ padding: 14px; }

.section{
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.stack{ display:flex; flex-direction:column; gap:12px; }
.row{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }

/* -------------------------
   TYPO
------------------------- */
h1{
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

h2{
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 750;
}

p{
  margin: 0 0 10px;
  color: var(--muted);
}

.small{ font-size: 12px; color: var(--muted); }

/* -------------------------
   HEADER / NAV (PRO)
   (garde tes classes existantes .header / .header-inner)
------------------------- */
.header{
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 999;
}

.header-inner{
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 18px;
  display:flex;
  align-items:center;
  gap: 16px;
}

.brand{
  font-weight: 900;
  letter-spacing: .02em;
}

/* NAV */
.topnav{
  display:flex;
  align-items:center;
  gap: 8px;
  flex: 1;
  position: relative;
  flex-wrap: wrap; /* flexible si ajout de nouveaux menus */
}

.topnav .nav-link{
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 999px;
  display:inline-flex;
  align-items:center;
  gap: 6px;
  transition: background .12s ease, transform .12s ease;
}

.topnav .nav-link:hover{
  background: rgba(169, 2, 47, .08);
}

.nav-spacer{ flex: 1; }

.nav-user{
  font-size: 12px;
  color: var(--muted);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
}

.caret{ opacity: .7; font-size: 12px; }

/* Dropdown overlay (ne casse jamais le header) */
.dropdown{ position: relative; }

.dropdown-menu{
  position:absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 16px 40px rgba(16,24,40,.14);
  display:none;
  z-index: 9999;
}

.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu{
  display:block;
}

.dropdown-link{
  display:block;
  padding: 10px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
}

.dropdown-link:hover{
  background: rgba(0,0,0,.05);
}

/* -------------------------
   FORMS - PRO & COMPACT
------------------------- */
label{
  display:block;
  font-size: 12px;
  font-weight: 750;
  color: #374151;
  margin: 0 0 6px;
}

input, select, textarea{
  width:100%;
  border: 1px solid var(--border-2);
  background: #fff;
  border-radius: 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}

/* Champs COMPACTS */
input, select{
  height: 38px;              /* plus petit */
  padding: 8px 10px;         /* pro */
}

textarea{
  padding: 10px 10px;
  min-height: 110px;
  resize: vertical;
}

/* Focus pro */
input:focus, select:focus, textarea:focus{
  border-color: rgba(169,2,47,.55);
  box-shadow: 0 0 0 4px rgba(169,2,47,.12);
}

/* Placeholders */
::placeholder{ color: #9ca3af; }

/* Groupes de champs */
.form-grid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}

.col-12{ grid-column: span 12; }
.col-6{ grid-column: span 6; }
.col-4{ grid-column: span 4; }
.col-3{ grid-column: span 3; }

@media (max-width: 900px){
  .col-6, .col-4, .col-3{ grid-column: span 12; }
}

/* Ligne compacte (ex: search + bouton) */
.input-row{
  display:flex;
  gap:10px;
  align-items:end;
  flex-wrap:wrap;
}
.input-row > *{ flex:1; }
.input-row .btn{ flex:0 0 auto; }

/* -------------------------
   BUTTONS - PRO
------------------------- */
.btn{
  appearance:none;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 12px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap: 8px;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease;
  box-shadow: 0 10px 20px rgba(169,2,47,.18);
}

.btn:hover{
  background: var(--accent-2);
  transform: translateY(-1px);
}

.btn:active{ transform: translateY(0); }

.btn.secondary{
  background: #fff;
  color: var(--accent);
  border-color: rgba(169,2,47,.35);
  box-shadow: none;
}

.btn.secondary:hover{
  background: rgba(169,2,47,.06);
}

/* Bouton petit */
.btn.sm{
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

/* -------------------------
   TABLES (plus clean)
------------------------- */
table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

th, td{
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  text-align:left;
  font-size: 13px;
}

th{
  background: var(--panel-2);
  color: #374151;
  font-weight: 800;
  font-size: 12px;
}

tr:last-child td{ border-bottom: none; }

/* -------------------------
   ALERTS
------------------------- */
.alert{
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 650;
}

.alert.success{
  border-color: rgba(16,185,129,.35);
  background: rgba(16,185,129,.08);
  color: #065f46;
}

.alert.error{
  border-color: rgba(239,68,68,.35);
  background: rgba(239,68,68,.08);
  color: #7f1d1d;
}

/* -------------------------
   UTILITAIRES
------------------------- */
hr{
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

.badge{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  color: #374151;
}

/* ===== FIX ALIGNEMENT HEADER + NAV ===== */

.header-inner{
  max-width: var(--max, 1400px);
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between; /* logo à gauche, nav à droite */
  gap: 16px;
}

.brand{ font-weight: 900; }

.topnav{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* bouton dropdown ressemble à un lien */
.nav-btn{
  border: 0;
  background: transparent;
  cursor: pointer;
}

/* Important: dropdown caché par défaut */
.dropdown-menu{
  display: none;
}

/* Affiché quand la dropdown est "open" */
.dropdown.open .dropdown-menu{
  display: block;
}

/* Evite que tes anciens styles .nav influencent */
.nav{ all: unset; }
/* ===========================
   TABLE PRODUITS – 1 LIGNE
   =========================== */

.products-table {
  width: 100%;
  table-layout: fixed; /* 🔑 clé absolue */
  border-collapse: collapse;
  font-size: 12px;
}

.products-table th,
.products-table td {
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* Inputs ultra compacts */
.products-table input,
.products-table select {
  height: 26px;
  padding: 3px 6px;
  font-size: 12px;
  border-radius: 6px;
  width: 100%;
}

/* ===================
   LARGEURS FIXES
   =================== */

/* Code */
.products-table th.col-code,
.products-table td.col-code { width: 70px; }

/* Nom (texte tronqué) */
.products-table th.col-name,
.products-table td.col-name { width: 100px; }

/* Type / Collection / Sélection / Essence */
.products-table th.col-small,
.products-table td.col-small { width: 95px; }

/* Dimension */
.products-table th.col-dim,
.products-table td.col-dim { width: 90px; }

/* Numériques */
.products-table th.col-num,
.products-table td.col-num { width: 70px; text-align: right; }

/* Fiche */
.products-table th.col-fiche,
.products-table td.col-fiche { width: 150px; }

/* Actif */
.products-table th.col-active,
.products-table td.col-active { width: 55px; text-align: center; }

.products-table td.col-active select {
  width: 50px;
}

/* Actions */
.products-table th.col-actions,
.products-table td.col-actions { width: 90px; }

/* Boutons minuscules */
.products-table .btn {
  padding: 4px 6px;
  font-size: 11px;
  border-radius: 6px;
}

/* Actions sur une seule ligne */
.products-table .actions {
  display: flex;
  gap: 4px;
  justify-content: center;
}

/* Hover ligne (lisibilité) */
.products-table tbody tr:hover {
  background: #f6f8fb;
}
/* Produits — encore plus compact (override) */
.products-table { font-size: 11px; }

.products-table th,
.products-table td { padding: 3px 5px !important; }

.products-table input,
.products-table select{
  height: 22px !important;
  padding: 2px 5px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
}

.products-table .btn{
  height: 22px;
  padding: 2px 6px !important;
  font-size: 11px !important;
  border-radius: 6px !important;
  box-shadow: none !important;
}

.products-table .actions{ gap: 3px; }
/* ===========================
   PRODUITS — FORM AJOUT COMPACT
   =========================== */

.product-create .row,
.product-create .grid {
  gap: 10px !important;
}

.product-create label {
  font-size: 11px;
  margin-bottom: 4px;
}

.product-create input,
.product-create select {
  height: 22px !important;
  padding: 2px 6px !important;
  font-size: 11px !important;
  border-radius: 6px !important;
}

.product-create input[type="number"] {
  padding-right: 6px !important;
}

/* bouton Ajouter compact */
.product-create .btn,
.product-create button {
  height: 26px;
  padding: 4px 10px !important;
  font-size: 11px !important;
  border-radius: 8px !important;
}

/* option : card moins “haute” */
.product-create.card {
  padding: 12px 14px !important;
}

.product-create h2,
.product-create h3 {
  margin: 0 0 10px 0;
  font-size: 14px;
}
/* Conteneur du label */
label.small {
  display: flex;
  align-items: center;
  gap: 6px;            /* espace réduit */
  font-size: 13px;     /* texte plus compact */
  cursor: pointer;
}

/* Checkbox native plus petite */
label.small input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.badge{
  display:inline-flex;
  align-items:center;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  border:1px solid var(--border);
}

.status-red{ background:#ffe8ea; border-color:#ffb3bb; color:#a10010; }
.status-orange{ background:#fff1e3; border-color:#ffd1a6; color:#8a4b00; }
.status-green{ background:#e9fff0; border-color:#aee9c2; color:#0d6a2a; }
.status-gray{ background:#f2f2f2; border-color:#d7d7d7; color:#4c4c4c; }

/* ===========================
   LITIGE VIEW — Mail builder compact
   =========================== */

/* Card plus dense */
.card.compact {
  padding: 12px 14px;
}

/* Titres moins gros */
.card.compact h2 {
  font-size: 16px;
  margin: 0;
}
.card.compact h3 {
  font-size: 14px;
  margin: 0 0 8px 0;
}

/* Séparateurs plus discrets */
.card.compact hr {
  margin: 10px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* Form grid: réduire les espaces */
.card.compact .form-grid {
  gap: 10px 12px; /* row / col */
}
.card.compact label {
  font-size: 12px;
  margin-bottom: 4px;
  color: #111827;
}
.card.compact .small,
.card.compact .muted {
  font-size: 12px;
}

/* Inputs / selects plus compacts */
.card.compact input,
.card.compact select,
.card.compact textarea {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 13px;
}

/* Textareas: hauteur maîtrisée */
#email_text {
  min-height: 130px;   /* avant: trop grand */
  max-height: 220px;
  resize: vertical;
}

#email_advanced_block textarea {
  min-height: 78px;
  max-height: 160px;
  resize: vertical;
}

/* Ligne d’action en haut (boutons) plus tight */
.card.compact .row {
  gap: 8px;
}
.card.compact .btn {
  padding: 8px 12px;
}
.card.compact .btn.sm {
  padding: 6px 10px;
}

/* Bloc avancé: densité et alignements */
#email_advanced_block {
  margin-top: 10px;
}
#email_advanced_block .form-grid {
  margin-top: 6px;
}
#email_advanced_block .adv-section {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafa;
  margin-top: 10px;
}
#email_advanced_block .adv-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #6b7280;
  margin-bottom: 6px;
}
#email_advanced_block details.adv-optional {
  margin-top: 6px;
}
#email_advanced_block details.adv-optional > summary {
  cursor: pointer;
  font-size: 12px;
  color: #374151;
  list-style: none;
}
#email_advanced_block details.adv-optional > summary::marker,
#email_advanced_block details.adv-optional > summary::-webkit-details-marker {
  display: none;
}
#email_advanced_block details.adv-optional > summary::before {
  content: "+";
  display: inline-block;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  margin-right: 6px;
  font-weight: 700;
}
#email_advanced_block details[open].adv-optional > summary::before {
  content: "-";
}
#email_advanced_block .opt-small {
  min-height: 56px;
  max-height: 120px;
}
#email_advanced_block .adv-section {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
}
#email_advanced_block .adv-title {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 6px;
}
#email_advanced_block details.adv-optional {
  margin-top: 6px;
}
#email_advanced_block details.adv-optional summary {
  cursor: pointer;
  font-size: 12px;
  color: #374151;
}
#email_advanced_block details.adv-optional[open] summary {
  margin-bottom: 6px;
}
#email_advanced_block .opt-small {
  min-height: 48px;
  max-height: 120px;
}

/* Radios responsabilité : inline et compacts */
#email_advanced_block .check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #111827;
}
#email_advanced_block input[type="radio"],
#email_advanced_block input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

/* Réduire l’impact visuel des gros “ronds” (si ton navigateur les grossit) */
#email_advanced_block input[type="radio"] {
  transform: scale(0.95);
}
#email_advanced_block input[type="checkbox"] {
  transform: scale(0.95);
}

/* Les 2 checkboxes solution en ligne + plus serré */
#email_advanced_block .row {
  align-items: center;
}

/* Tablettes/écrans moyens: éviter les énormes blancs */
@media (max-width: 1100px) {
  .card.compact .form-grid { gap: 10px; }
  #email_text { min-height: 120px; }
  #email_advanced_block textarea { min-height: 72px; }
}
