/* ===== TsaraKonta SaaS – Design System ===== */
:root {
  --sidebar-width: 260px;
  --topbar-height: 56px;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-hover: rgba(255,255,255,0.08);
  --sidebar-active: rgba(37,99,235,0.25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #f8fafc;
  color: #1e293b;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.brand-icon { font-size: 1.6rem; }
.brand-name {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.sidebar-company {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-company .fw-semibold { color: #e2e8f0; font-size: 0.9rem; }
.badge-devise {
  display: inline-block;
  background: rgba(37,99,235,0.3);
  color: #93c5fd;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 10px;
}
.nav-section {
  color: #475569;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 16px 8px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}
.nav-item.active {
  background: var(--sidebar-active);
  color: #93c5fd;
  font-weight: 600;
}
.nav-item i { font-size: 1rem; width: 18px; text-align: center; }

.sidebar-footer {
  padding: 14px 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cbd5e1;
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.user-info i { font-size: 1.5rem; color: #64748b; }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.page-content {
  flex: 1;
  padding: 24px;
}

.page-header {
  margin-bottom: 24px;
}

/* ===== AUTH ===== */
.auth-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

/* ===== KPI Cards ===== */
.kpi-card {
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.kpi-blue { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.kpi-green { background: linear-gradient(135deg, #dcfce7, #bbf7d0); }
.kpi-orange { background: linear-gradient(135deg, #fef3c7, #fde68a); }

.kpi-icon { font-size: 2rem; opacity: 0.7; }
.kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.kpi-label { font-size: 0.8rem; color: #64748b; margin-top: 4px; }

/* ===== États cards ===== */
.etat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  text-decoration: none;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: all 0.2s;
  border: 2px solid transparent;
}
.etat-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(37,99,235,0.15);
  transform: translateY(-2px);
  color: var(--primary);
}

/* ===== Tables ===== */
.table th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table td { font-size: 0.875rem; vertical-align: middle; }

/* ===== Card ===== */
.card { border-radius: 12px; }
.card-header { border-radius: 12px 12px 0 0 !important; padding: 14px 18px; font-size: 0.9rem; }

/* ===== Buttons ===== */
.btn { border-radius: 8px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* ===== OCR Drop Zone ===== */
.ocr-drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #f8fafc;
}
.ocr-drop-zone:hover,
.ocr-drop-zone.ocr-drag-over {
  border-color: var(--primary);
  background: #eff6ff;
}
.ocr-drop-zone.ocr-drag-over {
  transform: scale(1.01);
}

/* ===== Print ===== */
@media print {
  .sidebar, .topbar, button, .btn, .page-header .d-flex .btn { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .auth-card { padding: 28px 20px; }
}
