/* ============================================================
   ProspectIA — Design System CSS Vanilla
   ============================================================ */

:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #eff6ff;
  --accent:        #7c3aed;
  --success:       #16a34a;
  --warning:       #d97706;
  --danger:        #dc2626;
  --gray-50:       #f9fafb;
  --gray-100:      #f3f4f6;
  --gray-200:      #e5e7eb;
  --gray-400:      #9ca3af;
  --gray-600:      #4b5563;
  --gray-800:      #1f2937;
  --gray-900:      #111827;
  --white:         #ffffff;
  --radius:        8px;
  --radius-lg:     12px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
  --shadow:        0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.14);
  --font:          'Inter', system-ui, -apple-system, sans-serif;
  --sidebar-w:     240px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Liens ── */
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Boutons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .625rem 1.25rem;
  border: none; border-radius: var(--radius);
  font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: background .18s, transform .12s, box-shadow .18s;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-800); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger    { background: var(--danger); color: var(--white); }
.btn-outline   { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-full      { width: 100%; }
.btn-sm        { padding: .4rem .9rem; font-size: .82rem; }
.btn-lg        { padding: .875rem 1.75rem; font-size: 1rem; }

/* ── Formulaires ── */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  margin-bottom: .4rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--gray-700, #374151);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: .625rem .875rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: .9rem;
  font-family: var(--font);
  background: var(--white);
  color: var(--gray-800);
  transition: border-color .18s, box-shadow .18s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
input::placeholder { color: var(--gray-400); }

.form-error {
  margin-top: .35rem;
  font-size: .8rem;
  color: var(--danger);
}

/* ── Alertes ── */
.alert {
  padding: .875rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  margin-bottom: 1rem;
  border-left: 4px solid transparent;
}
.alert-success { background: #f0fdf4; border-color: var(--success); color: #15803d; }
.alert-error   { background: #fef2f2; border-color: var(--danger);  color: #b91c1c; }
.alert-warning { background: #fffbeb; border-color: var(--warning);  color: #92400e; }
.alert-info    { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }

/* ── Cards ── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  padding: 1.5rem;
}
.card-header {
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--gray-100);
}
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); }

/* ── Badge ── */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-trial   { background: #fef9c3; color: #854d0e; }
.badge-active  { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fee2e2; color: #991b1b; }

/* ============================================================
   PAGE AUTH (login / register)
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #7c3aed 100%);
  padding: 1.5rem;
}

.auth-box {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-logo .logo-icon {
  width: 52px; height: 52px;
  background: var(--primary);
  border-radius: var(--radius-lg);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: .75rem;
}
.auth-logo .logo-icon svg { fill: var(--white); }
.auth-logo h1 { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); }
.auth-logo p  { font-size: .875rem; color: var(--gray-400); margin-top: .25rem; }

.auth-divider {
  text-align: center;
  margin: 1.25rem 0;
  position: relative;
  color: var(--gray-400);
  font-size: .82rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  position: absolute; top: 50%;
  width: 42%; height: 1px;
  background: var(--gray-200);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: .875rem;
  color: var(--gray-600);
}

.trial-banner {
  background: linear-gradient(135deg, var(--primary-light), #ede9fe);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .82rem;
  color: var(--primary-dark);
  margin-bottom: 1.25rem;
  text-align: center;
}

/* ============================================================
   LAYOUT DASHBOARD
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--gray-900);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s;
}

.sidebar-logo {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: .75rem;
}
.sidebar-logo .logo-mark {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem;
  flex-shrink: 0;
}
.sidebar-logo span { font-weight: 700; font-size: 1rem; }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }

.nav-section-title {
  padding: .5rem 1.25rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gray-400);
  margin-top: .5rem;
}

.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.25rem;
  color: rgba(255,255,255,.65);
  font-size: .875rem;
  font-weight: 500;
  border-radius: 0;
  transition: background .15s, color .15s;
  cursor: pointer;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: var(--white); text-decoration: none; }
.nav-item.active { background: var(--primary); color: var(--white); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-mini {
  display: flex; align-items: center; gap: .75rem;
}
.user-avatar {
  width: 34px; height: 34px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  flex-shrink: 0;
}
.user-mini-info { flex: 1; min-width: 0; }
.user-mini-name { font-size: .85rem; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mini-status { font-size: .72rem; color: var(--gray-400); }

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

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 1.1rem; font-weight: 700; color: var(--gray-900); }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }

.page-content { padding: 2rem; flex: 1; }

/* ── Stats grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue   { background: var(--primary-light); color: var(--primary); }
.stat-icon.green  { background: #f0fdf4; color: var(--success); }
.stat-icon.purple { background: #f5f3ff; color: var(--accent); }
.stat-icon.orange { background: #fff7ed; color: var(--warning); }

.stat-value { font-size: 1.6rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--gray-400); margin-top: .2rem; }

/* ── Tableau ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-400);
  border-bottom: 1px solid var(--gray-200);
}
tbody td {
  padding: .875rem 1rem;
  font-size: .875rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-800);
}
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 1rem; }
  .topbar { padding: 1rem; }
}
