.sidebar-toggle {
    position: fixed;
    top: 50%;
    left: calc(10px + 360px);
    transform: translateY(-50%) translateX(-16px);
    z-index: 2100;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    border-left: none;
    width: 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        2px 0 12px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

.sidebar-toggle:hover {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
    transform: translateY(-50%) translateX(-14px);
    box-shadow: 
        4px 0 16px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(33, 150, 243, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
    border-color: rgba(33, 150, 243, 0.4);
}

.sidebar-toggle:active {
    transform: translateY(-50%) translateX(-16px);
    box-shadow: 
        2px 0 8px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sidebar-toggle svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

[data-theme="light"] .sidebar-toggle {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(240, 240, 240, 0.8));
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-left: none;
    box-shadow: 
        2px 0 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .sidebar-toggle:hover {
    background: linear-gradient(145deg, rgba(255, 255, 255, 1), rgba(245, 245, 245, 0.9));
    box-shadow: 
        4px 0 16px rgba(0, 0, 0, 0.15),
        0 0 20px rgba(33, 150, 243, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    border-color: rgba(33, 150, 243, 0.3);
}

/* Sidebar collapsed state */
body.sidebar-collapsed .sidebar {
    transform: translateX(-110%);
}

/* Ensure sidebar is visible when not collapsed (desktop default) */
body:not(.sidebar-collapsed) .sidebar {
    transform: translateX(0);
}

body.sidebar-collapsed .sidebar-toggle {
    left: 0;
    transform: translateY(-50%);
    border-radius: 0;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    border-left: none;
}

body.sidebar-collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

body.sidebar-collapsed .sidebar-toggle:hover {
    transform: translateY(-50%) translateX(2px);
}

body.sidebar-collapsed .sidebar-toggle:active {
    transform: translateY(-50%) translateX(0);
}

/* Mobile Responsiveness */
@media screen and (max-width: 1024px) {
    .sidebar {
        width: 350px;
    }
}

@media screen and (max-width: 768px) {

    /* Tablet and Mobile */
    .sidebar {
        width: 100vw;
        max-width: 350px;
        top: 0;
        left: 0;
        bottom: 0;
        border-radius: 0;
        border-top-right-radius: 16px;
        border-bottom-right-radius: 16px;
    }
    
    .sidebar-toggle {
        left: calc(10px + 360px - 14px);
        width: 28px;
        height: 56px;
    }
    
    body.sidebar-collapsed .sidebar-toggle {
        left: 0;
    }

    /* Hide sidebar when collapsed on mobile */
    body.sidebar-collapsed .sidebar {
        transform: translateX(-100%);
    }

    /* Make cell details more compact on mobile */
    .cell-details {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .detail-row {
        font-size: 0.8rem;
    }
}

@media screen and (max-width: 480px) {

    /* Small phones */
    .sidebar {
        width: calc(100vw - 20px);
        max-width: none;
    }

    .sidebar-header {
        padding: 10px;
    }

    .logo-img {
        height: 35px;
    }

    .logo-title {
        font-size: 0.8rem;
    }

    .logo-subdiv {
        font-size: 0.7rem;
    }

    .cell-item {
        padding: 12px;
    }

    .cell-id {
        font-size: 0.85rem;
    }

    .cell-status {
        font-size: 0.7rem;
    }

    .tab-btn {
        font-size: 0.8rem;
        padding: 6px;
    }
}

/* Ensure map takes full width when sidebar is collapsed */
.container {
    width: 100vw;
    transition: width 0.3s ease;
}

/* Left scrollbar for station list */
.station-list {
    direction: rtl;
    /* Change text direction to move scrollbar to left */
}

.station-list .station-item {
    direction: ltr;
    /* Keep text direction normal for items */
}

/* Fix time display wrapping on mobile */
@media screen and (max-width: 768px) {
    .p-time-display {
        font-size: 1rem !important;
        min-width: 70px !important;
        white-space: nowrap;
    }

    .tracker-header {
        flex-wrap: nowrap;
        gap: 8px;
    }

    .station-name {
        font-size: 0.95rem !important;
    }
}

@media screen and (max-width: 480px) {
    .p-time-display {
        font-size: 0.9rem !important;
        min-width: 60px !important;
    }
}