/* ============================================================
   YCS · components.css
   Composants UI réutilisés entre sections (www, admin, my, staff)
   Charger APRÈS base.css, AVANT les CSS de section.
   ============================================================ */

/* ============================================================
   1 · BOUTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--t-fast) var(--ease);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.btn-ghost { color: var(--ink-soft); }
.btn-ghost:hover { color: var(--ink); background: rgba(26, 31, 29, 0.04); }

.btn-primary { background: var(--teal-800); color: var(--cream); }
.btn-primary:hover { background: var(--teal-900); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-light {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-light:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }

/* Icon button (carré, pour toolbar / topbar) */
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  transition: all var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--paper); color: var(--ink); }
.icon-btn i { width: 17px; height: 17px; }

/* Mini tab button (pour card-header-actions / pagination) */
.tab-btn {
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 500;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { background: var(--cream-2); color: var(--ink); }


/* ============================================================
   2 · BRAND SIGNATURE
   ============================================================ */
.brand-sig {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  font-variation-settings: "opsz" 48, "SOFT" 100;
  font-weight: 400;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.012em;
  color: var(--ink);
  position: relative;
  padding-top: 11px;
  display: inline-block;
  white-space: nowrap;
}
.brand-sig::before {
  content: "YOUR";
  position: absolute;
  top: 0;
  left: 2px;
  font-family: 'JetBrains Mono', monospace;
  font-style: normal;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.24em;
  color: var(--muted);
  font-variation-settings: normal;
}
.brand-sig .st { color: var(--teal-700); }
.brand-sig::after {
  content: "";
  position: absolute;
  right: -10px;
  top: 52%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--terra);
}

.brand-sig.xs { font-size: 16px; padding-top: 8px; }
.brand-sig.xs::before { font-size: 7.5px; letter-spacing: 0.22em; left: 1px; }
.brand-sig.xs::after { width: 3px; height: 3px; right: -7px; }

.brand-sig.sm { font-size: 20px; padding-top: 9px; }
.brand-sig.sm::before { font-size: 8.5px; letter-spacing: 0.22em; }

.brand-sig.lg { font-size: 36px; padding-top: 14px; }
.brand-sig.lg::before { font-size: 10.5px; letter-spacing: 0.26em; left: 3px; }

.brand-sig.on-dark { color: var(--cream); }
.brand-sig.on-dark::before { color: rgba(247, 243, 236, 0.5); }
.brand-sig.on-dark .st { color: var(--mustard); }
.brand-sig.on-dark::after { background: var(--mustard); }


/* ============================================================
   3 · TENANT MARK
   ============================================================ */
.tenant-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--mustard);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}


/* ============================================================
   4 · AVATARS
   ============================================================ */
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--teal-500);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 14px;
  flex-shrink: 0;
}
.avatar.a2 { background: var(--terra); }
.avatar.a3 { background: var(--mustard); }
.avatar.a4 { background: var(--plum); }
.avatar.a5 { background: var(--slate); }
.avatar.a6 { background: var(--sage); }

.avatar-sm { width: 28px; height: 28px; font-size: 12px; }
.avatar-xs { width: 22px; height: 22px; font-size: 10px; }


/* ============================================================
   5 · CARDS (conteneurs génériques)
   ============================================================ */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px 16px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}
.card-header h3 {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.card-header .subtitle {
  font-size: 12.5px;
  color: var(--muted);
}
.card-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.card-body { padding: 20px 24px 24px; }
.card-body.tight { padding: 8px 24px; }

/* Card compacte inline (side panels) */
.card-inline {
  padding: 16px;
  background: var(--cream);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}


/* ============================================================
   6 · TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab {
  padding: 10px 16px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--t-fast) var(--ease);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.tab i { width: 15px; height: 15px; }
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--teal-700);
}
.tab .count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: var(--cream-2);
  color: var(--muted);
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 600;
}
.tab.active .count { background: var(--teal-100); color: var(--teal-800); }

.tab-panels > .tab-panel { display: none; }
.tab-panels > .tab-panel.active { display: block; animation: fadeIn var(--t-fast) var(--ease); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ============================================================
   7 · FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.filter-chip:hover { border-color: var(--line-2); }
.filter-chip.active {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}
.filter-chip i { width: 14px; height: 14px; }
.filter-chip .count,
.filter-chip .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
}
.filter-chip.active .count,
.filter-chip.active .mono { color: rgba(247, 243, 236, 0.6); }

.filter-divider {
  width: 1px;
  background: var(--line);
  height: 24px;
  margin: 0 6px;
}
.filter-spacer { flex: 1; }


/* ============================================================
   8 · SEARCH BOX
   ============================================================ */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  min-width: 240px;
}
.search-box i { width: 14px; height: 14px; }
.search-box kbd {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  padding: 1px 5px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
}


/* ============================================================
   9 · FORMS (inputs, labels, groups, switch)
   ============================================================ */
.input, .select, .textarea {
  font-family: 'Figtree', sans-serif;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: var(--paper);
  color: var(--ink);
  transition: all var(--t-fast) var(--ease);
  width: 100%;
}
.input.mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px rgba(15, 89, 82, 0.08);
}

.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.form-value {
  font-size: 14.5px;
  color: var(--ink);
  font-weight: 450;
}
.form-value.mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Switch (toggle) — 2 variantes supportées :
   1. <label class="switch"><input type="checkbox"><span class="switch-slider"></span></label>
   2. <span class="switch"></span>  (toggle via JS ajoutant la classe .on)         */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
  background: var(--line-2);
  border-radius: 999px;
  transition: background var(--t-fast) var(--ease);
}
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
}
.switch-slider::before,
.switch::after {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  top: 2px;
  background: white;
  border-radius: 50%;
  transition: transform var(--t-fast) var(--ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.switch:has(input:checked),
.switch.on {
  background: var(--teal-700);
}
.switch:has(input:checked) .switch-slider::before,
.switch.on::after {
  transform: translateX(18px);
}


/* ============================================================
   10 · STATUS BADGES
   ============================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 500;
  width: fit-content;
}
.status-badge .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.status-badge.ready    { background: var(--sage-soft);    color: #3B5C38; }
.status-badge.ready   .dot { background: #6B8866; }
.status-badge.cleaning { background: var(--teal-100);     color: var(--teal-800); }
.status-badge.cleaning .dot { background: var(--teal-600); }
.status-badge.pending  { background: var(--mustard-soft); color: #7A5B12; }
.status-badge.pending .dot { background: var(--mustard); }
.status-badge.alert    { background: var(--terra-soft);   color: var(--terra-dark); }
.status-badge.alert   .dot { background: var(--terra); }
.status-badge.ongoing  { background: var(--teal-100);     color: var(--teal-800); }
.status-badge.ongoing .dot { background: var(--teal-600); }


/* ============================================================
   11 · STATUS ITEM (liste statuts avec dot + metric)
   ============================================================ */
.status-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.status-item:last-child { border-bottom: none; }
.status-item .label {
  font-size: 13px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6B8866;
  box-shadow: 0 0 0 3px rgba(107, 136, 102, 0.18);
  flex-shrink: 0;
}
.status-dot.warn {
  background: #D9A83E;
  box-shadow: 0 0 0 3px rgba(217, 168, 62, 0.18);
}
.status-dot.err {
  background: var(--terra);
  box-shadow: 0 0 0 3px rgba(189, 90, 61, 0.18);
}
.status-item .metric {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--muted);
}


/* ============================================================
   12 · ACTIVITY FEED
   ============================================================ */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--teal-100);
  color: var(--teal-800);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.activity-icon i { width: 14px; height: 14px; }
.activity-icon.terra   { background: var(--terra-soft);   color: var(--terra-dark); }
.activity-icon.mustard { background: var(--mustard-soft); color: #7A5B12; }
.activity-icon.sage    { background: var(--sage-soft);    color: #3B5C38; }
.activity-icon.plum    { background: var(--plum-soft);    color: var(--plum); }

.activity-content { flex: 1; }
.activity-content p {
  line-height: 1.4;
  color: var(--ink-soft);
}
.activity-content p strong { color: var(--ink); font-weight: 500; }
.activity-content .time {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}


/* ============================================================
   13 · EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 30px;
  color: var(--muted);
}
.empty-state > i {
  width: 40px;
  height: 40px;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-state-icon i { color: var(--muted); width: 26px; height: 26px; }
.empty-state h4 {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 6px;
}
.empty-state p {
  font-size: 14px;
  max-width: 42ch;
  margin: 0 auto 20px;
}


/* ============================================================
   14 · INFO BANNER
   ============================================================ */
.info-banner {
  background: var(--teal-50);
  border: 1px solid rgba(15, 89, 82, 0.15);
  color: var(--teal-800);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13.5px;
  margin-bottom: 20px;
}
.info-banner > i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--teal-700);
}
.info-banner strong { font-weight: 600; }


/* ============================================================
   15 · PROGRESS BAR
   ============================================================ */
.progress {
  flex: 1;
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--teal-600);
  border-radius: 999px;
  transition: width var(--t-med) var(--ease);
}
.progress-fill.low  { background: var(--terra); }
.progress-fill.mid  { background: var(--mustard); }
.progress-fill.high { background: #6B8866; }

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  font-size: 13px;
}
.progress-row .pbar-label {
  width: 180px;
  font-weight: 500;
}
.progress-row .pbar-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--muted);
  min-width: 110px;
  text-align: right;
}


/* ============================================================
   16 · TAGS
   ============================================================ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--cream-2);
  color: var(--ink-soft);
}
.tag.teal    { background: var(--teal-100);     color: var(--teal-800); }
.tag.terra   { background: var(--terra-soft);   color: var(--terra-dark); }
.tag.mustard { background: var(--mustard-soft); color: #7A5B12; }
.tag.plum    { background: var(--plum-soft);    color: var(--plum); }
.tag.sage    { background: var(--sage-soft);    color: #3B5C38; }
.tag.rose    { background: var(--rose-soft);    color: #7B2D3A; }


/* ============================================================
   17 · SECTION DIVIDER
   ============================================================ */
.section-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 30px 0 16px;
}
.section-divider h3 {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 500;
  white-space: nowrap;
}
.section-divider .line {
  flex: 1;
  height: 1px;
  background: var(--line);
}
.section-divider .count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}


/* ============================================================
   18 · BACK LINK
   ============================================================ */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease);
}
.back-link:hover { color: var(--teal-700); }
.back-link i { width: 15px; height: 15px; }


/* ============================================================
   19 · INCIDENT PRIORITY BADGE
   ============================================================ */
.incident-priority {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
}
.incident-priority.high   { background: var(--terra-soft);   color: var(--terra-dark); }
.incident-priority.medium { background: var(--mustard-soft); color: #7A5B12; }
.incident-priority.low    { background: var(--cream-2);      color: var(--muted); }
