/* ═══════════════════════════════════════════════
   PALETTE & VARIABLES
═══════════════════════════════════════════════ */
:root {
  --blue-900: #0d2547;
  --blue-800: #1a3c6e;
  --blue-700: #1e4d8c;
  --blue-500: #3b7dd8;
  --blue-300: #7eb2f0;
  --blue-100: #ddeafe;
  --blue-50:  #f0f5ff;
  --surface:  #f4f7fc;
  --white:    #ffffff;
  --text:     #1e2a3a;
  --text-muted: #6b7a91;
  --border:   #d0d9e8;
  --shadow-sm: 0 1px 4px rgba(26,60,110,.08);
  --shadow-md: 0 4px 16px rgba(26,60,110,.12);
  --shadow-lg: 0 8px 32px rgba(26,60,110,.16);
  --radius:   12px;
  --radius-sm: 8px;
  --transition: .18s ease;
}

/* ═══════════════════════════════════════════════
   BASE
═══════════════════════════════════════════════ */
body {
  background: var(--surface);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ═══════════════════════════════════════════════
   HEADER
═══════════════════════════════════════════════ */
.app-header {
  background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 100%);
  box-shadow: 0 2px 16px rgba(13,37,71,.35);
  position: relative;
  overflow: hidden;
}
.app-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 80% 50%, rgba(59,125,216,.25) 0%, transparent 60%),
    radial-gradient(ellipse at 10% 80%, rgba(255,255,255,.05) 0%, transparent 50%);
  pointer-events: none;
}
.app-header img { filter: drop-shadow(0 2px 4px rgba(0,0,0,.3)); }

/* ═══════════════════════════════════════════════
   CARDS — PAGE D'ACCUEIL & ASSEMBLÉE
═══════════════════════════════════════════════ */
.card-link {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  overflow: hidden;
}
.card-link::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue-800), var(--blue-500));
  opacity: 0;
  transition: opacity var(--transition);
}
.card-link { position: relative; }
.card-link:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--blue-300);
  transform: translateY(-3px);
}
.card-link:hover::before { opacity: 1; }
.card-link .card-body { padding: 1.1rem 1.2rem; }

.att-icon, .ass-icon { flex-shrink: 0; }

/* Badge type manifestation */
.badge-type {
  display: inline-block;
  background: var(--blue-100);
  color: var(--blue-800);
  font-size: .7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  margin-bottom: 4px;
}

/* ═══════════════════════════════════════════════
   TOOLBAR INDEX
═══════════════════════════════════════════════ */
.index-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1.25rem;
}
.index-toolbar .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.index-toolbar #searchInput {
  min-width: 180px;
  flex: 1 1 180px;
  border-radius: 20px;
  border-color: var(--border);
  padding-left: 1rem;
  font-size: .85rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.index-toolbar #searchInput:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,125,216,.15);
}

/* ═══════════════════════════════════════════════
   FORM PAGE — HEADER RESPONSIVE
═══════════════════════════════════════════════ */
.form-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 20px;
}
.form-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.form-header-title .fw-bold {
  font-size: clamp(.85rem, 2.5vw, 1rem);
  letter-spacing: .3px;
}
.form-header-title .text-white-50 {
  font-size: clamp(.7rem, 2vw, .82rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════
   FORM FIELDS
═══════════════════════════════════════════════ */
.form-section-label {
  font-weight: 700;
  font-size: .78rem;
  color: var(--blue-800);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.form-section-content { font-size: .82rem; color: var(--text-muted); }
.form-label-sm {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.form-control, .form-select {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,125,216,.15);
}
.form-control[readonly] {
  background: var(--blue-50);
  color: var(--blue-800);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════
   CARACTÉRISTIQUES DU MONTAGE
═══════════════════════════════════════════════ */
.card-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-section-header {
  background: linear-gradient(90deg, var(--blue-800), var(--blue-700));
  color: white;
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .6px;
  padding: 8px 14px;
  text-transform: uppercase;
  border-radius: var(--radius) var(--radius) 0 0;
}

/* Équipements */
.equip-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  margin-bottom: 5px;
  font-size: .82rem;
}
.equip-badge .qty {
  background: var(--blue-800);
  color: white;
  font-size: .7rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 10px;
  white-space: nowrap;
  margin-left: 8px;
}

/* ═══════════════════════════════════════════════
   CHECKLIST
═══════════════════════════════════════════════ */
.checklist-header-banner {
  background: linear-gradient(90deg, #fff3cd, #fff8e1);
  border: 1px solid #ffe082;
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 800;
  color: #b45309;
  font-size: .85rem;
  padding: 8px 14px;
  letter-spacing: .6px;
}

.checklist-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: .75rem;
}
.checklist-section-header {
  background: linear-gradient(90deg, var(--blue-800), var(--blue-700));
  color: white;
  font-weight: 700;
  font-size: .72rem;
  padding: 6px 12px;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.checklist-items { padding: 2px 0; }
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: .82rem;
  line-height: 1.4;
  border-bottom: 1px solid #f0f2f5;
  transition: background var(--transition);
  user-select: none;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover { background: var(--blue-50); }
.checklist-item .form-check-input {
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
  width: 17px;
  height: 17px;
  border: 2px solid var(--blue-300);
  border-radius: 4px;
  transition: background var(--transition), border-color var(--transition);
}
.checklist-item .form-check-input:checked {
  background-color: var(--blue-800);
  border-color: var(--blue-800);
}

/* ═══════════════════════════════════════════════
   CERTIFICATION & SIGNATURE
═══════════════════════════════════════════════ */
.cert-block {
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.signature-pad-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: var(--radius-sm);
  width: 100%;
  overflow: hidden;
  box-shadow: inset 0 1px 4px rgba(0,0,0,.06);
}
.signature-pad-wrapper canvas {
  display: block;
  cursor: crosshair;
  touch-action: none;
  width: 100%;
  height: 80px;
}
#clearSignature {
  font-size: .72rem;
  align-self: flex-end;
  padding: 2px 8px;
  color: var(--text-muted);
}
#clearSignature:hover { color: #c00; }

/* ═══════════════════════════════════════════════
   BOUTONS
═══════════════════════════════════════════════ */
.btn-primary {
  background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: .3px;
  box-shadow: 0 2px 8px rgba(59,125,216,.3);
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}
.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 14px rgba(59,125,216,.4);
  transform: translateY(-1px);
}
.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  border: none;
  color: #1a1a1a;
  font-weight: 700;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(245,158,11,.3);
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}
.btn-warning:hover {
  filter: brightness(1.06);
  box-shadow: 0 4px 14px rgba(245,158,11,.4);
  transform: translateY(-1px);
  color: #1a1a1a;
}
.btn-outline-secondary {
  border-color: var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-outline-secondary:hover {
  background: var(--blue-50);
  border-color: var(--blue-300);
  color: var(--blue-800);
}
.btn-outline-light {
  border-color: rgba(255,255,255,.35);
  color: rgba(255,255,255,.85);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
  transition: all var(--transition);
}
.btn-outline-light:hover {
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.6);
  color: white;
}

/* ═══════════════════════════════════════════════
   ADMIN — CARTES
═══════════════════════════════════════════════ */
.admin-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  overflow: hidden;
}
.admin-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.admin-card .card-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 14px;
}

/* ═══════════════════════════════════════════════
   INFO ASSEMBLÉE (page intermédiaire)
═══════════════════════════════════════════════ */
.ass-info-card {
  background: linear-gradient(135deg, var(--blue-50), var(--white));
  border: 1px solid var(--blue-100);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 1.5rem;
}

/* ═══════════════════════════════════════════════
   DATE BUTTON (admin)
═══════════════════════════════════════════════ */
.date-btn {
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 5px 16px;
  cursor: pointer;
  font-size: .85rem;
  background: white;
  color: var(--text);
  transition: all var(--transition);
  font-weight: 500;
}
.date-btn:hover {
  border-color: var(--blue-500);
  background: var(--blue-50);
  color: var(--blue-800);
}
.date-btn.selected {
  background: linear-gradient(135deg, var(--blue-800), var(--blue-500));
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(59,125,216,.35);
}

/* ═══════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════ */
.toast {
  min-width: 260px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

/* ═══════════════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════════════ */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.att-card, .ass-card, .admin-card {
  animation: fadeInUp .3s ease both;
}
.att-card:nth-child(2)  { animation-delay: .04s; }
.att-card:nth-child(3)  { animation-delay: .08s; }
.att-card:nth-child(4)  { animation-delay: .12s; }
.att-card:nth-child(5)  { animation-delay: .16s; }
.att-card:nth-child(6)  { animation-delay: .20s; }
.ass-card:nth-child(2)  { animation-delay: .04s; }
.ass-card:nth-child(3)  { animation-delay: .08s; }
.ass-card:nth-child(4)  { animation-delay: .12s; }

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 576px) {
  .app-header img { height: 38px; }
  .form-header-inner { padding: 8px 12px; gap: 8px; }
  #btnGeneratePdf { width: 100%; justify-content: center; }
  #btnGeneratePdf svg { display: none; }
  main.container-xl, main.container { padding-left: 12px; padding-right: 12px; }
}
