/* ========================================
   RouteLogix Dashboard — Styles
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    height: 100vh;
    overflow: hidden;
    background: #1a1a2e;
    color: #e0e0e0;
}

/* --- Login screen --- */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}

.login-screen.hidden {
    display: none;
}

.login-box {
    text-align: center;
    padding: 40px;
}

.login-logo {
    font-size: 64px;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 20px rgba(233, 69, 96, 0.4));
}

.login-title {
    font-size: 32px;
    font-weight: 700;
    color: #e94560;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 14px;
    color: #a0a0b0;
    margin-bottom: 32px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 320px;
    margin: 0 auto;
}

.login-input {
    padding: 14px 18px;
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

.login-input:focus {
    border-color: #e94560;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
}

.login-input::placeholder {
    color: #666;
}

.login-submit-btn {
    padding: 14px 24px;
    background: #e94560;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

.login-submit-btn:hover {
    background: #d63a52;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

.login-submit-btn:active {
    transform: translateY(0);
}

.login-error {
    color: #e94560;
    font-size: 14px;
    margin-top: 4px;
    animation: shake 0.4s ease-in-out;
}

.login-error.hidden {
    display: none;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    50% { transform: translateX(8px); }
    75% { transform: translateX(-4px); }
}

/* --- Header user & logout --- */
.header-user {
    font-size: 13px;
    font-weight: 600;
    color: #4ade80;
    padding: 0 8px;
}

/* --- Header --- */
#header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    padding: 0 16px;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left h1 {
    font-size: 18px;
    font-weight: 700;
    color: #e94560;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #a0a0b0;
}

.header-center .separator {
    color: #333;
}

.header-right {
    display: flex;
    gap: 8px;
}

.header-right button {
    background: #0f3460;
    border: 1px solid #1a4080;
    color: #e0e0e0;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.header-right button:hover {
    background: #1a4080;
}

/* --- Connection status --- */
#connection-status {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
}

.status-connected {
    background: #0d4d2e;
    color: #4ade80;
    border: 1px solid #166534;
}

.status-disconnected {
    background: #4d0d0d;
    color: #f87171;
    border: 1px solid #7f1d1d;
}

.status-connecting {
    background: #4d3d0d;
    color: #fbbf24;
    border: 1px solid #78350f;
}

/* --- Main container --- */
#main-container {
    display: flex;
    height: calc(100vh - 50px);
    position: relative;
}

/* --- Map --- */
#map {
    flex: 1;
    z-index: 1;
}

/* --- Side panel --- */
#side-panel {
    width: 340px;
    background: #16213e;
    border-left: 1px solid #0f3460;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
    z-index: 500;
}

#side-panel.panel-closed {
    width: 0;
    border-left: none;
}

.panel-tabs {
    display: flex;
    border-bottom: 1px solid #0f3460;
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    padding: 10px 4px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #a0a0b0;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: #e0e0e0;
    background: rgba(255,255,255,0.03);
}

.tab-btn.active {
    color: #e94560;
    border-bottom-color: #e94560;
}

/* --- Tab content --- */
.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.tab-header {
    padding: 4px 0 8px;
    flex-shrink: 0;
}

.tab-header input {
    width: 100%;
    padding: 8px 12px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 13px;
    outline: none;
}

.tab-header input:focus {
    border-color: #e94560;
}

/* --- Item list --- */
.item-list {
    flex: 1;
    overflow-y: auto;
}

.empty-msg {
    text-align: center;
    color: #555;
    padding: 40px 16px;
    font-size: 13px;
}

/* --- Vehicle card --- */
.vehicle-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 4px;
    background: #1a1a2e;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.vehicle-card:hover {
    background: #1e2545;
    border-color: #0f3460;
}

.vehicle-card .emoji {
    font-size: 28px;
    flex-shrink: 0;
}

.vehicle-card .info {
    flex: 1;
    min-width: 0;
}

.vehicle-card .name {
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vehicle-card .details {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.vehicle-card .speed {
    font-size: 13px;
    font-weight: 600;
    color: #4ade80;
    flex-shrink: 0;
}

.vehicle-card .speed.stopped {
    color: #888;
}

/* --- Obstacle card --- */
.obstacle-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 4px;
    background: #1a1a2e;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid #fbbf24;
}

.obstacle-card:hover {
    background: #1e2545;
}

.obstacle-card .emoji {
    font-size: 24px;
}

.obstacle-card .info {
    flex: 1;
}

.obstacle-card .type-name {
    font-size: 13px;
    font-weight: 600;
    color: #fbbf24;
}

.obstacle-card .description {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

.obstacle-card .meta {
    font-size: 10px;
    color: #666;
    margin-top: 4px;
}

/* --- SOS card --- */
.sos-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    margin-bottom: 4px;
    background: #2d0a0a;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid #7f1d1d;
    animation: sos-pulse 2s ease-in-out infinite;
}

.sos-card:hover {
    background: #3d1010;
}

.sos-card .emoji {
    font-size: 28px;
}

.sos-card .info {
    flex: 1;
}

.sos-card .type-name {
    font-size: 14px;
    font-weight: 700;
    color: #f87171;
}

.sos-card .user-name {
    font-size: 12px;
    color: #fca5a5;
    margin-top: 2px;
}

.sos-card .message {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.sos-card .time {
    font-size: 11px;
    color: #ef4444;
    font-weight: 600;
    flex-shrink: 0;
}

@keyframes sos-pulse {
    0%, 100% { border-color: #7f1d1d; }
    50% { border-color: #ef4444; box-shadow: 0 0 12px rgba(239, 68, 68, 0.3); }
}

/* --- Map markers --- */
.vehicle-marker {
    text-align: center;
    line-height: 1;
}

.vehicle-marker .marker-emoji {
    font-size: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    display: block;
    transition: transform 0.3s ease;
}

.vehicle-marker .marker-label {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: rgba(22, 33, 62, 0.85);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    margin-top: 2px;
    display: inline-block;
    border: 1px solid rgba(233, 69, 96, 0.5);
}

.obstacle-marker .marker-emoji {
    font-size: 26px;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}

.sos-marker {
    text-align: center;
    animation: sos-marker-pulse 1.5s ease-in-out infinite;
}

.sos-marker .marker-emoji {
    font-size: 36px;
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.8));
}

.sos-marker .marker-label {
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: rgba(127, 29, 29, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    display: inline-block;
}

@keyframes sos-marker-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* --- Settings modal --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #16213e;
    border: 1px solid #0f3460;
    border-radius: 12px;
    padding: 24px;
    width: 400px;
    max-width: 90vw;
}

.modal-content h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #e94560;
}

.setting-group {
    margin-bottom: 14px;
}

.setting-group label {
    display: block;
    font-size: 12px;
    color: #a0a0b0;
    margin-bottom: 4px;
}

.setting-group input {
    width: 100%;
    padding: 8px 12px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 13px;
    outline: none;
}

.setting-group input:focus {
    border-color: #e94560;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-primary {
    padding: 8px 20px;
    background: #e94560;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:hover {
    background: #d63a55;
}

.btn-secondary {
    padding: 8px 20px;
    background: transparent;
    color: #a0a0b0;
    border: 1px solid #0f3460;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #0f3460;
    color: #e0e0e0;
}

/* --- Leaflet overrides --- */
.leaflet-control-layers {
    background: #16213e !important;
    border: 1px solid #0f3460 !important;
    border-radius: 8px !important;
    color: #e0e0e0 !important;
}

.leaflet-control-layers-base label,
.leaflet-control-layers-overlays label {
    color: #e0e0e0 !important;
}

.leaflet-control-zoom {
    border: none !important;
    box-shadow: none !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaflet-control-zoom a {
    background: rgba(22, 33, 62, 0.8) !important;
    color: #e0e0e0 !important;
    border: 1px solid rgba(15, 52, 96, 0.8) !important;
    width: 44px !important;
    height: 44px !important;
    line-height: 44px !important;
    font-size: 22px !important;
    border-radius: 8px !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(26, 64, 128, 0.85) !important;
}

/* --- Trace controls --- */
.trace-controls {
    padding: 4px 0 8px;
    flex-shrink: 0;
}

.trace-field {
    margin-bottom: 10px;
}

.trace-field label {
    display: block;
    font-size: 12px;
    color: #a0a0b0;
    margin-bottom: 4px;
}

.trace-field select,
.trace-field input[type="date"] {
    width: 100%;
    padding: 8px 12px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 13px;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.trace-field select:focus,
.trace-field input[type="date"]:focus {
    border-color: #e94560;
}

.trace-field select option {
    background: #1a1a2e;
    color: #e0e0e0;
}

.trace-field.hidden {
    display: none;
}

.btn-full {
    width: 100%;
    margin-top: 6px;
}

.trace-status {
    font-size: 12px;
    padding: 6px 0;
    text-align: center;
    min-height: 24px;
}

.trace-status.loading {
    color: #fbbf24;
}

.trace-status.success {
    color: #4ade80;
}

.trace-status.error {
    color: #f87171;
}

/* --- Trace stats --- */
.trace-stats {
    padding: 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 2px;
    background: #1a1a2e;
    border-radius: 6px;
}

.stat-label {
    font-size: 12px;
    color: #a0a0b0;
}

.stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #e94560;
}

/* --- Trace actions --- */
.trace-actions {
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.trace-actions.hidden {
    display: none;
}

/* --- Scrollbar --- */
.item-list::-webkit-scrollbar {
    width: 6px;
}

.item-list::-webkit-scrollbar-track {
    background: transparent;
}

.item-list::-webkit-scrollbar-thumb {
    background: #0f3460;
    border-radius: 3px;
}

.item-list::-webkit-scrollbar-thumb:hover {
    background: #1a4080;
}

/* --- Messaging --- */
.msg-compose {
    padding: 4px 0 8px;
    flex-shrink: 0;
}

.msg-field {
    margin-bottom: 10px;
}

.msg-field label {
    display: block;
    font-size: 12px;
    color: #a0a0b0;
    margin-bottom: 4px;
}

.msg-field textarea {
    width: 100%;
    padding: 8px 12px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    outline: none;
    resize: vertical;
    min-height: 60px;
}

.msg-field textarea:focus {
    border-color: #e94560;
}

.msg-target-btns {
    display: flex;
    gap: 6px;
}

.msg-target-btn {
    flex: 1;
    padding: 8px 10px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    color: #a0a0b0;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.msg-target-btn:hover {
    background: #1e2545;
    color: #e0e0e0;
}

.msg-target-btn.active {
    background: #0f3460;
    color: #e94560;
    border-color: #e94560;
}

.msg-vehicle-select {
    margin-bottom: 10px;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #0f3460;
    border-radius: 6px;
    background: #1a1a2e;
}

.msg-vehicle-select.hidden {
    display: none;
}

.msg-vehicle-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}

.msg-vehicle-item:hover {
    background: #1e2545;
}

.msg-vehicle-item input[type="checkbox"] {
    accent-color: #e94560;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.msg-vehicle-item .emoji {
    font-size: 18px;
}

.msg-vehicle-item .name {
    color: #e0e0e0;
}

/* --- Send row with voice button --- */
.msg-send-row {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.msg-send-btn {
    flex: 1;
}

.btn-voice {
    width: 44px;
    height: 40px;
    background: #1a1a2e;
    border: 1px solid #0f3460;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-voice:hover {
    background: #1e2545;
    border-color: #e94560;
}

.btn-voice.recording {
    background: #7f1d1d;
    border-color: #ef4444;
    animation: voice-pulse 1s ease-in-out infinite;
}

@keyframes voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* --- Voice recording indicator --- */
.voice-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #2d0a0a;
    border: 1px solid #7f1d1d;
    border-radius: 6px;
    margin-top: 6px;
}

.voice-indicator.hidden {
    display: none;
}

.voice-dot {
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
    animation: voice-dot-blink 1s ease-in-out infinite;
}

@keyframes voice-dot-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.voice-indicator #voice-timer {
    font-size: 14px;
    font-weight: 700;
    color: #f87171;
    font-variant-numeric: tabular-nums;
}

.voice-label {
    font-size: 12px;
    color: #fca5a5;
}

/* --- Audio play button in history --- */
.msg-play-btn {
    background: #0f3460;
    border: 1px solid #1a4080;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 6px;
    transition: background 0.2s;
}

.msg-play-btn:hover {
    background: #1a4080;
}

.msg-status {
    font-size: 12px;
    padding: 4px 0;
    text-align: center;
    min-height: 20px;
}

.msg-status.success { color: #4ade80; }
.msg-status.error { color: #f87171; }

.msg-separator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 11px;
    color: #555;
}

.msg-separator::before,
.msg-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #0f3460;
}

/* --- Message cards --- */
.msg-card {
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    font-size: 13px;
}

.msg-sent {
    background: #0f2847;
    border-left: 3px solid #60a5fa;
}

.msg-received {
    background: #1a1a2e;
    border-left: 3px solid #4ade80;
}

.msg-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}

.msg-direction {
    font-weight: 600;
}

.msg-sent .msg-direction { color: #60a5fa; }
.msg-received .msg-direction { color: #4ade80; }

.msg-sender {
    color: #e0e0e0;
    font-weight: 500;
}

.msg-target {
    color: #a0a0b0;
}

.msg-time {
    margin-left: auto;
    color: #666;
}

.msg-body {
    color: #e0e0e0;
    line-height: 1.4;
    word-break: break-word;
}

/* --- Message notification banner --- */
.msg-banner {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: #16213e;
    border: 1px solid #4ade80;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 500px;
    z-index: 3000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: msg-banner-in 0.3s ease-out;
}

.msg-banner-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.msg-banner-content {
    flex: 1;
    min-width: 0;
}

.msg-banner-content strong {
    display: block;
    color: #4ade80;
    font-size: 13px;
}

.msg-banner-content p {
    color: #e0e0e0;
    font-size: 14px;
    margin-top: 2px;
    word-break: break-word;
}

.msg-banner-close {
    background: none;
    border: none;
    color: #666;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
}

.msg-banner-close:hover {
    color: #e0e0e0;
}

@keyframes msg-banner-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* --- Radio / Mumble channels --- */
.radio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(15, 52, 96, 0.3);
    border-bottom: 1px solid rgba(15, 52, 96, 0.5);
}

.radio-status {
    font-weight: 600;
    font-size: 14px;
}

.radio-online {
    font-size: 12px;
    color: #4ade80;
    font-weight: 600;
}

.radio-channel {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(15, 52, 96, 0.3);
    transition: background 0.2s;
}

.radio-channel:hover {
    background: rgba(15, 52, 96, 0.2);
}

.radio-channel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.radio-channel-icon {
    font-size: 16px;
}

.radio-channel-name {
    font-weight: 600;
    font-size: 13px;
    color: #e0e0e0;
}

.radio-channel-count {
    margin-left: auto;
    font-size: 11px;
    color: #888;
    background: rgba(255,255,255,0.05);
    padding: 2px 8px;
    border-radius: 10px;
}

.radio-channel-count.has-users {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.radio-channel-users {
    margin-left: 24px;
    margin-top: 4px;
}

.radio-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    font-size: 12px;
    color: #c0c0d0;
    border-radius: 4px;
    background: rgba(255,255,255,0.03);
    margin-bottom: 2px;
}

.radio-user-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    flex-shrink: 0;
}

.radio-user-dot.muted {
    background: #f59e0b;
}

.radio-user-name {
    flex: 1;
}

.radio-user-time {
    font-size: 10px;
    color: #666;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

/* --- Mobile nav bar (bottom) --- */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #16213e;
    border-top: 1px solid #0f3460;
    z-index: 2000;
    padding: 0;
}

.mobile-nav-inner {
    display: flex;
    height: 100%;
}

.mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #a0a0b0;
    font-size: 18px;
    cursor: pointer;
    gap: 2px;
    transition: color 0.2s;
    position: relative;
}

.mobile-nav-btn span {
    font-size: 9px;
    font-weight: 600;
}

.mobile-nav-btn.active {
    color: #e94560;
}

.mobile-nav-btn .nav-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    min-width: 16px;
    height: 16px;
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* --- Panel overlay backdrop --- */
.panel-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1500;
}

@media (max-width: 768px) {

    /* Show mobile nav */
    .mobile-nav {
        display: block;
    }

    /* Header adjustments */
    #header {
        height: 44px;
        padding: 0 8px;
    }

    .header-left h1 {
        font-size: 15px;
    }

    .header-center {
        display: none;
    }

    .header-right {
        gap: 4px;
    }

    .header-right button {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    #btn-toggle-panel {
        display: none;
    }

    .header-user {
        display: none;
    }

    /* Main container accounts for bottom nav */
    #main-container {
        height: calc(100vh - 44px - 56px);
    }

    /* Map takes full width */
    #map {
        width: 100%;
    }

    /* Side panel becomes overlay from bottom */
    #side-panel {
        position: fixed;
        top: 44px;
        left: 0;
        right: 0;
        bottom: 56px;
        width: 100% !important;
        border-left: none;
        border-top: 1px solid #0f3460;
        z-index: 1600;
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }

    #side-panel.panel-open {
        transform: translateY(0);
    }

    #side-panel.panel-closed {
        transform: translateY(100%);
        width: 100% !important;
    }

    /* Show backdrop when panel is open */
    .panel-backdrop.visible {
        display: block;
    }

    /* Panel tabs scroll on small screens */
    .panel-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .tab-btn {
        white-space: nowrap;
        padding: 10px 8px;
        font-size: 11px;
    }

    /* Message banner */
    .msg-banner {
        top: 50px;
        min-width: auto;
        max-width: calc(100vw - 20px);
        left: 10px;
        right: 10px;
        transform: none;
    }

    @keyframes msg-banner-in {
        from { opacity: 0; transform: translateY(-20px); }
        to { opacity: 1; transform: translateY(0); }
    }

    /* Modal */
    .modal-content {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }

    /* Leaflet zoom controls — bigger on mobile */
    .leaflet-control-zoom a {
        width: 52px !important;
        height: 52px !important;
        line-height: 52px !important;
        font-size: 26px !important;
    }

    .leaflet-control-layers {
        max-width: calc(100vw - 80px);
        max-height: calc(100vh - 160px);
        overflow-y: auto;
    }

    /* Touch improvements */
    .vehicle-card, .obstacle-card, .sos-card, .msg-card {
        padding: 12px;
    }

    .vehicle-card .emoji, .sos-card .emoji {
        font-size: 24px;
    }

    /* Voice button bigger on mobile */
    .btn-voice {
        width: 52px;
        height: 44px;
        font-size: 22px;
    }
}
