/* ── Base ────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #F0F4FA;
  color: #1A1A1A;
  min-height: 100vh;
  font-size: 16px;
}

button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* ── Écran de connexion ─────────────────────────────────────── */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-box {
  background: white;
  border-radius: 16px;
  padding: 48px 32px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  max-width: 380px;
  width: 100%;
}

.login-box h1 { font-size: 28px; color: #0B3D91; margin-bottom: 12px; }
.login-box p  { color: #666; margin-bottom: 28px; font-size: 15px; }

/* ── Conteneur principal ────────────────────────────────────── */
.app-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 0 40px 0;
}

/* ── En-tête ────────────────────────────────────────────────── */
.app-header {
  background: #0B3D91;
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.app-header h1 { font-size: 20px; }

.btn-logout {
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* ── Bandeau hors-ligne ──────────────────────────────────────── */
.offline-bar {
  background: #F0C040;
  color: #5a3e00;
  text-align: center;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
}

/* ── Onglets ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  overflow-x: auto;
  background: white;
  border-bottom: 1px solid #E0E6EF;
  position: sticky;
  top: 56px;
  z-index: 9;
}
.tab {
  flex: 1 0 auto;
  min-width: 90px;
  background: none;
  border: none;
  padding: 12px 10px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tab.active { color: #0B3D91; border-bottom-color: #0B3D91; font-weight: 600; }

/* ── Contenu des onglets ─────────────────────────────────────── */
.tab-content { padding: 16px; }

.section-title { margin: 20px 0 10px; font-size: 17px; color: #0B3D91; }

/* ── Cartes / formulaires ────────────────────────────────────── */
.card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card h2 { font-size: 19px; margin-bottom: 8px; color: #0B3D91; }
.card h3 { font-size: 16px; margin-bottom: 10px; color: #333; }

.croisiere-card .form-row { margin-top: 8px; }

.form-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.form-row input,
.form-row select,
.form-row textarea {
  flex: 1 1 140px;
  padding: 10px 12px;
  border: 1px solid #D5DCE8;
  border-radius: 8px;
  min-width: 0;
}
.form-row textarea { width: 100%; resize: vertical; }

.field-label {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  color: #666;
  gap: 4px;
  flex: 1 1 140px;
}
.field-label input, .field-label textarea { width: 100%; }
.field-label-block { width: 100%; margin-top: 8px; }

/* ── Boutons ─────────────────────────────────────────────────── */
.btn-primary {
  background: #0B3D91;
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}
.btn-primary:hover { background: #08296b; }

.btn-secondary {
  background: white;
  color: #0B3D91;
  border: 2px solid #0B3D91;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.btn-add {
  background: #0B3D91;
  color: white;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  font-size: 24px;
  cursor: pointer;
  flex: 0 0 auto;
}

.btn-back {
  background: none;
  border: none;
  color: #0B3D91;
  font-size: 15px;
  font-weight: 600;
  padding: 8px 0;
  margin-bottom: 8px;
  cursor: pointer;
}

.btn-icon-danger {
  background: none;
  border: none;
  color: #C0392B;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  margin-left: auto;
}

.btn-maps {
  background: #EAF0FB;
  color: #0B3D91;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-maps:hover { background: #D5E1F7; }

/* ── Escales ─────────────────────────────────────────────────── */
.escale-list, .adresse-list, .checklist-list, .budget-list, .reservation-list, .carnet-list, .activite-list {
  list-style: none;
  margin-bottom: 14px;
}

.escale-item {
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.escale-item:active { background: #F5F8FD; }
.escale-item-main { font-size: 16px; padding-right: 30px; }
.escale-item-meta { font-size: 13px; color: #666; }
.escale-item .btn-icon-danger { position: absolute; top: 10px; right: 10px; margin-left: 0; }

.escale-today { border-left: 5px solid #2E9E5B; }
.escale-next  { border-left: 5px solid #E0A030; }

.escale-badge {
  display: inline-block;
  background: #2E9E5B;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  margin-right: 8px;
  vertical-align: middle;
}
.escale-badge-next { background: #E0A030; }

.empty-msg { color: #888; font-size: 14px; padding: 12px 4px; font-style: italic; }

/* ── Adresses (fiche escale) ─────────────────────────────────── */
.adresse-item {
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.adresse-item-main { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.adresse-item-addr, .adresse-item-notes { font-size: 13px; color: #666; margin-top: 4px; }
.adresse-item-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.adresse-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  color: white;
  background: #888;
}
.adresse-badge-restaurant { background: #C0392B; }
.adresse-badge-taxi       { background: #E0A030; }
.adresse-badge-visite     { background: #2E9E5B; }
.adresse-badge-autre      { background: #7A7A7A; }

/* ── Checklist ───────────────────────────────────────────────── */
.checklist-item {
  background: white;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.checklist-label { display: flex; align-items: center; gap: 10px; flex: 1; font-size: 16px; }
.checklist-label input[type="checkbox"] { width: 22px; height: 22px; }
.checklist-done span { text-decoration: line-through; color: #999; }

/* ── Budget ──────────────────────────────────────────────────── */
.budget-total-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0B3D91;
  color: white;
}
.budget-total-label { font-size: 14px; opacity: 0.85; }
.budget-total-value { font-size: 22px; font-weight: 700; }

.budget-item, .reservation-item {
  background: white;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.budget-item-main, .reservation-item-main { display: flex; align-items: center; gap: 6px; font-size: 15px; }
.budget-item-meta, .reservation-item-meta { font-size: 13px; color: #666; margin-top: 4px; }

/* ── Carnet de voyage ────────────────────────────────────────── */
.carnet-item {
  background: white;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.carnet-item-header { display: flex; justify-content: space-between; align-items: center; }
.carnet-item-text { font-size: 14px; color: #333; margin-top: 6px; white-space: pre-wrap; }

/* ── Activités planifiées ────────────────────────────────────── */
.activite-escale-tag { font-size: 13px; font-weight: 400; color: #0B3D91; }

.activite-day-picker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.day-pill {
  background: white;
  border: 1px solid #D5DCE8;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
}
.day-pill.active { background: #0B3D91; color: white; border-color: #0B3D91; font-weight: 600; }
.day-pill-picker {
  border: 1px solid #D5DCE8;
  border-radius: 20px;
  padding: 5px 10px;
  font-size: 14px;
  color: #333;
}

.activite-item {
  background: white;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.activite-item-main { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.activite-item-heure {
  background: #0B3D91;
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}
.activite-item-meta, .activite-item-notes { font-size: 13px; color: #666; margin-top: 4px; }

.btn-expand {
  background: none;
  border: none;
  font-size: 14px;
  color: #0B3D91;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
}

.sous-activite-block {
  margin-top: 10px;
  margin-left: 20px;
  padding-left: 12px;
  border-left: 2px solid #EAF0FB;
}
.sous-activite-list { list-style: none; }
.sous-activite-item { padding: 8px 0; border-bottom: 1px solid #F0F2F6; }
.sous-activite-item:last-child { border-bottom: none; }
.sous-activite-item-main { display: flex; align-items: center; gap: 8px; font-size: 14px; }

.btn-add-sub {
  background: none;
  border: 1px dashed #0B3D91;
  color: #0B3D91;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
}

.btn-cancel-inline {
  background: none;
  border: none;
  color: #666;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 4px;
  width: auto;
}

/* ── Toast de synchronisation ────────────────────────────────── */
.alert-toast-container {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
}
.alert-toast {
  background: #2E9E5B;
  color: white;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  cursor: pointer;
}

/* ── Modale de conflit ───────────────────────────────────────── */
.conflict-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.conflict-modal {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 420px;
  width: 100%;
}
.conflict-title { font-size: 18px; margin-bottom: 10px; }
.conflict-desc { font-size: 14px; color: #444; margin-bottom: 16px; }
.conflict-counts { display: flex; gap: 10px; margin-bottom: 16px; }
.conflict-card {
  flex: 1;
  background: #F0F4FA;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.conflict-label { display: block; font-size: 12px; color: #666; margin-bottom: 4px; }
.conflict-num { font-size: 16px; font-weight: 700; }
.conflict-actions { display: flex; flex-direction: column; gap: 8px; }
.btn-conflict {
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-conflict-local  { background: #EAF0FB; color: #0B3D91; }
.btn-conflict-merge  { background: #0B3D91; color: white; }
.btn-conflict-remote { background: #EAF0FB; color: #0B3D91; }
.btn-conflict-clear  { background: #FBEAEA; color: #C0392B; }

/* ── Impression (à ajuster si besoin) ──────────────────────────── */
@media print {
  .app-header, .tabs, .btn-primary, .btn-secondary, .btn-add, .btn-icon-danger { display: none; }
}
