﻿/* App logo (top-left) */
.app-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    user-select: none;
}

/* Logo image */
.app-logo-img {
    width: 32px;
    height: 32px;
    display: block;
    flex-shrink: 0;
}

/* App name text */
.app-logo-text {
    font-size: 19px;
    font-weight: 600;
    letter-spacing: 0.25px;
    line-height: 1;
    color: #111;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Phones */
@media (max-width: 480px) {
    .app-logo-img {
        width: 36px;
        height: 36px;
    }

    .app-logo-text {
        font-size: 18px;
    }
}

/* Auth screen: match landing vibe */
body.auth-mode {
    padding: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(900px 600px at 20% 10%, rgba(24,198,198,0.20), rgba(24,198,198,0) 60%), radial-gradient(800px 520px at 85% 25%, rgba(46,227,163,0.16), rgba(46,227,163,0) 60%), linear-gradient(180deg, #071018, #081822);
    color: #eaf3ff;
}

    /* Replace your old inline styled card */
    body.auth-mode .auth-shell {
        width: min(720px, calc(100vw - 28px));
        margin: 0;
        padding: 18px;
        border-radius: 22px;
        border: 1px solid rgba(255,255,255,0.14);
        background: rgba(12,28,39,0.78);
        backdrop-filter: blur(14px);
        box-shadow: 0 24px 80px rgba(0,0,0,0.45);
    }

    /* Brand row */
    body.auth-mode .auth-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 10px;
    }

    body.auth-mode .auth-logo {
        width: 40px;
        height: 40px;
        display: block;
        flex: 0 0 auto;
        object-fit: contain;
    }

    body.auth-mode .auth-name {
        font-size: 22px;
        font-weight: 800;
        letter-spacing: 0.2px;
    }

    body.auth-mode .auth-tag {
        margin-top: 2px;
        font-size: 13px;
        color: rgba(234,243,255,0.75);
    }

    /* Short product line */
    body.auth-mode .auth-hero {
        font-size: 14px;
        line-height: 1.5;
        color: rgba(234,243,255,0.80);
        margin: 10px 0 14px 0;
    }

    /* Inner form card */
    body.auth-mode .auth-card {
        border-radius: 18px;
        padding: 16px;
        border: 1px solid rgba(255,255,255,0.12);
        background: rgba(6,11,16,0.42);
    }

    body.auth-mode .auth-card-title {
        font-size: 14px;
        font-weight: 800;
        margin-bottom: 12px;
        color: rgba(234,243,255,0.90);
    }

    body.auth-mode .auth-label {
        display: block;
        font-size: 12px;
        margin-bottom: 6px;
        color: rgba(234,243,255,0.70);
    }

    body.auth-mode .auth-input {
        width: 100%;
        box-sizing: border-box;
        font-size: 16px;
        padding: 11px 12px;
        border-radius: 14px;
        border: 1px solid rgba(255,255,255,0.14);
        background: rgba(255,255,255,0.06);
        color: #eaf3ff;
        outline: none;
        margin-bottom: 12px;
    }

        body.auth-mode .auth-input:focus {
            border-color: rgba(255,255,255,0.22);
            background: rgba(255,255,255,0.08);
        }

    /* CTA button */
    body.auth-mode .auth-actions {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        margin-top: 2px;
    }

    body.auth-mode .auth-btn {
        border: 0;
        cursor: pointer;
        border-radius: 999px;
        padding: 12px 16px;
        font-size: 15px;
        font-weight: 800;
        color: #060b10;
        background: linear-gradient(135deg, rgba(24,198,198,1), rgba(46,227,163,1));
    }

        body.auth-mode .auth-btn:active {
            transform: scale(0.99);
        }

    body.auth-mode .auth-msg {
        margin-top: 10px;
        font-size: 13px;
        color: rgba(234,243,255,0.75);
    }

/* Mobile */
@media (max-width: 480px) {
    body.auth-mode .auth-shell {
        padding: 16px;
        border-radius: 20px;
    }

    body.auth-mode .auth-logo {
        width: 36px;
        height: 36px;
    }

    body.auth-mode .auth-name {
        font-size: 20px;
    }
}

body {
    margin: 0;
    padding: 22px;
    font-family: Arial, sans-serif;
    background: #f5f5f5;
    color: #111;
    visibility: visible;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

#auth input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 16px;
}


.header-actions {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

    .header-actions .sub {
        text-align: right;
    }

/* Auth screen layout */
body.auth-mode {
    padding: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

    /* Make the auth card responsive and nicely centered */
    body.auth-mode #auth {
        margin: 0;
        width: min(520px, calc(100vw - 48px));
    }



.logout-btn {
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}



header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  max-width: 1400px;
  margin: 0 auto 12px auto;
}

.chip.active {
  background: #111;
  color: #fff;
  border-color: #111;
}

h1 {
  margin: 0;
  font-size: 26px;
}

.sub {
  font-size: 14px;
  opacity: 0.75;
  text-align: right;
}

.controls {
  max-width: 1400px;
  margin: 0 auto 12px auto;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  transition: background 120ms ease, border-color 120ms ease;
}

.chip:hover {
  background: #f0f0f0;
  border-color: #ccc;
}

.hint {
  font-size: 13px;
  opacity: 0.75;
}

.map-wrap {
  max-width: 1400px;
  margin: 0 auto 18px auto;
}

#map {
    width: 100%;
    height: 420px;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(0,0,0,0.12);
    overflow: hidden;
}

/* Phone sizing: use dynamic viewport units so it fits better */
@media (max-width: 620px) {
    #map {
        height: 38dvh;
        min-height: 260px;
        max-height: 340px;
    }
}

.section-head {
  max-width: 1400px;
  margin: 0 auto 10px auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 18px;
}

.section-sub {
  font-size: 13px;
  opacity: 0.75;
  text-align: right;
}

/* Grid */
.grid {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(520px, 1fr));
  gap: var(--gap);
}

.camera-card {
    position: relative; /* NEW: for badge overlay */
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    user-select: none;
    transition: transform 120ms ease, box-shadow 120ms ease;
}

    /* NEW: selected card styling */
    .camera-card.is-selected {
        outline: 3px solid rgba(17,17,17,0.95);
        outline-offset: -3px;
        box-shadow: 0 14px 34px rgba(0,0,0,0.20);
    }

/* NEW: camera id badge on thumbnail */
.cam-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(0,0,0,0.72);
    border: 1px solid rgba(255,255,255,0.35);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.2px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    pointer-events: none;
}

/* Slightly stronger when selected */
.camera-card.is-selected .cam-badge {
    background: rgba(17,17,17,0.88);
    border-color: rgba(255,255,255,0.55);
}


.camera-card:hover {
  transform: scale(1.01);
  box-shadow: 0 10px 28px rgba(0,0,0,0.15);
}

.thumb {
  width: 100%;
  height: 360px;
  object-fit: cover;
  display: block;
  background: #e9e9e9;
}

.camera-info {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  background: #fafafa;
  font-size: 14px;
  border-top: 1px solid #eee;
  gap: 12px;
}

.camera-name {
  font-weight: 600;
}

.camera-meta {
  opacity: 0.75;
  white-space: nowrap;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.78);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9999;
}

.modal-backdrop.open {
  display: flex;
}

.modal-content {
  width: 100%;
  height: 100%;
  max-width: 1600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-toolbar {
  display: flex;
  justify-content: space-between;
  color: #fff;
  gap: 12px;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.btn {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}

.btn:hover {
  background: rgba(255,255,255,0.22);
  transform: translateY(-1px);
}

.modal-image-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-image {
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  background: #111;
}

/* Numbered pins (small circle) */
.cam-pin {
  background: transparent;
  border: none;
}

.cam-pin-inner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid #ffffff;
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);

  display: flex;
  align-items: center;
  justify-content: center;

  color: #ffffff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  text-align: center;

  user-select: none;
  pointer-events: auto;
}

/* Responsive */
@media (max-width: 620px) {
  body {
    padding: 14px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .thumb {
    height: 300px;
  }
}

.basis-pin-inner {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #A40026;
  border: 3px solid #fff;
  box-shadow: 0 8px 18px rgba(0,0,0,0.4);
  position: relative;
}

.basis-pin-inner::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(17,17,17,0.25);
}

.basis-pin {
  background: transparent !important;
  border: none !important;
}

.chip[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.warn {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #f3c6c6;
    background: #fff3f3;
    font-size: 14px;
}

/*SEARCH form address
 Search bar + dropdown */

.search-wrap {
    position: relative;
    min-width: 0; /* allow shrinking */
    flex: 1 1 auto;
}

.controls:has(.route-actions[style*="inline-flex"]) {
    flex-wrap: nowrap;
}


#searchBox {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 16px;
    outline: none;
}


    #searchBox:focus {
        border-color: #bbb;
    }

.search-dd {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.12);
    overflow: hidden;
    display: none;
    z-index: 2000;
    max-height: 280px;
    overflow-y: auto;
}

    .search-dd.open {
        display: block;
    }

.search-item {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.2;
    border-top: 1px solid #f1f1f1;
}

    .search-item:first-child {
        border-top: none;
    }

    .search-item:hover,
    .search-item.active {
        background: #f3f3f3;
    }

    .search-item .small {
        display: block;
        margin-top: 4px;
        font-size: 12px;
        opacity: 0.75;
    }


/* Segmented direction control */
.segmented {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #ddd;
    border-radius: 999px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
}

.seg-btn {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 10px 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px; /* also keeps iOS happy */
    line-height: 1;
    user-select: none;
    touch-action: manipulation;
}

    .seg-btn + .seg-btn {
        border-left: 1px solid #eee;
    }

.seg-ico {
    font-size: 18px;
    opacity: 0.9;
}

.seg-txt {
    font-weight: 700;
}

/* Your JS toggles .active on the clicked button */
.seg-btn.active {
    background: #111;
    color: #fff;
}

/* Make it feel nice on press */
.seg-btn:active {
    transform: scale(0.99);
}

/* Small phones: tighten a little */
@media (max-width: 620px) {
    .seg-btn {
        padding: 10px 12px;
        gap: 6px;
    }
}


@media (max-width: 620px) {
    #dirControls .hint {
        flex-basis: 100%;
    }
}


/* Accordion (details/summary) */
.accordion {
    width: 100%;
    max-width: 520px;
    border: 1px solid #ddd;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    overflow: hidden;
}

.accordion-summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 14px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    user-select: none;
    font-size: 16px; /* helps iOS avoid odd zoom behaviors */
}

    .accordion-summary::-webkit-details-marker {
        display: none;
    }

.accordion-sub {
    font-size: 13px;
    opacity: 0.7;
}

.accordion-body {
    padding: 12px 14px 14px 14px;
    border-top: 1px solid #eee;
}

/* Optional: a small chevron indicator */
.accordion-summary::after {
    content: "▾";
    opacity: 0.7;
    margin-left: auto;
}

.accordion[open] .accordion-summary::after {
    content: "▴";
}





.search-item--info {
    opacity: 0.7;
    font-style: italic;
}


/* Centered-on info inside accordion */
.centered-on {
    margin-bottom: 14px;
}

.centered-label {
    font-size: 12px;
    opacity: 0.65;
    margin-bottom: 4px;
}

.centered-text {
    font-size: 14px;
    line-height: 1.25;
    color: #111;
    /* Clamp to 2 lines so it never explodes */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* Gear + dropdown config menu */
.config-wrap {
  position: relative;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.icon-btn:active {
  transform: scale(0.98);
}

.config-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: min(520px, calc(100vw - 28px));
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.12);
  padding: 12px;
  z-index: 3000;
  display: none;
}

.config-menu.open {
  display: block;
}

.config-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}

.config-section {
  display: grid;
  gap: 8px;
}

.config-label {
  font-size: 12px;
  opacity: 0.7;
}

.config-hint {
  font-size: 12px;
  opacity: 0.65;
}

/* Centered-on card (always visible) */
.centered-card {
  flex: 1;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.08);
  padding: 10px 12px;
}

.centered-label {
  font-size: 12px;
  opacity: 0.65;
  margin-bottom: 4px;
}

.centered-value {
    font-size: 14px;
    line-height: 1.25;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    display: block;
}


/* Segmented direction control (better than chips for a compact menu) */
.segmented {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid #ddd;
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
}

.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 10px 14px;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  gap: 8px;

  font-size: 16px;
  line-height: 1;
  user-select: none;

  touch-action: manipulation;
}

.seg-btn + .seg-btn {
  border-left: 1px solid #eee;
}

.seg-ico {
  font-size: 18px;
  opacity: 0.9;
}

.seg-txt {
  font-weight: 700;
}

.seg-btn.active {
  background: #111;
  color: #fff;
}

/* Gear + dropdown config menu */
.config-wrap {
    position: relative;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

    .icon-btn:active {
        transform: scale(0.98);
    }

.config-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: min(520px, calc(100vw - 28px));
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 14px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.12);
    padding: 12px;
    z-index: 3000;
    display: none;
}

    .config-menu.open {
        display: block;
    }

.config-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
}

.config-section {
    display: grid;
    gap: 8px;
}

.config-label {
    font-size: 12px;
    opacity: 0.7;
}

.config-hint {
    font-size: 12px;
    opacity: 0.65;
}

/* Centered-on card (always visible) */
.centered-card {
    flex: 1;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(0,0,0,0.08);
    padding: 10px 12px;
}

.centered-label {
    font-size: 12px;
    opacity: 0.65;
    margin-bottom: 4px;
}

.centered-value {
    font-size: 14px;
    line-height: 1.25;
    /* Clamp to 2 lines so it never gets awkward */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Segmented direction control (better than chips for a compact menu) */
.segmented {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #ddd;
    border-radius: 999px;
    background: #fff;
    overflow: hidden;
}

.seg-btn {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 10px 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    line-height: 1;
    user-select: none;
    touch-action: manipulation;
}

    .seg-btn + .seg-btn {
        border-left: 1px solid #eee;
    }

.seg-ico {
    font-size: 18px;
    opacity: 0.9;
}

.seg-txt {
    font-weight: 700;
}

.seg-btn.active {
    background: #111;
    color: #fff;
}


/* Gear + centered-on row */
.config-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

    /* Keep gear fixed size */
    .config-row .config-wrap {
        flex: 0 0 auto;
    }

    /* Let centered card fill remaining space */
    .config-row .centered-card {
        flex: 1 1 auto;
        min-width: 0; /* critical so ellipsis works */
    }


    /* Header hamburger menu */
.menu-wrap {
  position: relative;
}

.menu-dd {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;

  width: 180px;
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.12);
  padding: 8px;
  z-index: 4000;

  display: none;
}

.menu-dd.open {
  display: block;
}

.menu-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}

.menu-item:hover {
  background: #f3f3f3;
}


.cam-pin-inner.is-selected {
    transform: scale(1.25);
    border-width: 2.5px;
    box-shadow: 0 10px 22px rgba(0,0,0,0.45);
    outline: 3px solid rgba(255,255,255,0.85);
    outline-offset: 2px;
}

/* Spacer keeps layout from jumping when map becomes fixed */
.map-pip-spacer {
    height: 0;
    transition: height 220ms ease;
}

/* PiP mode */
body.map-pip .map-pip-spacer {
    display: block;
}

#mapWrap {
    transition: top 220ms ease, left 220ms ease, width 220ms ease, height 220ms ease, transform 220ms ease;
}

body.map-pip #mapWrap {
    position: fixed;
    right: 12px;
    top: calc(12px + env(safe-area-inset-top));
    width: min(56vw, 260px);
    height: 150px;
    margin: 0;
    z-index: 5000;
}

/* Make Leaflet map fill the PiP */
body.map-pip #map {
    width: 100%;
    height: 100%;
    border-radius: 14px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.22);
}

/* Small phones */
@media (max-width: 620px) {
    body.map-pip #mapWrap {
        width: min(56vw, 260px);
        height: 150px;
        right: 10px;
        top: calc(10px + env(safe-area-inset-top));
    }
}

.route-actions {.controls.config-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0; /* never collapse buttons */
}

    .route-actions .chip {
        padding: 8px 10px;
        font-size: 14px;
        white-space: nowrap;
    }

/* Config bar must never wrap to a second line */
.controls.config-row {
    flex-wrap: nowrap;
}


