/* ===================================
   User Profile Widget (Header)
   =================================== */

.patreon-user-profile-widget {
    position: relative;
    margin-left: 0;
    display: inline-flex;
    align-items: center;
}

.patreon-user-profile-widget__controls {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.kuehn-site-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: transparent;
    color: #1c2024;
    cursor: pointer;
    padding: 0;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.kuehn-site-theme-toggle:hover {
    background-color: #f5f6f8;
}

.kuehn-site-theme-toggle:focus {
    outline: 2px solid var(--kuehn-focus-ring, #8b6f5a);
    outline-offset: 2px;
}

.kuehn-site-theme-toggle__icon {
    line-height: 1;
    font-size: 15px;
}

/* Profile Trigger (Avatar Button) */
.patreon-profile-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #e3e3e7;
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    padding: 0;
    transition: border-color 0.2s ease;
}

.patreon-profile-trigger:hover {
    border-color: #a0a0aa;
}

.patreon-profile-trigger:focus {
    outline: 2px solid var(--kuehn-focus-ring, #8b6f5a);
    outline-offset: 2px;
}

.patreon-profile-trigger img.patreon-profile-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.patreon-profile-trigger__fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    user-select: none;
}

/* Dropdown */
.patreon-profile-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 280px;
    background: #fff;
    border: 1px solid #e3e3e7;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 9999;
}

.patreon-profile-dropdown.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.patreon-profile-dropdown__inner {
    padding: 16px;
}

/* Dropdown Header */
.patreon-profile-dropdown__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e9e9ec;
    margin-bottom: 12px;
}

.patreon-profile-dropdown__avatar {
    flex-shrink: 0;
}

.patreon-profile-dropdown__avatar img,
.patreon-profile-dropdown__avatar .patreon-profile-trigger__fallback {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: block;
}

.patreon-profile-dropdown__avatar .patreon-profile-trigger__fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.patreon-profile-dropdown__user {
    flex: 1;
    min-width: 0;
}

.patreon-profile-dropdown__name {
    font-weight: 600;
    font-size: 15px;
    color: #1c2024;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.patreon-profile-dropdown__tier {
    margin-top: 4px;
}

/* Tier Badges */
.patreon-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #eef3f8;
    color: #243446;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.patreon-badge--none {
    background: #f3f4f6;
    color: #6b7280;
}

.patreon-badge--supporter {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    border: none;
    box-shadow: 0 1px 5px color-mix(in srgb, #f59e0b 28%, transparent);
}

.patreon-badge--premium {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: #fff;
    border: none;
    box-shadow: 0 1px 5px color-mix(in srgb, #7c3aed 28%, transparent);
}

.patreon-badge[class*="patreon-badge--key-"] {
    border: none;
}

.patreon-badge--key-supporter {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    box-shadow: 0 1px 5px color-mix(in srgb, #f59e0b 28%, transparent);
}

.patreon-badge--key-premium {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: #fff;
    box-shadow: 0 1px 5px color-mix(in srgb, #7c3aed 28%, transparent);
}

/* Dropdown Navigation */
.patreon-profile-dropdown__nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.patreon-profile-dropdown__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #1c2024;
    font-size: 14px;
    transition: background-color 0.15s ease;
}

.patreon-profile-dropdown__item:hover {
    background: #f5f6f8;
}

.patreon-profile-dropdown__item:focus {
    outline: 2px solid var(--kuehn-focus-ring, #8b6f5a);
    outline-offset: -2px;
}

.patreon-profile-dropdown__item-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.patreon-profile-dropdown__item-text {
    flex: 1;
    font-weight: 500;
}

/* Dropdown Footer */
.patreon-profile-dropdown__footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e9e9ec;
}

.patreon-profile-dropdown__item--logout {
    color: #dc2626;
}

.patreon-profile-dropdown__item--logout:hover {
    background: #fef2f2;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .patreon-profile-dropdown {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.7);
        border: none;
        border-radius: 0;
        box-shadow: none;
        transform: none;
        display: flex;
        align-items: flex-end;
        justify-content: flex-end;
    }

    .patreon-profile-dropdown__inner {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 85%;
        max-width: 320px;
        background: #fff;
        border-radius: 0;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }

    .patreon-profile-dropdown.is-open .patreon-profile-dropdown__inner {
        transform: translateX(0);
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .patreon-profile-dropdown,
    .patreon-profile-dropdown__inner,
    .patreon-profile-trigger,
    .patreon-profile-dropdown__item {
        transition: none;
    }
}

/* ===================================
   Guest Profile Widget
   =================================== */

.patreon-profile-trigger__fallback--guest {
    background: #e9e9ec;
    color: #6b7280;
    font-size: 0;
}

.patreon-profile-dropdown__guest-hint {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 14px;
    text-align: center;
}

.patreon-profile-dropdown__login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: #ff424d;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    transition: background-color 0.2s ease;
    box-sizing: border-box;
}

.patreon-profile-dropdown__login-btn:hover {
    background: #e53c46;
    color: #fff;
}
