/* ===== MAP PAGE LAYOUT ===== */

.letter-spacing-1 {
    letter-spacing: 0.05em;
}

.hillshade-overlay {
    mix-blend-mode: multiply;
}

/* ===== ICON RAIL ===== */
.map-icon-rail .btn:focus {
    outline: none;
    box-shadow: none;
}

.rail-tab.active {
    background-color: var(--accent-bronze, #9B7C58) !important;
    color: #fff !important;
    border-color: var(--accent-bronze, #9B7C58) !important;
}

/* ===== DEVICE LIST ===== */
.device-row {
    transition: background-color var(--transition-fast, 0.15s);
    cursor: default;
}

.device-row:hover {
    background-color: var(--bg-hover, rgba(0,0,0,0.03));
}

.device-row-enabled {
    background-color: rgba(77, 122, 94, 0.1);
    border-left: 3px solid var(--status-success, #4D7A5E);
}

.device-row-enabled:hover {
    background-color: rgba(77, 122, 94, 0.15);
}

.device-row-focused {
    background-color: rgba(139, 115, 85, 0.12);
    border-left: 3px solid var(--accent-bronze, #8B7355);
    box-shadow: inset 0 0 0 1px rgba(139, 115, 85, 0.2);
    position: relative;
}

.device-row-focused::after {
    content: 'FOCUSED';
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    background-color: var(--accent-bronze, #8B7355);
    padding: 1px 5px;
    border-radius: 3px;
    opacity: 0.85;
}

.device-list {
    margin: 0 -1rem;
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.map-layout {
    overflow: hidden;
    min-height: 0;
}

.map-body {
    overflow: hidden;
    min-height: 0;
}

.map-sidebar {
    width: 300px;
    min-width: 300px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-sidebar, #EEE9E2);
    transition: width var(--transition-normal, 0.2s ease), min-width var(--transition-normal, 0.2s ease);
}

.map-sidebar-content {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

.sidebar-panel {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
}

.map-sidebar.collapsed {
    width: 0;
    min-width: 0;
    overflow: hidden;
}

.map-sidebar-toggle {
    position: absolute;
    top: 8px;
    left: 60px;
    z-index: 1000;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm, 4px);
    background: var(--bg-panel, #fff);
    box-shadow: var(--shadow-panel, 0 1px 5px rgba(0,0,0,0.3));
    cursor: pointer;
    font-size: 16px;
    line-height: 32px;
    text-align: center;
    padding: 0;
    transition: left var(--transition-normal, 0.2s ease);
}

.map-sidebar-toggle.shifted {
    left: 360px;
}

.map-sidebar-header {
    background-color: var(--bg-sidebar, #EEE9E2);
}

/* ===== BOTTOM BAR ===== */
.map-bottom-bar {
    flex-shrink: 0;
    overflow: hidden;
    transition: height 0.25s ease;
}

.map-bottom-bar.collapsed {
    height: 36px !important;
}

.bottom-bar-header {
    height: 36px;
    min-height: 36px;
    cursor: pointer;
    user-select: none;
}

#bottomBarBtn:focus {
    outline: none;
    box-shadow: none;
}

.bottom-bar-body {
    height: 220px;
    overflow: hidden;
}

.datalog-wrap {
    overflow-y: auto;
    max-height: 200px;
}

.datalog-table {
    font-size: 0.78rem;
}

.datalog-table th,
.datalog-table td {
    padding: 0.2rem 0.4rem;
    white-space: nowrap;
}

.datalog-table tr.active-row {
    background-color: rgba(13, 110, 253, 0.12);
}

.speed-graph {
    height: 190px;
    position: relative;
}

.speed-graph canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ===== STATUS INDICATOR (centered on map) ===== */
.map-status-indicator {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: var(--overlay-glass, rgba(255,255,255,0.92));
    backdrop-filter: blur(8px);
    padding: 4px 14px;
    border-radius: 20px;
    box-shadow: var(--shadow-panel, 0 2px 6px rgba(0,0,0,0.15));
    font-size: 0.78rem;
    pointer-events: none;
    white-space: nowrap;
}

/* ===== WIDGETS (right overlay) ===== */
.map-widgets {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 999;
    width: 280px;
    max-height: calc(100% - 16px);
    overflow-y: auto;
    pointer-events: none;
}

.widget-card {
    pointer-events: auto;
    font-size: 0.8rem;
    background: var(--overlay-glass, rgba(255,255,255,0.96));
    backdrop-filter: blur(8px);
    border-radius: var(--radius-md, 12px);
    border-color: var(--border-primary, #D5CFC7);
}

.widget-card .table {
    --bs-table-bg: transparent;
}

.widget-card .card-header {
    padding: 0.35rem 0.6rem;
    font-weight: 600;
    font-size: 0.78rem;
}

.widget-card .card-body {
    padding: 0.4rem 0.6rem;
}

.widget-card table td {
    padding: 0.15rem 0.3rem;
    border: none;
    font-size: 0.78rem;
}

.widget-card table td:first-child {
    color: #6c757d;
    white-space: nowrap;
    width: 90px;
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.status-dot.moving { background: #28a745; }
.status-dot.stopped { background: #ffc107; }
.status-dot.offline { background: #dc3545; }

/* ===== VEHICLE MARKER ===== */
.vehicle-div-icon {
    background: transparent !important;
    border: none !important;
}

.vehicle-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    color: inherit;
    filter: drop-shadow(0 0 1px rgba(0,0,0,0.3));
    text-align: center;
    transition: transform 0.3s ease;
}

.vehicle-icon svg {
    width: 100%;
    height: 100%;
    display: block;
    paint-order: stroke fill;
}

/* ===== FOCUS BUTTON ===== */
.focus-btn {
    font-size: 14px;
    line-height: 1;
    text-decoration: none !important;
    opacity: 0.4;
    transition: opacity 0.15s;
}

.focus-btn:hover {
    opacity: 0.8;
}

.focus-btn.focused {
    opacity: 1;
}

/* ===== LIVE INDICATOR ===== */
.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc3545;
    animation: pulse 1.5s infinite;
    margin-right: 4px;
    vertical-align: middle;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

/* ===== MOBILE: hide widgets overlay ===== */
@media (max-width: 767.98px) {
    .map-widgets {
        display: none !important;
    }

    .is-chrome .map-icon-rail {
        padding-bottom: 5px !important;
    }

    .is-chrome .map-bottom-bar {
        margin-bottom: 60px;
    }

    .is-chrome.is-ios .map-bottom-bar {
        margin-bottom: 110px;
    }

    .is-safari header > nav:first-child {
        padding-top: env(safe-area-inset-top, 0px) !important;
    }

    .is-safari .map-bottom-bar {
        margin-bottom: calc(env(safe-area-inset-bottom, 50px) + 44px);
    }
}
