html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
}

/* === MyRouteMap Map-First Shell === */

/* Full-height app */
html, body {
    height: 100%;
}

.mrm-body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Header bar */
.mrm-header {
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: linear-gradient(90deg, #0b3a66, #0f63a8);
    color: #fff;
    box-shadow: 0 4px 18px rgba(0,0,0,.18);
    z-index: 20;
    position: relative;
    box-sizing: border-box;
}

.mrm-logo {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: .2px;
}

.mrm-subtitle {
    font-size: 12px;
    opacity: .85;
}

.mrm-shell {
    height: calc(100vh - 68px - 32px);
    display: flex;
    position: relative;
}

/* Left panel */
.mrm-left {
    width: 420px;
    min-width: 360px;
    max-width: 520px;
    background: rgba(10, 48, 90, 0.94);
    color: #eaf4ff;
    border-right: 1px solid rgba(255,255,255,.08);
    backdrop-filter: blur(8px);
    z-index: 10;
    overflow: auto;
}

/* Map */
.mrm-map-wrap {
    flex: 1;
    position: relative;
}

.mrm-map {
    position: absolute;
    inset: 0;
}

/* Tabs/menu */
.mrm-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 12px 8px 12px;
    border-bottom: 1px solid rgba(255,255,255,.10);
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(10, 48, 90, 0.94);
    backdrop-filter: blur(8px);
}

.mrm-tab {
    flex: 1;
    padding: 10px 10px;
    border-radius: 12px;
    background: rgba(255,255,255,.10);
    color: #eaf4ff;
    border: 1px solid rgba(255,255,255,.10);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
}

    .mrm-tab.active {
        background: rgba(255,255,255,.18);
        border-color: rgba(255,255,255,.18);
    }

    /* Second-row buttons under tabs (Save/Clear/Spacer) */
    .mrm-tab.mrm-tab-sub {
        font-size: 12px;
        padding: 8px 10px;
        font-weight: 600;
    }

    .mrm-tab.mrm-tab-danger {
        background: rgba(255,70,70,.14);
        border-color: rgba(255,70,70,.20);
    }

        .mrm-tab.mrm-tab-danger:hover {
            background: rgba(255,70,70,.20);
        }

    .mrm-tab.mrm-tab-placeholder {
        opacity: .35;
        cursor: default;
    }

.mrm-panel {
    padding: 12px;
}

.mrm-card {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 10px 26px rgba(0,0,0,.22);
}

/* Inline Save Route panel (appears under the top buttons, above Add Point) */
.mrm-savebar {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 10px 26px rgba(0,0,0,.22);
    margin-bottom: 12px;
}

.mrm-savebar-title {
    font-weight: 800;
    margin-bottom: 8px;
}

.mrm-savebar-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

    .mrm-savebar-actions .mrm-btn {
        width: auto;
        flex: 1;
    }

.mrm-label {
    font-size: 12px;
    opacity: .85;
}

.mrm-input {
    width: 100%;
    padding: 10px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(0,0,0,.18);
    color: #fff;
    outline: none;
}

.mrm-btn {
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    border: 0;
    background: #39a6ff;
    color: #06233e;
    font-weight: 800;
}

    .mrm-btn:hover {
        filter: brightness(1.05);
    }


/* Validation success cue */
.mrm-validated {
    outline: 2px solid rgba(70, 220, 140, 0.9);
    box-shadow: 0 0 0 4px rgba(70, 220, 140, 0.18);
}


/* Login partial in header */
.mrm-login ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 12px;
    align-items: center;
}

.mrm-login .nav-link {
    color: #fff !important;
    opacity: .92;
    padding: 0;
}

    .mrm-login .nav-link:hover {
        opacity: 1;
        text-decoration: underline;
    }

.mrm-login button.nav-link {
    border: 0;
    background: transparent;
    cursor: pointer;
}

/* Right-click context menu */
.mrm-ctx {
    color: #fff;
    position: fixed;
    z-index: 9999;
    /* Avoid "fill available width" behavior that can create a large empty area */
    width: auto;
    min-width: 240px;
    max-width: 320px;
    background: rgba(15, 25, 40, .96);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 14px;
    padding: 6px;
    box-shadow: 0 18px 40px rgba(0,0,0,.35);
}

    /* Allow more width only when the Favorites submenu is actually shown */
    .mrm-ctx.has-sub {
        max-width: 680px;
    }

    .mrm-ctx .mrm-ctx-title {
        font-size: 12px;
        opacity: .85;
        padding: 4px 6px 6px 6px;
    }

    .mrm-ctx button {
        width: 100%;
        text-align: left;
        /* tighter spacing so long menus fit without blocking the map */
        padding: 3px 6px;
        background: transparent;
        color: #fff;
        border: 0;
        border-radius: 10px;
    }

        .mrm-ctx button:hover {
            background: rgba(255,255,255,.08);
        }

    .mrm-ctx .mrm-ctx-muted {
        font-size: 12px;
        opacity: .85;
        padding: 6px;
    }

    /* Two-panel context menu (root + submenu) */
    .mrm-ctx .mrm-ctx-panels {
        display: flex;
        /* No gap between panels so the pointer can move into the submenu reliably */
        gap: 0;
        align-items: flex-start;
    }

    .mrm-ctx .mrm-ctx-panel {
        min-width: 240px;
    }

        .mrm-ctx .mrm-ctx-panel.mrm-ctx-sub {
            /* Hidden unless explicitly opened (Insert Favorite...) */
            display: none;
            min-width: 280px;
            border-left: 1px solid rgba(255,255,255,.12);
            /* Provide spacing inside the submenu without creating an external gap */
            padding-left: 10px;
        }

    .mrm-ctx.has-sub .mrm-ctx-panel.mrm-ctx-sub {
        display: block;
    }

    .mrm-ctx .mrm-ctx-arrow {
        float: right;
        opacity: .75;
    }

/* Context menu: compact submenu headers/lists */
.mrm-ctx-head {
    font-size: 12px;
    font-weight: 700;
    opacity: .9;
    padding: 4px 6px 6px 6px;
}

.mrm-ctx-hint {
    font-size: 12px;
    opacity: .8;
    padding: 4px 6px;
}

.mrm-ctx-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Secondary action button */
.mrm-btn-secondary {
    background: #3a5876;
    color: #e8eef6;
    font-weight: 700;
}

    .mrm-btn-secondary:hover {
        filter: brightness(1.05);
    }

.mrm-ctx-sep {
    height: 1px;
    background: rgba(255,255,255,.12);
    margin: 2px 0;
}

/* Leaflet: use an arrow cursor on the map surface (easier for precise point selection) */
.leaflet-container,
.leaflet-container.leaflet-grab,
.leaflet-container.leaflet-touch-drag,
.leaflet-container.leaflet-drag-target,
.leaflet-container .leaflet-grab,
.leaflet-container .leaflet-drag-target {
    cursor: default !important;
}

.leaflet-control-zoom a {
    cursor: pointer !important;
}

.mrm-stoprow {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 6px 6px;
    border-radius: 10px;
    cursor: default;
}

    .mrm-stoprow:hover {
        background: rgba(255,255,255,.06);
    }

.mrm-stopicon {
    width: 22px;
    text-align: center;
    opacity: .95;
    margin-top: 2px;
}

.mrm-stoptext {
    flex: 1;
    line-height: 1.25;
}

/* Stop list: primary/secondary + inline actions */
.mrm-stopprimary {
    font-weight: 800;
}

.mrm-stopsecondary {
    font-size: 11px;
    opacity: .85;
    margin-top: 1px;
}

.mrm-stopactions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.mrm-iconbtn {
    background: transparent;
    border: 1px solid rgba(255,255,255,.14);
    color: #e8eef6;
    padding: 4px 7px;
    border-radius: 9px;
    line-height: 1;
}

    .mrm-iconbtn:hover {
        background: rgba(255,255,255,.06);
    }

    .mrm-iconbtn:active {
        transform: translateY(1px);
    }

/* Context menu: ensure submenu content is readable */
.mrm-contextmenu, .mrm-contextmenu * {
    color: #e8eef6;
}

    .mrm-contextmenu .muted, .mrm-contextmenu .loading {
        color: #c6d3e6;
    }

/* --- Leaflet numbered markers (divIcon) --- */
.mrm-marker-icon {
    background: transparent;
    border: none;
}

.mrm-marker-badge {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: rgba(46, 141, 255, .95);
    box-shadow: 0 8px 14px rgba(0,0,0,.35);
    border: 2px solid rgba(255,255,255,.35);
}

    .mrm-marker-badge span {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%,-50%) rotate(45deg);
        font-weight: 700;
        font-size: 13px;
        color: #fff;
        text-shadow: 0 1px 1px rgba(0,0,0,.45);
    }

/* Leaflet: use arrow cursor (default) instead of hand/grab */
.leaflet-container,
.leaflet-container.leaflet-grab,
.leaflet-container .leaflet-grab,
.leaflet-container.leaflet-drag-target {
    cursor: default !important;
}

    .leaflet-container .leaflet-control-zoom a,
    .leaflet-container .leaflet-control a {
        cursor: pointer !important;
    }


/* Tabs with mini action buttons */
.mrm-tabwrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.mrm-mini {
    width: 100%;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(255,255,255,.08);
    color: #eaf4ff;
    border: 1px solid rgba(255,255,255,.10);
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
}

    .mrm-mini:hover {
        background: rgba(255,255,255,.12);
    }

.mrm-mini-danger {
    background: rgba(255,70,70,.14);
    border-color: rgba(255,70,70,.20);
}

    .mrm-mini-danger:hover {
        background: rgba(255,70,70,.20);
    }

.mrm-mini-placeholder {
    height: 34px;
}
/* keeps equal height across tabs */


/* Slightly darker selects for readability (Favorites + Active Trip) */
.mrm-input-dark {
    background-color: rgba(0, 0, 0, 0.22);
}

/* Segmented control (Trips / Routes) */
.mrm-seg {
    display: inline-flex;
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 10px;
    overflow: hidden;
}

.mrm-segbtn {
    background: rgba(255,255,255,.06);
    color: rgba(255,255,255,.92);
    border: none;
    padding: 4px 10px;
    font-size: 13px;
}

    .mrm-segbtn + .mrm-segbtn {
        border-left: 1px solid rgba(255,255,255,.20);
    }

    .mrm-segbtn.active {
        background: rgba(255,255,255,.16);
        font-weight: 700;
    }

/* Compact route list */
.mrm-routeitem {
    border-bottom: 1px solid rgba(255,255,255,.10);
    padding: 6px 0;
    margin-bottom: 4px;
}

    .mrm-routeitem:last-child {
        border-bottom: none;
    }

.mrm-routehead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mrm-routename {
    font-weight: 800;
}

.mrm-routemeta {
    opacity: .85;
    font-size: 12px;
    margin-top: 2px;
}

/* ------------------------------------------------------------
   POI popup (Gas / Hotel / Food)
   - start over the left panel (not centered)
   - compact so user can see the map
   - draggable (grab header)
------------------------------------------------------------ */
#poiModal .mrm-poi-dialog {
    position: fixed;
    top: 86px; /* below header */
    left: 14px; /* over the left panel */
    margin: 0;
    width: 560px;
    max-width: calc(100vw - 28px);
    height: calc(100vh - 120px);
    transform: none !important; /* override bootstrap centering */
}

#poiModal .modal-content {
    height: 100%;
}

#poiModal .modal-body {
    overflow: auto;
}

#poiModal .modal-header {
    cursor: move;
    user-select: none;
}

/* Make list rows use space efficiently (removes empty middle space) */
#poiResults .poi-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

#poiResults .poi-main {
    flex: 1 1 auto;
    min-width: 0;
}

#poiResults .poi-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
}

/* Header: logged-in user label (right-justified, fixed width so button group stays aligned) */
.mrm-user {
    min-width: 260px;
    max-width: 360px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ffffff;
}


/* Header brand (logo + text) */
.mrm-header-left {
    display: flex;
    align-items: center;
    height: 100%;
}

.mrm-brand {
    display: flex;
    align-items: center;
    gap: 12px; /* was 100px */
    height: 100%; /* fill header height so centering works */
    padding: 0;
    margin: 0;
    line-height: 1; /* prevents anchor line-height from nudging alignment */
    color: #fff;
    text-decoration: none;
}

    .mrm-brand:hover {
        color: #fff;
        text-decoration: none;
        opacity: .95;
    }

.mrm-brand-logo {
    height: 100%; /* fill the brand container height */
    max-height: 64px; /* match .mrm-header height */
    width: auto;
    display: block;
}

/*.mrm-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}*/
/* Hide the brand text block next to the logo */
.mrm-brand-text {
    display: none !important;
}


/* --- FORCE header logo sizing + alignment --- */
.mrm-header {
    height: 64px;
    padding-top: 0;
    padding-bottom: 0;
}

.mrm-header-left {
    height: 100%;
    display: flex;
    align-items: center;
}

.mrm-brand {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0;
    margin: 0;
    line-height: 1;
}

/* Logo nearly touches header edges */
.mrm-brand-logo {
    height: 62px; /* near-full height of 64px header */
    width: auto;
    display: block;
}
/* ==== FINAL HEADER LOGO OVERRIDE ==== */

/* Lock header height */
.mrm-header {
    height: 64px !important;
    min-height: 64px !important;
    max-height: 64px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Force left container full height */
.mrm-header-left {
    height: 100% !important;
    display: flex !important;
    align-items: stretch !important;
}

/* Force brand to fill header */
.mrm-brand {
    height: 100% !important;
    display: flex !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Force logo to fill brand */
.mrm-brand-logo {
    height: 100% !important;
    max-height: 64px !important;
    min-height: 64px !important;
    width: auto !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}
/* Header slogan (logged-in only) */
.mrm-header-slogan {
    margin-left: 12px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .3px;
    color: rgba(255,255,255,.9);
    white-space: nowrap;
    line-height: 1;
    display: flex;
    align-items: center;
}

/* === Admin (Dark Theme Overrides) === */
.mrm-admin {
    color: #eaf4ff;
}

.mrm-admin h1,
.mrm-admin h2,
.mrm-admin h3,
.mrm-admin h4,
.mrm-admin h5 {
    color: #ffffff;
}

.mrm-admin .text-muted {
    color: rgba(234, 244, 255, 0.72) !important;
}

.mrm-admin .card {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    color: #eaf4ff;
    box-shadow: 0 10px 26px rgba(0,0,0,.22);
}

.mrm-admin .alert-info {
    background: rgba(57, 166, 255, 0.16);
    border-color: rgba(57, 166, 255, 0.26);
    color: #eaf4ff;
}

.mrm-admin .table {
    color: #eaf4ff;
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255,255,255,.06);
    --bs-table-hover-bg: rgba(255,255,255,.08);
    --bs-table-border-color: rgba(255,255,255,.12);
}

.mrm-admin .table thead th {
    color: #ffffff;
    border-bottom-color: rgba(255,255,255,.18);
}

.mrm-admin .form-control,
.mrm-admin textarea.form-control {
    background: rgba(0,0,0,.18);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,.18);
}

.mrm-admin .form-control::placeholder {
    color: rgba(234, 244, 255, 0.65);
}

.mrm-admin .btn-outline-secondary,
.mrm-admin .btn-outline-dark,
.mrm-admin .btn-outline-primary,
.mrm-admin .btn-outline-warning,
.mrm-admin .btn-outline-success {
    color: #eaf4ff;
    border-color: rgba(255,255,255,.22);
}

.mrm-admin .btn-outline-secondary:hover,
.mrm-admin .btn-outline-dark:hover,
.mrm-admin .btn-outline-primary:hover,
.mrm-admin .btn-outline-warning:hover,
.mrm-admin .btn-outline-success:hover {
    background: rgba(255,255,255,.12);
    border-color: rgba(255,255,255,.30);
    color: #ffffff;
}


/* Admin layout polish */
.mrm-admin .mrm-kpi-card .card-title {
    margin-bottom: .35rem;
}
.mrm-admin .mrm-kpi-card .display-6,
.mrm-admin .mrm-kpi-card .kpi-value {
    font-size: 2.25rem;
    line-height: 1.05;
    letter-spacing: .2px;
    white-space: nowrap;
}
.mrm-admin .mrm-kpi-card .btn {
    margin-top: auto;
}
.mrm-admin .btn.text-nowrap,
.mrm-admin .btn.w-100 {
    white-space: nowrap;
}
.mrm-admin .form-control {
    max-width: 100%;
}

.mrm-admin .btn-sm { padding: .35rem .75rem; }


/* Admin layout alignment */
.admin-tile-title{min-height:52px;}

/* Footer */
.mrm-footer {
  border-top: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.15);
  color: rgba(255,255,255,.85);
  font-size: 12px;
  padding: 10px 14px;
}

.mrm-footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.mrm-footer-sep {
  opacity: .6;
}

.mrm-footer-link {
  color: rgba(255,255,255,.9);
  text-decoration: none;
}

.mrm-footer-link:hover {
  text-decoration: underline;
}

/* Full-width authenticated pages (e.g., Demo) */
.mrm-full {
  padding: 18px;
  padding-bottom: 70px;
}

/* Footer (fixed so it is always visible even with map-first layout) */
.mrm-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 28, 52, 0.92);
    color: rgba(255,255,255,.85);
    z-index: 5;
    border-top: 1px solid rgba(255,255,255,.10);
    backdrop-filter: blur(8px);
    padding: 0 10px;
    box-sizing: border-box;
    pointer-events: none;
}


.mrm-footer-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mrm-footer-sep {
    opacity: .45;
}

.mrm-footer-link {
    color: rgba(255,255,255,.85);
    text-decoration: none;
}

.mrm-footer-link:hover {
    text-decoration: underline;
}


.mrm-footer a, .mrm-footer-link {
    pointer-events: auto;
}
