/* ChessBlock Branded Navigation Sidebar with Homepage Detection */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --sidebar-width: 260px;
    --sidebar-bg: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    --sidebar-hover: rgba(168, 85, 247, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #e0e7ff;
    --accent-color: #a855f7;
    --accent-hover: #9333ea;
    --border-color: rgba(168, 85, 247, 0.2);
    --online-status: #10b981;
    --electric-blue: #60a5fa;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Main wrapper */
.nav-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.nav-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    box-shadow: 4px 0 24px rgba(168, 85, 247, 0.15);
}

/* Logo section */
.nav-logo {
    padding: 28px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: 'Orbitron', sans-serif;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 1px;
    background: rgba(168, 85, 247, 0.15);
    backdrop-filter: blur(10px);
    text-shadow: 0 0 20px rgba(168, 85, 247, 0.6);
}

/* Circuit King SVG Logo */
.nav-logo-icon {
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 0 12px rgba(96, 165, 250, 0.8))
            drop-shadow(0 0 6px rgba(96, 165, 250, 0.6));
    animation: logo-pulse 3s ease-in-out infinite;
}

@keyframes logo-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 12px rgba(96, 165, 250, 0.8))
                drop-shadow(0 0 6px rgba(96, 165, 250, 0.6));
    }
    50% {
        filter: drop-shadow(0 0 16px rgba(96, 165, 250, 1))
                drop-shadow(0 0 8px rgba(96, 165, 250, 0.8));
    }
}

/* User profile section */
.nav-user {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(168, 85, 247, 0.05);
}

.nav-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    position: relative;
    border: 2px solid rgba(168, 85, 247, 0.4);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

/* ChessBlock logo badge on avatar */
.nav-user-avatar::after {
    content: '♔';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    border-radius: 50%;
    border: 2px solid var(--accent-color);
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.nav-user-info {
    flex: 1;
    min-width: 0;
}

.nav-user-name {
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
}

.nav-user-status {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

/* Online status with pulse animation */
.nav-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--online-status);
    box-shadow: 0 0 8px var(--online-status);
    animation: pulse 2s ease-in-out infinite;
    position: relative;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
        box-shadow: 0 0 12px var(--online-status);
    }
}

.nav-status-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--online-status);
    opacity: 0.3;
    animation: pulse-ring 2s ease-in-out infinite;
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* Navigation menu */
.nav-menu {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border-left: 3px solid transparent;
    font-family: 'Inter', sans-serif;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0;
    background: linear-gradient(90deg, var(--accent-color), transparent);
    transition: width 0.3s ease;
    opacity: 0.2;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--text-primary);
    transform: translateX(2px);
}

.nav-item:hover::before {
    width: 100%;
}

.nav-item.active {
    background: var(--sidebar-hover);
    color: var(--text-primary);
    border-left-color: var(--accent-color);
    font-weight: 600;
}

.nav-item.active::before {
    width: 100%;
}

/* Chess piece icons - Enhanced styling */
.nav-item-icon {
    font-size: 1.5rem;
    width: 28px;
    text-align: center;
    filter: drop-shadow(0 0 6px rgba(168, 85, 247, 0.4));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Hover effect: scale + enhanced glow */
.nav-item:hover .nav-item-icon {
    filter: drop-shadow(0 0 12px rgba(168, 85, 247, 0.7));
    transform: scale(1.15);
}

/* Active state: maximum purple shadow */
.nav-item.active .nav-item-icon {
    filter: drop-shadow(0 0 16px rgba(168, 85, 247, 1))
            drop-shadow(0 0 8px rgba(168, 85, 247, 0.8));
    transform: scale(1.1);
}

.nav-item-text {
    font-size: 14px;
    font-weight: 500;
}

.nav-item.active .nav-item-text {
    font-weight: 600;
}

/* Main content area - only shift when sidebar is present */
.nav-content {
    flex: 1;
    min-height: 100vh;
}

/* Only add margin when body has sidebar */
body.has-sidebar .nav-content {
    margin-left: var(--sidebar-width);
}

/* Mobile menu toggle */
.nav-mobile-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
    backdrop-filter: blur(10px);
}

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

/* Mobile overlay */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 27, 75, 0.8);
    backdrop-filter: blur(4px);
    z-index: 999;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .nav-sidebar {
        transform: translateX(-100%);
    }

    .nav-sidebar.active {
        transform: translateX(0);
    }

    body.has-sidebar .nav-content {
        margin-left: 0;
        width: 100%;
    }

    .nav-mobile-toggle {
        display: block;
    }

    .nav-overlay.active {
        display: block;
    }
}

/* Scrollbar styling */
.nav-sidebar::-webkit-scrollbar {
    width: 6px;
}

.nav-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.nav-sidebar::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.3);
    border-radius: 3px;
}

.nav-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(168, 85, 247, 0.5);
}
