/*
 * accountMenu.css - the account menu (#userPopup) on every page that has
 * one, built by media/js/accountMenu.js. Load it after the page's own CSS
 * (hub.css, landing.css, profile.css) so one look wins everywhere.
 *
 * Skin it with the tokens below: set them on .account-menu (or anything
 * above it). Profiles map them to the artist's colours in profile.css.
 */
.account-menu {
    --am-bg: rgba(62, 76, 102, 0.97);
    --am-border: rgba(148, 163, 184, 0.35);
    --am-text: #e5e7eb;
    --am-muted: #cbd5f5;
    --am-icon: #ffffff;
    --am-link: var(--am-text);
    --am-link-hover: #ffffff;
    --am-divider: rgba(210, 214, 220, 0.3);
    --am-btn-bg: rgba(210, 214, 220, 0.14);
    --am-btn-bg-hover: rgba(210, 214, 220, 0.24);
    --am-btn-border: rgba(210, 214, 220, 0.28);
    --am-btn-text: var(--am-text);
    --am-pic-bg: rgba(15, 23, 42, 0.55);
    --am-pic-border: rgba(210, 214, 220, 0.3);
    --am-photo-btn-bg: rgba(15, 23, 42, 0.92);
}

#userPopup.account-menu {
    width: 284px;
    min-width: 0;
    max-width: calc(100vw - 24px);
    box-sizing: border-box;
    padding: 18px 16px 16px;
    background: var(--am-bg);
    border: 1px solid var(--am-border);
    border-radius: 12px;
    color: var(--am-text);
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

#userPopup.account-menu.show,
#userPopup.account-menu.is-open {
    display: flex;
}

/* ---- Picture and name ---- */
#userPopup .account-menu-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#userPopup .account-menu-pic-wrap {
    position: relative;
    width: 72px;
    height: 72px;
}

#userPopup .account-menu-pic {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    box-sizing: border-box;
    background: var(--am-pic-bg);
    border: 2px solid var(--am-pic-border);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#userPopup .account-menu-pic > svg {
    width: 42px;
    height: 42px;
    fill: var(--am-muted);
}

#userPopup .account-menu-pic img,
#userPopup .account-menu-pic #userPopupJazzicon {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

#userPopup .account-menu-pic > div:not(#userPopupJazzicon) {
    width: 100%;
    height: 100%;
}

#userPopup .account-menu-photo-btn {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 26px;
    height: 26px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    border: 1px solid var(--am-btn-border);
    background: var(--am-photo-btn-bg);
    color: var(--am-icon);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s, background-color 0.15s;
}

#userPopup .account-menu-photo-btn:hover {
    transform: scale(1.08);
}

#userPopup .account-menu-photo-btn[hidden] {
    display: none;
}

#userPopup .account-menu-photo-icon {
    width: 14px;
    height: 14px;
}

#userPopup.account-menu .user-popup-name {
    color: var(--am-text);
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    word-break: break-word;
    margin: 0;
}

/* ---- The three links above the line ---- */
#userPopup .account-menu-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 12px;
    margin-top: 2px;
}

#userPopup .account-menu-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 0;
    color: var(--am-link);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
    text-align: left;
    white-space: nowrap;
    background: none;
    border: 0;
    width: auto;
    margin: 0;
}

#userPopup .account-menu-link[hidden] {
    display: none;
}

#userPopup .account-menu-link:hover,
#userPopup .account-menu-link:focus-visible {
    color: var(--am-link-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

#userPopup .account-menu-link-icon {
    width: 14px;
    height: 14px;
    flex: none;
    color: var(--am-icon);
}

#userPopup.account-menu .user-popup-divider {
    width: 100%;
    height: 1px;
    background: var(--am-divider);
    margin: 4px 0;
}

/* ---- The page's own buttons below the line ---- */
#userPopup.account-menu > button,
#userPopup.account-menu > a {
    width: 100%;
    margin: 0;
    padding: 10px 16px;
    box-sizing: border-box;
    border-radius: 8px;
    border: 1px solid var(--am-btn-border);
    background: var(--am-btn-bg);
    color: var(--am-btn-text);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    filter: none;
    transform: none;
    transition: background-color 0.15s, border-color 0.15s;
}

#userPopup.account-menu > button:hover,
#userPopup.account-menu > a:hover {
    background: var(--am-btn-bg-hover);
    color: var(--am-btn-text);
    filter: none;
    transform: none;
}

#userPopup.account-menu > [hidden] {
    display: none;
}

/* ---- Change your photo (crop window) ---- */
.account-photo-modal {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(2, 6, 23, 0.72);
}

.account-photo-modal.show {
    display: flex;
}

.account-photo-dialog {
    width: min(100%, 440px);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 22px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(30, 35, 50, 0.98);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
    color: #e5e7eb;
    font-family: inherit;
}

.account-photo-dialog h3 {
    margin: 0 0 6px;
    font-size: 17px;
}

.account-photo-note {
    margin: 0 0 14px;
    color: #aab3c5;
    font-size: 13px;
}

.account-photo-canvas-wrap {
    width: min(100%, 400px);
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    background: #111827;
    touch-action: none;
    cursor: grab;
}

.account-photo-canvas-wrap.is-dragging {
    cursor: grabbing;
}

.account-photo-canvas-wrap canvas {
    display: block;
    width: 100%;
    height: auto;
}

.account-photo-zoom {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 12px;
    margin: 16px 0 4px;
    color: #cbd5e1;
    font-size: 13px;
}

.account-photo-zoom input {
    width: 100%;
}

.account-photo-error {
    margin-top: 12px;
    padding: 9px 11px;
    border: 1px solid rgba(239, 68, 68, 0.55);
    border-radius: 7px;
    color: #fecaca;
    background: rgba(127, 29, 29, 0.3);
    font-size: 12px;
}

.account-photo-error[hidden] {
    display: none;
}

.account-photo-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.account-photo-buttons button {
    padding: 9px 18px;
    border-radius: 8px;
    border: 1px solid rgba(210, 214, 220, 0.28);
    background: rgba(210, 214, 220, 0.14);
    color: #e5e7eb;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.account-photo-buttons [data-photo-save] {
    background: #e5e7eb;
    color: #0f172a;
    border-color: transparent;
}

.account-photo-buttons button:disabled {
    opacity: 0.55;
    cursor: wait;
}
