/* ========================================
   Base Sidebar - Modern Design System
   Version: 2.0
   ======================================== */

/* CSS Variables for Sidebar */
:root {
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 0px;
    --sidebar-bg-start: rgba(15, 23, 42, 0.97);
    --sidebar-bg-end: rgba(30, 41, 59, 0.97);
    --sidebar-accent: #6366f1;
    --sidebar-accent-light: #818cf8;
    --sidebar-accent-glow: rgba(99, 102, 241, 0.3);
    --sidebar-text: rgba(255, 255, 255, 0.85);
    --sidebar-text-muted: rgba(255, 255, 255, 0.5);
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
    --sidebar-active-bg: rgba(99, 102, 241, 0.15);
    --sidebar-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

/* ========================================
   Main Sidebar Container
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050;
    background: var(--sidebar-bg-start);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transition: transform var(--sidebar-transition), width var(--sidebar-transition);
    flex-shrink: 0;
    box-sizing: border-box;
}

/* Sidebar inner glow effect */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 200px;
    background: radial-gradient(ellipse at top, var(--sidebar-accent-glow) 0%, transparent 70%);
    pointer-events: none;
    opacity: 0.5;
}

/* Sidebar Content Wrapper */
.sidebar-content {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-accent) transparent;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Sidebar içindeki tüm elementlerin taşmasını engelle */
.sidebar-content > * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Sidebar Nav - Scroll edilebilir alan */
/* Styles merged into main .sidebar-content .sidebar-nav above */

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--sidebar-accent);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: var(--sidebar-accent-light);
}

/* ========================================
   Sidebar Brand / Logo
   ======================================== */
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 10px;
    margin: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(139, 92, 246, 0.1) 100%);
    border-bottom: 1px solid var(--sidebar-border);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    min-height: 70px;
}

.sidebar-brand::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--sidebar-accent), transparent);
}

.sidebar-brand img,
.sidebar-brand svg,
.sidebar-brand .sidebar-logo {
    width: 140px;
    height: 50px;
    object-fit: contain;
    object-position: center;
    transition: transform var(--sidebar-transition);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.sidebar-brand:hover img,
.sidebar-brand:hover svg,
.sidebar-brand:hover .sidebar-logo {
    transform: scale(1.05);
}

/* ========================================
   Sidebar Navigation
   ======================================== */
.sidebar-content .sidebar-nav {
    list-style: none;
    padding: 8px 0;
    margin: 0;
    width: 100%;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-accent) transparent;
}

.sidebar-content .sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content .sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-content .sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--sidebar-accent);
    border-radius: 3px;
}

.sidebar-content .sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: var(--sidebar-accent-light);
}

/* ========================================
   Sidebar Section
   ======================================== */
.sidebar-section {
    margin: 2px 8px;
    border-radius: 10px;
    overflow: hidden;
    transition: all var(--sidebar-transition);
    background: transparent;
}

.sidebar-section:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* ========================================
   Sidebar Header (Section Title)
   ======================================== */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 6px 12px;
    margin: 0 0 2px 0;
    color: var(--sidebar-text);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: all var(--sidebar-transition);
    border-radius: 6px;
    position: relative;
}

/* Underline for section headers */
.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 14px;
    right: 14px;
    height: 2px;
    background: linear-gradient(90deg, 
        var(--sidebar-accent) 0%, 
        var(--sidebar-accent-light) 50%,
        transparent 100%);
    border-radius: 2px;
    opacity: 0.6;
    transition: opacity var(--sidebar-transition);
}

.sidebar-header:hover {
    color: #fff;
    background: var(--sidebar-hover-bg);
}

.sidebar-header:hover::after {
    opacity: 1;
}

/* Collapse Icon */
.sidebar-header .collapse-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform var(--sidebar-transition);
    opacity: 0.7;
}

.sidebar-header:hover .collapse-icon {
    opacity: 1;
}

/* Sidebar Header Link (tıklanabilir başlık) */
.sidebar-header-link {
    color: inherit;
    text-decoration: none;
    flex: 1;
}

.sidebar-header-link:hover {
    color: #fff;
    text-decoration: none;
}

/* Collapsed State - Icon rotated */
.sidebar-section.collapsed .sidebar-header .collapse-icon {
    transform: rotate(-90deg);
}

/* Active Section Header */
.sidebar-section:not(.collapsed) .sidebar-header {
    color: #fff;
    background: rgba(99, 102, 241, 0.12);
}

.sidebar-section:not(.collapsed) .sidebar-header::after {
    opacity: 1;
    background: linear-gradient(90deg, 
        var(--sidebar-accent-light) 0%, 
        var(--sidebar-accent) 100%);
}

/* ========================================
   Sidebar Items Container
   ======================================== */
.sidebar-items {
    list-style: none;
    padding: 0 0 8px 0;
    margin: 0;
    max-height: 2000px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                padding 0.3s ease;
}

/* Collapsed Items */
.sidebar-section.collapsed .sidebar-items {
    max-height: 0;
    opacity: 0;
    padding: 0;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease,
                padding 0.2s ease;
}

/* ========================================
   Sidebar Item
   ======================================== */
.sidebar-item {
    list-style: none;
    margin: 2px 0;
    transform: translateX(0);
    opacity: 1;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Item animation when collapsing */
.sidebar-section.collapsed .sidebar-item {
    transform: translateX(-8px);
    opacity: 0;
}

/* ========================================
   Sidebar Link
   ======================================== */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 7px 10px;
    margin: 0 4px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 450;
    border-radius: 6px;
    transition: all var(--sidebar-transition);
    position: relative;
    overflow: hidden;
    min-height: 36px;
}

/* Link hover effect */
.sidebar-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--sidebar-accent);
    transform: scaleY(0);
    transition: transform var(--sidebar-transition);
    border-radius: 0 2px 2px 0;
}

.sidebar-link:hover {
    color: #fff;
    background: var(--sidebar-hover-bg);
    text-decoration: none;
}

.sidebar-link:hover::before {
    transform: scaleY(0.5);
}

/* Link Icon - Feather icons become SVG after initialization */
.sidebar-link i.align-middle,
.sidebar-link svg.align-middle,
.sidebar-link > i,
.sidebar-link > svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    max-width: 28px;
    margin-right: 10px;
    padding: 6px;
    border-radius: 8px;
    background: linear-gradient(135deg, 
        rgba(99, 102, 241, 0.25) 0%, 
        rgba(139, 92, 246, 0.18) 100%);
    box-sizing: border-box;
    flex-shrink: 0;
    opacity: 1;
    transition: all var(--sidebar-transition);
}

/* Feather icon SVG inside - ensure proper sizing */
.sidebar-link svg.align-middle,
.sidebar-link > svg {
    stroke-width: 2;
}

.sidebar-link:hover i.align-middle,
.sidebar-link:hover svg.align-middle,
.sidebar-link:hover > i,
.sidebar-link:hover > svg {
    background: linear-gradient(135deg, 
        rgba(99, 102, 241, 0.4) 0%, 
        rgba(139, 92, 246, 0.3) 100%);
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* Link Text */
.sidebar-link span,
.sidebar-link span.align-middle {
    flex: 1;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
    min-width: 0;
    /* Reset any icon styles that might apply */
    width: auto;
    height: auto;
    max-width: none;
    padding: 0;
    margin-right: 0;
    background: none;
    border-radius: 0;
}

/* ========================================
   Active Item State
   ======================================== */
.sidebar-item.active .sidebar-link {
    color: #fff;
    background: var(--sidebar-active-bg);
    font-weight: 500;
}

.sidebar-item.active .sidebar-link::before {
    transform: scaleY(1);
    box-shadow: 0 0 12px var(--sidebar-accent-glow);
}

.sidebar-item.active .sidebar-link i.align-middle,
.sidebar-item.active .sidebar-link svg.align-middle,
.sidebar-item.active .sidebar-link > i,
.sidebar-item.active .sidebar-link > svg {
    opacity: 1;
    color: var(--sidebar-accent-light);
    background: linear-gradient(135deg, 
        rgba(99, 102, 241, 0.45) 0%, 
        rgba(139, 92, 246, 0.35) 100%);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

/* Hub linkleri için gölge ve arka plan kaldır */
.sidebar-link.hub-link i.align-middle,
.sidebar-link.hub-link svg.align-middle,
.sidebar-link.hub-link > i,
.sidebar-link.hub-link > svg,
.sidebar-item.active .sidebar-link.hub-link i.align-middle,
.sidebar-item.active .sidebar-link.hub-link svg.align-middle,
.sidebar-item.active .sidebar-link.hub-link > i,
.sidebar-item.active .sidebar-link.hub-link > svg {
    background: transparent !important;
    box-shadow: none !important;
}

/* ========================================
   Sidebar Overlay (Mobile)
   ======================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   Sidebar Toggle Button
   ======================================== */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.1) 100%);
    color: var(--sidebar-accent);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--sidebar-transition);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.sidebar-toggle:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(139, 92, 246, 0.2) 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

.sidebar-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--sidebar-accent-glow);
}

.sidebar-toggle i {
    transition: transform var(--sidebar-transition);
}

/* ========================================
   Section Divider
   ======================================== */
.sidebar-section .sidebar-item[style*="border-top"] {
    margin: 8px 6px !important;
    border-color: var(--sidebar-border) !important;
}

/* ========================================
   Mobile Responsive
   ======================================== */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 1050;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: block;
    }
    
    /* Main content full width on mobile */
    .main {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

@media (max-width: 576px) {
    .sidebar {
        width: 280px;
    }
    
    .sidebar-brand {
        padding: 16px 10px;
        min-height: 100px;
    }
    
    .sidebar-brand img,
    .sidebar-brand svg {
        width: 160px;
        height: 80px;
        max-height: 80px;
    }
    
    .sidebar-header {
        padding: 10px 12px;
        font-size: 0.65rem;
    }
    
    .sidebar-link {
        padding: 8px 10px;
        font-size: 0.825rem;
    }
    
    .sidebar-link i.align-middle,
    .sidebar-link svg.align-middle,
    .sidebar-link > i,
    .sidebar-link > svg {
        width: 30px;
        height: 30px;
        min-width: 30px;
        max-width: 30px;
        margin-right: 10px;
        padding: 7px;
    }
    
    .sidebar-toggle {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }
}

/* ========================================
   Animation Keyframes
   ======================================== */
@keyframes sidebarSlideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes sidebarItemFadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Staggered animation for items */
.sidebar-section:not(.collapsed) .sidebar-item {
    animation: sidebarItemFadeIn 0.3s ease forwards;
}

.sidebar-section:not(.collapsed) .sidebar-item:nth-child(1) { animation-delay: 0.02s; }
.sidebar-section:not(.collapsed) .sidebar-item:nth-child(2) { animation-delay: 0.04s; }
.sidebar-section:not(.collapsed) .sidebar-item:nth-child(3) { animation-delay: 0.06s; }
.sidebar-section:not(.collapsed) .sidebar-item:nth-child(4) { animation-delay: 0.08s; }
.sidebar-section:not(.collapsed) .sidebar-item:nth-child(5) { animation-delay: 0.10s; }
.sidebar-section:not(.collapsed) .sidebar-item:nth-child(6) { animation-delay: 0.12s; }
.sidebar-section:not(.collapsed) .sidebar-item:nth-child(7) { animation-delay: 0.14s; }
.sidebar-section:not(.collapsed) .sidebar-item:nth-child(8) { animation-delay: 0.16s; }
.sidebar-section:not(.collapsed) .sidebar-item:nth-child(9) { animation-delay: 0.18s; }
.sidebar-section:not(.collapsed) .sidebar-item:nth-child(10) { animation-delay: 0.20s; }

/* ========================================
   Sidebar Nav Container - Scrollable
   ======================================== */
/* Styles defined in .sidebar-content .sidebar-nav above */

/* ========================================
   Sidebar Footer - Ödemelerim Altında
   ======================================== */
.sidebar-footer {
    padding: 10px 8px;
    margin-top: auto;
    flex-shrink: 0;
    border-top: 1px solid var(--sidebar-border);
    background: rgba(0, 0, 0, 0.15);
}

/* Footer içindeki kullanıcı bilgisi kartı */
.sidebar-footer-user {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-footer-link {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all var(--sidebar-transition);
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    text-decoration: none;
    transform: translateX(3px);
    border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-footer-link i.align-middle,
.sidebar-footer-link svg.align-middle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    min-width: 26px;
    max-width: 26px;
    margin-right: 8px;
    padding: 5px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.12);
    box-sizing: border-box;
    flex-shrink: 0;
    transition: all var(--sidebar-transition);
    color: rgba(255, 255, 255, 0.95);
}

.sidebar-footer-link:hover i.align-middle,
.sidebar-footer-link:hover svg.align-middle {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.sidebar-footer-link span.align-middle {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Profil butonu özel stili - Üstteki menü stiline uygun */
.sidebar-footer-profile {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.sidebar-footer-profile:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.35);
}

.sidebar-footer-profile i.align-middle,
.sidebar-footer-profile svg.align-middle {
    background: rgba(99, 102, 241, 0.3);
    color: #fff;
}

.sidebar-footer-profile:hover i.align-middle,
.sidebar-footer-profile:hover svg.align-middle {
    background: rgba(99, 102, 241, 0.45);
}

/* Çıkış butonu özel stili - Kırmızı tonlarında */
.sidebar-footer-logout {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: rgba(255, 180, 180, 1);
}

.sidebar-footer-logout:hover {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.35);
    color: #fff;
}

.sidebar-footer-logout i.align-middle,
.sidebar-footer-logout svg.align-middle {
    background: rgba(239, 68, 68, 0.22);
    color: rgba(255, 180, 180, 1);
}

.sidebar-footer-logout:hover i.align-middle,
.sidebar-footer-logout:hover svg.align-middle {
    background: rgba(239, 68, 68, 0.35);
    color: #fff;
}

/* ========================================
   Sticky Navbar
   ======================================== */
/* Main content area - sidebar fixed olduğu için margin gerekli */
.main {
    margin-left: var(--sidebar-width);
    transition: margin-left var(--sidebar-transition);
}

.main .navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.main .content {
    min-height: calc(100vh - 60px);
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .sidebar,
    .sidebar-overlay,
    .sidebar-toggle {
        display: none !important;
    }
}

