/* CS Aviation – Routenplaner v2 – Operations Design */

.rp-wrap {
  font-family: 'Lato', system-ui, -apple-system, sans-serif;
  color: #1f2937;
  background: #f5f6f8;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(15, 37, 72, 0.08);
  margin: 2rem 0;
}

/* ═══ Header ═══ */
.rp-head {
  background: linear-gradient(135deg, #0f2548 0%, #1a3d7c 60%, #1f4a94 100%);
  color: #fff;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.rp-head-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.rp-head-sub {
  font-size: 0.85rem;
  opacity: 0.85;
  letter-spacing: 0.03em;
}
.rp-legend {
  display: flex;
  gap: 1.2rem;
  font-size: 0.8rem;
  flex-wrap: wrap;
}
.rp-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.rp-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.rp-body { padding: 1.75rem 2rem; }
.rp-foot {
  background: #eef2f7;
  padding: 0.9rem 2rem;
  font-size: 0.75rem;
  color: #6b7280;
  border-top: 1px solid #d1d7e1;
}
.rp-err, .rp-err-inline {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  border-left: 4px solid #dc2626;
  font-size: 0.85rem;
}

/* ═══ Section-Titles ═══ */
.rp-section-title {
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0f2548;
  margin: 1.75rem 0 0.9rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #1a3d7c;
}
.rp-section-title:first-child { margin-top: 0; }

/* ═══ Meta-Grid (Kopfdaten) ═══ */
.rp-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.9rem 1.1rem;
  margin-bottom: 1.5rem;
}
.rp-field { display: flex; flex-direction: column; }
.rp-field label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #4b5563;
  margin-bottom: 0.3rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.rp-field input, .rp-field select {
  padding: 0.55rem 0.7rem;
  border: 1px solid #d1d7e1;
  border-radius: 6px;
  background: #fff;
  font-size: 0.9rem;
  color: #1f2937;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.rp-field input:focus, .rp-field select:focus {
  outline: none;
  border-color: #1a3d7c;
  box-shadow: 0 0 0 3px rgba(26, 61, 124, 0.15);
}

/* ═══ Karte + Wegpunkt-Panel ═══ */
.rp-plan-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.rp-map-wrap { display: flex; flex-direction: column; gap: 0.5rem; }
#rp-map {
  position: relative;
  height: 520px;
  border-radius: 8px;
  border: 1px solid #d1d7e1;
  background: #f6f4ee;
}
.rp-map-hint {
  font-size: 0.72rem;
  color: #6b7280;
  padding: 0.4rem 0.2rem;
  font-style: italic;
}

.rp-wp-panel {
  background: #fff;
  border: 1px solid #d1d7e1;
  border-radius: 8px;
  padding: 1rem;
  max-height: 530px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.rp-wp-panel .rp-section-title { margin-top: 0; }

/* ═══ Suche ═══ */
.rp-search { position: relative; margin-bottom: 0.8rem; }
.rp-search input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid #d1d7e1;
  border-radius: 6px;
  font-size: 0.88rem;
}
.rp-search input:focus {
  outline: none;
  border-color: #1a3d7c;
  box-shadow: 0 0 0 3px rgba(26, 61, 124, 0.15);
}
#rp-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #d1d7e1;
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.rp-search-hit {
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid #eef2f7;
  font-size: 0.85rem;
}
.rp-search-hit:hover { background: #f8fafc; }
.rp-search-hit:last-child { border-bottom: none; }
.rp-search-type {
  font-size: 0.65rem;
  font-weight: 900;
  color: #fff;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  letter-spacing: 0.03em;
  min-width: 2.5rem;
  text-align: center;
}
.rp-search-label { flex: 1; color: #1f2937; }
.rp-search-loading, .rp-search-empty {
  padding: 0.6rem 0.8rem;
  font-size: 0.82rem;
  color: #6b7280;
  font-style: italic;
}

/* ═══ Wegpunkt-Liste ═══ */
#rp-waypoints { flex: 1; }
.rp-wp-empty {
  font-size: 0.85rem;
  color: #9ca3af;
  font-style: italic;
  text-align: center;
  padding: 1.5rem 0;
}
.rp-wp {
  display: grid;
  grid-template-columns: 28px 1fr 70px 30px;
  gap: 0.5rem;
  align-items: center;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid #eef2f7;
}
.rp-wp:last-child { border-bottom: none; }
.rp-wp-num {
  background: #1a3d7c;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rp-wp-main { min-width: 0; }
.rp-wp-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rp-wp-type {
  font-size: 0.65rem;
  font-weight: 900;
  color: #1a3d7c;
  background: #eef3fc;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  margin-left: 0.3rem;
}
.rp-wp-coords { font-size: 0.7rem; color: #6b7280; }
.rp-wp-alt {
  width: 100%;
  padding: 0.35rem 0.4rem;
  border: 1px solid #d1d7e1;
  border-radius: 4px;
  font-size: 0.8rem;
  text-align: right;
}
.rp-wp-del {
  background: none;
  border: none;
  color: #dc2626;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.2rem;
}
.rp-wp-del:hover { color: #991b1b; }

/* ═══ Leaflet-Marker ═══ */
.rp-marker-wrap { background: transparent !important; border: none !important; }
.rp-marker-pin {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.02em;
  font-family: 'Lato', Arial, sans-serif;
}

/* Leg-Labels (HDG + Zeit) mitten auf der Route */
.rp-leg-label-wrap { background: transparent !important; border: none !important; }
.rp-leg-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 235, 0.95);
  border: 1.5px solid #c8234a;
  border-radius: 5px;
  padding: 2px 7px;
  font-family: 'Lato', Arial, sans-serif;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  pointer-events: none;
  line-height: 1.1;
}
.rp-leg-hdg {
  color: #c8234a;
  font-weight: 900;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}
.rp-leg-time {
  color: #0f2548;
  font-weight: 700;
  font-size: 0.72rem;
}

/* Luftraum-Höhen-Label (oben/unten im Polygon) */
.rp-as-alt-wrap { background: transparent !important; border: none !important; }
.rp-as-alt {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #0f2548;
  border-radius: 3px;
  padding: 2px 4px;
  font-family: 'Lato', Arial, sans-serif;
  text-align: center;
  pointer-events: none;
  line-height: 1.15;
  font-size: 0.68rem;
}
.rp-as-alt-class {
  color: #3030a0;
  font-weight: 900;
  font-size: 0.6rem;
  letter-spacing: 0.02em;
}
.rp-as-alt-upper {
  color: #0f2548;
  font-weight: 900;
  font-size: 0.72rem;
}
.rp-as-alt-lower {
  color: #0f2548;
  font-weight: 900;
  font-size: 0.72rem;
}
.rp-as-alt-rule {
  height: 1px;
  background: #0f2548;
  margin: 1px 2px;
}
.rp-as-tip {
  font-family: 'Lato', Arial, sans-serif;
}

/* Subtle-Mini-Pille für irrelevante Lufträume (A, B, F, G, FIR …) */
.rp-as-subtle {
  background: rgba(255, 250, 225, 0.82);
  border: 0.5px solid rgba(176, 148, 15, 0.5);
  color: #6b5b00;
  font-family: 'Lato', Arial, sans-serif;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 2px;
  text-align: center;
  letter-spacing: 0.01em;
  pointer-events: none;
  white-space: nowrap;
}

/* ═══ Flight-Log Tabelle ═══ */
.rp-log-wrap { overflow-x: auto; margin-bottom: 1.5rem; }
.rp-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  background: #fff;
  border: 1px solid #d1d7e1;
  border-radius: 6px;
  overflow: hidden;
}
.rp-log-table thead th {
  background: #0f2548;
  color: #fff;
  padding: 0.6rem 0.5rem;
  font-weight: 700;
  text-align: right;
  letter-spacing: 0.03em;
  font-size: 0.72rem;
  text-transform: uppercase;
}
.rp-log-table thead th:nth-child(2) { text-align: left; }
.rp-log-table tbody td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid #eef2f7;
  text-align: right;
}
.rp-log-table tbody td:nth-child(2) { text-align: left; }
.rp-log-table tbody tr:nth-child(even) { background: #f8fafc; }
.rp-log-table tbody tr:hover { background: #eef3fc; }
.rp-log-empty {
  text-align: center !important;
  color: #9ca3af;
  font-style: italic;
  padding: 1.5rem !important;
}
.rp-log-table tfoot td {
  padding: 0.6rem 0.5rem;
  background: #eef3fc;
  font-weight: 900;
  color: #0f2548;
  border-top: 2px solid #1a3d7c;
  text-align: right;
}

/* ═══ Weight & Balance ═══ */
.rp-wb-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.rp-wb-inputs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem 1rem;
}
.rp-wb-output {
  background: #fff;
  border: 1px solid #d1d7e1;
  border-radius: 8px;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.rp-wb-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
}
.rp-wb-row > span:first-child {
  color: #4b5563;
  font-weight: 600;
}
.rp-wb-row > span:last-child {
  color: #1f2937;
  font-weight: 700;
}
.rp-wb-status {
  margin-top: 0.6rem;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  background: #f3f4f6;
  color: #6b7280;
  letter-spacing: 0.03em;
}
.rp-wb-ok {
  background: #d1fae5;
  color: #065f46;
}
.rp-wb-warn {
  background: #fee2e2;
  color: #991b1b;
}

/* ═══ Buttons ═══ */
.rp-actions {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1.2rem;
}
.rp-btn {
  padding: 0.7rem 1.3rem;
  border: none;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s;
}
.rp-btn:hover { transform: translateY(-1px); }
.rp-btn:active { transform: translateY(0); }
.rp-btn-primary {
  background: linear-gradient(135deg, #0f2548 0%, #1a3d7c 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(15, 37, 72, 0.2);
}
.rp-btn-primary:hover {
  box-shadow: 0 4px 14px rgba(15, 37, 72, 0.35);
}
.rp-btn-ghost {
  background: #fff;
  color: #0f2548;
  border: 1px solid #d1d7e1;
}
.rp-btn-ghost:hover { background: #f8fafc; }
.rp-msg { margin-left: 0.8rem; font-size: 0.82rem; }
.rp-msg-ok { color: #065f46; font-weight: 700; }
.rp-msg-err { color: #991b1b; font-weight: 700; }

/* ═══ Briefing-Modal ═══ */
.rp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 37, 72, 0.6);
  backdrop-filter: blur(3px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: rp-fade 0.2s;
}
.rp-modal-overlay[hidden] { display: none; }
@keyframes rp-fade { from { opacity: 0; } to { opacity: 1; } }

.rp-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 760px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: rp-slide 0.25s ease-out;
}
@keyframes rp-slide { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.rp-modal-head {
  background: linear-gradient(135deg, #0f2548 0%, #1a3d7c 60%, #1f4a94 100%);
  color: #fff;
  padding: 1.2rem 1.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.rp-modal-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
}
.rp-modal-close:hover { background: rgba(255, 255, 255, 0.3); }

.rp-modal-body {
  padding: 1.5rem 1.6rem 1.8rem;
  overflow-y: auto;
}
.rp-modal-intro {
  font-size: 0.88rem;
  color: #4b5563;
  margin-bottom: 1.2rem;
  line-height: 1.55;
}

.rp-briefing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.9rem;
}
.rp-brief-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1.2rem 1rem;
  background: #f8fafc;
  border: 1.5px solid #d1d7e1;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.rp-brief-tile:hover:not(:disabled) {
  border-color: #1a3d7c;
  background: #eef3fc;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(26, 61, 124, 0.15);
}
.rp-brief-tile:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}
.rp-brief-tile-full {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #eef3fc 0%, #f8fafc 100%);
  border-color: #1a3d7c;
}
.rp-brief-tile-full .rp-brief-title { margin: 0; }
.rp-brief-tile-full .rp-brief-sub { margin-left: auto; }

.rp-brief-icon { font-size: 1.8rem; line-height: 1; }
.rp-brief-tile-full .rp-brief-icon { font-size: 2.2rem; }
.rp-brief-title {
  font-size: 1rem;
  font-weight: 900;
  color: #0f2548;
  letter-spacing: 0.02em;
}
.rp-brief-sub {
  font-size: 0.78rem;
  color: #4b5563;
  line-height: 1.4;
}

.rp-brief-status {
  margin-top: 1.2rem;
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  text-align: center;
  min-height: 2rem;
}
.rp-brief-status .rp-ok {
  color: #065f46;
  font-weight: 700;
}
.rp-brief-status .rp-err-inline {
  background: transparent;
  padding: 0;
  border: none;
  display: inline;
}
.rp-spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #d1d7e1;
  border-top-color: #1a3d7c;
  border-radius: 50%;
  animation: rp-spin 0.8s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}
@keyframes rp-spin { to { transform: rotate(360deg); } }

/* ═══ ICAO-Chart-Look für interaktive Leaflet-Karte ═══ */
/* OSM-Tiles dezent entsättigt → Vordergrund (Route, Lufträume) tritt hervor */
#rp-map.rp-icao-chart .leaflet-tile-pane {
  filter: saturate(0.32) brightness(1.08) contrast(0.92);
}
#rp-map.rp-icao-chart { background: #f6f4ee; }

/* Luftraum-Ladebadge */
.rp-as-loading {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 37, 72, 0.9);
  color: #fff;
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  z-index: 500;
  pointer-events: none;
  letter-spacing: 0.04em;
}

/* ═══ Settings-Tabelle ═══ */
.rp-cfg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  background: #fff;
  border: 1px solid #d1d7e1;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 0.8rem;
  display: block;
  overflow-x: auto;
}
.rp-cfg-table th {
  background: #0f2548;
  color: #fff;
  padding: 0.5rem;
  font-size: 0.72rem;
  text-align: left;
  white-space: nowrap;
}
.rp-cfg-table td {
  padding: 0.3rem;
  border-bottom: 1px solid #eef2f7;
}
.rp-cfg-table td input {
  width: 85px;
  padding: 0.3rem 0.4rem;
  border: 1px solid #d1d7e1;
  border-radius: 4px;
  font-size: 0.8rem;
}
.rp-cfg-table td input[type="text"] { width: 120px; }
.rp-cfg-table td input:focus {
  outline: none;
  border-color: #1a3d7c;
  box-shadow: 0 0 0 2px rgba(26, 61, 124, 0.18);
}
.rp-cfg-table td input[readonly] {
  background: #eef3fc;
  color: #0f2548;
  font-weight: 700;
  border-color: #c4cfe0;
}
.rp-cfg-table td:first-child {
  background: #f8fafc;
  white-space: nowrap;
  padding-left: 0.8rem;
}

/* ═══ Flugzeug-Profil-Gruppen ═══ */
.rp-cfg-group {
  margin-bottom: 1.6rem;
}
.rp-cfg-group-head {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  margin-bottom: 0.35rem;
  padding: 0.1rem 0 0.35rem 0;
  border-bottom: 2px solid #1a3d7c;
}
.rp-cfg-group-title {
  font-size: 0.78rem;
  font-weight: 900;
  color: #0f2548;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.rp-cfg-group-hint {
  font-size: 0.72rem;
  color: #6b7280;
  font-style: italic;
  flex: 1;
}
.rp-cfg-del {
  width: 28px;
  height: 28px;
  border: 1px solid #fecdd3;
  background: #fff5f6;
  color: #c8234a;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s;
}
.rp-cfg-del:hover {
  background: #fee2e2;
  border-color: #fca5ad;
  transform: scale(1.05);
}

/* ═══ Responsive ═══ */
@media (max-width: 1024px) {
  .rp-plan-grid { grid-template-columns: 1fr; }
  .rp-wp-panel { max-height: none; }
  #rp-map { height: 400px; }
  .rp-meta-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .rp-body { padding: 1.2rem 1rem; }
  .rp-head { padding: 1.2rem 1rem; }
  .rp-meta-grid { grid-template-columns: repeat(2, 1fr); }
  .rp-wb-grid { grid-template-columns: 1fr; }
  .rp-wb-inputs { grid-template-columns: 1fr; }
  .rp-briefing-grid { grid-template-columns: 1fr; }
  .rp-brief-tile-full { flex-direction: column; align-items: flex-start; }
  .rp-brief-tile-full .rp-brief-sub { margin-left: 0; }
  #rp-map { height: 340px; }
}
