/* AerialDeck page layout (redesign, Nov 2026). Everything here is scoped to
   body.layout-v2, so "Classic layout" in Settings removes it completely. */

body.layout-v2 { background: #eef0ee; }
body.layout-v2.dark { background: #0f0f0f; }

/* Top bar */
body.layout-v2 .header { padding: 0.9rem 1.75rem; background: var(--bg-primary); }
body.layout-v2 .header-section { display: none; }

/* Left icon menu */
.v2-nav { display: none; }
body.layout-v2 .v2-nav {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  position: fixed; top: 76px; left: 0; bottom: 0; width: 84px; padding: 1.25rem 0;
  background: var(--bg-primary); border-right: 1px solid var(--border);
  overflow: visible; z-index: 900;
}
body.layout-v2 .v2-nav a {
  position: relative; flex: 0 0 auto;
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); text-decoration: none;
}
body.layout-v2 .v2-nav a:hover { background: var(--border-light); color: var(--text-primary); }
body.layout-v2 .v2-nav a.active { background: #1d2420; color: #fff; }
body.layout-v2.dark .v2-nav a.active { background: var(--accent); color: #0f0f0f; }
body.layout-v2 .v2-nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Name shown beside the icon on hover */
body.layout-v2 .v2-nav a span {
  position: absolute; left: 58px; top: 50%; transform: translateY(-50%);
  background: #1d2420; color: #fff; font-size: 0.8rem; white-space: nowrap;
  padding: 0.35rem 0.6rem; border-radius: 8px; pointer-events: none;
  opacity: 0; transition: opacity .12s;
}
body.layout-v2 .v2-nav a:hover span, body.layout-v2 .v2-nav a:focus-visible span { opacity: 1; }
body.layout-v2 .v2-nav-gap { flex: 1; min-height: 1rem; }

/* Content area */
body.layout-v2 .main-content { margin-left: 84px; max-width: none; padding: 1.75rem 2rem 3rem; }

/* Page heading */
.v2-page-head { display: none; }
body.layout-v2 .v2-page-head { display: block; margin-bottom: 1.5rem; }
body.layout-v2 .v2-crumb { font-size: 0.85rem; color: var(--text-muted); }
body.layout-v2 .v2-crumb a { color: var(--text-muted); text-decoration: none; }
body.layout-v2 .v2-crumb a:hover { color: var(--text-primary); }
body.layout-v2 .v2-page-head h1 {
  margin: 0.3rem 0 0; font-size: 3rem; line-height: 1.1; font-weight: 700;
  letter-spacing: -1px; color: var(--text-primary);
}

/* One section per page: no tab strip, the bento only on Home */
body.layout-v2 .tabs { display: none !important; }
body.layout-v2:not(.v2-home) #bentoGrid { display: none; }
body.layout-v2.v2-home #flightPlansTab,
body.layout-v2.v2-home #flightLogsTab,
body.layout-v2.v2-home #dronesTab,
body.layout-v2.v2-home #batteriesTab,
body.layout-v2.v2-home #meetingsTab,
body.layout-v2.v2-home #maintenanceTab,
body.layout-v2.v2-home #trainingTab,
body.layout-v2.v2-home #incidentsTab,
body.layout-v2.v2-home #soraTab { display: none !important; }

/* Section title is now the page heading; keep the section's own buttons */
body.layout-v2 .tab-header h3 { display: none; }
body.layout-v2 .tab-header { justify-content: flex-end; }

/* Cards */
body.layout-v2 .bento-grid { gap: 1.25rem; }
body.layout-v2 .bento-card {
  border-radius: 24px; border: none; padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(20, 30, 20, .05);
}
body.layout-v2 .bento-card:hover { transform: none; box-shadow: 0 6px 20px rgba(20, 30, 20, .08); }
body.layout-v2 #flightMap { border-radius: 24px; }
body.layout-v2 .card-audit { background: var(--accent); color: #fff; }
body.layout-v2 .card-audit h3, body.layout-v2 .card-audit .audit-progress-label .title,
body.layout-v2 .card-audit .percent { color: #fff !important; }

/* Plan detail page */
body.layout-v2 .detail-view .back-btn { font-size: 0.85rem; }
body.layout-v2 #detailHeader h2 { font-size: 3rem; line-height: 1.1; letter-spacing: -1px; }

/* Phones and small tablets: the menu becomes a bar along the bottom */
@media (max-width: 760px) {
  body.layout-v2 .v2-nav {
    top: auto; right: 0; width: auto; height: 64px; flex-direction: row;
    padding: 0 0.5rem; border-right: 0; border-top: 1px solid var(--border);
    overflow-x: auto; overflow-y: hidden; gap: 0.25rem;
  }
  body.layout-v2 .v2-nav a span, body.layout-v2 .v2-nav-gap { display: none; }
  body.layout-v2 .main-content { margin-left: 0; padding: 1rem 1rem 5rem; }
  body.layout-v2 .v2-page-head h1, body.layout-v2 #detailHeader h2 { font-size: 2.1rem; }
}

/* Home: no heading, and the panels fill the browser window at any size */
body.layout-v2.v2-home .v2-page-head { display: none; }
body.layout-v2.v2-home #bentoGrid { margin-bottom: 0; }
@media (min-width: 1201px) {
  body.layout-v2.v2-home #bentoGrid {
    height: calc(100vh - var(--v2-head, 76px) - 3.5rem);
    min-height: 640px;
    grid-auto-rows: minmax(0, 1fr);
  }
  body.layout-v2.v2-home #bentoGrid .bento-card { min-height: 0; overflow: hidden; }
  body.layout-v2.v2-home #bentoGrid .card-map #flightMap { height: 100%; min-height: 0; }
}
body.layout-v2.v2-home .main-content { padding-bottom: 1.75rem; }
body.layout-v2 .bento-card.card-map { padding: 0; }

/* Calendar page (replaces the pop-up and the top-bar button) */
body.layout-v2 .header-actions button[title="Calendar"] { display: none; }
.v2-calendar { display: none; }
body.layout-v2.v2-calendar-page .v2-calendar { display: block; }
body.layout-v2.v2-calendar-page #bentoGrid,
body.layout-v2.v2-calendar-page #flightPlansTab,
body.layout-v2.v2-calendar-page #flightLogsTab,
body.layout-v2.v2-calendar-page #dronesTab,
body.layout-v2.v2-calendar-page #batteriesTab,
body.layout-v2.v2-calendar-page #meetingsTab,
body.layout-v2.v2-calendar-page #maintenanceTab,
body.layout-v2.v2-calendar-page #trainingTab,
body.layout-v2.v2-calendar-page #incidentsTab,
body.layout-v2.v2-calendar-page #soraTab { display: none !important; }
body.layout-v2 .v2-calendar:hover { box-shadow: 0 1px 2px rgba(20, 30, 20, .05); }

/* Calendar page fills the browser window */
body.layout-v2.v2-calendar-page .main-content {
  height: calc(100vh - var(--v2-head, 76px)); box-sizing: border-box;
  padding-bottom: 1.75rem; display: flex; flex-direction: column; min-height: 560px;
}
body.layout-v2.v2-calendar-page #homeView { flex: 1; min-height: 0; display: flex !important; flex-direction: column; }
body.layout-v2.v2-calendar-page .v2-calendar { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.layout-v2.v2-calendar-page #calBody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.layout-v2.v2-calendar-page .cal-grid { flex: 1; min-height: 0; grid-template-rows: auto repeat(6, minmax(0, 1fr)); }
body.layout-v2.v2-calendar-page #calendarPage .cal-day { min-height: 0; overflow-y: auto; }

/* Plan detail page: map first, then flight logs, then the rest; cards in the new style */
body.layout-v2 #detailView.active { display: flex; flex-direction: column; gap: 1.25rem; }
body.layout-v2 #detailView > * { margin: 0 !important; }
body.layout-v2 #detailView > :first-child { order: 0; }
body.layout-v2 #detailHeader { order: 1; }
body.layout-v2 #flightGeoSection { order: 2; }
body.layout-v2 #detailView > .flight-logs-section { order: 3; }
body.layout-v2 #detailView > .flight-record-upload-section { order: 4; }
body.layout-v2 #evidenceSection { order: 5; }
body.layout-v2 #detailView > .image-modal, body.layout-v2 #detailView > .modal-overlay { order: 9; }

body.layout-v2 .flight-logs-section, body.layout-v2 .flight-record-upload-section,
body.layout-v2 .evidence-section, body.layout-v2 .flight-geo-section {
  border: none; border-radius: 24px; box-shadow: 0 1px 2px rgba(20, 30, 20, .05);
}

/* Header: big plan name, then the details as tiles */
body.layout-v2 .detail-header { background: none; border: none; padding: 0; }
body.layout-v2 .detail-header > div:first-child { align-items: center !important; gap: 1rem; flex-wrap: wrap; }
body.layout-v2 #detailHeader h2 { margin: 0; }
body.layout-v2 .detail-info { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1.25rem; margin-top: 1.25rem; }
body.layout-v2 .detail-info-item {
  background: var(--bg-card); border-radius: 20px; padding: 1.1rem 1.25rem;
  box-shadow: 0 1px 2px rgba(20, 30, 20, .05);
}
body.layout-v2 .detail-info-item label { font-size: 0.72rem; font-weight: 500; text-transform: none; letter-spacing: 0; margin-bottom: 0.4rem; }
body.layout-v2 .detail-info-item span { font-size: 1.35rem; font-weight: 700; line-height: 1.2; word-break: break-word; }

/* Compliance score as the green card */
body.layout-v2 .detail-header .compliance-mini {
  background: var(--accent); border-radius: 20px; padding: 0.9rem 1.25rem; min-width: 260px;
  align-items: stretch;
}
body.layout-v2 .detail-header .compliance-mini-label { color: rgba(255, 255, 255, .9); font-size: 0.72rem; }
body.layout-v2 .detail-header .compliance-mini-bar { flex: 1; width: auto; background: rgba(255, 255, 255, .3); }
body.layout-v2 .detail-header .compliance-mini-fill { background: #fff !important; animation: none; }
body.layout-v2 .detail-header .compliance-mini-percent { color: #fff !important; font-size: 1.35rem; }

/* Plan detail: narrower map with its settings beside it in two columns, no scrolling */
@media (min-width: 1101px) {
  body.layout-v2 .flight-geo-content { grid-template-columns: minmax(0, 1fr) 560px; }
  body.layout-v2 .flight-geo-map-container { min-height: 380px; }
  body.layout-v2 .flight-geo-sidebar {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem 1rem;
    grid-template-areas: "ctl res" "ctl leg" "hint hint" "zones avoid" "act act";
    align-content: start;
  }
  body.layout-v2 .flight-geo-sidebar > .flight-geo-controls { grid-area: ctl; }
  body.layout-v2 .flight-geo-sidebar > .flight-geo-results { grid-area: res; }
  body.layout-v2 .flight-geo-sidebar > .flight-geo-legend { grid-area: leg; }
  body.layout-v2 .flight-geo-sidebar > .editable-hint { grid-area: hint; }
  body.layout-v2 .flight-geo-sidebar > .btn-toggle-zones { grid-area: zones; align-self: start; }
  body.layout-v2 .flight-geo-sidebar > .flight-geo-avoid { grid-area: avoid; }
  body.layout-v2 .flight-geo-sidebar > .flight-geo-actions { grid-area: act; }
}
@media (max-width: 900px) {
  body.layout-v2 .flight-geo-map-container { min-height: 340px; }
}

/* Plan detail: flight logs collapsed until opened */
.v2-toggle-arrow { display: none; }
body.layout-v2 .flight-logs-header.v2-toggle { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
body.layout-v2 .flight-logs-header .v2-toggle-arrow { display: inline; font-size: 18px; color: var(--text-muted); }
body.layout-v2 .flight-logs-section.v2-open .v2-toggle-arrow { display: inline-block; transform: rotate(90deg); }
body.layout-v2 #detailView > .flight-logs-section:not(.v2-open) #flightLogsContainer { display: none; }
body.layout-v2 #detailView > .flight-logs-section:not(.v2-open) .flight-logs-header { border-bottom: 0; }

/* UF101 Creator page: fills the window below the heading */
.v2-uf101 { display: none; }
body.layout-v2.v2-uf101-page .main-content {
  height: calc(100vh - var(--v2-head, 76px)); box-sizing: border-box;
  padding-bottom: 1.75rem; display: flex; flex-direction: column; min-height: 560px;
}
body.layout-v2.v2-uf101-page #homeView { flex: 1; min-height: 0; display: flex !important; flex-direction: column; }
body.layout-v2.v2-uf101-page .v2-uf101 { display: block; flex: 1; min-height: 0; padding: 0; overflow: hidden; }
body.layout-v2.v2-uf101-page .v2-uf101:hover { box-shadow: 0 1px 2px rgba(20, 30, 20, .05); }
body.layout-v2 #uf101Frame { width: 100%; height: 100%; border: 0; display: block; }
body.layout-v2.v2-uf101-page #bentoGrid,
body.layout-v2.v2-uf101-page #flightPlansTab,
body.layout-v2.v2-uf101-page #flightLogsTab,
body.layout-v2.v2-uf101-page #dronesTab,
body.layout-v2.v2-uf101-page #batteriesTab,
body.layout-v2.v2-uf101-page #meetingsTab,
body.layout-v2.v2-uf101-page #maintenanceTab,
body.layout-v2.v2-uf101-page #trainingTab,
body.layout-v2.v2-uf101-page #incidentsTab,
body.layout-v2.v2-uf101-page #soraTab { display: none !important; }

/* Home: stop widening past 1600px and centre the panels, like the UF101 Creator */
body.layout-v2.v2-home #bentoGrid { max-width: 1600px; margin-left: auto; margin-right: auto; }

/* Home: also stop growing taller at 900px (16:9 with the 1600px width) and sit in the middle */
@media (min-width: 1201px) {
  body.layout-v2.v2-home .main-content {
    min-height: calc(100vh - var(--v2-head, 76px)); box-sizing: border-box;
    display: flex; flex-direction: column; justify-content: center;
  }
  body.layout-v2.v2-home #bentoGrid {
    width: 100%;
    height: min(calc(100vh - var(--v2-head, 76px) - 3.5rem), 900px);
  }
}

/* All pages: stop widening past 1600px and centre, like Home */
body.layout-v2 #homeView, body.layout-v2 #detailView.active {
  width: 100%; max-width: 1600px; margin-left: auto; margin-right: auto; box-sizing: border-box;
}
/* Calendar and UF101 Creator fill the window: also stop growing taller and sit in the middle */
body.layout-v2.v2-calendar-page .main-content,
body.layout-v2.v2-uf101-page .main-content { justify-content: center; }
body.layout-v2.v2-calendar-page #homeView,
body.layout-v2.v2-uf101-page #homeView { max-height: 1010px; }

/* Drones page: cards side by side in columns */
body.layout-v2 #dronesGrid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.25rem; }
body.layout-v2 #dronesGrid .data-card { border-radius: 24px; border: none; padding: 1.5rem; box-shadow: 0 1px 2px rgba(20, 30, 20, .05); }
body.layout-v2 .drone-photo { height: 200px; border-radius: 16px; }
body.layout-v2 .drone-photo { background: none; }
body.layout-v2 .drone-photo img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: cover; }

/* Batteries page: cards in columns, 4 per row (fewer on narrow screens) */
body.layout-v2 #batteriesGrid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; }
body.layout-v2 #batteriesGrid .data-card { border-radius: 24px; padding: 1.5rem; box-shadow: 0 1px 2px rgba(20, 30, 20, .05); }
@media (max-width: 1200px) { body.layout-v2 #batteriesGrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { body.layout-v2 #batteriesGrid { grid-template-columns: minmax(0, 1fr); } }

/* Cards match the rest of AerialDeck: no coloured left edges */
body.layout-v2 .drone-card, body.layout-v2 .meeting-card, body.layout-v2 .battery-card { border-left: none; }
body.layout-v2 #batteriesGrid .data-card { border: none; }
/* Line icons (icons.js) */
.ic-svg { display: inline-block; }

/* UF101 Creator menu item: small text instead of an icon */
body.layout-v2 .v2-nav-text { font-size: 9px; font-weight: 700; letter-spacing: 0.2px; line-height: 1; }

/* UF101 Creator: no outer panel around it */
body.layout-v2.v2-uf101-page .v2-uf101 { background: none; box-shadow: none; border-radius: 0; }
body.layout-v2.v2-uf101-page .v2-uf101:hover { box-shadow: none; }
