:root {
  --droneco-blue: #01001c;
  --droneco-blue-soft: #121036;
  --droneco-orange: #ff5c00;
  --droneco-orange-soft: rgba(255, 92, 0, 0.18);
  --surface: #ffffff;
  --surface-alt: #f4f5f8;
  --surface-muted: #e8ebf1;
  --border: #26253f;
  --text: #111320;
  --text-soft: #5d6377;
  --shadow: rgba(1, 0, 28, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #eaedf3 0%, #f4f5f8 100%);
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: auto 1fr;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.75rem 0.7rem;
  background: linear-gradient(180deg, var(--droneco-blue) 0%, var(--droneco-blue-soft) 100%);
  color: #ffffff;
  font-size: 0.9rem;
  border-right: 4px solid var(--droneco-orange);
  transition: width 160ms ease, padding 160ms ease;
  overflow-x: hidden;
  overflow-y: auto;
  box-shadow: 12px 0 30px rgba(1, 0, 28, 0.18);
}

.sidebar.is-collapsed {
  width: 76px;
  padding-inline: 0.55rem;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.65rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-toggle-icon {
  color: var(--droneco-orange);
  font-weight: 700;
  font-size: 1rem;
}

.sidebar-toggle-label {
  font-weight: 600;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.menu-group {
  display: grid;
  gap: 0.3rem;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 4px solid var(--droneco-orange);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.menu-item:focus-visible,
.sidebar-toggle:focus-visible,
.plan-collapse-button:focus-visible {
  outline: 2px solid var(--droneco-orange);
  outline-offset: 2px;
}

.menu-item-icon {
  color: var(--droneco-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.menu-item-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.menu-item-label {
  white-space: nowrap;
}

.sidebar-panel {
  display: grid;
  gap: 0.65rem;
  min-width: 0;
  padding: 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.sidebar-subpanel {
  margin: -0.1rem 0 0 1.1rem;
  border-top-left-radius: 0;
}

.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 0.92rem;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: var(--droneco-orange);
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.84rem;
}

.plans-upload-input {
  display: none;
}

.plans-list,
.plans-map-toggle-list {
  display: grid;
  gap: 0.5rem;
}

.plans-placeholder {
  color: rgba(255, 255, 255, 0.68);
  line-height: 1.5;
}

.plan-card {
  padding: 0.6rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: grab;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.plan-card:hover {
  background: rgba(255, 255, 255, 0.085);
  border-color: rgba(255, 255, 255, 0.14);
}

.plan-card.is-dragging {
  opacity: 0.55;
}

.plan-card.is-drop-target {
  border-color: var(--droneco-orange);
  box-shadow: inset 0 0 0 1px var(--droneco-orange);
}

.plan-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.plan-card-title-group {
  min-width: 0;
  flex: 1;
}

.plan-card h3 {
  margin: 0;
  font-size: 0.86rem;
  word-break: break-word;
}

.plan-card p {
  margin: 0.16rem 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  word-break: break-word;
}

.plan-card-body {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

.plan-field-grid {
  display: grid;
  gap: 0.5rem;
}

.plan-field {
  display: grid;
  gap: 0.24rem;
}

.plan-field span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.74rem;
  font-weight: 600;
}

.plan-field input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.plan-field input:focus {
  outline: 2px solid var(--droneco-orange-soft);
  border-color: var(--droneco-orange);
}

.plan-collapse-button {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--droneco-orange);
  cursor: pointer;
}

.plan-drag-handle {
  align-self: center;
  color: rgba(255, 255, 255, 0.72);
  font-size: 1rem;
  user-select: none;
}

.plan-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.plan-card-actions .button {
  flex: 1 1 140px;
  min-width: 0;
  padding: 0.58rem 0.75rem;
  border-radius: 8px;
  font-size: 0.84rem;
}

.map-plan-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.viewer-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.map-status {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 800;
  min-width: 240px;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(1, 0, 28, 0.9);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(1, 0, 28, 0.22);
  pointer-events: none;
}

.map-status-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.map-status-time {
  margin-top: 0.2rem;
  color: var(--droneco-orange);
  font-variant-numeric: tabular-nums;
}

.map-status-hint {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.92rem;
}

.is-hidden {
  display: none !important;
}

.plans-map-panel {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 800;
  min-width: 220px;
  max-width: 280px;
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  background: rgba(1, 0, 28, 0.9);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(1, 0, 28, 0.22);
}

.plans-map-panel-title {
  margin-bottom: 0.65rem;
  color: var(--droneco-orange);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#map {
  min-height: 0;
  width: 100%;
  height: 100%;
}

#map.is-picking-location {
  cursor: crosshair;
}

.leaflet-control-layers {
  border: 1px solid #d7dce6 !important;
  border-radius: 12px !important;
  box-shadow: 0 16px 28px var(--shadow) !important;
}

.leaflet-control-layers-toggle {
  width: 40px !important;
  height: 40px !important;
  background-size: 20px 20px !important;
}

.orientation-control-button,
.own-location-control-button {
  width: 40px;
  height: 40px;
  border: 0;
  background: #ffffff;
  color: var(--droneco-blue);
  font-weight: 700;
  cursor: pointer;
}

.own-location-control-button {
  font-size: 1.3rem;
  line-height: 1;
}

.leaflet-control-rotate a {
  width: 40px !important;
  height: 40px !important;
}

.leaflet-control-rotate a,
.orientation-control-button,
.own-location-control-button {
  box-shadow: 0 10px 20px rgba(1, 0, 28, 0.08);
}

.own-location-marker {
  background: transparent;
  border: 0;
}

.own-location-marker-dot {
  display: block;
  width: 22px;
  height: 22px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: #2f80ff;
  box-shadow: 0 0 0 2px rgba(47, 128, 255, 0.35), 0 8px 18px rgba(1, 0, 28, 0.28);
}

.own-location-accuracy {
  pointer-events: none;
}

.leaflet-control-rotate-arrow {
  filter: saturate(0) brightness(0.3);
}

.sidebar.is-collapsed .sidebar-toggle {
  justify-content: center;
  padding-inline: 0.5rem;
}

.sidebar.is-collapsed .sidebar-toggle-label,
.sidebar.is-collapsed .menu-item-label {
  display: none;
}

.sidebar.is-collapsed .menu-item {
  justify-content: center;
  padding-inline: 0.5rem;
}

.sidebar.is-collapsed .menu-group {
  justify-items: center;
}

.sidebar.is-collapsed .sidebar-panel {
  display: none !important;
}

.sidebar.is-collapsed .menu-item-icon,
.sidebar.is-collapsed .sidebar-toggle-icon {
  width: 24px;
  height: 24px;
}

.leaflet-popup-content-wrapper {
  border-top: 4px solid var(--droneco-orange);
  border-radius: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(1, 0, 28, 0.5);
  z-index: 2000;
}

.modal-backdrop.is-hidden {
  display: none;
}

.modal {
  width: min(100%, 560px);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 22px 44px rgba(1, 0, 28, 0.28);
  overflow: hidden;
}

.modal-header {
  padding: 1.15rem 1.2rem 1rem;
  background: var(--droneco-blue);
  color: #ffffff;
  border-bottom: 4px solid var(--droneco-orange);
}

.modal-header h2 {
  margin: 0;
}

.modal-header p {
  margin: 0.35rem 0 0;
  color: rgba(255, 255, 255, 0.74);
}

.event-form {
  display: grid;
  gap: 0.95rem;
  padding: 1.2rem;
}

.event-form label {
  display: grid;
  gap: 0.38rem;
}

.event-form span {
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 600;
}

.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
}

.event-form input {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid #cfd5df;
  border-radius: 10px;
  background: var(--surface);
}

.event-form input:focus {
  outline: 2px solid var(--droneco-orange-soft);
  border-color: var(--droneco-orange);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.7rem;
  padding-top: 0.4rem;
}

.button {
  max-width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
}

.button-primary {
  background: var(--droneco-orange);
  color: #ffffff;
}

.button-secondary {
  background: var(--droneco-blue);
  color: #ffffff;
}

.button-ghost {
  background: #ffffff;
  border-color: #d5dbe5;
  color: var(--text);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 4px solid var(--droneco-orange);
  }

  .sidebar.is-collapsed {
    width: auto;
  }

  #map {
    min-height: 65vh;
  }

  .map-status {
    left: 10px;
    right: 10px;
    min-width: 0;
  }

  .plans-map-panel {
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .inline-field {
    grid-template-columns: 1fr;
  }

  .plan-card-topline {
    flex-wrap: wrap;
  }
}

@media (max-width: 760px) {
  .leaflet-control-layers-toggle,
  .orientation-control-button,
  .own-location-control-button,
  .leaflet-control-zoom a,
  .leaflet-control-rotate a {
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
  }

  .own-location-marker-dot {
    width: 24px;
    height: 24px;
  }
}
