/* ====================================
   Component Styles - OPTIMIZED & FIXED
   REDitors - Noir Edition
   Production-Ready Performance
   ==================================== */

/* ===== FILM EFFECTS (GPU Accelerated) ===== */
.noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJhIj48ZmVUdXJidWxlbmNlIGJhc2VGcmVxdWVuY3k9Ii43NSIgc3RpdGNoVGlsZXM9InN0aXRjaCIgdHlwZT0iZnJhY3RhbE5vaXNlIi8+PGZlQ29sb3JNYXRyaXggdHlwZT0ic2F0dXJhdGUiIHZhbHVlcz0iMCIvPjwvZmlsdGVyPjxwYXRoIGQ9Ik0wIDBoMzAwdjMwMEgweiIgZmlsdGVyPSJ1cmwoI2EpIiBvcGFjaXR5PSIuMDUiLz48L3N2Zz4=');
    opacity: 0.03;
    pointer-events: none;
    z-index: 9999;
    animation: grain 0.3s steps(3) infinite;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9998;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03) 0px,
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
    will-change: transform;
    transform: translateZ(0);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.6) 100%);
    z-index: 9997;
    will-change: transform;
    transform: translateZ(0);
}

/* ===== CUSTOM CURSOR (Desktop Only) ===== */
.cursor-dot,
.cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10000;
    border-radius: 50%;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.15s ease;
    will-change: transform;
    backface-visibility: hidden;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background: var(--accent, #ffffff);
    transform: translate(-50%, -50%) translateZ(0);
}

.cursor-outline {
    width: 32px;
    height: 32px;
    border: 2px solid var(--accent, #ffffff);
    opacity: 0.5;
    transform: translate(-50%, -50%) translateZ(0);
}

/* Hide cursor on touch devices */
@media (hover: none) and (pointer: coarse) {
    .cursor-dot,
    .cursor-outline {
        display: none !important;
    }
}

/* ===== LOADING SCREEN (Optimized) ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg, #050505);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: opacity 0.5s ease-out;
    will-change: opacity;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    max-width: 400px;
    padding: 0 20px;
    animation: fadeInUp 0.6s ease-out;
}

.loading-logo {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    letter-spacing: -2px;
    margin-bottom: 2rem;
    color: var(--accent, #ffffff);
    animation: pulse 2s ease-in-out infinite;
}

.loading-bar {
    width: 300px;
    max-width: 100%;
    height: 2px;
    background: var(--gray, #1a1a1a);
    position: relative;
    overflow: hidden;
    margin: 0 auto 1rem;
    border-radius: 2px;
}

.loading-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--accent, #ffffff);
    width: 0;
    animation: loading 2s ease-out forwards;
    will-change: width;
}

.loading-text {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: var(--text-sm, 0.875rem);
    color: var(--text-dim, #999999);
    letter-spacing: 2px;
    animation: blink 1.5s ease-in-out infinite;
}

/* ===== NAVIGATION (Highly Optimized) ===== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border, #222222);
    animation: slideDown 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s ease,
                box-shadow 0.3s ease;
    will-change: transform, background;
    transform: translateZ(0);
}

.nav.scrolled {
    background: rgba(5, 5, 5, 0.95);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem clamp(20px, 5vw, 80px);
    max-width: 1600px;
    margin: 0 auto;
    height: 80px;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: -2px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--accent, #ffffff);
    text-decoration: none;
}

.logo::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent, #ffffff);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo:hover::after {
    width: 100%;
}

.logo:active {
    transform: scale(0.98);
}

.version {
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
    color: var(--text-dim, #999999);
    padding: 3px 8px;
    border: 1px solid var(--border, #222222);
    border-radius: 6px;
    transition: all 0.3s ease;
    user-select: none;
}

.version:hover {
    border-color: var(--accent, #ffffff);
    color: var(--accent, #ffffff);
    transform: translateY(-1px);
}

.nav-center {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--text-muted, #666666);
    font-size: 0.875rem;
    font-weight: 500;
    position: relative;
    transition: color 0.3s ease;
    padding: 0.5rem 0;
    text-decoration: none;
    cursor: pointer;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent, #ffffff);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent, #ffffff);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* ===== NAVIGATION BUTTONS (Optimized) ===== */
.nav-btn-primary,
.nav-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    will-change: transform;
}

.nav-btn-primary {
    background: var(--accent, #ffffff);
    color: var(--bg, #050505);
}

.nav-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.2);
}

.nav-btn-primary:active {
    transform: translateY(0);
}

.nav-btn-secondary {
    background: transparent;
    color: var(--accent, #ffffff);
    border: 1px solid var(--border, #222222);
}

.nav-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent, #ffffff);
}

/* ===== ICON BUTTONS ===== */
.nav-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border, #222222);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    background: transparent;
    color: var(--text, #ffffff);
    cursor: pointer;
}

.nav-icon-btn:hover {
    border-color: var(--accent, #ffffff);
    background: rgba(255, 255, 255, 0.05);
    transform: scale(1.05);
}

.nav-icon-btn:active {
    transform: scale(0.95);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--error, #ef4444);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 9999px;
    min-width: 18px;
    text-align: center;
    line-height: 1;
    animation: pulse 2s ease-in-out infinite;
}

/* ===== LANGUAGE SWITCH ===== */
.lang-switch {
    background: transparent;
    color: var(--accent, #ffffff);
    border: 1px solid var(--border, #222222);
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.lang-switch:hover {
    border-color: var(--accent, #ffffff);
    background: rgba(255, 255, 255, 0.05);
}

.lang-switch:focus {
    outline: 2px solid var(--accent, #ffffff);
    outline-offset: 2px;
}

.lang-switch option {
    background: var(--bg, #050505);
    color: var(--text, #ffffff);
}

/* ===== THEME TOGGLE (Smooth Animation) ===== */
.theme-toggle {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border, #222222);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    cursor: pointer;
}

.theme-toggle:hover {
    border-color: var(--accent, #ffffff);
    transform: rotate(180deg);
}

.theme-toggle:active {
    transform: rotate(180deg) scale(0.9);
}

.theme-icon {
    font-size: 1.2rem;
    transition: transform 0.4s ease;
}

/* ===== MOBILE MENU TOGGLE ===== */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    width: 30px;
    height: 30px;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.mobile-menu-toggle span {
    width: 100%;
    height: 2px;
    background: var(--accent, #ffffff);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translateY(7px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translateY(-7px);
}

/* ===== USER MENU (Enhanced Hover) ===== */
.auth-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    position: relative;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent, #ffffff);
    color: var(--bg, #050505);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    user-select: none;
}

.user-avatar:hover {
    transform: scale(1.1);
    border-color: var(--accent, #ffffff);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.user-avatar:active {
    transform: scale(1.05);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--bg-secondary, #0a0a0a);
    border: 1px solid var(--border, #222222);
    border-radius: 12px;
    padding: 0.5rem;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 1001;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    pointer-events: none;
    
    /* Smooth transitions */
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0s linear 0.3s;
}

/* Expanded hover area for better UX */
.user-dropdown::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -50px;
    bottom: -50px;
    left: -30px;
    z-index: -1;
}

.user-menu:hover .user-dropdown,
.user-dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    transition-delay: 0s;
}

.user-dropdown a,
.user-dropdown button {
    padding: 10px 15px;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text, #ffffff);
    width: 100%;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    display: block;
    font-family: inherit;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
    background: var(--gray, #1a1a1a);
    color: var(--accent, #ffffff);
    transform: translateX(5px);
}

.user-dropdown a:active,
.user-dropdown button:active {
    transform: translateX(3px);
}

/* ===== MOBILE MENU (Smooth Slide) ===== */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 400px;
    height: 100vh;
    background: var(--bg-secondary, #0a0a0a);
    z-index: 999;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid var(--border, #222222);
    overflow-y: auto;
    box-shadow: -10px 0 50px rgba(0, 0, 0, 0.5);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-content {
    padding: 6rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.mobile-menu-link {
    font-size: 1.125rem;
    font-weight: 600;
    padding: 1rem;
    border-bottom: 1px solid var(--border, #222222);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text, #ffffff);
    text-decoration: none;
    display: block;
}

.mobile-menu-link:hover {
    color: var(--accent, #ffffff);
    padding-left: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
}

.mobile-menu-link:active {
    background: rgba(255, 255, 255, 0.05);
}

/* ===== CTA BUTTONS (Enhanced) ===== */
.special-btn,
.cta-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--accent, #ffffff);
    color: var(--bg, #050505);
    padding: 1rem 2rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: none;
    cursor: pointer;
    text-decoration: none;
    will-change: transform;
}

.special-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
    transition: left 0.6s ease;
}

.special-btn:hover::before {
    left: 100%;
}

.special-btn:hover,
.cta-btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 60px rgba(255, 255, 255, 0.3);
}

.special-btn:active,
.cta-btn-primary:active {
    transform: translateY(-1px);
}

/* ===== RESPONSIVE NAV ===== */
@media (max-width: 1023px) {
    .nav-center {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .lang-switch {
        display: none;
    }
}

@media (max-width: 767px) {
    .nav-container {
        padding: 1rem 1.25rem;
        height: 60px;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .version {
        display: none;
    }
    
    .nav-icon-btn,
    .theme-toggle {
        width: 36px;
        height: 36px;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .nav-btn-primary,
    .nav-btn-secondary {
        font-size: 0.8125rem;
        padding: 0.625rem 1.25rem;
    }
    
    .mobile-menu {
        width: 90%;
        max-width: 320px;
    }
}

/* ===== ACCESSIBILITY ===== */
.nav-link:focus-visible,
.nav-btn-primary:focus-visible,
.nav-btn-secondary:focus-visible,
.theme-toggle:focus-visible {
    outline: 2px solid var(--accent, #ffffff);
    outline-offset: 2px;
}

/* ===== MODALS & PANELS (FIXED) ===== */

/* Search Modal */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 120px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.search-modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.search-modal-content {
    width: 90%;
    max-width: 600px;
    background: var(--bg-secondary, #0a0a0a);
    border: 1px solid var(--border, #222222);
    border-radius: 16px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-modal.active .search-modal-content {
    transform: translateY(0) scale(1);
}

.search-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--border, #222222);
}

.search-header i {
    color: var(--text-dim, #999999);
}

.search-header input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text, #ffffff);
    font-size: 1.1rem;
    font-family: inherit;
    outline: none;
}

.search-close {
    background: transparent;
    border: none;
    color: var(--text-dim, #999999);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text, #ffffff);
}

.search-results {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.search-category {
    margin-bottom: 24px;
}

.search-category h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted, #666666);
    margin-bottom: 12px;
    padding-left: 12px;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-dim, #999999);
}

.search-item:hover {
    background: var(--bg-tertiary, #1a1a1a);
    color: var(--text, #ffffff);
}

/* Notifications Panel */
.notifications-panel {
    position: fixed;
    top: 80px;
    right: max(20px, calc((100vw - 1600px) / 2 + 20px));
    width: 380px;
    background: var(--bg-secondary, #0a0a0a);
    border: 1px solid var(--border, #222222);
    border-radius: 16px;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
    z-index: 1900;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.notifications-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border, #222222);
}

.notifications-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text, #ffffff);
}

.mark-all-read {
    background: transparent;
    border: none;
    color: var(--accent, #ffffff);
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 500;
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border, #222222);
    transition: background 0.2s ease;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.notification-item.unread {
    background: rgba(255, 255, 255, 0.03);
}

.notification-item.unread:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notification-icon {
    font-size: 1.25rem;
    padding-top: 2px;
}

.notification-content h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text, #ffffff);
    margin-bottom: 4px;
}

.notification-content p {
    font-size: 0.85rem;
    color: var(--text-dim, #999999);
    margin-bottom: 6px;
    line-height: 1.4;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-muted, #666666);
}

.notifications-footer {
    padding: 12px;
    text-align: center;
    border-top: 1px solid var(--border, #222222);
}

.notifications-footer a {
    color: var(--text-dim, #999999);
    font-size: 0.8rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.notifications-footer a:hover {
    color: var(--accent, #ffffff);
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    .noise,
    .loading-logo,
    .notification-badge {
        animation: none !important;
    }
    
    .theme-toggle:hover {
        transform: none;
    }
    
    * {
        transition-duration: 0.01ms !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .noise,
    .scanlines,
    body::before,
    .cursor-dot,
    .cursor-outline,
    .nav,
    .mobile-menu {
        display: none !important;
    }
}