/* User menu styles - bottom sheet on mobile, popover on desktop */

/* User Icon Button */
.user-icon-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.user-icon-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.user-icon-btn svg {
    width: 24px;
    height: 24px;
}

/* Menu Overlay - z-index must be higher than reading-progress-indicator (100) */
.user-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

.user-menu-overlay.visible {
    opacity: 1;
}

.user-menu-overlay[hidden] {
    display: none;
}

/* Menu Container - Base styles, z-index above overlay */
.user-menu {
    position: fixed;
    background-color: #ffffff;
    z-index: 1200;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.user-menu[hidden] {
    display: none;
}

/* Drag Handle (mobile only) */
.user-menu-handle {
    display: flex;
    justify-content: center;
    padding: 0.75rem;
}

.user-menu-handle span {
    width: 40px;
    height: 4px;
    background-color: #dee2e6;
    border-radius: 2px;
}

/* Menu Navigation */
.user-menu-nav {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    text-decoration: none;
    color: #333;
    font-size: 1rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s;
}

.user-menu-item:hover {
    background-color: #f8f9fa;
}

.user-menu-item svg {
    flex-shrink: 0;
    color: #666;
}

.user-menu-form {
    margin: 0;
}

/* ===================
   MOBILE: Bottom Sheet
   =================== */
@media (max-width: 767px) {
    .user-menu {
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s ease-out;
        max-height: 50vh;
        overflow-y: auto;
    }

    .user-menu.visible {
        transform: translateY(0);
    }

    .user-menu-item {
        padding: 1.25rem 1.5rem;
    }
}

/* ===================
   DESKTOP: Popover
   =================== */
@media (min-width: 768px) {
    .user-menu {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        left: auto;
        bottom: auto;
        border-radius: 8px;
        min-width: 180px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        transform: scale(0.95);
        opacity: 0;
        transform-origin: top right;
        transition: transform 0.15s ease-out, opacity 0.15s ease-out;
    }

    .user-menu.visible {
        transform: scale(1);
        opacity: 1;
    }

    /* Hide drag handle on desktop */
    .user-menu-handle {
        display: none;
    }

    /* Semi-transparent overlay on desktop */
    .user-menu-overlay {
        background-color: transparent;
    }

    .user-menu-item {
        padding: 0.75rem 1rem;
    }
}

/* Header positioning for user icon */
.site-header-content {
    position: relative;
}

.site-header-user {
    display: flex;
    align-items: center;
    position: relative;
}
