/**
 * FSP Navigation Framework Styles
 * Professional, scalable navigation styling
 */

/* ===== VARIABLES ===== */
:root {
    --fsp-primary: #C99B32;
    --fsp-secondary: #2c5530;
    --nav-bg: #ffffff;
    --nav-border: #e5e7eb;
    --nav-text: #374151;
    --nav-text-light: #6b7280;
    --nav-hover: #f9fafb;
    --nav-active: #fef3c7;
    --nav-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --nav-transition: all 0.3s ease;
}

/* ===== MAIN NAVIGATION ===== */
.main-navigation {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    box-shadow: var(--nav-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Hide main navigation content by default */
.main-navigation-content {
    display: none;
    transition: var(--nav-transition);
}

/* Show navigation when toggled */
.main-navigation-content.nav-expanded {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-groups {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    padding: 1rem 0;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-group {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
}

.nav-group-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--fsp-primary), var(--fsp-secondary));
    color: white;
    border-radius: 0.75rem 0.75rem 0 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.nav-group-header i {
    font-size: 1.25rem;
}

.nav-group-items {
    border: 1px solid var(--nav-border);
    border-top: none;
    border-radius: 0 0 0.75rem 0.75rem;
    overflow: hidden;
}

/* ===== NAVIGATION ITEMS ===== */
.nav-item {
    position: relative;
    transition: var(--nav-transition);
}

.nav-item-clickable {
    cursor: pointer;
}

.nav-item-clickable:hover {
    background: var(--nav-hover);
    transform: translateY(-1px);
}

.nav-item-active {
    background: var(--nav-active);
    border-left: 4px solid var(--fsp-primary);
}

.nav-item-content {
    padding: 1.5rem;
    position: relative;
}

.nav-item-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.nav-item-icon {
    width: 3rem;
    height: 3rem;
    background: linear-gradient(135deg, var(--fsp-primary), var(--fsp-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.nav-item-info {
    flex: 1;
}

.nav-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--nav-text);
    margin: 0 0 0.5rem 0;
}

.nav-item-description {
    color: var(--nav-text-light);
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
}

.nav-item-features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.feature-tag {
    background: #f3f4f6;
    color: #374151;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.nav-item-action {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: var(--fsp-primary);
    font-size: 1.1rem;
    transition: var(--nav-transition);
}

.nav-item-clickable:hover .nav-item-action {
    transform: translateX(4px);
}

/* ===== SPECIAL STATES ===== */
.nav-item-upgrade {
    position: relative;
    opacity: 0.7;
}

.nav-item-upgrade::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(201, 155, 50, 0.1) 50%, transparent 70%);
    pointer-events: none;
}

.upgrade-lock {
    position: absolute;
    top: 1rem;
    right: 3rem;
    color: var(--fsp-primary);
    font-size: 1.25rem;
}

.nav-item-coming-soon {
    opacity: 0.6;
    cursor: not-allowed !important;
}

.nav-item-coming-soon:hover {
    transform: none !important;
    background: var(--nav-bg) !important;
}

.coming-soon-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--nav-text-light);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

/* ===== USER NAVIGATION ===== */
.user-navigation {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--nav-bg);
    border: 1px solid var(--nav-border);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: var(--nav-transition);
}

.user-menu-trigger:hover {
    background: var(--nav-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* User Profile Dropdown Styles */
.user-profile-container {
    position: relative;
    display: inline-block;
}

.user-profile-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border: none;
    border-radius: 50%;
    background: var(--nav-bg);
    cursor: pointer;
    transition: var(--nav-transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-profile-button:hover {
    background: var(--nav-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.user-profile-button.active {
    background: var(--nav-active);
    box-shadow: 0 0 0 2px rgba(201, 155, 50, 0.2);
}

.user-profile-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 280px;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--nav-transition);
    z-index: 1000;
    overflow: hidden;
}

.user-profile-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.user-avatar.large {
    width: 3rem;
    height: 3rem;
    font-size: 1.25rem;
}

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

.dropdown-header .user-name {
    font-weight: 600;
    font-size: 1rem;
    color: #1f2937;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.dropdown-header .user-email {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.user-role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background: var(--fsp-primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.375rem;
}

.dropdown-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 0;
}

.dropdown-menu {
    padding: 0.5rem 0;
}

/* User Welcome Message */
.user-welcome {
    color: var(--nav-text);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    background: rgba(201, 155, 50, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(201, 155, 50, 0.3);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.15s ease;
    font-size: 0.875rem;
}

.dropdown-item:hover {
    background: #f3f4f6;
}

.dropdown-item.active {
    background: #eff6ff;
    color: var(--fsp-primary);
}

.dropdown-item i {
    width: 1.25rem;
    text-align: center;
    color: #6b7280;
    font-size: 1rem;
}

.dropdown-item:hover i,
.dropdown-item.active i {
    color: currentColor;
}

.user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, var(--fsp-primary), var(--fsp-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-name {
    font-weight: 600;
    color: var(--nav-text);
    font-size: 0.9rem;
}

.user-role {
    color: var(--nav-text-light);
    font-size: 0.8rem;
}

/* Legacy styles removed - replaced with user-profile-dropdown */

.user-info {
    padding: 1rem;
    border-bottom: 1px solid var(--nav-border);
}

.user-menu-items {
    padding: 0.5rem 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--nav-text);
    cursor: pointer;
    transition: var(--nav-transition);
}

.user-menu-item:hover {
    background: var(--nav-hover);
}

.user-menu-item.active {
    background: var(--nav-active);
    color: var(--fsp-secondary);
    font-weight: 500;
}

.user-menu-item i {
    width: 1.25rem;
    text-align: center;
    color: var(--nav-text-light);
}

.menu-divider {
    height: 1px;
    background: var(--nav-border);
    margin: 0.5rem 0;
}

.menu-group-label {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--nav-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== AUTH ACTIONS ===== */
.auth-actions {
    display: flex;
    gap: 0.75rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--nav-transition);
    font-size: 0.9rem;
}

.nav-btn-primary {
    background: var(--fsp-primary);
    color: white;
}

.nav-btn-primary:hover {
    background: var(--fsp-secondary);
    transform: translateY(-1px);
}

.nav-btn-secondary {
    background: transparent;
    color: var(--nav-text);
    border: 1px solid var(--nav-border);
}

.nav-btn-secondary:hover {
    background: var(--nav-hover);
}

/* Breadcrumbs removed */

/* ===== SIDEBAR NAVIGATION ===== */
.sidebar-navigation {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background: var(--nav-bg);
    border-right: 1px solid var(--nav-border);
    box-shadow: var(--nav-shadow);
    transition: var(--nav-transition);
    z-index: 300;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-open .sidebar-navigation {
    left: 0;
}

/* Prevent body scroll when sidebar is open on mobile */
.sidebar-open {
    overflow: hidden;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--nav-border);
    background: linear-gradient(135deg, var(--fsp-primary), var(--fsp-secondary));
    color: white;
    flex-shrink: 0;
}

.sidebar-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar for sidebar */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

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

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(201, 155, 50, 0.3);
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(201, 155, 50, 0.5);
}

/* Sidebar user section styling */
.sidebar-user-section {
    padding: 1rem;
    border-bottom: 1px solid var(--nav-border);
    flex-shrink: 0;
}

.sidebar-nav-groups {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0 1rem;
    min-height: 0; /* Prevent flex shrinking issues */
}

.sidebar-nav-group {
    border-bottom: 1px solid var(--nav-border);
    padding-bottom: 1rem;
}

.sidebar-nav-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.sidebar-nav-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--nav-text);
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.sidebar-nav-group-header i {
    color: var(--fsp-primary);
    font-size: 1rem;
}

.sidebar-nav-group-items {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-bottom: 0.5rem;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--nav-text);
    cursor: pointer;
    transition: var(--nav-transition);
}

.sidebar-nav-item:hover {
    background: var(--nav-hover);
}

.sidebar-nav-item.active {
    background: var(--nav-active);
    border-right: 3px solid var(--fsp-primary);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .nav-groups {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-group {
        max-width: none;
    }
}

@media (max-width: 768px) {
    .main-navigation {
        position: relative;
    }
    
    .nav-groups {
        padding: 0.5rem;
    }
    
    .nav-item-content {
        padding: 1rem;
    }
    
    .nav-item-header {
        gap: 0.75rem;
    }
    
    .nav-item-icon {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1rem;
    }
    
    /* User profile dropdown adjustments for mobile */
    .user-profile-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: auto;
        border-radius: 1rem 1rem 0 0;
        transform: translateY(100%);
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .user-profile-dropdown.open {
        transform: translateY(0);
    }
    
    .dropdown-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        background: #f8fafc;
        z-index: 10;
    }
    
    .dropdown-header .user-name {
        font-size: 0.9rem;
    }
    
    .dropdown-header .user-email {
        font-size: 0.8rem;
    }
    
    .dropdown-item {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .nav-item-features {
        display: none;
    }
    
    .nav-item-action {
        display: none;
    }
    
    .auth-actions {
        flex-direction: column;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

.nav-item-clickable:focus,
.user-menu-item:focus,
.nav-btn:focus {
    outline: 2px solid var(--fsp-primary);
    outline-offset: 2px;
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --nav-bg: #1f2937;
        --nav-border: #374151;
        --nav-text: #f9fafb;
        --nav-text-light: #d1d5db;
        --nav-hover: #374151;
        --nav-active: #451a03;
        --nav-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    }
    
    .feature-tag {
        background: #374151;
        color: #d1d5db;
    }
}

/* ===== NAVIGATION OVERLAY ===== */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 250; /* Between sidebar (300) and normal content */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(2px);
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
    display: block !important;
}

/* Ensure sidebar appears above overlay */
.sidebar-navigation {
    z-index: 300;
}

/* Mobile-specific navigation styles */
@media (max-width: 768px) {
    .sidebar-navigation.mobile-open {
        left: 0;
        transform: translateX(0);
    }

    /* Ensure sidebar content is clickable on mobile */
    .sidebar-navigation .sidebar-content,
    .sidebar-navigation .sidebar-nav-item,
    .sidebar-navigation .sidebar-user-section,
    .sidebar-navigation .sidebar-nav-item.clickable,
    .sidebar-navigation .sidebar-user-menu-item.clickable {
        pointer-events: auto;
        position: relative;
        z-index: 310;
        cursor: pointer;
    }

    /* Ensure touch events work on mobile */
    .sidebar-navigation .sidebar-nav-item.clickable,
    .sidebar-navigation .sidebar-user-menu-item.clickable {
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(201, 155, 50, 0.3);
        user-select: none;
    }

    /* Fix for mobile safari touch events */
    .sidebar-navigation.mobile-open * {
        pointer-events: auto;
    }
}