/* ══════════════════════════════════════
   Crédit Rapide — Espace Client CSS
══════════════════════════════════════ */

:root {
  --green:       #00843D;
  --green-dark:  #005C2A;
  --green-light: #E8F5EC;
  --green-bg:    #F0F7F2;
  --orange:      #F57C00;
  --white:       #FFFFFF;
  --light:       #F0F4F8;
  --border:      #D0E5D8;
  --text:        #1A2430;
  --text-muted:  #637074;
  --red:         #C8102E;
  --shadow:      0 2px 16px rgba(0,100,50,0.08);
  --shadow-lg:   0 8px 40px rgba(0,100,50,0.14);
  --radius:      12px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--light);
  font-size: 15px;
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ── Layout ── */
.client-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ── */
.cl-sidebar {
  background: var(--green-dark);
  color: white;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}
.cl-sidebar-head {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.cl-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.cl-logo-icon {
  width: 38px; height: 38px;
  background: white;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--green);
  font-size: 1rem;
}
.cl-logo-text {
  font-size: 1.05rem;
  font-weight: 800;
  color: white;
}
.cl-account-box {
  background: rgba(255,255,255,0.09);
  border-radius: 10px;
  padding: 14px 16px;
}
.cl-account-num {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.cl-account-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: white;
}

.cl-nav {
  padding: 16px 14px;
  flex: 1;
}
.cl-nav-section {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.28);
  padding: 14px 10px 6px;
}
.cl-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.68);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 2px;
}
.cl-nav a:hover,
.cl-nav a.active {
  background: rgba(255,255,255,0.13);
  color: white;
}
.cl-nav a i { width: 18px; text-align: center; }
.unread-badge {
  background: var(--orange);
  color: white;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: auto;
}

.cl-sidebar-foot {
  padding: 18px 24px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.cl-sidebar-foot a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.45);
  font-size: 0.85rem;
  transition: color 0.2s;
}
.cl-sidebar-foot a:hover { color: white; }

/* ── Main ── */
.cl-main { min-width: 0; display: flex; flex-direction: column; }
.cl-topbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.cl-topbar h1 { font-size: 1.3rem; font-weight: 700; }
.cl-content { padding: 32px; }

/* ── Alert ── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.9rem;
}
.alert-success { background: var(--green-light); color: var(--green-dark); border: 1px solid #9DCBAE; }
.alert-error   { background: #FEE2E2; color: #9B1C1C; border: 1px solid #FECACA; }
.alert-info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ── Cards ── */
.card {
  background: white;
  border-radius: 14px;
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title i { color: var(--green); }

/* ── Balance card ── */
.balance-hero {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
  border-radius: 16px;
  padding: 36px 40px;
  color: white;
  position: relative;
  overflow: hidden;
  margin-bottom: 28px;
}
.balance-hero::after {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 180px; height: 180px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}
.balance-hero::before {
  content: '';
  position: absolute;
  bottom: -40px; left: 60px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}
.balance-label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}
.balance-amount {
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 20px;
}
.balance-meta {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}
.balance-meta-item small {
  display: block;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.45);
  margin-bottom: 2px;
}
.balance-meta-item span {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
}

/* ── Dashboard grid ── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.dashboard-grid .full { grid-column: 1 / -1; }

/* ── Quick actions ── */
.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
}
.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-green { background: var(--green); color: white; }
.btn-green:hover { background: var(--green-dark); transform: translateY(-1px); }
.btn-orange { background: var(--orange); color: white; }
.btn-orange:hover { background: #e56500; transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--green); color: var(--green); }
.btn-red { background: var(--red); color: white; }
.btn-red:hover { background: #a50025; }

/* ── Mini stats ── */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.mini-stat {
  background: white;
  border-radius: 12px;
  padding: 20px 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.mini-stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.mini-stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}
.mini-stat-value.green { color: var(--green); }
.mini-stat-value.orange { color: var(--orange); }

/* ── Table ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  padding: 11px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--green-bg); }

.tx-credit { color: var(--green); font-weight: 700; }
.tx-debit  { color: var(--red);   font-weight: 700; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.73rem;
  font-weight: 700;
}
.badge-transfert { background: #EFF6FF; color: #1D4ED8; }
.badge-depot     { background: var(--green-light); color: var(--green-dark); }
.badge-retrait   { background: #FEF2F2; color: var(--red); }
.badge-ajustement{ background: #FFF7ED; color: #C2410C; }
.badge-actif     { background: var(--green-light); color: var(--green-dark); }
.badge-suspendu  { background: #FEF2F2; color: var(--red); }
.badge-pending   { background: #FFF7ED; color: #C2410C; }
.badge-approuve  { background: var(--green-light); color: var(--green-dark); }
.badge-rejete    { background: #FEF2F2; color: var(--red); }

/* ── Message thread ── */
.msg-thread {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 480px;
  overflow-y: auto;
  padding: 4px 0 20px;
  margin-bottom: 24px;
  scrollbar-width: thin;
}
.msg-row { display: flex; gap: 12px; max-width: 82%; }
.msg-row.from-admin  { align-self: flex-start; }
.msg-row.from-client { align-self: flex-end; flex-direction: row-reverse; }

.msg-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.msg-row.from-admin  .msg-avatar { background: var(--green-light); color: var(--green-dark); }
.msg-row.from-client .msg-avatar { background: var(--orange); color: white; }

.msg-bubble {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
}
.msg-row.from-client .msg-bubble {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.msg-text { font-size: 0.9rem; line-height: 1.65; white-space: pre-wrap; }
.msg-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.msg-row.from-client .msg-time { color: rgba(255,255,255,0.6); }
.msg-empty {
  text-align: center;
  padding: 48px 0;
  color: var(--text-muted);
}
.msg-empty i { font-size: 2.5rem; margin-bottom: 12px; color: var(--border); display: block; }

/* ── Form elements ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 15px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0,132,61,0.08);
}
.form-group textarea { resize: vertical; min-height: 120px; }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 5px; }

/* ── Transfer / balance info box ── */
.info-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--green-light);
  border: 1px solid #9DCBAE;
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 28px;
}
.info-box i { font-size: 1.5rem; color: var(--green); }
.info-box strong { display: block; font-size: 0.82rem; color: var(--green-dark); margin-bottom: 2px; }
.info-box span { font-size: 1.5rem; font-weight: 900; color: var(--green); }

/* ── Login page ── */
.login-wrap {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 920px;
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.28);
  display: grid;
  grid-template-columns: 1fr 1.05fr;
}
.auth-left {
  background: linear-gradient(160deg, var(--green-dark), var(--green));
  padding: 52px 44px;
  color: white;
}
.auth-left-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 44px;
}
.auth-left-logo .logo-icon {
  width: 40px; height: 40px;
  background: white;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: var(--green); font-size: 1rem;
}
.auth-left-logo span { font-size: 1.15rem; font-weight: 800; }
.auth-left h2 { font-size: 1.7rem; font-weight: 900; margin-bottom: 14px; line-height: 1.25; }
.auth-left p { color: rgba(255,255,255,0.65); font-size: 0.92rem; line-height: 1.7; margin-bottom: 36px; }
.auth-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.78);
  font-size: 0.9rem;
  margin-bottom: 14px;
}
.auth-features li i { color: #7FD4A0; width: 18px; }
.auth-right { padding: 52px 44px; }
.auth-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 32px;
}
.auth-tab {
  padding: 10px 26px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.auth-tab.active { color: var(--green); border-bottom-color: var(--green); }
.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-form h3 { font-size: 1.2rem; font-weight: 800; margin-bottom: 24px; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 3rem;
  color: var(--border);
  margin-bottom: 16px;
  display: block;
}
.empty-state h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }

/* ── Admin extension (clients, commentaires) ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-header h1 { font-size: 1.4rem; font-weight: 800; }
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.search-bar input {
  flex: 1;
  padding: 10px 16px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 0.9rem;
  font-family: inherit;
}
.search-bar input:focus { outline: none; border-color: var(--green); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .client-layout { grid-template-columns: 220px 1fr; }
  .cl-content { padding: 20px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: 1fr 1fr; }
  .auth-card { max-width: 560px; grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .client-layout { grid-template-columns: 1fr; }
  .cl-sidebar { display: none; }
  .balance-amount { font-size: 2.2rem; }
  .mini-stats { grid-template-columns: 1fr; }
  .cl-topbar { padding: 16px 18px; }
  .cl-content { padding: 16px; }
  .auth-right { padding: 36px 24px; }
}
