/* =========================================
   DTGestion - Feuille de style principale
   ========================================= */

:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #eff6ff;
  --secondary:     #64748b;
  --success:       #16a34a;
  --danger:        #dc2626;
  --warning:       #d97706;
  --dark:          #0f172a;
  --light:         #f8fafc;
  --border:        #e2e8f0;
  --shadow:        0 4px 24px rgba(15,23,42,.10);
  --radius:        12px;
  --radius-sm:     8px;
  --font:          'Inter', 'Segoe UI', system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--light);
  color: var(--dark);
  min-height: 100vh;
  margin: 0;
}

/* ---- AUTH LAYOUT ---- */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.auth-brand {
  flex: 1;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.auth-brand::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  top: -80px; left: -80px;
}
.auth-brand::after {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  bottom: -60px; right: -60px;
}

.auth-brand .brand-logo {
  width: 80px; height: 80px;
  background: rgba(255,255,255,.15);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.2);
  z-index: 1;
}

.auth-brand h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -.5px;
  margin-bottom: .5rem;
  z-index: 1;
}

.auth-brand p {
  opacity: .8;
  font-size: .95rem;
  text-align: center;
  max-width: 280px;
  z-index: 1;
}

.auth-brand .features {
  margin-top: 3rem;
  z-index: 1;
  width: 100%;
  max-width: 320px;
}

.auth-brand .feature-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem;
  background: rgba(255,255,255,.08);
  border-radius: var(--radius-sm);
  margin-bottom: .75rem;
  border: 1px solid rgba(255,255,255,.12);
  font-size: .88rem;
}

.auth-brand .feature-item i {
  font-size: 1.1rem;
  opacity: .9;
  width: 20px;
  text-align: center;
}

.auth-form-panel {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 2.5rem;
  background: #fff;
  overflow-y: auto;
}

.auth-form-panel .auth-header {
  margin-bottom: 2rem;
}

.auth-form-panel .auth-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: .4rem;
}

.auth-form-panel .auth-header p {
  color: var(--secondary);
  font-size: .9rem;
}

/* ---- FORM ---- */
.form-label {
  font-weight: 600;
  font-size: .85rem;
  color: #374151;
  margin-bottom: .4rem;
}

.form-control, .form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem 1rem;
  font-size: .92rem;
  transition: border-color .2s, box-shadow .2s;
  background: #fafafa;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background: #fff;
  outline: none;
}

.form-control.is-invalid {
  border-color: var(--danger);
  background-image: none;
}

.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn           { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border: 1.5px solid var(--border); border-left: 0; }

/* ---- BUTTONS ---- */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  border-radius: var(--radius-sm);
  font-weight: 600;
  padding: .7rem 1.5rem;
  font-size: .95rem;
  transition: background .2s, transform .1s, box-shadow .2s;
  letter-spacing: .01em;
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-outline-secondary {
  border-radius: var(--radius-sm);
  font-weight: 500;
}

/* ---- ALERTS ---- */
.alert {
  border-radius: var(--radius-sm);
  font-size: .9rem;
  border: none;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}

.alert-danger  { background: #fef2f2; color: #991b1b; }
.alert-success { background: #f0fdf4; color: #166534; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info    { background: #eff6ff; color: #1e40af; }

/* ---- PASSWORD STRENGTH ---- */
.pwd-strength { margin-top: .5rem; }
.pwd-strength .bar-wrap {
  display: flex; gap: 4px; margin-bottom: .25rem;
}
.pwd-strength .bar {
  flex: 1; height: 4px; border-radius: 4px;
  background: var(--border);
  transition: background .3s;
}
.pwd-strength .bar.active-weak   { background: #ef4444; }
.pwd-strength .bar.active-medium { background: #f59e0b; }
.pwd-strength .bar.active-strong { background: #22c55e; }
.pwd-strength .label { font-size: .78rem; color: var(--secondary); }

/* ---- DIVIDER ---- */
.divider {
  display: flex; align-items: center; gap: 1rem;
  color: var(--secondary); font-size: .82rem; margin: 1.25rem 0;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ---- DASHBOARD ---- */
.sidebar {
  width: 260px;
  height: 100vh;
  background: var(--dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 1000;
  overflow: hidden;
  transition: width .3s;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
  color: #fff;
}

.sidebar-brand .logo-icon {
  width: 38px; height: 38px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-brand .logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.3px;
}

.sidebar-brand .logo-version {
  font-size: .7rem;
  opacity: .5;
  display: block;
  font-weight: 400;
}

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

.nav-section-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  padding: 1rem 1.25rem .4rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.25rem;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  border-radius: 0;
  transition: all .15s;
  border-left: 3px solid transparent;
  margin: 1px 0;
}

.sidebar-link i { width: 18px; text-align: center; font-size: 1rem; }

.sidebar-link:hover,
.sidebar-link.active {
  color: #fff;
  background: rgba(255,255,255,.06);
  border-left-color: var(--primary);
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-footer .user-info {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.05);
}

.sidebar-footer .avatar {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-footer .user-name { font-size: .85rem; font-weight: 600; line-height: 1.2; }
.sidebar-footer .user-role { font-size: .72rem; color: rgba(255,255,255,.45); }

.main-content {
  margin-left: 260px;
  min-height: 100vh;
  background: var(--light);
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: .85rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar .page-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
  margin: 0;
}

.content-area { padding: 2rem; }

/* ---- STAT CARDS ---- */
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: box-shadow .2s, transform .2s;
}

.stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #eff6ff; color: #2563eb; }
.stat-icon.green  { background: #f0fdf4; color: #16a34a; }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.purple { background: #faf5ff; color: #7c3aed; }

.stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1; margin-bottom: .2rem; }
.stat-label { font-size: .82rem; color: var(--secondary); font-weight: 500; }
.stat-trend { font-size: .78rem; margin-top: .4rem; }
.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ---- CARD ---- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: .95rem;
  border-radius: var(--radius) var(--radius) 0 0 !important;
}

/* ---- VERIFY PAGE ---- */
.verify-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  padding: 2rem;
}

.verify-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 3rem 2.5rem;
  max-width: 480px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.verify-icon {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
  margin: 0 auto 1.5rem;
}

.verify-icon.success { background: #f0fdf4; color: #16a34a; }
.verify-icon.error   { background: #fef2f2; color: #dc2626; }
.verify-icon.pending { background: #fffbeb; color: #d97706; }

/* ---- BADGE ---- */
.badge-role {
  font-size: .72rem;
  padding: .25rem .6rem;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: .03em;
}
.badge-role.admin   { background: #faf5ff; color: #7c3aed; }
.badge-role.manager { background: #eff6ff; color: #2563eb; }
.badge-role.user    { background: #f0fdf4; color: #16a34a; }

/* ---- LINK ---- */
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

.link-muted { color: var(--secondary); font-size: .88rem; }

/* ---- RESPONSIVE ---- */
@media (max-width: 991px) {
  .auth-brand { display: none; }
  .auth-form-panel { max-width: 100%; }
}

@media (max-width: 767px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .content-area { padding: 1rem; }
}

/* ---- ANIMATIONS ---- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: fadeInUp .4s ease both; }

.border-dashed { border: 2px dashed var(--border) !important; }

.btn-xs { padding: .15rem .4rem; font-size: .72rem; border-radius: .25rem; line-height: 1.4; }

.fade-in-up:nth-child(1) { animation-delay: .05s; }
.fade-in-up:nth-child(2) { animation-delay: .10s; }
.fade-in-up:nth-child(3) { animation-delay: .15s; }
.fade-in-up:nth-child(4) { animation-delay: .20s; }
