:root {
    --ca-bg: #13171c;
    --ca-surface: #1c2028;
    --ca-surface-2: #242a34;
    --ca-border: rgba(255, 255, 255, 0.08);
    --ca-border-strong: rgba(255, 255, 255, 0.12);
    --ca-accent: #0693e3;
    --ca-accent-dk: #0577c0;
    --ca-text: #e6eaf2;
    --ca-text-soft: #c9d1de;
    --ca-muted: #6e7787;
    --ca-muted-soft: #9ba6b8;
    --ca-success: #00d084;
    --ca-success-soft: #7ff0c7;
    --ca-error: #cf2e2e;
    --ca-error-soft: #ffb4aa;
    --ca-error-soft-2: #ffd2cc;
}

/**
 * User Menu Dropdown Styles
 * Styled to match akordi-next theme tokens
 * @package CustomAuth
 */

/* Override header-right text-end inheritance */
.header-right .custom-auth-menu,
.custom-auth-menu {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    text-align: left;
}

.header-right .custom-auth-menu *,
.custom-auth-menu * {
    text-align: left;
    direction: ltr;
}

/* Trigger button (compact style for header-right) */
.header-right .custom-auth-menu .custom-auth-menu-trigger,
.custom-auth-menu .custom-auth-menu-trigger {
    font-family: 'Noto Sans', sans-serif;
    font-style: normal;
    font-weight: 400;
    font-size: 14px;
    line-height: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    text-decoration: none;
    background: transparent;
    border: none;
    color: var(--ca-text);
    cursor: pointer;
    transition: color 0.2s;
    border-radius: 6px;
    position: relative;
    z-index: 1001;
}

.header-right .custom-auth-menu .custom-auth-menu-trigger:hover,
.header-right .custom-auth-menu .custom-auth-menu-trigger[aria-expanded="true"],
.custom-auth-menu .custom-auth-menu-trigger:hover,
.custom-auth-menu .custom-auth-menu-trigger[aria-expanded="true"] {
    color: var(--ca-text);
    background-color: rgba(255, 255, 255, 0.05);
}

.header-right .custom-auth-menu .custom-auth-menu-trigger:hover .user-avatar,
.header-right .custom-auth-menu .custom-auth-menu-trigger[aria-expanded="true"] .user-avatar,
.custom-auth-menu .custom-auth-menu-trigger:hover .user-avatar,
.custom-auth-menu .custom-auth-menu-trigger[aria-expanded="true"] .user-avatar {
    border-color: rgba(6, 147, 227, 0.34);
    box-shadow: 0 0 8px rgba(6, 147, 227, 0.18);
}

.header-right .custom-auth-menu .custom-auth-menu-trigger:hover .dropdown-icon,
.header-right .custom-auth-menu .custom-auth-menu-trigger[aria-expanded="true"] .dropdown-icon,
.custom-auth-menu .custom-auth-menu-trigger:hover .dropdown-icon,
.custom-auth-menu .custom-auth-menu-trigger[aria-expanded="true"] .dropdown-icon {
    opacity: 1;
    transform: rotate(180deg);
}

.header-right .custom-auth-menu .custom-auth-menu-trigger .user-icon,
.custom-auth-menu .custom-auth-menu-trigger .user-icon {
    font-size: 16px;
    opacity: 0.8;
    pointer-events: none;
}

.header-right .custom-auth-menu .custom-auth-menu-trigger .user-avatar,
.custom-auth-menu .custom-auth-menu-trigger .user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(6, 147, 227, 0.18);
    transition: all 0.2s ease;
    pointer-events: none;
}

.header-right .custom-auth-menu .custom-auth-menu-trigger .user-name,
.custom-auth-menu .custom-auth-menu-trigger .user-name {
    font-size: 14px;
    color: inherit;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}

.header-right .custom-auth-menu .custom-auth-menu-trigger .menu-text,
.custom-auth-menu .custom-auth-menu-trigger .menu-text {
    font-size: 14px;
    color: inherit;
    pointer-events: none;
}

.header-right .custom-auth-menu .custom-auth-menu-trigger .dropdown-icon,
.custom-auth-menu .custom-auth-menu-trigger .dropdown-icon {
    font-size: 10px;
    opacity: 0.6;
    transition: all 0.2s;
    pointer-events: none;
}

/* Dropdown container (positioned from header-right) */
.header-right .custom-auth-menu .custom-auth-dropdown,
.custom-auth-menu .custom-auth-dropdown {
    opacity: 0;
    visibility: hidden;
    transition-duration: 0.2s;
    position: absolute;
    top: calc(100% + 15px);
    right: -10px;
    z-index: 999999;
    min-width: 300px;
    max-width: 320px;
    border-radius: 8px;
    padding: 0;
    background: var(--ca-surface);
    border: 1px solid var(--ca-border);
    box-shadow: 0px 23.1405px 69.4215px rgba(0, 0, 0, 0.12);
}

.header-right .custom-auth-menu .custom-auth-dropdown[aria-hidden="false"],
.custom-auth-menu .custom-auth-dropdown[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

/* Dropdown header (logged-in users) */
.header-right .custom-auth-menu .dropdown-header,
.custom-auth-menu .dropdown-header {
    padding: 20px;
    border-bottom: 1px solid var(--ca-border);
}

.header-right .custom-auth-menu .dropdown-header strong,
.custom-auth-menu .dropdown-header strong {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--ca-text);
    margin-bottom: 4px;
}

.header-right .custom-auth-menu .dropdown-header .user-email,
.custom-auth-menu .dropdown-header .user-email {
    display: block;
    font-size: 13px;
    color: var(--ca-muted-soft);
}

/* Dropdown actions/links */
.header-right .custom-auth-menu .dropdown-actions,
.custom-auth-menu .dropdown-actions {
    padding: 8px 0;
}

.header-right .custom-auth-menu .dropdown-actions .dropdown-link,
.custom-auth-menu .dropdown-actions .dropdown-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    font-size: 14px;
    color: var(--ca-text-soft);
    text-decoration: none;
    transition: all 0.2s;
    text-align: left;
    position: relative;
}

.header-right .custom-auth-menu .dropdown-actions .dropdown-link i,
.custom-auth-menu .dropdown-actions .dropdown-link i {
    font-size: 14px;
    width: 16px;
    flex-shrink: 0;
    opacity: 0.7;
    text-align: center;
}

.header-right .custom-auth-menu .dropdown-actions .dropdown-link:hover,
.custom-auth-menu .dropdown-actions .dropdown-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--ca-text);
}

.header-right .custom-auth-menu .dropdown-actions .dropdown-link:hover i,
.custom-auth-menu .dropdown-actions .dropdown-link:hover i {
    opacity: 1;
}

.header-right .custom-auth-menu .dropdown-actions .dropdown-link.logout,
.custom-auth-menu .dropdown-actions .dropdown-link.logout {
    color: var(--ca-error-soft);
}

.header-right .custom-auth-menu .dropdown-actions .dropdown-link.logout:hover,
.custom-auth-menu .dropdown-actions .dropdown-link.logout:hover {
    color: var(--ca-error-soft-2);
}

/* Admin links */
.header-right .custom-auth-menu .dropdown-actions .dropdown-link.admin-link,
.custom-auth-menu .dropdown-actions .dropdown-link.admin-link {
    color: var(--ca-text-soft);
}

.header-right .custom-auth-menu .dropdown-actions .dropdown-link.admin-link i,
.custom-auth-menu .dropdown-actions .dropdown-link.admin-link i {
    color: var(--ca-text-soft);
}

.header-right .custom-auth-menu .dropdown-actions .dropdown-link.admin-link:hover,
.custom-auth-menu .dropdown-actions .dropdown-link.admin-link:hover {
    background-color: rgba(6, 147, 227, 0.08);
}

.header-right .custom-auth-menu .dropdown-actions .dropdown-link.login-link,
.header-right .custom-auth-menu .dropdown-actions .dropdown-link.register-link,
.custom-auth-menu .dropdown-actions .dropdown-link.login-link,
.custom-auth-menu .dropdown-actions .dropdown-link.register-link {
    font-weight: 500;
}

.header-right .custom-auth-menu .dropdown-actions .dropdown-link.forgot-link,
.custom-auth-menu .dropdown-actions .dropdown-link.forgot-link {
    font-size: 13px;
    color: var(--ca-muted-soft);
    padding-top: 8px;
    border-top: 1px solid var(--ca-border);
    margin-top: 4px;
}

/* Count badge for favorites link */
.header-right .custom-auth-menu .dropdown-actions .dropdown-link .count-badge,
.custom-auth-menu .dropdown-actions .dropdown-link .count-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background-color: var(--ca-text);
    color: var(--ca-bg);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
}

/* Dropdown divider */
.header-right .custom-auth-menu .dropdown-divider,
.custom-auth-menu .dropdown-divider {
    height: 1px;
    background: var(--ca-border);
    margin: 8px 0;
}

/* Dropdown section title */
.header-right .custom-auth-menu .dropdown-section-title,
.custom-auth-menu .dropdown-section-title {
    padding: 12px 20px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ca-muted-soft);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Logged out state */
.custom-auth-menu.logged-out .custom-auth-dropdown {
    min-width: 220px;
}

/* Hover state for whole component — desktop/pointer devices only */
@media (hover: hover) and (pointer: fine) {
    .custom-auth-menu:hover .custom-auth-dropdown {
        opacity: 1;
        visibility: visible;
    }
}

/* JavaScript active state */
.custom-auth-menu-trigger[aria-expanded="true"]+.custom-auth-dropdown {
    opacity: 1;
    visibility: visible;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .custom-auth-menu .custom-auth-menu-trigger {
        padding: 6px 10px;
        gap: 4px;
    }

    .custom-auth-menu .custom-auth-menu-trigger .user-name,
    .custom-auth-menu .custom-auth-menu-trigger .menu-text {
        display: none;
    }

    .custom-auth-menu .custom-auth-dropdown {
        right: -30px;
        min-width: 280px;
        max-width: 300px;
    }
}

@media (max-width: 576px) {
    .custom-auth-menu .custom-auth-dropdown {
        right: -40px;
        left: auto;
        min-width: 260px;
    }
}