/**
 * Stack Engine — Widget styles (Token Pill + User Menu)
 *
 * Used by both Elementor widgets and the [stk_token_pill] / [stk_user_menu]
 * shortcodes. Uses plugin CSS custom properties where available.
 */

.stk-widget-wrap {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.stk-align-left   { text-align: left; display: flex; justify-content: flex-start; }
.stk-align-center { text-align: center; display: flex; justify-content: center; }
.stk-align-right  { text-align: right; display: flex; justify-content: flex-end; }

/* ==================================================================
 * TOKEN PILL
 * ================================================================*/

.stk-token-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(124, 92, 252, 0.15);
    border: 1px solid rgba(124, 92, 252, 0.30);
    border-radius: 100px;
    padding: 6px 14px;
    text-decoration: none;
    color: #A48DFD;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.stk-token-pill:hover {
    background: rgba(124, 92, 252, 0.25);
    color: #A48DFD;
}

.stk-token-pill:active {
    transform: scale(0.97);
}

.stk-token-pill-dot {
    width: 7px;
    height: 7px;
    background: #A48DFD;
    border-radius: 50%;
    flex-shrink: 0;
    animation: stk-pulse 2s ease-in-out infinite;
}

@keyframes stk-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

.stk-token-pill-text {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.stk-token-pill-balance {
    font-weight: 600;
}

.stk-token-pill-suffix {
    opacity: 0.85;
}

.stk-token-pill-guest {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(124, 92, 252, 0.30);
    color: inherit;
}

/* Subtle state when polling updates the balance */
.stk-token-pill.stk-balance-updating .stk-token-pill-balance {
    animation: stk-balance-flash 0.6s ease;
}

@keyframes stk-balance-flash {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ==================================================================
 * USER MENU
 * ================================================================*/

.stk-user-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.stk-user-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    background: #7C5CFC;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    padding: 0;
    line-height: 1;
    transition: opacity 0.15s, transform 0.15s;
}

.stk-user-menu-trigger:hover { opacity: 0.92; }
.stk-user-menu-trigger:active { transform: scale(0.95); }
.stk-user-menu-trigger:focus-visible {
    outline: 2px solid #7C5CFC;
    outline-offset: 2px;
}

.stk-user-menu-initial {
    display: inline-block;
    color: #fff;
    line-height: 1;
}

.stk-user-menu-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* If the user name is shown alongside the avatar, reshape to pill */
.stk-user-menu-trigger:has(.stk-user-menu-name) {
    border-radius: 100px;
    padding: 4px 14px 4px 4px;
}
.stk-user-menu-name {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
}

/* Dropdown */
.stk-user-menu-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 240px;
    width: 240px;
    background: #fff;
    border: 1px solid rgba(12, 12, 17, 0.09);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(12, 12, 17, 0.12);
    padding: 8px;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

.stk-user-menu-open .stk-user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Left-align dropdown when widget wrapper is left-aligned */
.stk-align-left .stk-user-menu-dropdown { right: auto; left: 0; }
.stk-align-center .stk-user-menu-dropdown {
    right: 50%;
    transform: translate(50%, -4px);
}
.stk-user-menu-open .stk-align-center .stk-user-menu-dropdown,
.stk-align-center .stk-user-menu-open .stk-user-menu-dropdown {
    transform: translate(50%, 0);
}

.stk-user-menu-header {
    padding: 10px 12px 12px;
    border-bottom: 1px solid rgba(12, 12, 17, 0.09);
    margin-bottom: 6px;
}
.stk-user-menu-header-name {
    font-size: 13px;
    font-weight: 600;
    color: #0C0C11;
    line-height: 1.3;
}
.stk-user-menu-header-email {
    font-size: 11px;
    color: #9896A8;
    margin-top: 2px;
    word-break: break-all;
}

.stk-user-menu-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stk-user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    color: #3A3A45;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.1s, color 0.1s;
}

.stk-user-menu-item:hover {
    background: #EDE9FF;
    color: #7C5CFC;
}

.stk-user-menu-item.stk-user-menu-danger {
    color: #E24B4A;
}

.stk-user-menu-item.stk-user-menu-danger:hover {
    background: #FCEBEB;
    color: #E24B4A;
}

.stk-user-menu-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stk-user-menu-icon svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.stk-user-menu-sep {
    height: 1px;
    background: rgba(12, 12, 17, 0.09);
    margin: 6px 4px;
}

/* Guest state */
.stk-user-menu-guest {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    border-radius: 100px;
    background: #7C5CFC;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s;
}
.stk-user-menu-guest:hover {
    opacity: 0.9;
    color: #fff;
}
