/* ══════════════════════════════════════════════════════════════════
   common.css — Styles partagés entre les outils Transit
   ══════════════════════════════════════════════════════════════════ */

/* ── Base ──────────────────────────────────────────────────────── */
body {
  font-family: Arial;
  max-width: 1400px;
  margin: 20px auto;
  padding: 0 12px;
}

/* ── Layout principal ──────────────────────────────────────────── */
#main        { display: flex; gap: 10px; }
#left-col    { flex: 2; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
#right-col   { flex: 1; display: flex; flex-direction: column; gap: 10px; min-width: 240px; }

/* ── Barre d'actions ───────────────────────────────────────────── */
.top-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px; align-items: center;
}
.top-actions button {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 6px 10px; border-radius: 4px; border: 1px solid #ccc;
  background: transparent; color: #333; font-size: 14px;
  cursor: pointer; transition: 0.2s;
}
.top-actions button:hover              { background: #f0f0f0; color: #000; }
.top-actions button:disabled           { opacity: 0.4; cursor: not-allowed; }
.top-actions button:disabled:hover     { background: transparent; color: #333; }

/* ── Material Icons ────────────────────────────────────────────── */
.material-icons { font-size: 20px; }

/* ── Carte Leaflet ─────────────────────────────────────────────── */
#map {
  height: 420px; border: 1px solid #ccc; border-radius: 6px;
  position: relative; background: #e8eef3;
}
#map-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: #bbb; font-size: 14px; gap: 8px;
  z-index: 1; pointer-events: none;
}
#map-placeholder .material-icons { font-size: 48px; }

/* ── Tooltip carte ─────────────────────────────────────────────── */
#map-tooltip {
  position: fixed; z-index: 9999; pointer-events: none;
  background: rgba(20,20,28,0.92); color: #f0f0f5;
  border-radius: 8px; padding: 8px 12px;
  font-size: 12px; line-height: 1.6;
  min-width: 150px; max-width: 280px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.08);
  display: none;
}
#map-tooltip .tt-header { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
#map-tooltip .tt-dot    { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
#map-tooltip .tt-title  { font-weight: 700; font-size: 13px; color: #fff; }
#map-tooltip .tt-row    { display: flex; gap: 6px; color: #b0b0c8; margin-top: 1px; }
#map-tooltip .tt-label  { color: #6b6b88; min-width: 52px; }
#map-tooltip .tt-badge  { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 700; color: #fff; margin: 2px 2px 0 0; }

/* ── Zone de dépôt (drop zone) ─────────────────────────────────── */
#drop-zone {
  border: 2px dashed #ccc; border-radius: 6px; padding: 30px 20px;
  text-align: center; cursor: pointer; background: #fafafa;
  transition: 0.2s; color: #666; font-size: 14px;
}
#drop-zone:hover,
#drop-zone.drag  { border-color: #555; background: #f0f0f0; color: #333; }
#drop-zone.loaded { border-color: #4caf50; border-style: solid; background: #f0fff4; }
#drop-zone .dz-icon       { font-size: 36px; color: #bbb; display: block; margin-bottom: 6px; }
#drop-zone.loaded .dz-icon { color: #4caf50; }
#drop-zone h3 { margin: 0 0 2px; font-size: 14px; font-weight: 600; }
#drop-zone p  { margin: 0; font-size: 11px; color: #999; }

/* ── Carte / panneau latéral ───────────────────────────────────── */
.card {
  border: 1px solid #ccc; border-radius: 6px;
  padding: 12px; background: #fff;
}
.card h3 {
  margin: 0 0 10px; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; color: #555;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.card h3 .material-icons { font-size: 16px; }

/* ── Panneau latéral droit ─────────────────────────────────────── */
#sidePanel {
  padding: 10px; background: #f9f9f9; overflow: auto;
  border: 1px solid #ccc; border-radius: 6px;
  display: flex; flex-direction: column; gap: 8px;
}

/* ── Entrée feed (liste des fichiers chargés) ──────────────────── */
.feed-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 6px;
  border: 1px solid #e0e0e0; background: #fff; font-size: 13px;
}
.feed-color-dot { width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(0,0,0,0.15); }
.feed-name      { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-period    { font-size: 11px; color: #888; white-space: nowrap; }
.feed-remove    { cursor: pointer; color: #bbb; font-size: 15px; line-height: 1; border: none; background: none; padding: 0 2px; }
.feed-remove:hover { color: #e53e3e; }

/* ── Titre de section (panneau latéral) ────────────────────────── */
.side-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: #888; margin-bottom: 4px; margin-top: 2px;
}

/* ── Statistiques ──────────────────────────────────────────────── */
.stats-row { display: flex; flex-wrap: wrap; gap: 6px; }
.stat-box {
  flex: 1; min-width: 75px; text-align: center;
  padding: 7px 5px; border: 1px solid #e0e0e0;
  border-radius: 4px; background: #f9f9f9;
}
.stat-val { font-size: 1.2rem; font-weight: 700; color: #333; display: block; }
.stat-lbl { font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Liste de validation ───────────────────────────────────────── */
.v-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.v-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 5px 8px; border-radius: 4px; font-size: 12px; line-height: 1.5;
}
.v-item.v-ok   { background: #f1f8f1; color: #2e7d32; }
.v-item.v-warn { background: #fff8e1; color: #e65100; }
.v-item.v-err  { background: #ffeaea; color: #c62828; }
.v-icon { font-size: 14px; margin-top: 1px; flex-shrink: 0; }

/* ── Légende carte ─────────────────────────────────────────────── */
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #444; padding: 2px 0; }
.legend-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.legend-line { width: 18px; height: 3px; border-radius: 2px; flex-shrink: 0; }

/* ── Slider de date ────────────────────────────────────────────── */
#slider-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #555; flex-wrap: wrap; }
#dateSlider { flex: 1; min-width: 120px; }
#dateLabel  { font-weight: 600; color: #333; min-width: 80px; }

/* ── Table de lignes (polyline viewer) ─────────────────────────── */
.lines-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lines-table th {
  background: #f5f5f5; font-weight: 700; text-transform: uppercase;
  font-size: 11px; letter-spacing: 0.4px; color: #666;
  padding: 6px 8px; border: 1px solid #e0e0e0; text-align: left;
}
.lines-table td { padding: 4px 6px; border: 1px solid #e8e8e8; }
.lines-table td input {
  width: 100%; padding: 4px 6px; border: 1px solid #e0e0e0;
  border-radius: 4px; font-size: 13px; font-family: Arial;
  background: #fafafa; transition: 0.15s;
}
.lines-table td input:focus { outline: none; border-color: #888; background: #fff; }
.lines-table tr:hover td { background: #fafafa; }

/* ── Boutons dans tableau ──────────────────────────────────────── */
.btn-remove {
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer;
  color: #bbb; padding: 4px; border-radius: 4px; transition: 0.15s;
}
.btn-remove:hover { color: #e53e3e; background: #ffeaea; }
.btn-remove .material-icons { font-size: 16px; }

.btn-add {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 4px; border: 1px dashed #ccc;
  background: transparent; color: #888; font-size: 12px; cursor: pointer;
  transition: 0.2s; margin-top: 6px; width: 100%; justify-content: center;
}
.btn-add:hover { border-color: #555; color: #333; background: #f5f5f5; }
.btn-add .material-icons { font-size: 16px; }

/* ── Badge de ligne (NeTEx / GTFS) ────────────────────────────── */
.route-badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 700; color: #fff;
}

/* ── Score badge (GTFS converter) ─────────────────────────────── */
.score-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 700;
}
.score-good   { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.score-medium { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.score-bad    { background: #ffeaea; color: #c62828; border: 1px solid #ef9a9a; }

/* ── Barre de progression ──────────────────────────────────────── */
.progress-wrap { background: #eee; border-radius: 4px; height: 6px; margin: 8px 0; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; width: 0%; }

/* ── Grille de fichiers (GTFS converter) ───────────────────────── */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 6px; }
.file-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 4px; border: 1px solid #e0e0e0;
  background: #fff; font-size: 12px;
}
.file-item.ok    { border-color: #a5d6a7; color: #2e7d32; }
.file-item.warn  { border-color: #ffe082; color: #e65100; }
.file-item.error { border-color: #ef9a9a; color: #c62828; }

/* ── Aperçu XML ────────────────────────────────────────────────── */
.xml-preview {
  background: #f8f8f8; border: 1px solid #e0e0e0; border-radius: 4px;
  padding: 10px; font-family: monospace; font-size: 11px; line-height: 1.6;
  overflow: auto; max-height: 320px; white-space: pre;
}
.xml-preview::-webkit-scrollbar       { width: 5px; height: 5px; }
.xml-preview::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
.xml-tag     { color: #0066bb; }
.xml-attr    { color: #b06000; }
.xml-val     { color: #007055; }
.xml-comment { color: #999; font-style: italic; }

/* ── Modal ─────────────────────────────────────────────────────── */
.gtfs-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 3000; }
.gtfs-modal   { background: #fff; padding: 20px; max-height: 80vh; overflow: auto; border-radius: 6px; width: 720px; border: 1px solid #ccc; }
.gtfs-modal h2 { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.gtfs-modal table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12px; }
.gtfs-modal th,
.gtfs-modal td   { border: 1px solid #e0e0e0; padding: 5px 8px; text-align: left; }
.gtfs-modal th   { background: #f5f5f5; font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: 0.4px; color: #666; }
.gtfs-modal td:nth-child(3),
.gtfs-modal td:nth-child(4) { text-align: center; }
.gtfs-modal button { margin-top: 12px; padding: 6px 14px; cursor: pointer; border-radius: 4px; border: 1px solid #ccc; background: #fff; font-size: 13px; }
.gtfs-modal button:hover { background: #f0f0f0; }

/* ── Visibilité des sections ───────────────────────────────────── */
.section         { display: none; }
.section.visible { display: block; }

/* ── Séparateur ────────────────────────────────────────────────── */
hr { border: none; border-top: 1px solid #e0e0e0; margin: 8px 0; }

/* ── Overlay de chargement ─────────────────────────────────────── */
#loadingOverlay {
  position: fixed; inset: 0; background: rgba(255,255,255,0.75);
  display: none; justify-content: center; align-items: center; z-index: 2000;
}
.spinner {
  border: 6px solid #f3f3f3; border-top: 6px solid #333;
  border-radius: 50%; width: 48px; height: 48px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 800px) { #main { flex-direction: column; } }
