/* ========================================
   azurgences — Design System CSS (SIZU)
   Sources : azurgences/archive/sizu-rh/static/sizurh.css
   ======================================== */

:root {
  /* ─── Marque SIZU ─── */
  --brand-primary:   #5b4fe8;
  --brand-secondary: #7a6ff0;
  --brand-hover:     #4b3fd6;
  --brand-active:    #3f35b8;
  --brand-accent:    #9d93f5;
  --brand-lavender:  #f2f0fe;
  --brand-dark:      #0e0e12;
  --brand-success:   #5ba87c;
  --brand-red:       #DC2626;
  --brand-red-hover: #B91C1C;
  --white:           #FFFFFF;

  /* ─── Fonds / Neutres ─── */
  --bg-app:        #ffffff;
  --bg-surface:    #ffffff;
  --bg-subtle:     #f8f7ff;
  --bg-dark:       #0e0e12;
  --border-default: #e5e5ec;
  --border-subtle:  #f0eff5;
  --border-input:   #d8d8e0;
  --divider-light:  #f0eff5;
  --text-primary:   #15151b;
  --text-secondary: #4a4a55;
  --text-tertiary:  #8a8a99;
  --text-disabled:  #b4b4bf;

  /* ─── Statuts ─── */
  --status-success-text: #2f7a50;
  --status-success-bg:   #e9f7ef;
  --status-warning-text: #9c6b1b;
  --status-warning-bg:   #fdf6e3;
  --status-error-text:   #b91c1c;
  --status-error-bg:     #fee2e2;
  --status-info-text:    #5b4fe8;
  --status-info-bg:      #f2f0fe;

  /* ─── Layout ─── */
  --sidebar-width:  260px;
  --navbar-height:  64px;
  --gutter:         24px;

  /* ─── Spacing tokens ─── */
  --card-padding:   20px;
  --card-gap:       16px;
  --input-height:   40px;
  --btn-padding:    8px 16px;
  --badge-padding:  4px 12px;

  /* ─── Radius ─── */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-pill: 9999px;

  /* ─── Shadows ─── */
  --shadow-card:  0 1px 2px rgba(21,21,27,0.04), 0 1px 3px rgba(21,21,27,0.02);
  --shadow-modal: 0 24px 48px -12px rgba(14,14,18,0.18), 0 12px 24px -8px rgba(14,14,18,0.10);
  --shadow-toast: 0 8px 16px -4px rgba(14,14,18,0.12), 0 4px 8px -2px rgba(14,14,18,0.06);
  --shadow-elevate: 0 4px 12px rgba(91,79,232,0.10);

  /* ─── Focus & Transitions ─── */
  --focus-ring: rgba(91,79,232,0.22);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-page: 300ms cubic-bezier(0.32, 0.72, 0, 1);
}

/* ─── Reset & Base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Skip to content ─── */
.skip-to-content {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 10000;
  background: var(--brand-primary);
  color: var(--white);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.skip-to-content:focus { left: 8px; outline: 2px solid var(--white); outline-offset: 2px; }

/* ─── Typography ─── */
.h1 { font-size: 28px; font-weight: 800; line-height: 34px; letter-spacing: -0.04em; }
.h2 { font-size: 18px; font-weight: 700; line-height: 26px; letter-spacing: -0.02em; }
.h3 { font-size: 15px; font-weight: 600; line-height: 22px; letter-spacing: -0.01em; }
.body-text { font-size: 14px; font-weight: 400; line-height: 20px; }
.label-text { font-size: 12px; font-weight: 500; line-height: 16px; }
.label-uppercase { font-size: 11px; font-weight: 600; line-height: 16px; letter-spacing: 0.05em; text-transform: uppercase; }
.font-mono { font-family: 'SF Mono', 'Fira Code', monospace; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-error { color: var(--status-error-text); }
.text-brand { color: var(--brand-primary); }

/* ─── Utility spacing / layout ─── */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-gutter { margin-top: var(--gutter); }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.w-full { width: 100%; }
.max-w-sm { max-width: 480px; }
.max-w-xs { max-width: 420px; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gutter-gap { gap: var(--gutter); }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

/* ─── Grid utilities ─── */
.grid { display: grid; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--card-gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--card-gap); }
.grid-cols-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--card-gap); }

.hidden { display: none !important; }

/* ─── Layout ─── */
.app-shell { display: flex; min-height: 100vh; background: var(--bg-app); }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width); height: 100vh; position: fixed; left: 0; top: 0;
  background: var(--bg-surface);
  display: flex; flex-direction: column; padding: 16px 0; z-index: 100;
  overflow-y: auto; overflow-x: hidden;
}
.sidebar-nav { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px; margin-bottom: 24px;
  text-decoration: none;
}
.sidebar-brand-star { color: var(--brand-primary); font-size: 24px; line-height: 1; font-weight: 700; }
.sidebar-brand-name {
  font-size: 22px; font-weight: 800; letter-spacing: -0.05em;
  color: var(--text-primary);
}
.sidebar-brand-suffix {
  display: inline-flex; align-items: center; margin-left: 6px;
  padding: 2px 8px; border-radius: var(--radius-pill);
  background: var(--brand-lavender); color: var(--brand-primary);
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
}

.sidebar-section-title {
  padding: 8px 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-secondary);
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px; font-size: 14px; font-weight: 500; color: var(--text-tertiary);
  text-decoration: none; transition: var(--transition-fast);
  min-height: 44px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-right: 16px;
}
.nav-item:hover { background: var(--bg-subtle); color: var(--text-primary); }
.nav-item.active { background: var(--bg-subtle); color: var(--brand-primary); font-weight: 600; }
.nav-item .icon { width: 20px; height: 20px; flex-shrink: 0; }

.main-area { flex: 1; margin-left: var(--sidebar-width); display: flex; flex-direction: column; min-height: 100vh; }

/* Navbar */
.navbar {
  height: var(--navbar-height); background: var(--bg-surface);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gutter); position: sticky; top: 0; z-index: 50;
}
.navbar-title { font-size: 18px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.02em; }
.navbar-user { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary); }

.page-content {
  flex: 1; padding: var(--gutter); overflow-y: auto;
}

/* App Footer */
.app-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px var(--gutter); background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}
.app-footer-brand { display: flex; align-items: center; gap: 8px; }
.app-footer-star { color: var(--brand-primary); font-size: 20px; line-height: 1; font-weight: 700; }
.app-footer-name { font-size: 18px; font-weight: 800; letter-spacing: -0.05em; color: var(--text-primary); }
.app-footer-baseline { font-size: 13px; font-weight: 700; color: var(--brand-primary); }
.app-footer-tagline { font-size: 12px; color: var(--text-tertiary); font-style: italic; }

/* ─── Cards ─── */
.card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-elevate); border-color: var(--border-default); }
.card-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 20px 0; }
.card-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.card-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.card-actions { display: flex; gap: 8px; }
.card-body { padding: var(--card-padding); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: var(--btn-padding); border-radius: var(--radius-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 500; line-height: 20px;
  cursor: pointer; transition: var(--transition-fast);
  text-decoration: none; min-height: 44px; min-width: 44px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--brand-primary); color: var(--white); border-color: var(--brand-primary); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:active:not(:disabled) { background: var(--brand-active); }
.btn-secondary { background: var(--bg-surface); color: var(--text-tertiary); border-color: var(--border-subtle); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-subtle); }
.btn-ghost { background: transparent; color: var(--text-tertiary); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--bg-subtle); }
.btn-danger { background: var(--brand-red); color: var(--white); border-color: var(--brand-red); }
.btn-danger:hover:not(:disabled) { background: var(--brand-red-hover); }
.btn-sm { padding: 4px 12px; font-size: 13px; min-height: 36px; min-width: 36px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }

/* ─── Inputs ─── */
.input, .select, .textarea {
  height: var(--input-height); padding: 8px 12px; border: 1px solid var(--border-input);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text-primary);
  background: var(--bg-surface); width: 100%; transition: var(--transition-fast);
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand-secondary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.textarea { height: auto; min-height: 80px; resize: vertical; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.form-error { display: block; font-size: 12px; color: var(--status-error-text); margin-top: 4px; }

/* ─── Badges ─── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: var(--badge-padding); border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500; line-height: 16px;
}
.badge-success { background: var(--status-success-bg); color: var(--status-success-text); }
.badge-warning { background: var(--status-warning-bg); color: var(--status-warning-text); }
.badge-error { background: var(--status-error-bg); color: var(--status-error-text); }
.badge-info { background: var(--status-info-bg); color: var(--status-info-text); }
.badge-neutral { background: var(--bg-subtle); color: var(--text-tertiary); }

/* ─── Tables ─── */
.table-wrapper { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap; vertical-align: middle;
}
.table td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.table tbody tr:hover { background: var(--bg-subtle); }

/* Status indicators */
.status { display: inline-flex; padding: 2px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 500; }
.status-pending { background: var(--status-warning-bg); color: var(--status-warning-text); }
.status-processing { background: var(--status-info-bg); color: var(--status-info-text); }
.status-ready { background: var(--status-success-bg); color: var(--status-success-text); }
.status-failed, .status-unknown { background: var(--status-error-bg); color: var(--status-error-text); }
.muted, .empty { color: var(--text-disabled); }

/* ─── Alert messages ─── */
.alert { padding: 12px 16px; border-radius: var(--radius-md); font-size: 14px; margin-bottom: 16px; }
.alert-danger { background: var(--status-error-bg); color: var(--status-error-text); }
.alert-info { background: var(--status-info-bg); color: var(--status-info-text); }
.alert-warning { background: var(--status-warning-bg); color: var(--status-warning-text); }
.alert-success { background: var(--status-success-bg); color: var(--status-success-text); }

/* ─── Spinner ─── */
.spinner { width: 24px; height: 24px; border: 3px solid var(--border-default); border-top-color: var(--brand-primary); border-radius: 50%; animation: spin 0.6s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toasts ─── */
.toast-container { position: fixed; bottom: 16px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-toast); min-width: 280px;
  font-size: 14px;
}
.toast-success { background: var(--status-success-bg); color: var(--status-success-text); }
.toast-error { background: var(--status-error-bg); color: var(--status-error-text); }
.toast-warning { background: var(--status-warning-bg); color: var(--status-warning-text); }
.toast-info { background: var(--status-info-bg); color: var(--status-info-text); }

/* ─── Camera UI (SODIA Capture Photo) ─── */
.camera-container {
  position: relative;
  width: 100%; max-width: 640px;
  background: #000; border-radius: var(--radius-md);
  overflow: hidden; margin-bottom: 1rem;
}
.camera-container video, .camera-container canvas {
  display: block; width: 100%;
}
.camera-overlay {
  position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%);
  display: flex; gap: 0.75rem;
}
.camera-guide {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  border: 3px dashed rgba(255,255,255,0.4);
  border-radius: var(--radius-md);
  pointer-events: none;
}
.camera-guide::before {
  content: ''; position: absolute;
  top: 10%; left: 10%; right: 10%; bottom: 10%;
  border: 2px solid rgba(91,79,232,0.5);
  border-radius: 4px;
}

/* Preview */
.preview-container { max-width: 640px; }
.preview-container img { width: 100%; border-radius: var(--radius-md); border: 1px solid var(--border-default); }
.ocr-fields { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }

/* ─── Empty state ─── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; text-align: center; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.empty-state-text { font-size: 14px; color: var(--text-secondary); }

/* ─── Responsive mobile ─── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); border: none; z-index: 250; }
  .sidebar.sidebar-open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .page-content { padding: 16px; }
  .navbar { padding: 0 16px; }
}

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

/* ─── Print ─── */
@media print {
  .sidebar, .navbar, .toast-container { display: none !important; }
  .main-area { margin-left: 0 !important; }
}