﻿
/* ==========================================================================
   user-account-menu.css
   کامپوننت منوی کاربری هدر — تمام سلکتورها با پیشوند "uam-" ایزوله شده‌اند.
   این پیشوند مخصوص این کامپوننت است و در هیچ‌کدام از فایل‌های دیگر پروژه
   (j- , k- , m- , epb-) استفاده نشده، بنابراین تداخل specificity رخ نمی‌دهد.
   رنگ‌ها و فونت‌ها با CSS variableهای سراسری پروژه هماهنگ شده‌اند و در صورت
   نبود آن‌ها، به مقادیر پیش‌فرض fallback می‌کنند.
   ========================================================================== */
.uam-root {
    --uam-navy-deep: var(--navy-deep, #0D1B2A);
    --uam-navy: var(--navy, #18467A);
    --uam-amber: var(--amber, #C8811A);
    --uam-amber-light: var(--amber-light, #E2932C);
    --uam-ink: #1F2937;
    --uam-muted: #7D8CA0;
    --uam-border: #E7EBF0;
    --uam-danger: #DC2626;
    --uam-font-fa: var(--font-vazir, 'Vazirmatn', sans-serif);
    --uam-font-mono: var(--font-mono, 'JetBrains Mono', monospace);
    position: relative;
    display: inline-block;
    font-family: var(--uam-font-fa);
    direction: rtl;
}

/* ---------- Trigger (button in header) ---------- */
.uam-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 4px;
    color: #fff;
    font-family: inherit;
}

.uam-trigger-name {
    font-size: 14px;
    font-weight: 600;
}

.uam-avatar {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .25);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #cfd8e3;
}

    .uam-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .uam-avatar svg {
        width: 20px;
        height: 20px;
    }

.uam-online-dot {
    position: absolute;
    bottom: -1px;
    left: -1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22C55E;
    border: 2px solid var(--uam-navy-deep);
}

.uam-chevron {
    width: 15px;
    height: 15px;
    transition: transform .18s ease;
}

.uam-root.is-open .uam-chevron {
    transform: rotate(180deg);
}

/* ---------- Dropdown panel ---------- */
.uam-panel {
    position: absolute;
    top: calc(100% + 12px);
    inset-inline-end: 0;
    width: 300px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 18px 40px -12px rgba(13, 27, 42, .35), 0 0 0 1px #838789;
    overflow: hidden;
    z-index: 80;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(.98);
    transform-origin: top left;
    transition: opacity .16s ease, transform .16s ease, visibility .16s;
}

.uam-root.is-open .uam-panel,
.uam-root.is-preview .uam-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ---------- Head (dark profile card) ---------- */
.uam-head {
    background: linear-gradient(135deg, #153d6e, #040f2d);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #fff;
}

.uam-head-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.uam-greeting {
    font-size: 12px;
    color: #C6D1DE;
}

.uam-name {
    font-size: 15px;
    font-weight: 700;
}

.uam-sub-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 600;
    color: var(--uam-amber-light);
    background: rgba(200, 129, 26, .16);
    border: 1px solid rgba(200, 129, 26, .4);
    padding: 3px 9px;
    border-radius: 999px;
}

.uam-sub-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--uam-amber-light);
    display: inline-block;
}

.uam-head-side {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.uam-score-ring {
    --uam-score: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--uam-font-mono);
    font-weight: 700;
    font-size: 12.5px;
    color: #fff;
    background: radial-gradient(closest-side, var(--uam-navy-deep) 66%, transparent 67% 100%), conic-gradient(var(--uam-amber-light) calc(var(--uam-score) * 1%), rgba(255,255,255,.18) 0);
}

.uam-head-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .22);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cfd8e3;
}

    .uam-head-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .uam-head-avatar svg {
        width: 20px;
        height: 20px;
    }

/* ---------- Menu list ---------- */
.uam-list {
    list-style: none;
    margin: 0;
    padding: 6px;
}

.uam-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 9px;
    color: var(--uam-ink);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background .12s ease;
}

    .uam-item:hover,
    .uam-item:focus-visible {
        background: #F1F5F9;
        outline: none;
    }

.uam-item-icon {
    width: 18px;
    height: 18px;
    color: var(--uam-navy);
    flex-shrink: 0;
    display: flex;
}

    .uam-item-icon svg {
        width: 100%;
        height: 100%;
    }

.uam-item-label {
    flex: 1;
}

.uam-item-badge {
    font-family: var(--uam-font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--uam-navy);
    background: #EAF0F7;
    border-radius: 999px;
    padding: 1px 8px;
}

.uam-divider {
    height: 1px;
    background: var(--uam-border);
    margin: 4px 12px;
}

.uam-item-danger {
    color: var(--uam-danger);
    margin: 6px;
}

    .uam-item-danger .uam-item-icon {
        color: var(--uam-danger);
    }

    .uam-item-danger:hover {
        background: #FEF2F2;
    }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
    .uam-trigger-name {
        display: none;
    }

    .uam-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        inset-inline: 0;
        width: 100%;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .uam-root.is-open .uam-panel {
        transform: translateY(0);
    }
    /* در موبایل فقط با کلیک باز می‌شود؛ حالت پیش‌نمایش هاور غیرفعال است (به JS مراجعه شود) */
    .uam-root.is-preview .uam-panel {
        opacity: 0;
        visibility: hidden;
        transform: translateY(100%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .uam-panel, .uam-chevron {
        transition: none;
    }
}