/* ═══════════════════════════════════════════════════════════
   PORTAIL CLIENT TANGO — Design Professionnel Clair
   Importé exclusivement dans index.html
   Remplace les variables de style.css pour le portail client
═══════════════════════════════════════════════════════════ */

:root {
  --bg:       #f7f8fa;
  --bg2:      #ffffff;
  --bg3:      #f0f2f5;
  --border:   #dde1e7;
  --border2:  #c8cdd5;
  --navy:     #1a2332;
  --navy2:    #243040;
  --gold:     #1a2332;
  --gold2:    #243040;
  --slate:    #6b7a8d;
  --red:      #c0392b;
  --red2:     #e74c3c;
  --text:     #1a2332;
  --muted:    #9aa3af;
  --dim:      #dde1e7;
  --font:     Georgia, serif;
  --font2:    Georgia, serif;
  --fontmono: 'Courier New', monospace;
}

/* ── Base ── */
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Auth ── */
#login-view,
#invite-view {
  background: linear-gradient(150deg, #f0f2f5 0%, #e6eaf0 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 32px rgba(26,35,50,0.10);
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
}

.brand { text-align: center; margin-bottom: 32px; }
.brand-name {
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 8px;
}
.brand-sub {
  color: var(--slate);
  font-family: Georgia, serif;
  font-size: 9px;
  letter-spacing: 2.5px;
  margin-top: 6px;
  text-transform: uppercase;
}

/* ── Form ── */
.field { margin-bottom: 18px; }
.field label {
  color: var(--slate);
  display: block;
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: Georgia, serif;
  font-size: 14px;
  outline: none;
  padding: 10px 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,35,50,0.07);
}
.field textarea { min-height: 90px; resize: vertical; }

.error-msg {
  background: #fdf2f2;
  border: 1px solid #f0c0c0;
  border-radius: 5px;
  color: var(--red);
  font-size: 12px;
  margin-bottom: 14px;
  padding: 9px 12px;
}

/* ── Buttons ── */
.btn {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-family: Georgia, serif;
  font-size: 12px;
  font-weight: 700;
  justify-content: center;
  letter-spacing: 0.3px;
  padding: 8px 18px;
  text-transform: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.btn:hover { background: var(--bg3); border-color: var(--border2); color: var(--navy); }
.btn:disabled { cursor: not-allowed; opacity: 0.4; }

.btn-primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  margin-top: 4px;
  padding: 11px 18px;
  width: 100%;
}
.btn-primary:hover { background: var(--navy2); border-color: var(--navy2); color: #ffffff; }

.btn-sm { font-size: 11px; padding: 5px 12px; }

.btn-back {
  background: none;
  border: none;
  color: var(--slate);
  cursor: pointer;
  display: block;
  font-family: Georgia, serif;
  font-size: 12px;
  padding: 0 0 16px 0;
  transition: color 0.12s;
}
.btn-back:hover { color: var(--navy); }

/* ── Topbar ── */
.topbar {
  background: var(--navy);
  border-bottom: none;
  box-shadow: 0 2px 8px rgba(26,35,50,0.18);
  padding: 13px 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-brand {
  color: #ffffff;
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 4px;
}
.topbar-user {
  align-items: center;
  color: rgba(255,255,255,0.60);
  display: flex;
  font-family: Georgia, serif;
  font-size: 12px;
  gap: 16px;
}
.topbar-user #user-name { color: rgba(255,255,255,0.88); font-size: 12px; }
.topbar-user .btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.22);
  color: rgba(255,255,255,0.72);
  font-size: 10px;
  letter-spacing: 0.8px;
  margin-top: 0;
  padding: 5px 13px;
  width: auto;
}
.topbar-user .btn:hover { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.40); color: #ffffff; }

/* ── Portal layout ── */
.portal-main { margin: 28px auto; max-width: 900px; padding: 0 20px 80px; }

/* ── Cards ── */
.card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(26,35,50,0.05);
  margin-bottom: 14px;
  padding: 22px 24px;
}
.card-title {
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-bottom: 14px;
}

/* ── Tabs ── */
.tabbar {
  border-bottom: 2px solid var(--border);
  display: flex;
  gap: 0;
  margin-bottom: 20px;
}
.tabbtn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  margin-bottom: -2px;
  padding: 10px 22px;
  text-transform: none;
  transition: color 0.12s, border-color 0.12s;
}
.tabbtn:hover { color: var(--navy); }
.tabbtn.active { border-bottom-color: var(--navy); color: var(--navy); }

/* ── Bottom navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid #dde1e7;
  display: flex;
  z-index: 50;
  padding: 8px 0 20px;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 0;
  position: relative;
}
.bottom-nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background 0.15s;
}
.bottom-nav-item.active .bottom-nav-icon {
  background: #1a2332;
}
.bottom-nav-label {
  font-size: 9px;
  color: #9aa3af;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.bottom-nav-item.active .bottom-nav-label {
  color: #1a2332;
}
.bottom-nav-badge {
  position: absolute;
  top: 0px;
  right: calc(50% - 20px);
  background: #e74c3c;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 1.5px solid #fff;
}

/* ── Station chips ── */
.chiprow { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--slate);
  cursor: pointer;
  display: inline-flex;
  font-family: Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 15px;
  transition: all 0.12s;
}
.chip:hover { background: var(--bg3); border-color: var(--border2); color: var(--navy); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #ffffff; }

/* ── List rows ── */
.list-row {
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy);
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 8px;
  padding: 14px 18px;
  transition: box-shadow 0.12s, transform 0.1s;
}
.list-row:hover { box-shadow: 0 3px 14px rgba(26,35,50,0.09); transform: translateY(-1px); }
.list-row-top { align-items: flex-start; display: flex; gap: 12px; justify-content: space-between; }
.list-row-title {
  color: var(--navy);
  font-family: Georgia, serif;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 3px;
}
.list-row-meta { color: var(--muted); font-size: 11px; }

/* ── Progress bar ── */
.pbar { background: #eef0f3; border-radius: 4px; overflow: hidden; }
.pfill { background: var(--navy); border-radius: 4px; height: 100%; transition: width 0.3s ease; }

/* ── Badges ── */
.badge {
  border: 1px solid currentColor;
  border-radius: 4px;
  display: inline-block;
  font-family: Georgia, serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 2px 8px;
}

/* Statut badges */
.badge-nouvelle     { background: #eef0f3; color: #6b7a8d; border-color: #dde1e7; }
.badge-en_traitement{ background: #fff8e6; color: #b8860b; border-color: #f0d9a0; }
.badge-resolue      { background: #edfbf3; color: #1e7e4a; border-color: #b8dfc8; }

/* Priorité badges */
.badge-basse   { background: #f5f6f7; color: #9aa3af; border-color: #dde1e7; }
.badge-normale { background: #eef0f3; color: #6b7a8d; border-color: #c8cdd5; }
.badge-haute   { background: #fff5e8; color: #c07820; border-color: #f0d0a0; }
.badge-urgente { background: #fdf2f2; color: #c0392b; border-color: #f0b8b8; }

/* ── Modal ── */
.modal-overlay {
  align-items: center;
  background: rgba(26,35,50,0.42);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 20px;
  position: fixed;
  z-index: 100;
}
.modal-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 40px rgba(26,35,50,0.16);
  max-height: 90vh;
  max-width: 500px;
  overflow-y: auto;
  padding: 28px 30px;
  width: 100%;
}
.modal-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-head h3 { color: var(--navy); font-family: Georgia, serif; font-size: 16px; font-weight: 700; }
.modal-close { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 22px; line-height: 1; padding: 2px 6px; }
.modal-close:hover { color: var(--navy); }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; }

/* ── Toast ── */
.toast {
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy);
  border-radius: 6px;
  bottom: 24px;
  box-shadow: 0 4px 20px rgba(26,35,50,0.12);
  color: var(--text);
  font-family: Georgia, serif;
  font-size: 13px;
  max-width: 320px;
  padding: 12px 18px;
  position: fixed;
  right: 24px;
  z-index: 200;
}
.toast.ok  { border-left-color: #1e7e4a; }
.toast.err { border-left-color: var(--red2); }

/* ── Section head ── */
.section-head { align-items: center; display: flex; justify-content: space-between; margin-bottom: 18px; }
.section-head h2 { color: var(--navy); font-family: Georgia, serif; font-size: 18px; font-weight: 700; }

/* ── Filter row ── */
.filter-row { align-items: center; display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }

/* ── Empty state ── */
.empty-state { color: var(--muted); font-style: italic; font-size: 13px; padding: 40px 20px; text-align: center; }

/* ── Detail grid ── */
.detail-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-top: 14px; }
.clbl { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1.5px; margin-bottom: 3px; text-transform: uppercase; }
.cval { color: var(--navy); font-size: 13px; font-weight: 600; }

/* ── Staff response ── */
.staff-resp {
  background: #f6fbf7;
  border: 1px solid #c5dfc8;
  border-left: 4px solid #1e7e4a;
  border-radius: 6px;
  color: var(--navy);
  font-size: 13px;
  line-height: 1.7;
  margin-top: 16px;
  padding: 14px 18px;
}

/* ── Photo ── */
.photoinc { border: 1px solid var(--border); border-radius: 6px; margin-top: 10px; max-width: 100%; }

/* ── Load more ── */
.load-more { justify-content: center; margin-top: 10px; width: 100%; }

/* ── Realtime agent link ── */
.rt-agent-link { cursor: pointer; }
.rt-agent-link:hover { text-decoration: underline; }

/* ── Realtime station link ── */
.rt-station-link { cursor: pointer; }
.rt-station-link:hover { text-decoration: underline; }

/* ── Realtime pulse ── */
@keyframes rt-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.50; }
}
.rt-pulse { animation: rt-pulse 2s ease-in-out infinite; }

/* ── Chat ── */
.chat-bubble-client {
  background: var(--navy);
  color: #ffffff;
  border-radius: 12px 12px 0 12px;
  padding: 10px 14px;
  max-width: 75%;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.chat-bubble-staff {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px 12px 12px 0;
  padding: 10px 14px;
  max-width: 75%;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}
.chat-time { font-size: 10px; color: var(--muted); margin-top: 3px; }
.chat-badge {
  background: #e74c3c;
  color: #ffffff;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
  font-style: normal;
}

/* ── Utils ── */
.text-muted { color: var(--muted); }

/* ════════════════════════════════════════════════════════════
   RESPONSIVE MOBILE  @media (max-width: 768px)
════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Auth ── */
  .auth-card { padding: 28px 18px; }

  /* ── Portal layout ── */
  .portal-main { margin: 10px auto; padding: 0 10px 96px; }

  /* ── Topbar ── */
  .topbar { padding: 9px 14px !important; }
  .topbar-brand { font-size: 11px !important; letter-spacing: 2px !important; }
  #user-name { display: none !important; }
  /* Réduire le bouton déconnexion à une icône */
  #logout-btn { font-size: 0 !important; width: 34px; height: 34px; padding: 0 !important; flex-shrink: 0; }
  #logout-btn::after { content: '⏻'; font-size: 16px; }

  /* ── Navigation (onglets scrollables) ── */
  .tabbar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 14px;
  }
  .tabbar::-webkit-scrollbar { display: none; }
  .tabbtn {
    font-size: 10px !important;
    padding: 8px 11px !important;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* ── Cards ── */
  .card { padding: 14px 12px; }

  /* ── Grilles → 1 colonne ── */
  #rt-stations        { grid-template-columns: 1fr !important; }
  #equipe-colonnes    { grid-template-columns: 1fr !important; }
  /* Stats factures */
  #tab-factures > div:first-child { grid-template-columns: 1fr !important; }

  /* ── Detail grid → 1 colonne ── */
  .detail-grid { grid-template-columns: 1fr !important; }

  /* ── Section head ── */
  .section-head { flex-wrap: wrap; gap: 8px; }
  .section-head .btn { width: auto; }

  /* ── Modales plein écran ── */
  .modal-overlay {
    padding: 0 !important;
    align-items: flex-end !important;
  }
  .modal-box {
    border-radius: 14px 14px 0 0 !important;
    max-width: 100% !important;
    max-height: 95vh !important;
    width: 100% !important;
    padding: 22px 16px !important;
  }
  .modal-actions {
    flex-direction: column;
    gap: 8px;
  }
  .modal-actions .btn,
  .modal-actions .btn-primary { width: 100% !important; }

  /* ── Formulaires pleine largeur ── */
  .field input,
  .field select,
  .field textarea { font-size: 16px; } /* évite le zoom auto sur iOS */

  /* ── Chips ── */
  .chip { font-size: 10px; padding: 4px 11px; }

  /* ── List rows ── */
  .list-row { padding: 11px 12px; }
  .list-row-title { font-size: 13px; }
  .list-row-top { flex-wrap: wrap; gap: 8px; }

  /* ── Chat ── */
  #tab-messages .card {
    display: flex;
    flex-direction: column;
    overflow: visible !important;
  }
  #chat-log {
    min-height: 220px !important;
    max-height: calc(100vh - 300px) !important;
    flex: 1;
  }
  #chat-log .chat-bubble-client,
  #chat-log .chat-bubble-staff { max-width: 88%; font-size: 13px; }
  #tab-messages .card > div:last-child {
    position: sticky;
    bottom: 74px;
    z-index: 2;
  }
  #chat-send-btn { white-space: nowrap; }

  /* ── Toast ── */
  .toast {
    left: 12px;
    right: 12px;
    max-width: none;
    bottom: 90px;
  }

  /* ── Bouton retour ── */
  .btn-back { padding: 0 0 12px 0; font-size: 12px; }

  /* ── Badge ── */
  .badge { font-size: 9px; padding: 2px 6px; }

  /* ── Filter row ── */
  .filter-row { gap: 5px; }

  /* ── Tables dans les modales (factures) ── */
  .modal-box table, #cl-fact-detail table { font-size: 10px; }
  .modal-box table th,
  .modal-box table td,
  #cl-fact-detail table th,
  #cl-fact-detail table td { padding: 5px 7px !important; }
}
