/* ================================================================
   BOUALA'S TECH. — Design System CSS
   Variables, reset, composants, utilitaires
   ================================================================ */

/* ── VARIABLES ──────────────────────────────────────────────── */
:root {
  /* Colors */
  --black:       #0A0A0A;
  --navy:        #0D1B2A;
  --dark:        #111827;
  --dark-2:      #1F2937;
  --dark-3:      #374151;
  --green:       #3BAA4B;
  --green-light: #4ADE80;
  --green-dark:  #2D8A3B;
  --gold:        #D4AF37;
  --gold-light:  #FBBF24;
  --white:       #F5F5F5;
  --muted:       #94A3B8;
  --muted-2:     #6B7280;
  --border:      rgba(255,255,255,0.06);
  --border-green:rgba(59,170,75,0.2);

  /* Status */
  --blue:        #3B82F6;
  --purple:      #8B5CF6;
  --orange:      #F97316;
  --red:         #EF4444;
  --red-dark:    #C62828;
  --yellow:      #F59E0B;
  --cyan:        #06B6D4;

  /* Fonts */
  --font-heading: 'Sora', sans-serif;
  --font-body:    'Rajdhani', sans-serif;

  /* Spacing */
  --sidebar-width: 260px;
  --header-height: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm:  0 2px 8px rgba(0,0,0,0.2);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow:0 0 20px rgba(59,170,75,0.15);

  /* Transitions */
  --transition: 0.2s ease;
}

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

body {
  background: var(--black);
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

img { max-width: 100%; height: auto; }

/* ── TYPOGRAPHY ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5 { font-family: var(--font-heading); font-weight: 700; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.95rem; }

.text-green  { color: var(--green); }
.text-gold   { color: var(--gold); }
.text-muted  { color: var(--muted); }
.text-red    { color: var(--red); }
.text-blue   { color: var(--blue); }
.text-sm     { font-size: 0.8rem; }
.text-xs     { font-size: 0.72rem; }
.text-upper  { text-transform: uppercase; letter-spacing: 0.05em; }
.font-body   { font-family: var(--font-body); }
.font-bold   { font-weight: 700; }
.font-extrabold { font-weight: 800; }

/* ── LAYOUT ─────────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition);
}
.app-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1400px;
  width: 100%;
}

/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 {
  font-size: 0.9rem;
  font-weight: 700;
}

/* ── STAT CARDS ─────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  transition: var(--transition);
}
.stat-card:hover {
  border-color: var(--green);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}
.stat-card .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-bottom: 12px;
}
.stat-card .stat-icon.green  { background: rgba(59,170,75,0.15); color: var(--green); }
.stat-card .stat-icon.blue   { background: rgba(59,130,246,0.15); color: var(--blue); }
.stat-card .stat-icon.gold   { background: rgba(212,175,55,0.15); color: var(--gold); }
.stat-card .stat-icon.purple { background: rgba(139,92,246,0.15); color: var(--purple); }
.stat-card .stat-icon.red    { background: rgba(239,68,68,0.15); color: var(--red); }
.stat-card .stat-icon.cyan   { background: rgba(6,182,212,0.15); color: var(--cyan); }
.stat-card .stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-label {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--green);
  color: var(--black);
}
.btn-primary:hover {
  background: var(--white);
  box-shadow: 0 0 20px rgba(59,170,75,0.4);
}
.btn-secondary {
  background: var(--dark-3);
  color: var(--white);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--dark-2); border-color: var(--muted); }
.btn-danger {
  background: var(--red-dark);
  color: var(--white);
}
.btn-danger:hover { background: var(--red); }
.btn-outline {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green);
}
.btn-outline:hover { background: rgba(59,170,75,0.1); }
.btn-sm { padding: 6px 14px; font-size: 0.78rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── FORMS ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font-heading);
  font-size: 0.88rem;
  outline: none;
  transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(59,170,75,0.1);
}
.form-input::placeholder, .form-textarea::placeholder {
  color: rgba(255,255,255,0.2);
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-select option { background: var(--dark); color: var(--white); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.form-hint {
  font-size: 0.75rem;
  color: var(--muted-2);
  margin-top: 4px;
}
.form-error {
  font-size: 0.75rem;
  color: var(--red);
  margin-top: 4px;
}
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.form-check input[type="checkbox"] {
  accent-color: var(--green);
  width: 16px;
  height: 16px;
}

/* ── TABLES ─────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  background: var(--dark-2);
  padding: 12px 16px;
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(59,170,75,0.03); }
.table .sortable { cursor: pointer; user-select: none; }
.table .sortable:hover { color: var(--green); }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-green  { background: rgba(59,170,75,0.15); color: var(--green); }
.badge-blue   { background: rgba(59,130,246,0.15); color: var(--blue); }
.badge-gold   { background: rgba(212,175,55,0.15); color: var(--gold); }
.badge-purple { background: rgba(139,92,246,0.15); color: var(--purple); }
.badge-orange { background: rgba(249,115,22,0.15); color: var(--orange); }
.badge-red    { background: rgba(239,68,68,0.15); color: var(--red); }
.badge-muted  { background: rgba(107,114,128,0.15); color: var(--muted-2); }
.badge-cyan   { background: rgba(6,182,212,0.15); color: var(--cyan); }

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; }
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}
.modal-close:hover { color: var(--white); }
.modal-body { padding: 24px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ── ALERTS / TOASTS ────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-success { background: rgba(59,170,75,0.12); border: 1px solid var(--green); color: var(--green); }
.alert-danger  { background: rgba(239,68,68,0.12); border: 1px solid var(--red); color: #ef5350; }
.alert-warning { background: rgba(245,158,11,0.12); border: 1px solid var(--yellow); color: var(--yellow); }
.alert-info    { background: rgba(59,130,246,0.12); border: 1px solid var(--blue); color: var(--blue); }

.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  min-width: 300px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ── PROGRESS BAR ───────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--dark-3);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ── TABS ───────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
}
.tab {
  padding: 12px 20px;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.tab:hover { color: var(--white); }
.tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── PAGINATION ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.pagination-btns {
  display: flex;
  gap: 4px;
}
.pagination-btns button {
  padding: 6px 12px;
  background: var(--dark-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}
.pagination-btns button:hover { border-color: var(--green); }
.pagination-btns button.active { background: var(--green); color: var(--black); border-color: var(--green); }
.pagination-btns button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 16px;
  display: block;
  opacity: 0.3;
}
.empty-state p { font-size: 0.88rem; margin-bottom: 16px; }

/* ── UTILITIES ──────────────────────────────────────────────── */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.flex-wrap  { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end    { justify-content: flex-end; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.p-16  { padding: 16px; }
.p-24  { padding: 24px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */

/* ── LARGE SCREENS (1600px+) ────────────────────────────────── */
@media (min-width: 1600px) {
  .app-content { padding: 36px 48px; max-width: 1600px; }
  .stat-grid { gap: 20px; }
  .stat-card { padding: 24px 28px; }
  .stat-card .stat-number { font-size: 2rem; }
  .card { padding: 24px 28px; }
  .table th { padding: 14px 20px; }
  .table td { padding: 14px 20px; font-size: 0.9rem; }
  .modal { max-width: 640px; }
  .toast { min-width: 360px; padding: 16px 24px; }
}

/* ── TABLETS (max 1024px) ───────────────────────────────────── */
@media (max-width: 1024px) {
  .app-content { padding: 24px; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
  .form-row { grid-template-columns: 1fr 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}

/* ── MOBILE (max 768px) ─────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .app-main { margin-left: 0; }
  .app-content { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .table { font-size: 0.8rem; }
  .table th, .table td { padding: 8px 10px; }
  .card { padding: 16px; border-radius: var(--radius-md); }
  .card-header { margin-bottom: 12px; padding-bottom: 10px; }
  .stat-card { padding: 16px 18px; }
  .stat-card .stat-number { font-size: 1.5rem; }
  .stat-card .stat-icon { width: 36px; height: 36px; font-size: 0.9rem; }
  h1 { font-size: 1.3rem; }
  h2 { font-size: 1.15rem; }
  h3 { font-size: 0.95rem; }
  .btn { padding: 10px 16px; font-size: 0.82rem; }
  .btn-sm { padding: 6px 12px; font-size: 0.75rem; }
  .btn-lg { padding: 12px 22px; font-size: 0.9rem; }
  .modal { margin: 12px; max-height: 90vh; border-radius: var(--radius-md); }
  .modal-header { padding: 16px 18px; }
  .modal-body { padding: 18px; }
  .modal-footer { padding: 12px 18px; }
  .toast-container { top: 72px; right: 12px; left: 12px; }
  .toast { min-width: auto; width: 100%; }
  .alert { padding: 12px 14px; font-size: 0.82rem; flex-wrap: wrap; }
  .badge { font-size: 0.65rem; padding: 2px 8px; }
  .tabs { gap: 0; }
  .tab { padding: 10px 14px; font-size: 0.78rem; }
  .pagination { flex-direction: column; gap: 12px; align-items: center; }
  .empty-state { padding: 32px 16px; }
  .empty-state i { font-size: 2rem; }
  .form-label { font-size: 0.72rem; }
  .form-hint, .form-error { font-size: 0.7rem; }
}

/* ── EXTRA SMALL (max 480px) ────────────────────────────────── */
@media (max-width: 480px) {
  .app-content { padding: 12px; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card .stat-number { font-size: 1.3rem; }
  .card { padding: 14px; }
  h1 { font-size: 1.15rem; }
  h2 { font-size: 1.05rem; }
  .table { font-size: 0.75rem; }
  .table th, .table td { padding: 6px 8px; }
  .btn-group { flex-direction: column; width: 100%; }
  .btn-group .btn { width: 100%; justify-content: center; }
  .form-textarea { min-height: 60px; }
}

/* ── TOUCH-FRIENDLY ─────────────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .form-input, .form-select, .form-textarea { min-height: 44px; }
  .nav-item { min-height: 44px; padding: 12px 20px; }
  .tab { min-height: 44px; }
  .pagination-btns button { min-width: 40px; min-height: 40px; }
}

/* ── REDUCED MOTION ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── HIGH CONTRAST ──────────────────────────────────────────── */
@media (forced-colors: active) {
  .btn { border: 1px solid currentColor; }
  .card, .stat-card { border: 1px solid currentColor; }
  .badge { border: 1px solid currentColor; }
}
