/* ===== GLOBAL SIDEBAR STİLLERİ ===== */

.sidebar {
    width: 260px;
    min-width: 260px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 5px 0;
    position: fixed;
    left: 0;
    top: 72px;
    height: calc(100vh - 72px);
    overflow-y: auto;
    z-index: 100;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/arkaplan/lazer-desen-arka-plan.svg') center/cover;
    z-index: -1;
}

.sidebar-nav {
    flex: 1;
}

.nav-item,
.footer-link {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 4px 16px;
    padding: 12px 14px;
    border-radius: 10px;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14.5px;
    font-weight: 500;
    font-family: inherit;
}

.nav-item:hover,
.footer-link:hover {
    background: #f1f5f9;
    color: #111827;
}

.nav-item.active {
    background: #f8fafc;
    /* Beyazın bir tık koyusu */
    color: #10b981;
    /* Abartmadan sadece rengi vurguladık */
}

.nav-item i,
.footer-link i {
    width: 20px;
    font-size: 18px;
}

.sidebar-footer {
    border-top: 1px solid #e5e7eb;
    padding-top: 16px;
    margin-top: 16px;
}

.sidebar-bottom {
    padding: 16px 24px;
    font-size: 11px;
    color: #9ca3af;
}

.sidebar-bottom .links {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.sidebar-bottom a {
    color: #6b7280;
    text-decoration: none;
}

/* ===== SIDEBAR OVERLAY & MOBİL HEADER ===== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
    display: none;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.sidebar-mobile-hdr {
    display: none;
}

/* ===== MOBİL SIDEBAR ===== */
@media (max-width: 768px) {

    .sidebar-overlay {
        display: block;
    }

    .sidebar-mobile-hdr {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 10px;
    }

    .sidebar {
        position: fixed !important;
        left: -280px !important;
        top: 0 !important;
        width: 270px !important;
        height: 100vh !important;
        z-index: 999999 !important;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        padding-top: 0 !important;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    .sidebar.active {
        left: 0 !important;
    }

    /* Sidebar açılma animasyonu — soldan kayma */
    .sidebar .sidebar-nav .nav-item,
    .sidebar .sidebar-footer .footer-link {
        opacity: 0;
        transform: translateX(-20px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .sidebar.active .sidebar-nav .nav-item,
    .sidebar.active .sidebar-footer .footer-link {
        opacity: 1;
        transform: translateX(0);
    }

    /* Her bir öğeye sıralı gecikme — soldan gelme efekti */
    .sidebar.active .sidebar-nav .nav-item:nth-child(1) {
        transition-delay: 0.05s;
    }

    .sidebar.active .sidebar-nav .nav-item:nth-child(2) {
        transition-delay: 0.08s;
    }

    .sidebar.active .sidebar-nav .nav-item:nth-child(3) {
        transition-delay: 0.11s;
    }

    .sidebar.active .sidebar-nav .nav-item:nth-child(4) {
        transition-delay: 0.14s;
    }

    .sidebar.active .sidebar-nav .nav-item:nth-child(5) {
        transition-delay: 0.17s;
    }

    .sidebar.active .sidebar-nav .nav-item:nth-child(6) {
        transition-delay: 0.20s;
    }

    .sidebar.active .sidebar-nav .nav-item:nth-child(7) {
        transition-delay: 0.23s;
    }

    .sidebar.active .sidebar-footer .footer-link:nth-child(1) {
        transition-delay: 0.26s;
    }

    .sidebar.active .sidebar-footer .footer-link:nth-child(2) {
        transition-delay: 0.29s;
    }
}

/* ===== DARK THEME SIDEBAR ===== */
body.dark-theme .sidebar {
    background: #1e1e1e;
    border-right-color: #333;
}

body.dark-theme .sidebar::before {
    opacity: 0.08;
}

body.dark-theme .nav-item,
body.dark-theme .footer-link {
    color: #9ca3af;
}

body.dark-theme .nav-item:hover,
body.dark-theme .footer-link:hover {
    background: #2a2a2a;
    color: #f9fafb;
}

body.dark-theme .nav-item.active {
    background: #2a2d31;
    /* Koyu temanın bir tık açığı */
    color: #10b981;
}

body.dark-theme .sidebar-footer {
    border-top-color: #333;
}

body.dark-theme .sidebar-bottom {
    color: #6b7280;
}

body.dark-theme .sidebar-bottom a {
    color: #6b7280;
}

body.dark-theme .sidebar-mobile-hdr {
    border-bottom-color: #333;
}

body.dark-theme .sidebar-mobile-hdr span {
    color: #f9fafb !important;
}

body.dark-theme .sidebar-mobile-hdr button {
    color: #9ca3af !important;
}

/* ===== MASAÜSTÜ SIDEBAR DARALTMA (Mini İkon Modu) ===== */
@media (min-width: 769px) {

    /* Sidebar geçiş animasyonu "lamba" olmasın diye iptal */
    .sidebar {
        transition: none;
    }

    .nav-item,
    .footer-link {
        white-space: nowrap;
    }

    /* Mini (collapsed) sidebar: sadece ikonlar */
    body.sidebar-collapsed .sidebar {
        width: 64px;
        min-width: 64px;
        overflow: visible;
    }

    /* Metinleri gizle */
    body.sidebar-collapsed .sidebar .nav-item span,
    body.sidebar-collapsed .sidebar .footer-link span,
    body.sidebar-collapsed .sidebar .sidebar-bottom,
    body.sidebar-collapsed .sidebar .sidebar-mobile-hdr {
        display: none;
    }

    /* Nav itemları solda tut (hareket etmemesi için padding-left 24px sabit) */
    body.sidebar-collapsed .sidebar .nav-item,
    body.sidebar-collapsed .sidebar .footer-link {
        margin: 4px 12px;
        padding: 12px 0;
        justify-content: center;
        gap: 0;
        position: relative;
    }

    /* İkon boyutu aynı kalsın ki hareket etmesin */
    body.sidebar-collapsed .sidebar .nav-item i,
    body.sidebar-collapsed .sidebar .footer-link i {
        font-size: 18px;
        width: 20px;
        text-align: center;
        flex-shrink: 0;
        /* İkonun ezilmesini önler */
    }

    /* Tooltip: hover'da ismi göster */
    body.sidebar-collapsed .sidebar .nav-item::after,
    body.sidebar-collapsed .sidebar .footer-link::after {
        content: attr(data-label);
        position: absolute;
        left: 70px;
        top: 50%;
        transform: translateY(-50%);
        background: #111827;
        color: #fff;
        font-size: 13px;
        font-weight: 600;
        padding: 6px 12px;
        border-radius: 8px;
        white-space: nowrap;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.2s;
        z-index: 9999;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    body.sidebar-collapsed .sidebar .nav-item:hover::after,
    body.sidebar-collapsed .sidebar .footer-link:hover::after {
        opacity: 1;
    }

    /* Sidebar footer ikonları */
    body.sidebar-collapsed .sidebar .sidebar-footer {
        padding-top: 8px;
        margin-top: 8px;
    }


    body.sidebar-collapsed .category-filters,
    body.sidebar-collapsed .filter-bar {
        left: 64px !important;
    }

    body.sidebar-collapsed .mm-vertical-panel {
        left: 74px !important;
    }

    /* Sidebar daraldığında overlay tam sayfa içeriğini kapatsın (sidebar 64px'e indi) */
    body.sidebar-collapsed .mm-overlay-focus {
        left: 64px !important;
        width: calc(100vw - 64px) !important;
        /* Sidebar dışını tamamen kapsar */
    }

    /* Köprü sadece panel ile sidebar arası dar boşluk - küçük kalır */
    body.sidebar-collapsed .mm-active-bridge {
        left: 64px !important;
        width: 15px !important;
        /* Sadece ince köprü, overlay ile bindişmez */
    }
}

/* Butonu mobilde gizle */
@media (max-width: 768px) {
    .desktop-sidebar-toggle {
        display: none !important;
    }
}