/* Navigation Menu Styles - Modern Premium Theme */

/* Theme Variables Override */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --primary-color: #6366f1;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --glow-cyan: 0 0 0 3px rgba(99, 102, 241, 0.3); /* Focus ring style */
}

/* Desktop Navigation Styles */

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
    gap: 0.25rem;
    position: relative;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown > a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-nav-dropdown {
    display: none;
}

.mobile-nav-dropdown .current-menu-label {
    display: inline-block;
    width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: auto;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    min-width: 220px;
    max-width: min(320px, calc(100vw - 16px));
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    list-style: none;
    padding: 0.5rem;
    display: none;
}

.nav-dropdown:hover .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block;
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu .nav-link {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    color: var(--text-secondary);
    font-weight: 500;
    background: transparent;
}

.dropdown-menu .nav-link:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.dropdown-menu .nav-link.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    transition: var(--transition);
    position: relative;
    font-size: 0.95rem;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
    text-shadow: none;
}

.nav-link:focus-visible {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.18);
    outline: 2px solid rgba(129, 140, 248, 0.95);
    outline-offset: 2px;
}

.nav-link.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
    text-shadow: none;
}

.nav-link.active::after {
    display: none;
}

/* Mobile Navigation Styles */

/* Navigation Container */
.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Changed to space-between for standard layout */
    position: relative;
    max-width: var(--container-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--container-padding);
    height: var(--header-height);
}

/* Logo Styles - Modern Gradient */
.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    z-index: 10;
    color: inherit;
}

/* Navigation Actions (Menu Toggle) */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 10;
}

/* Specific overrides for positioning to match previous layout logic but cleaner */
.nav-container > .nav-actions {
    position: static; /* Reset absolute */
    order: 1; /* Left side */
    margin-right: auto;
}

.nav-container > .logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-container > .nav-menu {
    position: static; /* Reset absolute */
    order: 2; /* Right side */
    margin-left: auto;
}

/* Tablet adaptation */
@media (min-width: 769px) and (max-width: 1024px) {
    .nav-container {
        padding: 0 12px;
        gap: 0.5rem;
    }

    .nav-container > .logo {
        max-width: 260px;
    }

    .logo .logo-text {
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .nav-menu {
        gap: 0.15rem;
    }

    .nav-link {
        font-size: 0.9rem;
        padding: 0.45rem 0.7rem;
    }

    .dropdown-menu {
        left: auto;
        right: 0;
        min-width: 180px;
    }
}

/* Re-adjust for desktop to center menu and left logo if preferred, 
   but based on original file, let's stick to a clean standard layout:
   Left: Sidebar Toggle
   Center: Logo
   Right: Navigation
*/

/* Tags Sidebar Styles - Modern Clean */
.tags-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: none;
    font-weight: 500;
}

.tags-toggle span {
    font-size: 0.9rem;
    font-weight: 500;
}

.tags-toggle:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: none;
    box-shadow: none;
}

.tags-toggle:focus-visible,
.sidebar-close:focus-visible,
.tag-item:focus-visible {
    outline: 2px solid rgba(129, 140, 248, 0.95);
    outline-offset: 2px;
}

.tags-toggle.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Tags Sidebar - Modern Style */
.tags-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100vh;
    background: var(--bg-primary);
    box-shadow: var(--shadow-xl);
    z-index: 2000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(0); /* Handled by left property in original, but let's use transform for performance if possible, keeping left for compat */
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.tags-sidebar.active {
    left: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.sidebar-header h2.sidebar-title {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
    font-weight: 700;
    text-shadow: none;
}

.sidebar-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-full);
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: none;
    box-shadow: none;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.tags-search {
    margin-bottom: 1.5rem;
}

.tags-search input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: all var(--transition-normal);
}

.tags-search input::placeholder {
    color: var(--text-muted);
}

.tags-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.tags-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tag-item {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-normal);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid transparent;
    font-weight: 500;
    font-size: 0.95rem;
}

.tag-item:hover {
    background: rgba(99, 102, 241, 0.05);
    color: var(--primary-color);
    border-color: rgba(99, 102, 241, 0.2);
    transform: none;
    box-shadow: none;
    text-shadow: none;
}

.tag-item span {
    font-weight: 500;
}

.tag-item.hidden {
    display: none;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nav-container {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0 12px;
        position: relative;
    }

    .nav-container > .nav-actions {
        position: absolute !important;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        margin: 0 !important;
        width: auto;
        display: flex;
        justify-content: flex-start;
    }

    .nav-container > .logo {
        position: absolute !important;
        left: 72px !important;
        right: 156px !important;
        top: 50%;
        transform: translateY(-50%) !important;
        min-width: 0;
        max-width: none !important;
        width: auto;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 4px !important;
        overflow: hidden;
        text-align: center;
    }

    .nav-container > .nav-menu {
        position: absolute !important;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        margin: 0 !important;
        min-width: 116px;
        justify-self: auto;
        text-align: center;
    }

    .nav-menu {
        display: flex !important;
        position: static !important;
        background: transparent !important;
        flex-direction: row !important;
        padding: 0 !important;
        box-shadow: none !important;
        border-top: none !important;
        align-items: center !important;
        gap: 0.25rem !important;
        margin-left: auto;
        flex: 0 0 auto;
        overflow: visible !important;
    }

    .nav-menu > li {
        display: none !important;
    }

    .nav-menu > li.mobile-nav-dropdown {
        display: block !important;
    }

    .nav-menu .nav-dropdown,
    .nav-menu.active .nav-dropdown {
        width: auto;
    }

    .nav-menu .nav-dropdown .dropdown-menu,
    .nav-menu.active .nav-dropdown .dropdown-menu {
        position: absolute !important;
        left: auto;
        right: 0;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-6px);
        margin-top: 0.25rem;
        min-width: 180px;
        border: 1px solid var(--border-color);
        box-shadow: var(--shadow-xl);
        background: var(--bg-secondary);
        display: block;
    }

    .nav-menu .nav-dropdown.open .dropdown-menu,
    .nav-menu.active .nav-dropdown.open .dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .logo .logo-text {
        display: inline-block;
        max-width: 120px;
        white-space: normal;
        word-break: break-word;
        overflow-wrap: break-word;
        line-height: 1.15;
    }

    .mobile-nav-dropdown .nav-link {
        box-sizing: border-box;
    }

    .mobile-nav-dropdown .current-menu-label {
        width: 72px;
    }

    .tags-sidebar {
        width: 100%;
        left: -100%;
        max-width: 300px;
    }

    .tags-sidebar.active {
        left: 0;
    }
}
