.map-main .row {
    gap: 16px;
    padding: 16px;
    border-top: none;
    align-items: stretch;
    height: 100%;
}

.sidebar-container {
    background-color: #fff;
    flex: 0 0 320px;
    max-width: 360px;
    height: 100%;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: hidden;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.sidebar-container.is-collapsed {
    display: none;
}

.form-container {
    background-color: transparent;
    padding: 0;
}

.list-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.count-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 11px;
    color: var(--color-muted);
    background: rgba(21, 110, 127, 0.06);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    gap: 8px;
}

.count-container span,
.count-container a {
    color: inherit;
}

.count-container a {
    text-decoration: none;
}

.count-container a:hover {
    color: var(--color-primary);
}

.count-container a.active-filter {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.marker-list {
    background-color: var(--color-panel);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow-y: auto;
    font-size: 12px;
    padding: 12px 16px 12px 12px;
    line-height: 1.5;
    text-align: left;
    scrollbar-gutter: stable both-edges;
    scrollbar-width: thin;
    scrollbar-color: rgba(21, 110, 127, 0.25) transparent;
}

.marker-list-item {
    background-color: #fff;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    margin-bottom: 8px;
    cursor: pointer;
}

.marker-list-item:hover {
    background-color: rgba(21, 110, 127, 0.08);
    border-color: var(--color-primary);
}

.marker-list-item .message-details {
    display: none;
    padding-left: 10px;
    padding: 7px;
    color: var(--color-text);
    font-size: 12px;
    border-left: 5px solid #B2C7D7;
    line-height: 1.2;
}

.map-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    padding: 0px;
    gap: 12px;
    min-height: 0;
    position: relative;
}

.map-main .row.is-sidebar-collapsed {
    padding-left: 16px;
    padding-right: 16px;
}

#map {
    flex: 1;
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    box-shadow: none;
}

/* Mobile layout */
@media (max-width: 768px) {
    .map-main .row {
        flex-direction: column;
    }

    .sidebar-container {
        flex: 0 0 auto;
        width: 100%;
        max-width: none;
    }
}

#vehicleSearchForm {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#vehicleSearchForm label {
    color: var(--color-muted);
    display: block;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: left;
    font-size: 12px;
}

#profileSelect {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 12px;
    background-color: #fff;
    color: var(--color-text);
}

.search-field-group {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: rgba(21, 110, 127, 0.06);
    padding-left: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-field-group:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(21, 110, 127, 0.12);
}

.search-field-group.is-disabled {
    opacity: 0.6;
}

.search-field-group.is-smart {
    background: rgba(21, 110, 127, 0.1);
}

#vehicleSearchInput {
    flex: 1;
    padding: 6px 10px;
    border: none;
    background: transparent;
    font-size: 12px;
    color: var(--color-text);
    outline: none;
    min-width: 0;
}

#vehicleSearchInput::placeholder {
    color: var(--color-muted);
}

.search-icon-button,
.search-all-button {
    border: none;
    background: transparent;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 600;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.search-icon-button {
    border-left: none;
    padding: 0 8px;
}

.search-icon-button .material-icons-outlined {
    font-size: 20px;
}

.search-all-button {
    border-left: 1px solid rgba(21, 110, 127, 0.15);
    padding-left: 10px;
    padding-right: 14px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.search-icon-button:hover,
.search-all-button:hover {
    color: var(--color-primary);
    background: transparent;
}

.search-all-button:hover {
    background: rgba(21, 110, 127, 0.08);
}

.search-all-button.is-active {
    color: var(--color-primary);
}

.search-icon-button:disabled,
.search-all-button:disabled {
    cursor: not-allowed;
    color: rgba(108, 117, 125, 0.7);
    background: transparent;
}

.search-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--color-muted);
}

.search-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(21, 110, 127, 0.12);
    color: var(--color-primary);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.search-result-indicator {
    margin-left: auto;
}

.search-clear-button {
    background: none;
    border: none;
    color: var(--color-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease;
}

.search-clear-button:hover {
    color: var(--color-primary);
}

.search-clear-button:disabled {
    cursor: not-allowed;
    color: rgba(108, 117, 125, 0.7);
}

.search-hint {
    font-size: 11px;
    color: var(--color-muted);
    margin: 0;
}

.search-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.search-header label {
    flex: 1;
    margin-bottom: 0;
}

.search-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.share-button-container {
    display: inline-flex;
    align-items: center;
    gap: 0px;
}

.share-data-input {
    display: none;
}

#shareButton {
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--color-primary);
    width: 28px;
    height: 28px;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

#shareButton:hover {
    background-color: rgba(21, 110, 127, 0.08);
}

#shareButton:disabled {
    background-color: transparent;
    border: none;
    color: var(--color-muted);
    cursor: not-allowed;
    box-shadow: none;
}

#shareButton .material-icons-outlined {
    font-size: 15px;
}

body.is-shared .app-sidebar {
    display: none;
}

body.is-shared .app-main {
    padding: 0;
}

.material-icons-outlined {
    vertical-align: middle;
}

.open-button .material-icons-outlined {
    font-size: 15px;
    color: var(--color-muted);
    transition: color 0.3s ease;
    display: inline-block;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 15;
}

.open-button:hover .material-icons-outlined {
    background-color: var(--color-border);
    /* Change icon color on hover */
}

.replay-button .material-icons-outlined {
    font-size: 15px;
    color: var(--color-muted);
    transition: color 0.3s ease;
    display: inline-block;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 15
}

.replay-button:hover .material-icons-outlined {
    background-color: var(--color-border);
    /* Change icon color on hover */
}

.reports-button .material-icons-outlined {
    font-size: 15px;
    color: var(--color-muted);
    transition: color 0.3s ease;
    display: inline-block;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 15
}

.reports-button:hover .material-icons-outlined {
    background-color: var(--color-border);
    /* Change icon color on hover */
}

.multimedia-button .material-icons-outlined {
    font-size: 15px;
    color: var(--color-muted);
    transition: color 0.3s ease;
    display: inline-block;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 15
}

.multimedia-button:hover .material-icons-outlined {
    background-color: var(--color-border);
    /* Change icon color on hover */
}

.capture-photo-button .material-icons-outlined {
    font-size: 15px;
    color: var(--color-muted);
    transition: color 0.3s ease;
    display: inline-block;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 15
}

.capture-photo-button:hover .material-icons-outlined {
    background-color: var(--color-border);
}

.fuel-button .material-icons-outlined {
    font-size: 15px;
    color: var(--color-muted);
    transition: color 0.3s ease;
    display: inline-block;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 15
}

.fuel-button:hover .material-icons-outlined {
    background-color: var(--color-border);
    /* Change icon color on hover */
}

.temperature-button .material-icons-outlined {
    font-size: 15px;
    color: var(--color-muted);
    transition: color 0.3s ease;
    display: inline-block;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 15
}

.temperature-button:hover .material-icons-outlined {
    background-color: var(--color-border);
    /* Change icon color on hover */
}

.video-stream-button .material-icons-outlined {
    font-size: 15px;
    color: var(--color-muted);
    transition: color 0.3s ease;
    display: inline-block;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 15
}

.video-stream-button:hover .material-icons-outlined {
    background-color: var(--color-border);
    /* Change icon color on hover */
}

.vod-button .material-icons-outlined {
    font-size: 15px;
    color: var(--color-muted);
    transition: color 0.3s ease;
    display: inline-block;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 15
}

.vod-button:hover .material-icons-outlined {
    background-color: var(--color-border);
}

.multi-channel-button .material-icons-outlined {
    font-size: 15px;
    color: var(--color-muted);
    transition: color 0.3s ease;
    display: inline-block;
    font-variation-settings:
        'FILL' 0,
        'wght' 400,
        'GRAD' 0,
        'opsz' 15
}

.multi-channel-button:hover .material-icons-outlined {
    background-color: var(--color-border);
}

.car-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    font-size: 12px;
    text-align: center;
    color: #000;
    cursor: pointer;
}

.car-icon img {
    width: 28px;
    height: 28px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.car-icon-text {
    position: absolute;
    bottom: -5px;
    width: 100%;
    text-align: center;
    font-size: 10px;
    font-weight: bold;
}

.rotate-icon {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    transform-origin: center;
}

#fuelChartContainer,
#temperatureChartContainer {
    display: none;
    position: absolute;
    background: #fff;
    border: 1px solid var(--color-border);
    box-shadow: 0 16px 32px rgba(6, 18, 56, 0.15);
    border-radius: 12px;
    padding: 20px;
    z-index: 1200;
    width: min(560px, calc(100vw - 48px));
    height: 320px;
    font-size: 20px;
}

#fuelChartContainer canvas,
#temperatureChartContainer canvas {
    width: 100% !important;
    height: 100% !important;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    padding: 24px;
    z-index: 1400;
    background: rgba(6, 18, 56, 0.45);
    overflow-y: auto;
}

.modal.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    width: min(640px, 100%);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(6, 18, 56, 0.12);
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.modal-title {
    margin: 0;
    font-size: 18px;
    color: var(--color-heading);
}

.modal-subtitle {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 4px;
}

.close {
    border: none;
    background: transparent;
    color: var(--color-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.close .material-icons-outlined {
    font-size: 20px;
}

.close:hover,
.close:focus {
    background: rgba(21, 110, 127, 0.08);
    color: var(--color-primary);
    outline: none;
}

#commandForm {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-muted);
}

.modal-section-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.form-field input[type="text"] {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--color-text);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.responseCommand {
    margin: 0;
    padding: 12px;
    border-radius: 10px;
    background: var(--color-panel);
    border: 1px solid var(--color-border);
    font-size: 12px;
    color: var(--color-muted);
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow-x: auto;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.responseCommand.success {
    background: #e7f5ef;
    border-color: #b9e2cc;
    color: #1c6c3c;
}

.responseCommand.error {
    background: #fdeaea;
    border-color: #f4bbbb;
    color: #a33333;
}

.responseRawData {
    height: 260px;
    max-height: 360px;
    overflow-y: auto;
    padding: 16px;
    border-radius: 10px;
    background-color: #0a0e1a;
    color: #e6f0ff;
    border: 1px solid #1b294f;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    word-wrap: break-word;
}

.marker-list::-webkit-scrollbar {
    width: 6px;
}

.marker-list::-webkit-scrollbar-track {
    background: transparent;
}

.marker-list::-webkit-scrollbar-thumb {
    background: rgba(21, 110, 127, 0.25);
    border-radius: 4px;
}

.spinner {
    border: 4px solid var(--color-panel);
    border-top: 4px solid var(--color-accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
    position: absolute;
    top: 70px;
    right: 15px;
    transform: translate(-50%, -50%);
    z-index: 1100;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.legend {
    padding: 6px 8px;
    font: 12px/1.5 Arial, Helvetica, sans-serif;
    background: white;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    line-height: 18px;
    color: #555;
}

.legend i {
    width: 18px;
    height: 18px;
    float: left;
    margin-right: 8px;
    opacity: 0.7;
}

/* Expand/collapse button styling */
.expand-button {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    margin-left: 8px;
}

.expand-button:hover {
    background: rgba(21, 110, 127, 0.1);
}

.expand-button .material-icons-outlined {
    font-size: 18px;
    color: var(--color-text);
    transition: transform 0.2s ease;
}

.expand-button.expanded .material-icons-outlined {
    transform: rotate(180deg);
}

.marker-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.marker-title-content {
    flex: 1;
}

/* Button tooltips showing IMEI */
.open-button::after,
.replay-button::after,
.reports-button::after,
.multimedia-button::after,
.capture-photo-button::after {
    content: attr(data-imei);
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-100%) translateX(-50%);
    left: 50%;
    margin-top: -4px;
    transition: opacity 0.2s ease;
}

.open-button:hover::after,
.replay-button:hover::after,
.reports-button:hover::after,
.multimedia-button:hover::after,
.capture-photo-button:hover::after {
    opacity: 1;
}

/* Map Controls */
.map-controls {
    position: absolute;
    top: 120px;
    right: 14px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-control-button {
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.map-control-button:hover {
    background: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.map-control-button.active {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}

.map-control-button .material-icons-outlined {
    font-size: 20px;
}

/* Marker Labels */
.marker-label {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transform: translate(-50%, -100%);
    margin-top: -45px;
    z-index: 1000;
    opacity: 0.7;
}

.marker-label.hidden {
    display: none;
}

/* Video Player Popup */
.video-player-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.video-player-header {
    display: none; /* Headless popup */
}

.video-player-title {
    font-weight: 600;
    font-size: 12px;
}

.video-player-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
    z-index: 10;
    width: 24px;
    height: 24px;
}

.video-player-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.video-player-body {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.video-player-status {
    font-size: 12px;
    color: #666;
    padding: 6px 8px;
    background: #f5f5f5;
    border-radius: 4px;
    line-height: 1.4;
}

.video-player-container {
    width: 100%;
    height: 200px;
    background: #000;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-player-container video {
    max-width: 100%;
    max-height: 100%;
}

.video-player-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 12px;
}

.video-player-controls label {
    font-size: 12px !important;
    margin-right: 4px;
    font-weight: normal;
}

.video-player-controls input {
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px !important;
    padding: 4px 6px;
    height: auto;
}

.video-player-controls input::placeholder {
    font-size: 12px;
}

.video-player-controls button,
.video-player-controls .primary-button {
    font-size: 12px !important;
    white-space: nowrap;
    padding: 4px 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .video-player-popup {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 10px;
    }
    
    .video-player-container {
        height: 180px;
    }
}


