/* =============================================
   DIGI-FINANCE — Espace Client CSS
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --red:      #C8102E;
  --red-dk:   #a00d24;
  --black:    #1A1A1A;
  --black-s:  #252525;
  --sidebar:  #111111;
  --white:    #FFFFFF;
  --gray-bg:  #F4F6FA;
  --gray-bdr: #E2E6EF;
  --gray-mid: #8898AA;
  --success:  #28a745;
  --warning:  #FFC107;
  --info:     #17a2b8;
  --shadow:   0 2px 16px rgba(0,0,0,.10);
  --radius:   10px;
  --font:     'Outfit', sans-serif;
  --trans:    all .25s ease;
  --sidebar-w: 250px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--gray-bg);
  color: var(--black);
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; }

/* ─── Login Page ─── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--black) 0%, #2a0a12 100%);
  padding: 20px;
}
.login-box {
  background: var(--white);
  border-radius: 18px;
  padding: 50px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--black);
}
.login-logo .brand span { color: var(--red); }
.login-logo .sub {
  font-size: .72rem;
  color: var(--gray-mid);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-top: 4px;
}
.login-box h2 {
  font-size: 1.15rem;
  margin-bottom: 24px;
  color: var(--black);
}
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; font-size: .82rem; margin-bottom: 6px; color: var(--black); }
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-bdr);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .9rem;
  transition: var(--trans);
}
.form-control:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(200,16,46,.1); }
.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--red);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--trans);
  margin-top: 6px;
}
.btn-login:hover { background: var(--red-dk); transform: translateY(-1px); }
.alert-error {
  background: #fff0f3;
  border: 1px solid #ffc0cb;
  color: var(--red);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: .85rem;
  margin-bottom: 16px;
}

/* ─── Layout ─── */
.admin-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: var(--trans);
}
.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar-logo .name { font-size: 1rem; font-weight: 800; color: var(--white); }
.sidebar-logo .name span { color: var(--red); }
.sidebar-logo .sub { font-size: .65rem; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }

.sidebar-section {
  padding: 16px 14px 4px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.25);
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 20px;
  color: rgba(255,255,255,.55);
  font-size: .88rem;
  font-weight: 500;
  transition: var(--trans);
  border-left: 3px solid transparent;
}
.sidebar-nav a i { width: 18px; text-align: center; font-size: .9rem; }
.sidebar-nav a:hover { color: var(--white); background: rgba(255,255,255,.05); }
.sidebar-nav a.active { color: var(--white); background: rgba(200,16,46,.15); border-left-color: var(--red); }
.sidebar-nav .badge-count {
  margin-left: auto;
  background: var(--red);
  color: var(--white);
  font-size: .65rem;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 700;
}
.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-footer a {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,.4);
  font-size: .82rem;
  transition: var(--trans);
}
.sidebar-footer a:hover { color: var(--red); }

/* Main Content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.admin-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-bdr);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 99;
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}
.topbar-left h1 { font-size: 1.1rem; font-weight: 700; }
.topbar-left .breadcrumb-admin {
  font-size: .75rem;
  color: var(--gray-mid);
  margin-top: 1px;
}
.topbar-right { display: flex; align-items: center; gap: 16px; font-size: .85rem; color: var(--gray-mid); }
.topbar-user {
  display: flex; align-items: center; gap: 9px;
}
.user-avatar {
  width: 36px; height: 36px;
  background: var(--red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-weight: 700; font-size: .88rem;
}

/* Page content */
.page-content { padding: 28px; flex: 1; }

/* ─── Stat Cards ─── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  overflow: hidden;
  border-left: 4px solid transparent;
}
.stat-card.red   { border-left-color: var(--red); }
.stat-card.black { border-left-color: var(--black); }
.stat-card.green { border-left-color: var(--success); }
.stat-card.blue  { border-left-color: var(--info); }
.stat-icon-box {
  width: 46px; height: 46px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-card.red   .stat-icon-box { background: #fff0f3; color: var(--red); }
.stat-card.black .stat-icon-box { background: #f0f0f0; color: var(--black); }
.stat-card.green .stat-icon-box { background: #eafaf1; color: var(--success); }
.stat-card.blue  .stat-icon-box { background: #e8f8fb; color: var(--info); }
.stat-info .num { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-info .label { font-size: .78rem; color: var(--gray-mid); margin-top: 4px; }
.stat-card .trend {
  position: absolute; top: 16px; right: 16px;
  font-size: .72rem; font-weight: 700;
  display: flex; align-items: center; gap: 2px;
}
.trend.up   { color: var(--success); }
.trend.down { color: var(--red); }

/* ─── Tables ─── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-bdr);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.card-header h3 { font-size: 1rem; font-weight: 700; }
.card-body { padding: 0; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
}
.admin-table th {
  background: var(--gray-bg);
  padding: 12px 18px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--gray-mid);
  border-bottom: 1px solid var(--gray-bdr);
  white-space: nowrap;
}
.admin-table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--gray-bdr);
  color: var(--black);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #fafbff; }
.admin-table .cell-wrap { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Status badges */
.badge-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-status.nouveau      { background: #fff0f3; color: var(--red); }
.badge-status.en_traitement{ background: #fff8e1; color: #b8860b; }
.badge-status.approuve     { background: #eafaf1; color: var(--success); }
.badge-status.refuse       { background: #f8f9fa; color: var(--gray-mid); }
.badge-status.lu           { background: #e8f8fb; color: var(--info); }
.badge-status.repondu      { background: #eafaf1; color: var(--success); }
.badge-status.active       { background: #eafaf1; color: var(--success); }
.badge-status.inactive     { background: #f8f9fa; color: var(--gray-mid); }
.badge-status.suspended    { background: #fff0f3; color: var(--red); }
.badge-status.closed       { background: #f8f9fa; color: var(--gray-mid); }
.badge-status.available    { background: #eafaf1; color: var(--success); }
.badge-status.processing   { background: #fff8e1; color: #b8860b; }
.badge-status.archived     { background: #f8f9fa; color: var(--gray-mid); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--trans);
  border: none;
}
.btn-primary { background: var(--red); color: var(--white); }
.btn-primary:hover { background: var(--red-dk); }
.btn-secondary { background: var(--gray-bg); color: var(--black); border: 1px solid var(--gray-bdr); }
.btn-secondary:hover { background: var(--gray-bdr); }
.btn-success { background: var(--success); color: var(--white); }
.btn-sm { padding: 5px 12px; font-size: .78rem; }

/* Search / filters */
.filters-row {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.search-box {
  display: flex; align-items: center;
  border: 1.5px solid var(--gray-bdr);
  border-radius: 8px;
  background: var(--white);
  padding: 0 12px;
  gap: 8px;
}
.search-box input {
  border: none; outline: none; padding: 8px 0;
  font-family: var(--font); font-size: .85rem;
  width: 200px;
}
.search-box i { color: var(--gray-mid); font-size: .85rem; }
.filter-select {
  border: 1.5px solid var(--gray-bdr);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font); font-size: .85rem;
  background: var(--white); color: var(--black);
  cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--red); }

/* Pagination */
.pagination {
  display: flex; align-items: center; gap: 4px;
  padding: 14px 18px;
  justify-content: flex-end;
  border-top: 1px solid var(--gray-bdr);
}
.pagination a {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: .82rem;
  color: var(--black);
  border: 1px solid var(--gray-bdr);
  transition: var(--trans);
}
.pagination a.active { background: var(--red); color: var(--white); border-color: var(--red); }
.pagination a:hover:not(.active) { background: var(--gray-bg); }

/* Charts placeholder */
.chart-wrap {
  padding: 24px;
  min-height: 180px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-mid); font-size: .88rem;
}

/* Activity */
.activity-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 24px;
  border-bottom: 1px solid var(--gray-bdr);
  font-size: .85rem;
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 32px; height: 32px; min-width: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  margin-top: 2px;
}
.activity-dot.compte  { background: #fff0f3; color: var(--red); }
.activity-dot.contact { background: #e8f8fb; color: var(--info); }
.activity-dot.news    { background: #eafaf1; color: var(--success); }
.activity-time { color: var(--gray-mid); font-size: .75rem; margin-top: 3px; }

/* Detail modal-ish panel */
.detail-row { display: flex; gap: 6px; margin-bottom: 10px; font-size: .88rem; }
.detail-label { min-width: 160px; color: var(--gray-mid); font-weight: 600; }
.detail-val   { color: var(--black); }

/* Responsive minimal */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; }
  .stats-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .stats-row { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
}
