/*
 * SOREL SAV — Feuille de style principale
 * Design : Professionnel, sobre, atelier SAV
 * Stack  : Bootstrap 5 + CSS3 custom
 */

/* ─── Variables ─────────────────────────────────────────────────────────── */
:root {
  --sorel-primary:    #1a2e4a;   /* Bleu marine professionnel */
  --sorel-secondary:  #2c4a6e;
  --sorel-accent:     #f0a500;   /* Or industriel */
  --sorel-accent2:    #e85d04;
  --sorel-bg:         #f4f6f9;
  --sorel-card:       #ffffff;
  --sorel-border:     #dee2e6;
  --sorel-text:       #212529;
  --sorel-muted:      #6c757d;
  --sorel-sidebar-w:  260px;
  --sorel-header-h:   60px;
  --radius:           8px;
  --shadow-sm:        0 1px 4px rgba(0,0,0,.08);
  --shadow:           0 2px 12px rgba(0,0,0,.1);
  --shadow-lg:        0 4px 24px rgba(0,0,0,.14);
  --transition:       0.2s ease;
}

/* ─── Reset / Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 0.875rem;
  background: var(--sorel-bg);
  color: var(--sorel-text);
  margin: 0;
  overflow-x: hidden;
}

/* ─── Layout Principal ──────────────────────────────────────────────────── */
.sorel-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
.sorel-sidebar {
  width: var(--sorel-sidebar-w);
  background: var(--sorel-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.sidebar-brand .brand-logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .5rem;
  letter-spacing: .5px;
}

.sidebar-brand .brand-logo .accent { color: var(--sorel-accent); }

.sidebar-brand .brand-subtitle {
  font-size: 0.7rem;
  color: rgba(255,255,255,.45);
  margin-top: .15rem;
  letter-spacing: .8px;
  text-transform: uppercase;
}

/* Menu nav */
.sidebar-nav { flex: 1; padding: .75rem 0; }

.nav-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.3);
  padding: 1rem 1.25rem .4rem;
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem 1.25rem;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  transition: all var(--transition);
  font-size: .82rem;
  border-left: 3px solid transparent;
  position: relative;
}

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

.sidebar-link .bi { font-size: 1rem; flex-shrink: 0; }

.sidebar-link .badge-count {
  margin-left: auto;
  background: var(--sorel-accent);
  color: #fff;
  font-size: .65rem;
  padding: .15rem .45rem;
  border-radius: 20px;
  font-weight: 700;
}

/* Footer sidebar */
.sidebar-footer {
  padding: .75rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .7rem;
  color: rgba(255,255,255,.25);
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer .powered {
  font-weight: 600;
  color: rgba(255,255,255,.35);
}

/* ─── Contenu principal ─────────────────────────────────────────────────── */
.sorel-main {
  margin-left: var(--sorel-sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Topbar ────────────────────────────────────────────────────────────── */
.sorel-topbar {
  height: var(--sorel-header-h);
  background: #fff;
  border-bottom: 1px solid var(--sorel-border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: var(--shadow-sm);
}

.topbar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--sorel-primary);
  cursor: pointer;
}

.topbar-breadcrumb {
  flex: 1;
  font-size: .82rem;
  color: var(--sorel-muted);
}

.topbar-breadcrumb .current {
  color: var(--sorel-text);
  font-weight: 600;
}

.topbar-actions { display: flex; align-items: center; gap: .75rem; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  color: var(--sorel-text);
}

.topbar-user .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sorel-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ─── Page Content ──────────────────────────────────────────────────────── */
.sorel-content {
  flex: 1;
  padding: 1.5rem;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--sorel-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.page-title .bi { color: var(--sorel-accent); }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.sorel-card {
  background: var(--sorel-card);
  border-radius: var(--radius);
  border: 1px solid var(--sorel-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.sorel-card .card-header {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--sorel-border);
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.sorel-card .card-header .card-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--sorel-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.sorel-card .card-body { padding: 1.25rem; }

/* ─── Stat Cards Dashboard ──────────────────────────────────────────────── */
.stat-card {
  background: var(--sorel-card);
  border-radius: var(--radius);
  border: 1px solid var(--sorel-border);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
  color: inherit;
}

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

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-icon.blue   { background: rgba(13,110,253,.1);   color: #0d6efd; }
.stat-icon.green  { background: rgba(25,135,84,.1);    color: #198754; }
.stat-icon.orange { background: rgba(253,126,20,.1);   color: #fd7e14; }
.stat-icon.red    { background: rgba(220,53,69,.1);    color: #dc3545; }
.stat-icon.purple { background: rgba(111,66,193,.1);   color: #6f42c1; }
.stat-icon.teal   { background: rgba(13,202,240,.1);   color: #0dcaf0; }
.stat-icon.gold   { background: rgba(240,165,0,.1);    color: var(--sorel-accent); }
.stat-icon.gray   { background: rgba(108,117,125,.1);  color: #6c757d; }

.stat-info .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--sorel-primary);
}

.stat-info .stat-label {
  font-size: .75rem;
  color: var(--sorel-muted);
  margin-top: .2rem;
}

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.sorel-table {
  width: 100%;
  border-collapse: collapse;
}

.sorel-table thead th {
  background: #f8f9fa;
  border-bottom: 2px solid var(--sorel-border);
  padding: .65rem 1rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--sorel-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}

.sorel-table tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid #f1f3f4;
  vertical-align: middle;
  font-size: .84rem;
}

.sorel-table tbody tr:hover { background: #f8f9fa; }
.sorel-table tbody tr:last-child td { border-bottom: none; }

/* ─── Formulaires ───────────────────────────────────────────────────────── */
.form-label {
  font-weight: 600;
  font-size: .82rem;
  margin-bottom: .35rem;
  color: var(--sorel-text);
}

.form-control, .form-select, .form-control:focus, .form-select:focus {
  font-size: .84rem;
  border-color: #ced4da;
  border-radius: 6px;
}

.form-control:focus, .form-select:focus {
  border-color: var(--sorel-secondary);
  box-shadow: 0 0 0 .2rem rgba(44,74,110,.15);
}

.form-section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--sorel-muted);
  border-bottom: 2px solid var(--sorel-border);
  padding-bottom: .4rem;
  margin: 1.5rem 0 1rem;
}

/* ─── Boutons ───────────────────────────────────────────────────────────── */
.btn-sorel-primary {
  background: var(--sorel-primary);
  color: #fff;
  border: none;
}
.btn-sorel-primary:hover {
  background: var(--sorel-secondary);
  color: #fff;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: .9rem;
}

/* ─── Priorité & Statuts ────────────────────────────────────────────────── */
.priority-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: .35rem;
  vertical-align: middle;
}
.priority-dot.basse   { background: #6c757d; }
.priority-dot.normale { background: #0d6efd; }
.priority-dot.haute   { background: #ffc107; }
.priority-dot.urgente { background: #dc3545; }

/* ─── Ticket Row retard ─────────────────────────────────────────────────── */
.row-overdue { background: rgba(220,53,69,.04) !important; }
.row-overdue td { border-left: 3px solid #dc3545; }

/* ─── Timeline interventions ────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: .45rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--sorel-border);
}
.timeline-item { position: relative; margin-bottom: 1.25rem; }
.timeline-dot {
  position: absolute;
  left: -1.5rem;
  top: .15rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--sorel-primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--sorel-border);
}
.timeline-item .tl-date {
  font-size: .72rem;
  color: var(--sorel-muted);
  margin-bottom: .2rem;
}
.timeline-item .tl-content {
  background: #f8f9fa;
  border-radius: 6px;
  padding: .65rem .9rem;
  border: 1px solid var(--sorel-border);
  font-size: .83rem;
}

/* ─── Photo grid ────────────────────────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .75rem;
}
.photo-thumb {
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--sorel-border);
  position: relative;
  cursor: pointer;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-thumb:hover .photo-overlay { opacity: 1; }
.photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .2s;
  color: #fff;
  font-size: 1.3rem;
}

/* ─── Upload zone ───────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--sorel-border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  color: var(--sorel-muted);
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--sorel-secondary);
  background: rgba(44,74,110,.04);
}

/* ─── Search bar ────────────────────────────────────────────────────────── */
.search-bar {
  position: relative;
}
.search-bar input {
  padding-left: 2.25rem;
}
.search-bar .bi {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sorel-muted);
  pointer-events: none;
}

/* ─── Login page ────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--sorel-primary) 0%, var(--sorel-secondary) 60%, #1a4a8a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo .app-name {
  font-size: 2rem;
  font-weight: 800;
  color: var(--sorel-primary);
  letter-spacing: -1px;
}

.login-logo .app-name .accent { color: var(--sorel-accent); }

.login-logo .app-tagline {
  font-size: .8rem;
  color: var(--sorel-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

/* Partners band */
.partners-band {
  display: flex;
  gap: .5rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1.25rem 0 0;
}

.partner-chip {
  background: #f8f9fa;
  border: 1px solid var(--sorel-border);
  border-radius: 4px;
  padding: .2rem .55rem;
  font-size: .65rem;
  font-weight: 700;
  color: var(--sorel-muted);
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* ─── Pagination ────────────────────────────────────────────────────────── */
.sorel-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.25rem;
  border-top: 1px solid var(--sorel-border);
  background: #fafafa;
  font-size: .8rem;
  color: var(--sorel-muted);
  gap: 1rem;
  flex-wrap: wrap;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sorel-sidebar {
    transform: translateX(-100%);
  }
  .sorel-sidebar.open {
    transform: translateX(0);
  }
  .sorel-main {
    margin-left: 0;
  }
  .topbar-toggle {
    display: block;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1039;
  }
  .sidebar-overlay.open { display: block; }
}

/* ─── Print / PDF ───────────────────────────────────────────────────────── */
@media print {
  .sorel-sidebar,
  .sorel-topbar,
  .no-print,
  .btn,
  button { display: none !important; }

  .sorel-main { margin-left: 0 !important; }
  .sorel-content { padding: 0 !important; }

  body { background: white; font-size: 11pt; }

  .pdf-document {
    max-width: 100%;
    margin: 0;
    padding: 0;
  }
}

/* ─── Utilitaires ───────────────────────────────────────────────────────── */
.text-sorel { color: var(--sorel-primary) !important; }
.bg-sorel   { background: var(--sorel-primary) !important; color: #fff; }
.border-sorel { border-color: var(--sorel-primary) !important; }

.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

.fs-11 { font-size: .7rem; }
.fs-12 { font-size: .75rem; }
.fs-13 { font-size: .81rem; }

.cursor-pointer { cursor: pointer; }

.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }

/* Scrollbar fine */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f1f3f4; }
::-webkit-scrollbar-thumb { background: #bdc1c6; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #9aa0a6; }
