/**
 * Community Menu Styles
 *
 * Left rail navigation menu visible on desktop (≥1024px).
 * Hidden on mobile - uses existing mobile bottom nav instead.
 *
 * @package Videohub360_Theme
 * @since 1.0.0
 */

/* ============================================
   Default Behavior (Menu Disabled)
   ============================================ */

.site-layout-wrapper {
    /* No layout changes by default */
}

.vh360-community-menu {
    display: none;
}

/* ============================================
   Menu Enabled - 3 Column Layout
   ============================================ */

body.has-community-menu .site-layout-wrapper {
    display: flex;
    min-height: calc(100vh - var(--header-height, 70px));
    padding-left: var(--community-menu-left-gutter, 24px);
}

body.has-community-menu .vh360-community-menu {
    display: block;
    position: sticky;
    top: 0;
    width: var(--community-menu-width, 280px);
    height: 100vh;
    flex-shrink: 0;
    overflow-y: auto;
    background-color: var(--community-menu-bg-color, #ffffff);
    border-right: 1px solid var(--border-1);
    z-index: 100;
}

/* Adjust for sticky header if present */
body.has-community-menu .site-header--sticky ~ .site-layout-wrapper .vh360-community-menu {
    top: var(--header-height, 70px);
    height: calc(100vh - var(--header-height, 70px));
}

body.has-community-menu .site-content {
    flex: 1;
    min-width: 0; /* Prevent flex item from overflowing */
}

/* ============================================
   Compact Mode
   ============================================ */

body.community-menu-compact .vh360-community-menu {
    width: 64px;
}

/* ============================================
   Mobile - Always Hidden
   ============================================ */

@media (max-width: 1023px) {
    body.has-community-menu {
        --community-menu-left-gutter: 0px;
    }

    .vh360-community-menu {
        display: none !important;
    }
    
    body.has-community-menu .site-layout-wrapper {
        display: block;
    }
}

/* ============================================
   Menu Inner Container
   ============================================ */

.vh360-community-menu__inner {
    padding: 20px 0;
}

/* ============================================
   Profile Card
   ============================================ */

.vh360-community-menu__profile-card {
    padding: 0 16px 20px;
    border-bottom: 1px solid var(--border-1);
    margin-bottom: 20px;
}

.vh360-community-menu__profile-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

.vh360-community-menu__profile-link:hover {
    opacity: 0.8;
}

.vh360-community-menu__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}

.vh360-community-menu__profile-info {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Allow text truncation */
}

.vh360-community-menu__profile-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vh360-community-menu__profile-username {
    font-size: 12px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Profile Card - Compact Mode */
body.community-menu-compact .vh360-community-menu__profile-card {
    padding: 0 8px 16px;
    text-align: center;
}

body.community-menu-compact .vh360-community-menu__profile-link {
    justify-content: center;
}

body.community-menu-compact .vh360-community-menu__profile-info {
    display: none;
}

/* ============================================
   Navigation Menu
   ============================================ */

.vh360-community-menu__nav {
    padding: 0;
}

.vh360-community-menu__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.vh360-community-menu__list li {
    margin: 0;
    padding: 0;
}

.vh360-community-menu__list a {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    color: var(--community-menu-text-color, #4b5563);
    text-decoration: none;
    font-family: var(--community-menu-font-family, inherit);
    font-size: var(--community-menu-font-size, 15px);
    font-weight: var(--community-menu-font-weight, 500);
    transition: all 0.2s ease;
    position: relative;
}

.vh360-community-menu__list a:hover {
    background: var(--community-menu-hover-bg-color, #f3f4f6);
    color: var(--text-color, #1f2937);
}

.vh360-community-menu__list a:focus {
    outline: 2px solid var(--ring-1);
    outline-offset: -2px;
}

/* Active state */
.vh360-community-menu__list .current-menu-item > a,
.vh360-community-menu__list .current_page_item > a,
.vh360-community-menu__list .current-menu-ancestor > a {
    background-color: var(--community-menu-active-bg-color, #eff6ff);
    color: var(--community-menu-active-color, #2563eb);
    font-weight: 600;
}

.vh360-community-menu__list .current-menu-item > a::before,
.vh360-community-menu__list .current_page_item > a::before,
.vh360-community-menu__list .current-menu-ancestor > a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--community-menu-active-color, #2563eb);
}

/* Icon styling */
.vh360-cm-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 12px;
}

.vh360-cm-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

/* Navigation - Compact Mode */
body.community-menu-compact .vh360-community-menu__list a {
    justify-content: center;
    padding: 16px 8px;
}

body.community-menu-compact .vh360-cm-label {
    display: none;
}

body.community-menu-compact .vh360-cm-icon {
    margin-right: 0;
}

/* ============================================
   Admin Notice
   ============================================ */

.vh360-community-menu__notice {
    padding: 16px;
    background-color: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning-color);
    border-radius: 6px;
    margin: 0 16px;
}

.vh360-community-menu__notice p {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--warning-color);
}

.vh360-community-menu__notice-link {
    display: inline-block;
    font-size: 13px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.vh360-community-menu__notice-link:hover {
    text-decoration: underline;
}

/* ============================================
   Custom Scrollbar
   ============================================ */

.vh360-community-menu::-webkit-scrollbar {
    width: 8px;
}

.vh360-community-menu::-webkit-scrollbar-track {
    background: var(--surface-3);
}

.vh360-community-menu::-webkit-scrollbar-thumb {
    background: var(--border-1);
    border-radius: 4px;
}

.vh360-community-menu::-webkit-scrollbar-thumb:hover {
    background: var(--text-2);
}

/* Firefox scrollbar */
.vh360-community-menu {
    scrollbar-width: thin;
    scrollbar-color: var(--border-1) var(--surface-3);
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    body.has-community-menu .vh360-community-menu {
        background-color: #1f2937;
        border-right-color: #374151;
    }
    
    .vh360-community-menu__profile-card {
        border-bottom-color: #374151;
    }
    
    .vh360-community-menu__profile-name {
        color: #f9fafb;
    }
    
    .vh360-community-menu__profile-username {
        color: #9ca3af;
    }
    
    .vh360-community-menu__list a {
        color: #d1d5db;
    }
    
    .vh360-community-menu__list a:hover {
        background-color: #374151;
        color: #f9fafb;
    }
    
    .vh360-community-menu__list .current-menu-item > a,
    .vh360-community-menu__list .current_page_item > a,
    .vh360-community-menu__list .current-menu-ancestor > a {
        background-color: #1e3a8a;
        color: #93c5fd;
    }
    
    .vh360-community-menu::-webkit-scrollbar-track {
        background: #111827;
    }
    
    .vh360-community-menu::-webkit-scrollbar-thumb {
        background: #4b5563;
    }
    
    .vh360-community-menu::-webkit-scrollbar-thumb:hover {
        background: #6b7280;
    }
    
    .vh360-community-menu {
        scrollbar-color: #4b5563 #111827;
    }
}
