/* ============================================================
   SavIPS — Feuille de style principale
   Charte IPS : navy #1B2A6B / steel blue #2E75B6
   Police : Arial
   ============================================================ */

:root {
  --navy:       #1B2A6B;
  --blue:       #2E75B6;
  --blue-light: #EBF3FB;
  --blue-mid:   #D0E4F5;
  --red:        #C0392B;
  --orange:     #E67E22;
  --green:      #27AE60;
  --grey:       #7F8C8D;
  --grey-light: #F4F6F9;
  --border:     #D5DDE9;
  --text:       #2C3E50;
  --white:      #FFFFFF;
  --shadow:     0 2px 8px rgba(27,42,107,.10);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--grey-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Topbar ---- */
.savips-topbar {
  background: var(--navy);
  color: var(--white);
  padding: 0 30px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.topbar-brand {
  font-size: 22px;
  font-weight: bold;
  color: var(--white);
  letter-spacing: 1px;
}
.topbar-brand span { color: var(--blue); }
.topbar-brand small {
  font-size: 11px;
  font-weight: normal;
  color: #aab4d0;
  margin-left: 10px;
}
.topbar-nav { display: flex; gap: 6px; align-items: center; }
.topbar-nav a {
  color: #aab4d0;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 4px;
  transition: background .2s, color .2s;
}
.topbar-nav a:hover,
.topbar-nav a.active {
  background: rgba(255,255,255,.12);
  color: var(--white);
  text-decoration: none;
}
.topbar-nav .btn-logout {
  background: rgba(192,57,43,.25);
  color: #f0a09a;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 4px;
}
.topbar-nav .btn-logout:hover { background: var(--red); color: var(--white); }

/* ---- Layout ---- */
.savips-wrap {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
  width: 100%;
}
.savips-wrap-narrow {
  flex: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 30px 20px;
  width: 100%;
}

/* ---- Cartes ---- */
.card {
  background: var(--white);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 17px;
  font-weight: bold;
  color: var(--navy);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--blue-mid);
}

/* ---- Formulaires ---- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: bold;
  font-size: 13px;
  color: var(--navy);
  margin-bottom: 5px;
}
.form-group label .req { color: var(--red); margin-left: 3px; }
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(46,117,182,.15);
}
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { background-color: var(--white); }

/* ---- Boutons ---- */
.btn {
  display: inline-block;
  padding: 9px 20px;
  border-radius: 4px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  border: none;
  text-align: center;
  transition: opacity .2s, box-shadow .2s;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn-primary   { background: var(--blue);   color: var(--white); }
.btn-navy      { background: var(--navy);   color: var(--white); }
.btn-success   { background: var(--green);  color: var(--white); }
.btn-danger    { background: var(--red);    color: var(--white); }
.btn-warning   { background: var(--orange); color: var(--white); }
.btn-grey      { background: var(--grey);   color: var(--white); }
.btn-outline   { background: transparent; border: 2px solid var(--blue); color: var(--blue); }
.btn-sm        { padding: 5px 12px; font-size: 12px; }
.btn-block     { display: block; width: 100%; }

/* ---- Alertes ---- */
.alert {
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
  font-size: 14px;
  border-left: 4px solid transparent;
}
.alert-success { background: #eafaf1; border-color: var(--green); color: #1e8449; }
.alert-error   { background: #fdedec; border-color: var(--red);   color: #922b21; }
.alert-info    { background: var(--blue-light); border-color: var(--blue); color: var(--navy); }
.alert-warning { background: #fef9e7; border-color: var(--orange); color: #784212; }

/* ---- Badges statut ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  color: var(--white);
}

/* ---- Tableau ---- */
.table-wrap { overflow-x: auto; }
table.savips-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.savips-table thead tr {
  background: var(--navy);
  color: var(--white);
}
.savips-table thead th {
  padding: 10px 12px;
  text-align: left;
  font-weight: bold;
  white-space: nowrap;
}
.savips-table tbody tr { border-bottom: 1px solid var(--border); }
.savips-table tbody tr:nth-child(even) { background: var(--blue-light); }
.savips-table tbody tr:hover { background: var(--blue-mid); }
.savips-table tbody td { padding: 9px 12px; vertical-align: middle; }

/* ---- Fil de messages ---- */
.message-thread { display: flex; flex-direction: column; gap: 14px; }
.message-bubble {
  padding: 14px 18px;
  border-radius: 6px;
  max-width: 85%;
}
.message-bubble.agent {
  background: var(--blue-light);
  border-left: 4px solid var(--blue);
  align-self: flex-start;
}
.message-bubble.client {
  background: #f0f0f0;
  border-left: 4px solid var(--grey);
  align-self: flex-end;
}
.message-bubble.prive {
  background: #fff8e1;
  border-left: 4px solid var(--orange);
  align-self: flex-start;
}
.message-meta {
  font-size: 11px;
  color: var(--grey);
  margin-bottom: 6px;
}
.message-corps { line-height: 1.6; white-space: pre-wrap; }

/* ---- Sidebar agent ---- */
.agent-layout { display: flex; gap: 0; min-height: calc(100vh - 56px); }
.agent-sidebar {
  width: 220px;
  background: var(--navy);
  flex-shrink: 0;
  padding: 20px 0;
}
.agent-sidebar a {
  display: block;
  color: #aab4d0;
  padding: 10px 22px;
  font-size: 13px;
  transition: background .2s, color .2s;
}
.agent-sidebar a:hover,
.agent-sidebar a.active {
  background: rgba(255,255,255,.10);
  color: var(--white);
  text-decoration: none;
}
.agent-sidebar .sidebar-section {
  font-size: 10px;
  font-weight: bold;
  color: #5a6a9a;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 22px 4px;
}
.agent-content { flex: 1; padding: 28px; overflow: auto; }

/* ---- Page login ---- */
.login-page {
  background: var(--navy);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: var(--white);
  border-radius: 8px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo .brand {
  font-size: 32px;
  font-weight: bold;
  color: var(--navy);
}
.login-logo .brand span { color: var(--blue); }
.login-logo small { display: block; color: var(--grey); font-size: 12px; }

/* ---- Page publique client ---- */
.client-header {
  background: var(--navy);
  color: var(--white);
  padding: 18px 30px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.client-header .brand { font-size: 20px; font-weight: bold; }
.client-header .brand span { color: var(--blue); }
.client-header .client-name { color: #aab4d0; font-size: 14px; }

/* ---- Stat cards dashboard ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: 6px;
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--blue);
}
.stat-card .stat-val {
  font-size: 32px;
  font-weight: bold;
  color: var(--navy);
}
.stat-card .stat-lbl {
  font-size: 12px;
  color: var(--grey);
  margin-top: 4px;
}

/* ---- Pagination ---- */
.pagination { display: flex; gap: 6px; margin-top: 16px; }
.pagination a, .pagination span {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--blue);
  background: var(--white);
}
.pagination .current {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}

/* ---- Footer ---- */
.savips-footer {
  background: var(--navy);
  color: #aab4d0;
  font-size: 12px;
  padding: 14px 30px;
  margin-top: auto;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.savips-footer a { color: var(--blue); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .agent-layout { flex-direction: column; }
  .agent-sidebar { width: 100%; }
  .savips-topbar { padding: 0 15px; }
  .agent-content { padding: 16px; }
}
