/* ============================================================
   AfriSell Pro — Feuille de styles principale
   ============================================================ */

/* ─── VARIABLES ─────────────────────────────────────────── */
:root {
  --primary:      #FF6B35;
  --primary-dark: #e85d2a;
  --dark:         #1a1a2e;
  --dark2:        #16213e;
  --sidebar-w:    260px;
  --topbar-h:     65px;
  --radius:       12px;
  --shadow-sm:    0 2px 10px rgba(0,0,0,.06);
  --shadow-md:    0 5px 25px rgba(0,0,0,.1);
  --success:      #28a745;
  --warning:      #ffc107;
  --info:         #17a2b8;
}

/* ─── RESET & BASE ───────────────────────────────────────── */
* { box-sizing: border-box; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: .92rem;
  line-height: 1.6;
  color: #333;
  background: #f4f6f9;
}
.fw-900 { font-weight: 900; }

/* ─── LAYOUT DASHBOARD ───────────────────────────────────── */
.dashboard-body { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .3s ease;
}
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 5px 0 30px rgba(0,0,0,.3);
  }
  .sidebar.show { transform: translateX(0); }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon  { font-size: 1.6rem; }
.brand-name  { font-size: 1.3rem; font-weight: 900; color: #fff; }
.brand-name .text-warning { color: var(--warning) !important; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.user-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #ff9a76);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem; color: #fff;
  overflow: hidden; flex-shrink: 0;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name  { font-weight: 700; color: #fff; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.user-plan  { font-size: .72rem; color: rgba(255,255,255,.5); }

.sidebar-nav {
  list-style: none;
  padding: 12px 0;
  margin: 0;
  flex: 1;
}
.nav-section {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: 14px 20px 6px;
  text-transform: uppercase;
}
.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  border-radius: 0;
  transition: all .2s;
  font-size: .88rem;
  border-left: 3px solid transparent;
}
.nav-item a:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
  border-left-color: rgba(255,255,255,.2);
}
.nav-item.active a {
  background: rgba(255,107,53,.15);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.nav-item a i { font-size: 1rem; width: 18px; text-align: center; }
.nav-item .ms-auto { margin-left: auto !important; }

.sidebar-upgrade {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: auto;
}

/* MAIN WRAPPER */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
@media (max-width: 991.98px) {
  .main-wrapper { margin-left: 0; }
}

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.sidebar-toggle {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: #555;
  padding: 5px;
  cursor: pointer;
}
.topbar-title { font-weight: 700; color: var(--dark); flex: 1; }
.topbar-right  { display: flex; align-items: center; gap: 12px; }
.stat-pill {
  background: #f8f9fa;
  border: 1px solid #eee;
  border-radius: 50px;
  padding: 5px 14px;
  font-size: .82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* PAGE CONTENT */
.page-content {
  padding: 24px;
  flex: 1;
}

/* ─── CARD BOX ───────────────────────────────────────────── */
.card-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

/* ─── STAT CARDS ─────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  flex-shrink: 0;
}
.stat-icon.bg-warning { background: linear-gradient(135deg, #ffc107, #fd7e14); }
.stat-icon.bg-success  { background: linear-gradient(135deg, #28a745, #20c997); }
.stat-icon.bg-primary  { background: linear-gradient(135deg, #007bff, #6610f2); }
.stat-icon.bg-info     { background: linear-gradient(135deg, #17a2b8, #0dcaf0); }
.stat-icon.bg-danger   { background: linear-gradient(135deg, #dc3545, #e83e8c); }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--dark); line-height: 1.2; }
.stat-label { font-size: .78rem; color: #888; font-weight: 500; }
.stat-sub   { font-size: .75rem; margin-top: 3px; }

/* ─── PRODUCT CARDS ──────────────────────────────────────── */
.product-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all .3s;
  border: 2px solid transparent;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(255,107,53,.2);
}
.product-cover {
  height: 170px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f0f2f5, #e4e8ec);
  display: flex; align-items: center; justify-content: center;
}
.product-cover img   { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder   { font-size: 3rem; }
.status-dot          { position: absolute; top: 10px; right: 10px; width: 10px; height: 10px; border-radius: 50%; }
.status-dot.green    { background: #28a745; box-shadow: 0 0 0 3px rgba(40,167,69,.2); }
.status-dot.gray     { background: #aaa; }
.product-body        { padding: 16px; }
.product-title       { font-weight: 700; font-size: .92rem; color: var(--dark); margin-bottom: 6px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-price       { font-weight: 800; color: var(--primary); }
.product-actions     { display: flex; gap: 5px; flex-wrap: wrap; }

/* ─── BUTTONS EXTRA ──────────────────────────────────────── */
.btn-xs { padding: 3px 8px; font-size: .75rem; border-radius: 6px; }

/* ─── FLASH ──────────────────────────────────────────────── */
.flash-container .alert { border-radius: var(--radius); }

/* ─── FORMS ──────────────────────────────────────────────── */
.form-control, .form-select {
  border-radius: 8px;
  border: 2px solid #e9ecef;
  padding: 9px 13px;
  font-size: .9rem;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,53,.12);
}
.form-label { font-weight: 600; font-size: .86rem; margin-bottom: 5px; color: #444; }

/* ─── TABLES ─────────────────────────────────────────────── */
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #888; font-weight: 700; padding: 10px 12px; }
.table td { padding: 12px; vertical-align: middle; }
.table tbody tr:hover { background: #fafbfc; }

/* ─── BADGES ─────────────────────────────────────────────── */
.badge { font-weight: 600; }

/* ─── PAGINATION ─────────────────────────────────────────── */
.pagination .page-link { border-radius: 8px !important; margin: 0 2px; border-color: #dee2e6; color: var(--dark); }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ─── TABS ───────────────────────────────────────────────── */
.nav-tabs { border-bottom: 2px solid #eee; }
.nav-tabs .nav-link { border: none; border-bottom: 3px solid transparent; color: #666; font-weight: 600; padding: 10px 18px; border-radius: 0; }
.nav-tabs .nav-link.active { color: var(--primary); border-bottom-color: var(--primary); background: none; }
.nav-tabs .nav-link:hover { color: var(--primary); background: #fff8f5; }

/* ─── ALERTS ─────────────────────────────────────────────── */
.alert { border-radius: var(--radius); border: none; }
.alert-warning { background: #fff8ec; color: #856404; }
.alert-info    { background: #e8f4fd; color: #055160; }
.alert-danger  { background: #fdecea; color: #842029; }
.alert-success { background: #edf7ed; color: #155724; }

/* ─── PROGRESS BAR ───────────────────────────────────────── */
.progress { background: #f0f2f5; }

/* ─── MODAL ──────────────────────────────────────────────── */
.modal-content { border-radius: 16px; border: none; box-shadow: 0 25px 80px rgba(0,0,0,.2); }
.modal-header  { border-bottom: 1px solid #f0f0f0; }
.modal-footer  { border-top: 1px solid #f0f0f0; }

/* ─── ANALYTICS CHARTS ───────────────────────────────────── */
canvas { max-height: 280px; }

/* ─── DROPDOWN ───────────────────────────────────────────── */
.dropdown-menu { border-radius: 12px; border: 1px solid #eee; box-shadow: var(--shadow-md); }
.dropdown-item { font-size: .88rem; padding: 8px 16px; }

/* ─── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .page-content  { padding: 16px; }
  .stat-value    { font-size: 1.2rem; }
  .topbar        { padding: 0 16px; }
  .topbar-stats  { display: none; }
}

/* ─── SCROLLBAR ──────────────────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }

/* ─── UTILITIES ──────────────────────────────────────────── */
.text-primary-brand { color: var(--primary) !important; }
.bg-primary-brand   { background: var(--primary) !important; }
.font-monospace     { font-family: 'Courier New', monospace; font-size: .85em; }
.rounded-4          { border-radius: 16px !important; }
.card-box.bg-light  { background: #f8f9fa !important; }
