/* ===================================================================
   User Menu — Premium Design (matches site palette)
   =================================================================== */

/* ===== Profile Button (Navbar) ===== */
.user-menu-dropdown {
    position: relative;
}

.btn-user {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2193b0 0%, #6dd5ed 100%);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.25);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(33, 147, 176, 0.2);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-user:hover {
    box-shadow: 0 2px 8px rgba(33, 147, 176, 0.35);
    border-color: rgba(255, 255, 255, 0.4);
    transform: none;
}

.btn-user:active {
    transform: scale(0.95);
}

.user-initial {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1;
    user-select: none;
}


/* ===== Dropdown Menu ===== */
.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: -4px;
    width: 260px;
    background: #ffffff;
    border-radius: 12px;
    z-index: 1001;
    overflow: hidden;
    padding: 0;

    /* Hidden state */
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px) scale(0.98);
    transform-origin: top right;
    transition:
        opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0.18s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);

    /* Layered shadow for depth */
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.04),
        0 2px 4px rgba(0, 0, 0, 0.04),
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 24px 48px rgba(0, 0, 0, 0.04);

    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Remove old arrow */
.user-menu::before {
    display: none;
}

/* Active state */
.user-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}


/* ===== User Header (inside dropdown) ===== */
.user-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfc;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2193b0 0%, #6dd5ed 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.user-avatar-letter {
    line-height: 1;
}

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

.user-name {
    font-weight: 600;
    color: #0f172a;
    font-size: 13.5px;
    line-height: 1.3;
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ===== Menu Sections ===== */
.user-menu-section {
    padding: 4px 0;
    border-bottom: 1px solid #f1f5f9;
}

.user-menu-section:last-child {
    border-bottom: none;
}

.user-menu-section-label {
    font-size: 11px;
    font-weight: 500;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px 16px 4px;
    user-select: none;
}


/* ===== Menu Links ===== */
.user-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.user-links li {
    margin: 0;
}

.user-links li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    color: #334155;
    text-decoration: none;
    font-weight: 450;
    font-size: 13px;
    transition: all 0.12s ease;
    border-radius: 0;
    position: relative;
}

.user-links li a:hover {
    background: #f0f9ff;
    color: #0f172a;
}

.user-links li a:active {
    background: #e0f2fe;
}

.user-links li a i {
    width: 16px;
    text-align: center;
    font-size: 13px;
    color: #64748b;
    transition: color 0.12s ease;
    flex-shrink: 0;
}

.user-links li a:hover i {
    color: #2193b0;
}

/* Keyboard shortcut hint */
.menu-shortcut {
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    color: #cbd5e1;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 1px 5px;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Mono', 'Segoe UI', monospace;
}

/* Divider (legacy support) */
.user-links .divider {
    height: 1px;
    background: #f1f5f9;
    margin: 4px 0;
}


/* ===== Logout Link ===== */
.logout-link,
.logout-link:visited {
    color: #64748b !important;
}

.logout-link:hover {
    color: #ef4444 !important;
    background: #fef2f2 !important;
}

.logout-link i {
    color: #94a3b8 !important;
}

.logout-link:hover i {
    color: #ef4444 !important;
}


/* ===== Overlay ===== */
.user-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.08);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    -webkit-backdrop-filter: blur(1px);
    backdrop-filter: blur(1px);
}

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


/* ===== Mobile (≤768px) — slide-in panel ===== */
@media (max-width: 768px) {
    .user-menu {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: 280px;
        max-width: 85vw;
        height: 100%;
        border-radius: 0;
        border: none;
        border-left: 1px solid #e2e8f0;

        /* Slide-in from right */
        opacity: 1;
        visibility: visible;
        transform: translateX(100%);
        transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);

        box-shadow:
            -4px 0 24px rgba(0, 0, 0, 0.08),
            -16px 0 48px rgba(0, 0, 0, 0.04);
    }

    .user-menu.active {
        transform: translateX(0);
    }

    .user-menu::before {
        display: none;
    }

    .user-header {
        padding: 20px 16px;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .user-menu-overlay {
        background: rgba(0, 0, 0, 0.2);
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }
}


/* ===== Small phones ===== */
@media (max-width: 400px) {
    .btn-user {
        width: 32px;
        height: 32px;
    }

    .user-initial {
        font-size: 12px;
    }
}
