/**
 * Navbar Component Styles
 * 
 * A self-contained, accessible navigation component following FAANG-level engineering standards.
 * Integrates with ProfileDropdown and provides responsive mobile navigation.
 */

/* Component Root */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-height, 5rem);
    background: var(--surface-overlay, rgba(255, 255, 255, 0.95));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light, #e5e7eb);
    z-index: 1000;
    isolation: isolate;
}

/* Container */
.navbar__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 1rem;
}

/* Brand/Logo */
.navbar__brand {
    flex-shrink: 0;
}

.navbar__brand-link {
    display: block;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.navbar__brand-link:hover {
    transform: scale(1.05);
}

.navbar__brand-link:focus {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: 4px;
    border-radius: 8px;
}

/* Desktop Navigation */
.navbar__nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
    align-items: center;
}

.navbar__nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: var(--text-primary, #1f2937);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    min-height: 44px; /* Touch target size */
    white-space: nowrap;
}

.navbar__nav-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary, #3b82f6);
    opacity: 0;
    transition: opacity 0.2s ease;
    border-radius: inherit;
}

.navbar__nav-link:hover {
    color: var(--primary, #3b82f6);
    transform: translateY(-1px);
}

.navbar__nav-link:hover::before {
    opacity: 0.08;
}

.navbar__nav-link:focus {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: 2px;
    color: var(--primary, #3b82f6);
}

.navbar__nav-link--active {
    color: var(--primary, #3b82f6);
    font-weight: 600;
}

.navbar__nav-link--active::before {
    opacity: 0.12;
}

/* Actions Section */
.navbar__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.navbar__action-item {
    display: flex;
    align-items: center;
}

/* Theme Toggle */
.navbar__theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 2px solid var(--border-light, #e5e7eb);
    border-radius: 50%;
    background: var(--surface-elevated, #ffffff);
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.navbar__theme-toggle:hover {
    border-color: var(--primary, #3b82f6);
    color: var(--primary, #3b82f6);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.navbar__theme-toggle:focus {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: 2px;
}

/* Profile Section */
.navbar__profile {
    display: flex;
    align-items: center;
}

/* Mobile Menu Button */
.navbar__mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: none;
    border: 2px solid var(--border-light, #e5e7eb);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.navbar__mobile-menu-btn:hover {
    border-color: var(--primary, #3b82f6);
    background: rgba(59, 130, 246, 0.05);
}

.navbar__mobile-menu-btn:focus {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: 2px;
}

/* Hamburger Icon */
.navbar__hamburger {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 18px;
    height: 14px;
}

.navbar__hamburger-line {
    width: 100%;
    height: 2px;
    background: var(--text-primary, #1f2937);
    border-radius: 1px;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Hamburger Animation */
.navbar__mobile-menu-btn[aria-expanded="true"] .navbar__hamburger-line:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
}

.navbar__mobile-menu-btn[aria-expanded="true"] .navbar__hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.navbar__mobile-menu-btn[aria-expanded="true"] .navbar__hamburger-line:nth-child(3) {
    transform: translateY(-5px) rotate(-45deg);
}

/* Mobile Menu Overlay */
.navbar__mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

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

/* Mobile Menu */
.navbar__mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: min(320px, 85vw);
    height: 100vh;
    background: var(--surface-elevated, #ffffff);
    z-index: 1000;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.navbar__mobile-menu.active {
    display: flex;
    flex-direction: column;
    right: 0;
}

/* Mobile Menu Header */
.navbar__mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
    flex-shrink: 0;
}

.navbar__mobile-brand {
    flex: 1;
}

.navbar__mobile-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.25rem;
}

.navbar__mobile-close:hover {
    background: var(--surface-hover, #f3f4f6);
    color: var(--text-primary, #1f2937);
}

.navbar__mobile-close:focus {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: 2px;
}

/* Mobile Navigation Links */
.navbar__mobile-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.navbar__mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--text-primary, #1f2937);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    min-height: 56px; /* Touch target size */
    background: none;
    border-top: none;
    border-right: none;
    border-bottom: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 1rem;
}

.navbar__mobile-nav-link:hover {
    background: var(--surface-hover, #f3f4f6);
    border-left-color: var(--primary, #3b82f6);
    color: var(--primary, #3b82f6);
}

.navbar__mobile-nav-link:focus {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: -2px;
    background: var(--surface-hover, #f3f4f6);
    color: var(--primary, #3b82f6);
}

.navbar__mobile-nav-link--active {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: var(--primary, #3b82f6);
    color: var(--primary, #3b82f6);
    font-weight: 600;
}

.navbar__mobile-nav-link i {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Mobile Auth Section */
.navbar__mobile-auth {
    border-top: 1px solid var(--border-light, #e5e7eb);
    margin-top: 1rem;
    padding-top: 1rem;
}

/* Mobile Actions */
.navbar__mobile-actions {
    border-top: 1px solid var(--border-light, #e5e7eb);
    padding: 1rem;
    flex-shrink: 0;
}

.navbar__mobile-action-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
}

.navbar__mobile-action-item:last-child {
    border-bottom: none;
}

.navbar__mobile-action-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    color: var(--text-primary, #1f2937);
}

.navbar__mobile-theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: none;
    border: none;
    color: var(--text-primary, #1f2937);
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 1rem;
}

.navbar__mobile-theme-toggle:hover {
    background: var(--surface-hover, #f3f4f6);
    color: var(--primary, #3b82f6);
}

.navbar__mobile-theme-toggle:focus {
    outline: 2px solid var(--primary, #3b82f6);
    outline-offset: 2px;
}

/* Mobile Profile Section */
.navbar__mobile-profile {
    border-top: 1px solid var(--border-light, #e5e7eb);
    margin-top: 1rem;
    padding-top: 1rem;
}

.navbar__mobile-profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--surface-hover, #f8fafc);
    border-radius: 12px;
    margin: 0 1rem 1rem;
}

.navbar__mobile-profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-light, #e5e7eb);
    flex-shrink: 0;
}

.navbar__mobile-profile-info {
    flex: 1;
    min-width: 0;
}

.navbar__mobile-profile-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.navbar__mobile-profile-role {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary, #6b7280);
    margin-top: 0.25rem;
}

.navbar__mobile-profile-actions {
    /* Styling handled by navbar__mobile-nav-link */
}

.navbar__mobile-logout {
    color: var(--danger, #dc2626) !important;
}

.navbar__mobile-logout:hover {
    background: rgba(220, 38, 38, 0.1) !important;
    border-left-color: var(--danger, #dc2626) !important;
    color: var(--danger, #dc2626) !important;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar__nav {
        display: none;
    }
    
    .navbar__actions {
        display: none;
    }
    
    .navbar__mobile-menu-btn {
        display: flex;
    }
    
    .navbar__container {
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .navbar__container {
        padding: 0 0.75rem;
    }
    
    .navbar__mobile-menu {
        width: 100vw;
        right: -100vw;
    }
    
    .navbar__mobile-menu.active {
        right: 0;
    }
}
