/**
 * Custom Avatar Menu System CSS
 * EXACT COPY of hamburger menu system with avatar selectors
 */

/* Simple avatar button - ORIGINAL STYLING PRESERVED */
.custom-avatar-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: inline-block;
}

.custom-avatar-icon:hover {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

.custom-avatar-icon img {
    border-width: 1px !important;
    border-radius: 50% !important;
    aspect-ratio: 1 !important;
    object-fit: cover !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    transition: transform 0.3s ease !important;
    display: block !important;
}

.custom-avatar-icon:hover img {
    transform: scale(1.05);
}

/* ============================================
   MODAL STYLES (EXACT COPY OF HAMBURGER)
   ============================================ */

.custom-avatar-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.custom-avatar-modal.active {
    opacity: 1;
    visibility: visible;
}

/* Modal overlay */
.custom-avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* Modal container */
.custom-avatar-container {
    position: relative;
    width: 90%;
    max-width: 600px;  /* SAME AS HAMBURGER MENU */
    max-height: 90vh;
    margin: 5vh auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: 24px;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: translateY(30px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.custom-avatar-modal.active .custom-avatar-container {
    transform: translateY(0) scale(1);
}

/* Modal header */
.custom-avatar-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 20px 20px 0 20px;
}

.custom-avatar-close {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: absolute;
    top: 20px;
    right: 20px;
}

.custom-avatar-close:hover {
    background: rgba(255, 0, 0, 0.1);
    transform: scale(1.05);
}

.custom-avatar-close svg {
    width: 20px;
    height: 20px;
    color: #333;
    transition: color 0.2s ease;
}

.custom-avatar-close:hover svg {
    color: #ff4444;
}

/* Modal content */
.custom-avatar-content {
    padding: 0 32px 32px 32px;
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar */
.custom-avatar-content::-webkit-scrollbar {
    width: 6px;
}

.custom-avatar-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.custom-avatar-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.custom-avatar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Nexus logo within menu item (like Nexus app style) */
.custom-avatar-link.nexus-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.nexus-logo-container {
    margin-right: 12px;
    display: flex;
    align-items: center;
}

.nexus-logo {
    height: 24px !important;
    width: auto !important;
    max-height: 24px !important;
    max-width: 100px !important;
    opacity: 0.8;
    border: none !important;
    border-radius: 0 !important;
    transition: opacity 0.3s ease;
    display: block !important;
}

.custom-avatar-link.nexus-link:hover .nexus-logo {
    opacity: 1;
}

/* ============================================
   AVATAR MENU STYLES
   ============================================ */

.custom-avatar-menu {
    margin-bottom: 16px;
}

.custom-avatar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.custom-avatar-item {
    margin-bottom: 8px;
}

/* Avatar links */
.custom-avatar-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 16px 20px;
    margin: 0;
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    transition: all 0.2s ease;
    cursor: pointer;
    outline: none;
}

.custom-avatar-link:hover {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #F59E0B;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.custom-avatar-link:focus {
    outline: 3px solid rgba(245, 158, 11, 0.5);
    outline-offset: 2px;
    border-color: #F59E0B;
}


/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .custom-avatar-container {
        width: 95%;
        margin: 20px auto;
        max-height: 90vh;
    }
    
    .custom-avatar-header {
        padding: 20px 24px 0 24px;
    }
    
    .custom-avatar-content {
        padding: 0 24px 24px 24px;
    }
    
    .custom-avatar-link {
        padding: 14px 16px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .custom-avatar-container {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .custom-avatar-content {
        padding: 0 20px 20px 20px;
        max-height: calc(100vh - 100px);
    }
    
    .custom-avatar-header {
        padding: 20px;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    .custom-avatar-container {
        background: rgba(30, 30, 30, 0.95);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .custom-avatar-close svg {
        color: #e0e0e0;
    }
    
    .custom-avatar-link {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
        color: #e0e0e0;
    }
    
    .custom-avatar-link:hover {
        background: rgba(245, 158, 11, 0.2);
        color: #F59E0B;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Prevent body scroll when modal is open */
body.custom-avatar-open {
    overflow: hidden;
}

/* Animation delays for staggered entrance */
.custom-avatar-item:nth-child(1) { animation-delay: 0.1s; }
.custom-avatar-item:nth-child(2) { animation-delay: 0.15s; }
.custom-avatar-item:nth-child(3) { animation-delay: 0.2s; }
.custom-avatar-item:nth-child(4) { animation-delay: 0.25s; }

/* Smooth entrance animation */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-avatar-modal.active .custom-avatar-item {
    animation: slideInUp 0.3s ease forwards;
}

/* ============================================
   THEME SYSTEM (Default Dark Mode)
   ============================================ */

/* Default to dark mode since site defaults to dark */
:root {
    --avatar-modal-bg: rgba(30, 30, 30, 0.95);
    --avatar-modal-border: rgba(255, 255, 255, 0.1);
    --avatar-modal-text: #e0e0e0;
    --avatar-button-bg: rgba(255, 255, 255, 0.05);
    --avatar-button-border: rgba(255, 255, 255, 0.1);
}

/* Light mode overrides */
[data-theme="light"] {
    --avatar-modal-bg: rgba(255, 255, 255, 0.95);
    --avatar-modal-border: rgba(0, 0, 0, 0.1);
    --avatar-modal-text: #333;
    --avatar-button-bg: rgba(0, 0, 0, 0.03);
    --avatar-button-border: rgba(0, 0, 0, 0.1);
}
