/**
 * RIFT - Sidebar Styles
 */

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999; /* Unter Sidebar (1000), über Topbar (100) */
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Swipe Handle (Mobile) */
.swipe-handle {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 20px;
    height: 100%;
    z-index: 89;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width, 240px);
    background: var(--bg-elevated, #1e1e1e);
    border-right: 1px solid var(--border, rgba(255, 255, 255, 0.06));
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar__header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 12px;
}

/* ========================================
   LOGO WITH EFFECTS
   ======================================== */

.sidebar__brand {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Glow background on hover */
.sidebar__brand::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: radial-gradient(circle at center, var(--accent, #FF4655) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

/* Ripple ring effect */
.sidebar__brand::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 16px;
    border: 2px solid var(--accent, #FF4655);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.sidebar__brand:hover {
    transform: scale(1.08);
}

.sidebar__brand:hover::before {
    opacity: 0.15;
    transform: scale(1);
}

.sidebar__brand:hover::after {
    opacity: 0.4;
    transform: scale(1);
}

.sidebar__brand:active {
    transform: scale(0.92);
    transition: transform 0.1s ease;
}

.sidebar__brand:active::before {
    opacity: 0.25;
}

.sidebar__brand:active::after {
    opacity: 0.6;
    transform: scale(1.1);
}

.sidebar__logo {
    width: 32px;
    height: 32px;
    fill: var(--text, #dedede);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 0 transparent);
    z-index: 1;
}

/* Logo color and glow on hover */
.sidebar__brand:hover .sidebar__logo {
    fill: var(--accent, #FF4655);
    filter: drop-shadow(0 0 8px rgba(255, 70, 85, 0.5));
}

/* Pulse animation on active */
.sidebar__brand:active .sidebar__logo {
    fill: var(--accent, #FF4655);
    filter: drop-shadow(0 0 12px rgba(255, 70, 85, 0.7));
}

/* Click ripple animation */
@keyframes logoRipple {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 70, 85, 0.4);
    }
    100% {
        box-shadow: 0 0 0 20px rgba(255, 70, 85, 0);
    }
}

.sidebar__brand.ripple {
    animation: logoRipple 0.4s ease-out;
}

.sidebar__nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    gap: 4px;
}

.sidebar__section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar__divider {
    height: 1px;
    background: var(--border, rgba(255, 255, 255, 0.06));
    margin: 12px 0;
}

.sidebar__link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    color: var(--text-muted, #bebebe);
    text-decoration: none;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    cursor: pointer;
}

.sidebar__link:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.06));
    color: var(--text, #dedede);
}

.sidebar__link:hover .sidebar__link-icon {
    transform: scale(1.15);
}

.sidebar__link.active {
    background: var(--red-dim, rgba(255, 70, 85, 0.12));
    color: var(--accent, #FF4655);
}

.sidebar__link-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
    transition: transform 0.2s ease;
}

/* Tooltip */
.sidebar__link[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    padding: 8px 12px;
    background: var(--bg-card, #2a2a2a);
    color: var(--text, #dedede);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: tooltipSlide 0.2s ease;
}

@keyframes tooltipSlide {
    from {
        opacity: 0;
        transform: translateY(-50%) translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* Sidebar Footer */
.sidebar__footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.06));
}

/* GM Link (green) */
.sidebar__link--gm {
    color: var(--success, #22c55e);
}

.sidebar__link--gm:hover {
    background: var(--green-dim, rgba(34, 197, 94, 0.12));
    color: var(--success, #22c55e);
}

/* Logout Link (red) */
.sidebar__link--logout {
    color: var(--accent, #FF4655);
}

.sidebar__link--logout:hover {
    background: var(--red-dim, rgba(255, 70, 85, 0.12));
    color: var(--accent, #FF4655);
}

/* Sidebar Badge */
.sidebar__badge {
    position: absolute;
    top: 8px;
    right: 8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--accent);
    border-radius: 9px;
    color: white;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: transform 0.2s ease;
}

.sidebar__badge.visible {
    transform: scale(1);
}

.sidebar__badge--dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    padding: 0;
    top: 10px;
    right: 10px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .swipe-handle {
        display: block;
    }
    
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        box-shadow: none;
        z-index: 1000; /* Über Topbar auf Mobile */
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    }
    
    .sidebar__nav {
        padding: 16px;
        gap: 8px;
    }
    
    .sidebar__section {
        gap: 8px;
    }
    
    .sidebar__link {
        width: 100%;
        height: auto;
        padding: 14px 16px;
        justify-content: flex-start;
        gap: 14px;
        border-radius: 12px;
    }
    
    .sidebar__link::after {
        content: attr(data-tooltip);
        font-size: 15px;
        font-weight: 500;
        color: inherit;
    }
    
    .sidebar__link[data-tooltip]:hover::after {
        position: static;
        padding: 0;
        background: none;
        box-shadow: none;
        animation: none;
        transform: none;
    }
    
    .sidebar__link-icon {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }
    
    .sidebar__footer {
        padding: 16px;
        gap: 8px;
    }
    
    .sidebar__footer .sidebar__link {
        width: 100%;
        justify-content: flex-start;
    }
}
