/* TruckNav -- Garmin dezl OTR710 replica layout */
/* 3-zone: green turn banner | map | white data bar */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0d0d1a;
    color: #e0e0e0;
    user-select: none;
    -webkit-user-select: none;
    display: flex;
    flex-direction: column;
}

/* ══ Zone 1: Header Bar (passive — no active route) ══ */
#header-bar {
    flex: 0 0 56px;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    padding: 0 10px;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    gap: 8px;
}

.app-title {
    font-size: 18px;
    font-weight: 700;
    color: #7eb8ff;
    letter-spacing: 1px;
    flex-shrink: 0;
}

#search-wrapper {
    flex: 1;
    position: relative;
}

#search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 15px;
    padding: 8px 14px;
    outline: none;
}

#search-input:focus {
    border-color: #7eb8ff;
}

#search-input::placeholder {
    color: #666;
}

/* ── Autocomplete Dropdown ── */
#search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e1e30;
    border: 1px solid rgba(126, 184, 255, 0.3);
    border-top: none;
    border-radius: 0 0 8px 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    z-index: 500;
    max-height: 220px;
    overflow-y: auto;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

#search-results.active {
    display: block;
}

#search-results li {
    padding: 10px 14px;
    color: #d0e0ff;
    font-size: 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#search-results li:last-child {
    border-bottom: none;
}

#search-results li:active {
    background: rgba(126, 184, 255, 0.2);
}

#gear-button,
#mic-button-header {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #888;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

#mic-button-header {
    color: #7eb8ff;
}

#gear-button:active,
#mic-button-header:active {
    color: #7eb8ff;
}

#mic-button-header.listening {
    background: rgba(126, 184, 255, 0.15);
}

/* ══ Zone 1: Turn Banner (active nav — Garmin GREEN) ══ */
#turn-banner {
    flex: 0 0 auto;
    min-height: 60px;
    background: #2d8a2d;
    display: none;
    align-items: center;
    padding: 8px 16px;
    z-index: 100;
    gap: 10px;
}

#turn-banner.active {
    display: flex;
}

.turn-distance {
    font-size: 28px;
    font-weight: 800;
    color: #ffffff;
    white-space: nowrap;
    min-width: 70px;
}

.turn-arrow {
    font-size: 30px;
    color: #ffffff;
    min-width: 36px;
    text-align: center;
}

.turn-street {
    flex: 1;
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
}

/* ══ Zone 2: Map Container ══ */
#map-container {
    flex: 1;
    position: relative;
    z-index: 1;
    min-height: 0;
}

/* ══ Zone 3: Data Bar (Garmin WHITE) ══ */
#info-bar {
    flex: 0 0 70px;
    background: #ffffff;
    display: flex;
    align-items: stretch;
    padding: 0;
    z-index: 100;
    border-top: 2px solid #cccccc;
}

/* Data bar cells */
.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    min-width: 0;
    border-right: 1px solid #ddd;
}

.info-item:last-child {
    border-right: none;
}

.info-item .info-value {
    font-size: 18px;
    font-weight: 700;
    color: #222;
    line-height: 1.1;
    white-space: nowrap;
}

.info-item .info-label {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

/* Speed cell — largest number on bar */
.info-item-speed {
    min-width: 80px;
}

.info-item-speed .info-value {
    font-size: 32px;
    font-weight: 800;
    color: #111;
}

.speed-unit {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    vertical-align: super;
    margin-left: 1px;
}

.info-item-speed .info-label {
    font-size: 11px;
    color: #666;
}

/* Road name cell — fills remaining space */
.info-item-road {
    flex: 1;
    min-width: 0;
}

#road-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Arrival/ETA cell (nav-only) */
.nav-info {
    display: none;
}

.nav-info.active {
    display: flex;
}

.info-item-arrival .info-value {
    font-size: 20px;
    font-weight: 700;
    color: #222;
}

.info-item-arrival .info-label {
    font-size: 11px;
    color: #888;
}

/* Edge buttons on data bar (back / menu) */
.bar-edge-btn {
    width: 44px;
    border: none;
    background: #f0f0f0;
    color: #444;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.bar-edge-btn:first-child {
    border-right: 1px solid #ddd;
}

.bar-edge-btn:last-child {
    border-left: 1px solid #ddd;
}

.bar-edge-btn:active {
    background: #e0e0e0;
}

/* ══ Speed Limit Box (Garmin "LIMIT XX" — left map edge) ══ */
#speed-limit-box {
    position: fixed;
    left: 12px;
    z-index: 150;
    background: #ffffff;
    border: 3px solid #111;
    border-radius: 3px;
    padding: 2px 6px 4px;
    display: none;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Positioned dynamically — default bottom-left above data bar */
#speed-limit-box {
    bottom: 150px;
}

.limit-label {
    font-size: 9px;
    font-weight: 700;
    color: #111;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

.limit-value {
    font-size: 22px;
    font-weight: 800;
    color: #111;
    line-height: 1;
}

#speed-limit-box.exceeded {
    border-color: #d32f2f;
    background: #fff0f0;
}

#speed-limit-box.exceeded .limit-value {
    color: #d32f2f;
}

/* ══ Zoom Buttons (Garmin left edge) ══ */
.map-zoom-buttons {
    position: fixed;
    left: 12px;
    z-index: 150;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Vertically centered in map area */
.map-zoom-buttons {
    top: 45%;
    transform: translateY(-50%);
}

.map-zoom-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #bbb;
    background: rgba(255, 255, 255, 0.92);
    color: #333;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.map-zoom-btn:first-child {
    border-radius: 4px 4px 0 0;
    border-bottom: none;
}

.map-zoom-btn:last-child {
    border-radius: 0 0 4px 4px;
}

.map-zoom-btn:active {
    background: #ddd;
}

/* ══ Right-Edge Map Buttons (Garmin icon stack) ══ */
.map-edge-buttons {
    position: fixed;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 150;
}

.map-edge-btn {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 30, 45, 0.85);
    color: #ffffff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.map-edge-btn:active {
    background: rgba(60, 60, 80, 0.95);
}

/* ══ Floating Mic Button ══ */
#mic-button {
    position: fixed;
    bottom: 86px;
    right: 14px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: none;
    background: #2d8a2d;
    color: #ffffff;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s;
}

#mic-button:active {
    transform: scale(0.92);
}

#mic-button.listening {
    background: #388e3c;
    box-shadow: 0 0 0 6px rgba(45, 138, 45, 0.3);
    animation: mic-pulse 1.5s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 6px rgba(45, 138, 45, 0.3); }
    50% { box-shadow: 0 0 0 14px rgba(45, 138, 45, 0.1); }
}

/* ══ Stop Navigation Button ══ */
#stop-nav-btn {
    position: fixed;
    bottom: 86px;
    left: 14px;
    height: 42px;
    padding: 0 16px;
    border-radius: 21px;
    border: none;
    background: rgba(180, 40, 40, 0.9);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    z-index: 200;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 6px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

#stop-nav-btn.active {
    display: flex;
}

#stop-nav-btn:active {
    background: rgba(200, 50, 50, 1);
}

/* ══ Voice Toast ══ */
#voice-toast {
    position: fixed;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 58, 95, 0.95);
    color: #d0e0ff;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 15px;
    z-index: 400;
    display: none;
    max-width: 80%;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

#voice-toast.active {
    display: block;
    animation: toast-in 0.3s ease;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ══ Highway Shield Markers ══ */
.highway-shield-wrapper {
    background: none !important;
    border: none !important;
}

.hwy-shield {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 11px;
    line-height: 1;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.hwy-shield span {
    display: block;
}

/* Interstate — blue shield with red top stripe (Garmin style) */
.hwy-shield.interstate {
    background: #003da5;
    color: #ffffff;
    min-width: 36px;
    height: 28px;
    padding: 2px 5px 4px;
    border-radius: 3px;
    border-top: 5px solid #bf0a30;
    font-size: 13px;
    clip-path: polygon(0% 12%, 8% 0%, 92% 0%, 100% 12%, 100% 100%, 50% 82%, 0% 100%);
    min-height: 32px;
    padding-top: 5px;
    padding-bottom: 8px;
}

/* US Route — black & white shield */
.hwy-shield.us-route {
    background: #ffffff;
    color: #000000;
    min-width: 32px;
    height: 26px;
    padding: 0 5px;
    border: 2px solid #000000;
    border-radius: 13px;
    font-size: 12px;
}

/* State Route — circle */
.hwy-shield.state-route {
    background: #ffffff;
    color: #000000;
    width: 30px;
    height: 30px;
    border: 2px solid #000000;
    border-radius: 50%;
    font-size: 11px;
}

/* ══ Leaflet overrides ══ */
.leaflet-control-attribution {
    font-size: 10px !important;
    background: rgba(255, 255, 255, 0.5) !important;
    color: #666 !important;
}

.truck-marker {
    background: none !important;
    border: none !important;
}
