/* ================================================================
   common.css — Styles partagés entre les 3 rôles
   ► --accent est défini dans chaque fichier CSS de rôle
   ================================================================ */

/* === RESET & BASE ============================================= */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Neutres */
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Sémantiques */
  --success:       #16a34a;
  --success-light: #dcfce7;
  --danger:        #dc2626;
  --danger-light:  #fee2e2;
  --warning:       #d97706;
  --warning-light: #fef3c7;
  --info-light:    #ccfbf1;

  /* Géométrie */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;

  /* Ombres */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* === TYPOGRAPHIE ============================================== */
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p  { font-size: 14px; line-height: 1.5; }

/* === LAYOUT =================================================== */
.page          { max-width: 640px; margin: 0 auto; padding: 0 16px 80px; }
.hidden        { display: none !important; }
.mt-8          { margin-top: 8px; }
.mt-16         { margin-top: 16px; }

/* === HEADER =================================================== */
.app-header {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  padding: 20px 16px 18px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-header h1    { font-size: 20px; margin-bottom: 2px; }
.app-header .sub  { font-size: 13px; opacity: .8; }
.header-row       { display: flex; align-items: center; justify-content: space-between; }

/* === BOUTONS ================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: transform .1s, opacity .15s;
  text-decoration: none;
}
.btn:active            { transform: scale(.97); }
.btn:disabled          { opacity: .55; cursor: not-allowed; transform: none; }
.btn .material-icons-round { font-size: 18px; }

.btn-primary {
  width: 100%;
  justify-content: center;
  padding: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-sm);
  font-size: 15px;
}
.btn-ghost {
  background: rgba(255,255,255,.15);
  color: white;
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 8px;
}
.btn-ghost:hover { background: rgba(255,255,255,.25); }

.btn-success { background: var(--success);       color: white; flex: 1; justify-content: center; }
.btn-danger  { background: var(--danger);        color: white; flex: 1; justify-content: center; }
.btn-neutral { background: var(--gray-200);      color: var(--gray-700); flex: 1; justify-content: center; }

/* === FORMULAIRES ============================================== */
.form-group       { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-group label .req { color: var(--danger); margin-left: 2px; }
.form-group label .hint { font-size: 11px; font-weight: 400; color: var(--gray-400); }

.fc {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--gray-50);
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
}
.fc:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
  background: white;
}
textarea.fc   { resize: vertical; min-height: 80px; }
select.fc {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

/* === CARD ===================================================== */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card { margin-top: 12px; }
.card-body    { padding: 16px; }
.card-row     {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-100);
}
.card-row:last-child  { border-bottom: none; }
.card-row .label      { color: var(--gray-500); flex-shrink: 0; }
.card-row .value      { font-weight: 600; text-align: right; }

/* === BADGES =================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-waiting { background: var(--warning-light); color: #92400e; }
.badge-ok      { background: var(--success-light); color: #166534; }
.badge-ko      { background: var(--danger-light);  color: #991b1b; }
.badge-done    { background: var(--info-light);     color: #115e59; }

.badge-urgence-normal   { background: var(--gray-100);    color: var(--gray-700); }
.badge-urgence-urgent   { background: var(--warning-light); color: #92400e; }
.badge-urgence-tres     { background: var(--danger-light);  color: #991b1b; }

/* === MODAL ==================================================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 100;
  animation: fadeIn .2s ease;
}
.modal {
  background: white;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 20px;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp .25s ease;
}
.modal h2         { font-size: 17px; margin-bottom: 16px; }
.modal-actions    { display: flex; gap: 10px; margin-top: 20px; }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(60px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* === TOAST ==================================================== */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px; font-weight: 500;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  max-width: calc(100% - 32px);
  text-align: center;
  animation: toastIn .3s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger);  }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === SPINNER ================================================== */
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .75s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === SECTION VIDE ============================================= */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-400);
}
.empty-state .material-icons-round { font-size: 48px; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* === BANDEAU HORS-LIGNE ======================================= */
.offline-bar {
  background: var(--warning);
  color: white;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  padding: 8px;
}

/* === RESPONSIVE DESKTOP ====================================== */
@media (min-width: 640px) {
  .page          { padding: 0 0 80px; }
  .app-header    { padding: 24px 24px 20px; }
  .app-header h1 { font-size: 22px; }
}
