.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    padding: 40px 28px;
    display: flex;
    flex-direction: column;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    overflow-y: auto;
}

.sidebar__section {
    margin-bottom: 0px;
}

.sidebar__brand {
    margin-bottom: 18px;
}

.sidebar__brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--sidebar-text);
}

.sidebar__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background-color: white;
    color: black;
    font-weight: 900;
    font-size: 1.2rem;
    letter-spacing: 0.1em;
}

.sidebar__brand-text {
    font-size: var(--sidebar-brand-font-size, 1.45rem);
    font-weight: 600;
    letter-spacing: 0.06em;
}

.sidebar__menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar__menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    border-radius: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    background-color: transparent;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

/* Fixed width for menu icons to align text consistently */
.sidebar__menu-link i {
    width: 1.25em;
    text-align: center;
    flex-shrink: 0;
}

.sidebar__menu-link:hover {
    background-color: rgba(122, 166, 255, 0.12);
    color: var(--sidebar-accent);
    transform: translateX(4px);
}

/* Only show focus styling on keyboard navigation, not mouse clicks */
.sidebar__menu-link:focus-visible {
    background-color: rgba(122, 166, 255, 0.12);
    color: var(--sidebar-accent);
    outline: 2px solid var(--sidebar-accent);
    outline-offset: 2px;
}

/* Active state for media type filter */
.sidebar__menu-link--active {
    background-color: rgba(122, 166, 255, 0.2);
    color: var(--sidebar-accent);
    font-weight: 600;
}

.sidebar__menu-item {
    position: relative;
}

.sidebar__label {
    font-size: var(--sidebar-label-font-size, 0.8rem);
    letter-spacing: 0.04em;
    text-transform: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar__spacer {
    flex: 0 0 28px;
}

.sidebar__search {
    position: relative;
}

.sidebar__search-input {
    width: 100%;
    padding: 6px 10px 6px 36px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(0, 0, 0, 0.25);
    color: var(--sidebar-text);
    font-size: 0.95rem;
    text-transform: none;
    transition: border 0.2s ease;
    outline: none;
}

.sidebar__search-input::placeholder {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: rgba(240, 244, 255, 0.5);
    text-transform: none;
}

/* Hide browser's native clear button for search inputs */
.sidebar__search-input::-webkit-search-cancel-button,
.sidebar__search-input::-webkit-search-decoration,
.sidebar__search-input::-webkit-search-results-button,
.sidebar__search-input::-webkit-search-results-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.sidebar__search-input:focus {
    border: 1px solid var(--sidebar-accent);
    outline: none;
}

.sidebar__search::before {
    content: '\f002';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: rgba(240, 244, 255, 0.7);
    pointer-events: none;
}

/* Active search state - highlighted */
.sidebar__search--active {
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 4px;
    margin: -4px;
}

.sidebar__search--active .sidebar__search-input {
    border-color: var(--sidebar-accent, #6b8afd);
    background-color: rgba(107, 138, 253, 0.15);
    padding-right: 32px;
}

.sidebar__search--active::before {
    color: var(--sidebar-accent, #6b8afd);
}

/* Clear search button */
.sidebar__search-clear {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.7rem;
    transition: background-color 0.2s ease;
}

.sidebar__search-clear:hover {
    background-color: rgba(255, 255, 255, 0.35);
}

/* Mobile sidebar toggle button - hidden on small/mobile, shown on medium */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    background-color: var(--sidebar-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--sidebar-text);
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

/* Mobile header with Menu and SquarePixel - hidden by default, shown on small/mobile screens */
.mobile-header {
    display: none;
    position: relative;
    width: 100%;
    z-index: 20;
    align-items: center;
}

.mobile-header__menu {
    background: rgba(122, 166, 255, 0.1);
    border: 1px solid rgba(122, 166, 255, 0.2);
    border-radius: 8px;
    color: var(--heading-color);
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 11px;
    margin-right: 16px;
    transition: all 0.3s ease;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mobile-header__menu:focus {
    outline: none;
}

.mobile-header__brand {
    color: var(--heading-color);
    font-size: 1.2rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.06em;
    transition: color 0.2s ease;
}

.mobile-header__brand:hover,
.mobile-header__brand:focus {
    color: var(--sidebar-accent);
    outline: none;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus {
    background-color: rgba(122, 166, 255, 0.12);
    outline: none;
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

/* Always show hamburger icon, always hide X icon */
.sidebar-toggle .fa-bars {
    display: inline-block;
}

.sidebar-toggle .fa-xmark {
    display: none;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.is-active {
    display: block;
    opacity: 1;
}

/* Mode 3 & 4: Small screen and Mobile (<= 1023px) - Show Menu/SquarePixel header */
@media (max-width: 1023px) {
    .mobile-header {
        display: flex;
        align-items: center;
    }

    /* Hide hamburger icon toggle on small/mobile */
    .sidebar-toggle {
        display: none;
    }

    /* Hide mobile header when sidebar is open */
    .mobile-header.is-hidden {
        display: none;
    }

    .sidebar {
        width: 280px; /* Override var(--sidebar-width) to maintain sidebar width when toggled */
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .content-area {
        margin-left: 0 !important;
    }
}

