* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: sans-serif; }
#map {
  position: absolute;
  top: 0; bottom: 0;
  left: 280px; right: 0;
  transition: left .2s ease, right .2s ease;
}

/* ── Panneau latéral ── */
#panel {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 280px;
  background: #1e1e2e;
  color: #cdd6f4;
  z-index: 10;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 12px rgba(0,0,0,0.4);
  transition: transform .2s ease;
}
#panel.hidden { transform: translateX(-280px); }
#panel.hidden ~ #map { left: 0; }

#panel-header {
  padding: 14px 16px;
  background: #181825;
  border-bottom: 1px solid #313244;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#panel-header h2 { font-size: 15px; color: #cba6f7; }
#clear-btn {
  background: #45475a;
  border: none;
  color: #cdd6f4;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  transition: background .15s;
}
#clear-btn:hover  { background: #f38ba8; color: #1e1e2e; }
#clear-btn:disabled { opacity: .35; cursor: default; }
#clear-btn:disabled:hover { background: #45475a; color: #cdd6f4; }

.header-actions { display: flex; align-items: center; gap: 8px; }

/* ── Filtres ── */
#filters { padding: 12px 16px; border-bottom: 1px solid #313244; }
.filter-label { font-size: 10px; color: #6c7086; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px; }
select, input[type=date] {
  width: 100%;
  background: #313244;
  border: 1px solid #45475a;
  color: #cdd6f4;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  margin-bottom: 10px;
  cursor: pointer;
}
select:focus { outline: none; border-color: #cba6f7; }
select:last-of-type { margin-bottom: 0; }

/* ── Liste ── */
#image-list { flex: 1; overflow-y: auto; padding: 8px 12px 12px; }
#image-list::-webkit-scrollbar { width: 4px; }
#image-list::-webkit-scrollbar-thumb { background: #45475a; border-radius: 4px; }

.section-header {
  font-size: 10px;
  color: #6c7086;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 12px 4px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-header.active { color: #a6e3a1; }
.section-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #313244;
}

/* ── Cartes image ── */
.img-card {
  background: #313244;
  border: 1px solid #45475a;
  border-radius: 8px;
  padding: 9px 11px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.img-card:hover  { border-color: #cba6f7; background: #3b3d52; }
.img-card.active { border-color: #a6e3a1; background: #2c3338; }
.img-card.active:hover { border-color: #f38ba8; background: #3b2c33; }

.img-card .top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.img-card .name { font-size: 13px; font-weight: 600; color: #cdd6f4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.img-card .meta { font-size: 11px; color: #6c7086; margin-top: 3px; }
.img-card .origine { display: inline-block; margin-top: 4px; font-size: 9px; padding: 2px 6px; border-radius: 9px; font-weight: 700; letter-spacing: .03em; }
.img-card .close { color: #f38ba8; font-size: 13px; font-weight: bold; }

/* ── Tags satellite ── */
.tag-s1 { background:#1e3a5f; color:#74c0fc; }
.tag-s2 { background:#1e4d2e; color:#69db7c; }
.tag-aq { background:#4d2a1e; color:#ffa94d; }
.tag-te { background:#3d1e4d; color:#da77f2; }
.tag-s3 { background:#4d3d1e; color:#ffd43b; }
.tag-am { background:#1e3d4d; color:#66d9e8; }

/* ── Opacité ── */
.opacity-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.opacity-row span { font-size: 10px; color: #6c7086; min-width: 30px; }
.opacity-row input[type=range] {
  flex: 1;
  accent-color: #a6e3a1;
  cursor: pointer;
}
.opacity-row .val { color: #a6e3a1; font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }

/* ── Drag & drop ── */
.drag-handle { color:#45475a; font-size:14px; cursor:grab; padding:0 4px; user-select:none; flex-shrink:0; }
.drag-handle:active { cursor:grabbing; }
.img-card.dragging { opacity:0.35; border-style:dashed; }
.img-card.drag-over { border-color:#f9e2af !important; background:#3d3520 !important; }

.empty { text-align:center; color:#6c7086; font-size:13px; padding:30px 8px; }
.section-empty { font-size:11px; color:#585b70; font-style:italic; padding:4px 6px 8px; }

#toggle-panel-btn {
  background: #45475a;
  border: none;
  color: #cdd6f4;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  transition: background .15s;
}
#toggle-panel-btn:hover { background: #cba6f7; color: #1e1e2e; }

#reopen-panel-btn {
  position: absolute;
  top: 14px; left: 14px;
  z-index: 10;
  background: #1e1e2e;
  border: 1px solid #45475a;
  color: #cdd6f4;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 2px 0 12px rgba(0,0,0,0.4);
  transition: background .15s;
}
#reopen-panel-btn:hover { background: #313244; border-color: #cba6f7; }

/* ── Bandeau bas (coordonnées curseur + infos navire) ── */
#bottom-bar {
  position: absolute;
  bottom: 14px; left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: stretch;
  gap: 8px;
  pointer-events: none;
}
#coord-box {
  background: #1e1e2e;
  border: 1px solid #45475a;
  color: #cdd6f4;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 2px 0 12px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
}

/* ── Bloc navigation GPS (position/route/vitesse du porteur) ── */
#gps-nav-box {
  background: #1e1e2e;
  border: 1px solid #45475a;
  color: #cdd6f4;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 2px 0 12px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  gap: 14px;
}
.nav-row { display: flex; align-items: baseline; gap: 5px; }
.nav-label { color: #6c7086; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; align-self: center; }
.nav-row span:last-child { color: #f38ba8; font-weight: 600; }

/* ── Marqueur GPS (navire, style AIS) ── */
.gps-marker {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gps-marker-boat {
  display: block;
  transform-origin: 50% 55%;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.7));
}
.gps-marker-boat path {
  fill: #e30613;
  stroke: #7a0000;
  stroke-width: 1.2;
  stroke-linejoin: round;
}

/* ── Panneau routes (droite, caché par défaut) ── */
#routes-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 280px;
  background: #1e1e2e;
  color: #cdd6f4;
  z-index: 10;
  display: flex;
  flex-direction: column;
  box-shadow: -2px 0 12px rgba(0,0,0,0.4);
  transition: transform .2s ease;
}
#routes-panel.hidden { transform: translateX(280px); }
#routes-panel.hidden ~ #map { right: 0; }

#routes-panel-header {
  padding: 14px 16px;
  background: #181825;
  border-bottom: 1px solid #313244;
  display: flex;
  align-items: center;
  gap: 8px;
}
#routes-panel-header h2 { font-size: 15px; color: #cba6f7; flex: 1; }
#routes-toggle-btn {
  background: #45475a;
  border: none;
  color: #cdd6f4;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  transition: background .15s;
}
#routes-toggle-btn:hover { background: #cba6f7; color: #1e1e2e; }
#routes-new-btn {
  background: #45475a;
  border: none;
  color: #cdd6f4;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
#routes-new-btn:hover { background: #a6e3a1; color: #1e1e2e; }
#routes-new-btn.drawing { background: #ffea00; color: #1e1e2e; }

#routes-reopen-btn {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 10;
  background: #1e1e2e;
  border: 1px solid #45475a;
  color: #cdd6f4;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 2px 0 12px rgba(0,0,0,0.4);
  transition: background .15s;
}
#routes-reopen-btn:hover { background: #313244; border-color: #cba6f7; }

#routes-list { flex: 1; overflow-y: auto; padding: 10px 12px 12px; }
#routes-list::-webkit-scrollbar { width: 4px; }
#routes-list::-webkit-scrollbar-thumb { background: #45475a; border-radius: 4px; }

.route-card {
  background: #313244;
  border: 1px solid #45475a;
  border-radius: 8px;
  padding: 9px 11px;
  margin-bottom: 8px;
}
.route-card.editing { border-color: #ffea00; }
.route-top { display: flex; align-items: center; gap: 7px; }
.route-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.route-name {
  font-size: 13px;
  font-weight: 600;
  color: #cdd6f4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  cursor: text;
  border-radius: 3px;
  padding: 1px 3px;
}
.route-name[contenteditable="true"] { background: #1e1e2e; outline: 1px solid #cba6f7; white-space: normal; overflow: visible; }
.route-visibility {
  background: none;
  border: none;
  color: #cdd6f4;
  cursor: pointer;
  font-size: 13px;
  opacity: .8;
  flex-shrink: 0;
}
.route-visibility:hover { opacity: 1; }
.route-card.hidden-route .route-visibility { opacity: .35; }
.route-card.hidden-route .route-name { color: #6c7086; }
.route-meta { font-size: 11px; color: #6c7086; margin-top: 4px; }
.route-actions { display: flex; gap: 6px; margin-top: 8px; }
.route-actions button {
  flex: 1;
  background: #45475a;
  border: none;
  color: #cdd6f4;
  padding: 5px 6px;
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  transition: background .15s;
}
.route-actions .route-edit:hover   { background: #89b4fa; color: #1e1e2e; }
.route-actions .route-edit.active  { background: #89b4fa; color: #1e1e2e; }
.route-actions .route-export:hover { background: #a6e3a1; color: #1e1e2e; }
.route-actions .route-delete:hover { background: #f38ba8; color: #1e1e2e; }
.route-actions .route-delete.confirm { background: #f38ba8; color: #1e1e2e; }

.route-edit-hint {
  font-size: 10px;
  color: #6c7086;
  font-style: italic;
  margin-top: 7px;
  line-height: 1.4;
}

/* ── Prochains passages satellite ── */
#passes-box {
  pointer-events: auto;
  background: #1e1e2e;
  border: 1px solid #45475a;
  color: #cdd6f4;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 2px 0 12px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
#passes-box:hover { border-color: #cba6f7; background: #262638; }
#passes-compact { display: flex; align-items: center; gap: 10px; }
#passes-compact .grp { display: flex; align-items: baseline; gap: 5px; }
#passes-compact .grp-tag {
  font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 8px; letter-spacing: .03em;
}
#passes-compact .grp-time { font-weight: 600; }
#passes-compact .grp-time.soon { color: #f38ba8; }

#passes-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #181825;
  color: #cdd6f4;
  display: flex;
  flex-direction: column;
}
#passes-fullscreen.hidden { display: none; }

#passes-fullscreen-header {
  padding: 16px 22px;
  background: #11111b;
  border-bottom: 1px solid #313244;
  display: flex;
  align-items: center;
  gap: 14px;
}
#passes-fullscreen-header h2 { font-size: 18px; color: #cba6f7; }
#passes-updated { flex: 1; font-size: 11px; color: #6c7086; }
#passes-close-btn {
  background: #45475a;
  border: none;
  color: #cdd6f4;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
}
#passes-close-btn:hover { background: #f38ba8; color: #1e1e2e; }

#passes-fullscreen-grid {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  align-content: start;
}

.passes-col {
  background: #1e1e2e;
  border: 1px solid #313244;
  border-radius: 10px;
  padding: 14px 16px;
}
.passes-col-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}
.passes-col-title .day-badge { font-size: 11px; color: #6c7086; font-weight: 400; }

.pass-row {
  padding: 10px 0;
  border-top: 1px solid #313244;
}
.pass-row:first-of-type { border-top: none; }
.pass-row .pass-sat { font-size: 13px; font-weight: 600; color: #cdd6f4; }
.pass-row .pass-meta { font-size: 11px; color: #6c7086; margin-top: 2px; }
.pass-row .pass-countdown {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
  color: #a6e3a1;
}
.pass-row .pass-countdown.soon { color: #f38ba8; }
.pass-row .pass-countdown.live { color: #89b4fa; }
.passes-col-empty { font-size: 12px; color: #585b70; font-style: italic; }

.pass-source {
  font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 8px;
  letter-spacing: .02em; vertical-align: middle; margin-left: 4px;
}
.pass-source.plan     { background: #1e4d2e; color: #69db7c; }
.pass-source.estimate { background: #3d3520; color: #f9e2af; }
.pass-source.schedule { background: #1e3d4d; color: #66d9e8; }
