/**
 * SME Re:Members SSO — Login Dropdown Styles
 */

/* Branding defaults — overridden per-instance via inline custom properties
   set by the [sme_rm_login] shortcode, or per-site in a theme stylesheet. */
.sme-rm-wrap {
    --sme-rm-accent: #c4850f;
    --sme-rm-accent-rgb: 196, 133, 15;
    --sme-rm-logo-line: #bfd730;
}

/* Always-visible page widget from [sme_rm_login_widget] — same inner field/
   button/error styles as the header dropdown (inherited via CSS variables),
   just a static block instead of an absolutely-positioned popup. */
.sme-rm-widget {
    --sme-rm-accent: #c4850f;
    --sme-rm-accent-rgb: 196, 133, 15;
    --sme-rm-logo-line: #bfd730;
    max-width: 340px;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: 3px solid var(--sme-rm-accent);
    border-radius: 0 0 4px 4px;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* HARD OVERRIDE: force correct desktop positioning regardless of any duplicate/injected rules elsewhere */
.sme-rm-wrap .sme-rm-dropdown {
    position: absolute !important;
    top: calc(100% + 8px) !important;
    right: 0 !important;
    left: auto !important;
}
@media (max-width: 780px) {
    .sme-rm-wrap .sme-rm-dropdown {
        position: fixed !important;
        top: 60px !important;
        left: 10px !important;
        right: 10px !important;
    }
}

/* Trigger button */
.sme-rm-trigger {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 6px;
    color: inherit;
    font-size: inherit;
    line-height: 1;
    text-decoration: none;
}

.sme-rm-trigger .tie-icon-user {
    font-size: 18px;
}

.sme-rm-login-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Position wrapper */
.sme-rm-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    z-index: 9999;
}

/* Dropdown panel */
.sme-rm-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 290px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: 3px solid var(--sme-rm-accent);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.14);
    z-index: 99999;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.sme-rm-dropdown[hidden] {
    display: none;
}

/* Header */
.sme-rm-dropdown-header {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sme-rm-dropdown-header .tie-icon-user {
    color: var(--sme-rm-accent);
    font-size: 16px;
}

/* Fields */
.sme-rm-field {
    margin-bottom: 12px;
}

.sme-rm-field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #666;
    margin-bottom: 4px;
}

.sme-rm-field input {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    color: #333;
    background: #fafafa;
    transition: border-color 0.15s, background 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}

.sme-rm-field input:focus {
    outline: none;
    border-color: var(--sme-rm-accent);
    background: #fff;
    box-shadow: 0 0 0 2px rgba(var(--sme-rm-accent-rgb), 0.12);
}

/* Error */
.sme-rm-error {
    font-size: 12px;
    color: #c0392b;
    background: #fdf0ef;
    border: 1px solid #f5c6c2;
    border-radius: 3px;
    padding: 7px 10px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.sme-rm-error[hidden] { display: none; }

/* Submit */
.sme-rm-submit {
    width: 100%;
    padding: 10px;
    background: var(--sme-rm-accent);
    color: #fff;
    border: none;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.sme-rm-submit:hover,
.sme-rm-submit:focus {
    filter: brightness(0.85);
    outline: none;
}

.sme-rm-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.sme-rm-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sme-spin 0.7s linear infinite;
    display: none;
}

.sme-rm-submit.loading .sme-rm-spinner { display: block; }
.sme-rm-submit.loading .sme-rm-btn-text { opacity: 0.7; }

@keyframes sme-spin {
    to { transform: rotate(360deg); }
}

/* Footer links */
.sme-rm-dropdown-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.sme-rm-dropdown-footer a {
    font-size: 11px;
    color: #888;
    text-decoration: none;
}

.sme-rm-dropdown-footer a:hover {
    color: var(--sme-rm-accent);
    text-decoration: underline;
}

/* Logo + header block */
.sme-rm-logo-block {
    text-align: center;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 2px solid var(--sme-rm-logo-line);
}

.sme-rm-logo-block img {
    height: 52px;
    width: auto;
    display: block;
    margin: 0 auto 6px;
}

.sme-rm-logo-block .sme-rm-logo-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555;
}

/* Logged-in dropdown */
.sme-rm-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.sme-rm-avatar {
    font-size: 32px;
    color: var(--sme-rm-accent);
    line-height: 1;
}

.sme-rm-user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sme-rm-username {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    text-decoration: none;
}

.sme-rm-username:hover {
    color: var(--sme-rm-accent);
    text-decoration: underline;
}

.sme-rm-member-type {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sme-rm-logout-btn {
    display: flex !important;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 9px 12px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    text-decoration: none;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    box-sizing: border-box;
    margin-top: 4px;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.03em;
}

.sme-rm-logout-btn:hover {
    background: #fee;
    border-color: #f5c6c2;
    color: #c0392b;
}

/* Position trigger to match logged-in icon style */
.sme-rm-trigger,
.sme-rm-trigger--in {
    padding: 0 2px;
    height: 40px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    vertical-align: middle;
}

/* Gravatar trigger */
.sme-rm-avatar-img,
.sme-rm-guest-avatar {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px;
    min-height: 30px;
    border-radius: 50% !important;
    display: block !important;
    object-fit: cover;
}

.sme-rm-trigger--in .sme-rm-avatar-img,
.sme-rm-trigger .sme-rm-guest-avatar {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px;
    min-height: 30px;
    border-radius: 50% !important;
    display: block !important;
    object-fit: cover;
    border: 1.5px solid rgba(var(--sme-rm-accent-rgb), 0.6);
}

.sme-rm-trigger--in:hover .sme-rm-avatar-img {
    border-color: var(--sme-rm-accent);
}

/* Hide Jannah's native user profile when our plugin is active */
.sme-rm-active .components-user-profile {
    display: none !important;
}

/* Hide Jannah's profile-icon menu item when our plugin is active */
.sme-rm-active .profile-icon {
    display: none !important;
}

/* Username button */
.sme-rm-username {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    color: #333;
    text-decoration: none;
    padding: 0;
    text-align: left;
}

.sme-rm-username:hover {
    color: var(--sme-rm-accent);
    text-decoration: underline;
}

/* Larger avatar in dropdown */
.sme-rm-user-info .sme-rm-avatar-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* Greeting */
.sme-rm-greeting {
    font-size: 13px;
    color: #555;
    font-weight: 400;
}

/* Larger avatar in dropdown with glow */
.sme-rm-user-info .sme-rm-avatar-img {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px;
    min-height: 48px;
    border-radius: 50% !important;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(var(--sme-rm-accent-rgb), 0.5);
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}

/* Sign Out button — matches Sign In gold style */
.sme-rm-logout-btn {
    display: flex !important;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    background: var(--sme-rm-accent);
    border: none;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 700;
    color: #fff !important;
    text-decoration: none;
    justify-content: center;
    transition: background 0.15s;
    box-sizing: border-box;
    margin-top: 8px;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.sme-rm-logout-btn:hover {
    background: #8d0e20 !important;
    color: #fff !important;
}

/* Logged-out login pill button */
.sme-rm-login-pill {
    background: var(--sme-rm-accent) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 20px !important;
    padding: 6px 14px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    cursor: pointer;
    height: auto !important;
    width: auto !important;
    transition: background 0.15s !important;
}

.sme-rm-login-pill:hover {
    filter: brightness(0.85) !important;
}

/* Align login li with social icons */
.sme-rm-li {
    display: inline-flex !important;
    align-items: center;
}

/* Mobile dropdown fix */
@media (max-width: 780px) {
    .sme-rm-dropdown {
        position: fixed !important;
        top: 60px !important;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        border-radius: 4px !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.2);
        z-index: 999999 !important;
    }

    /* Move Login button to right side on mobile */
    .mobile-header-components .sme-rm-li {
        margin-left: auto;
        margin-right: 8px;
    }
}

/* Close button */
.sme-rm-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    display: none;
}

.sme-rm-close:hover {
    color: #333;
}

/* Show close button on mobile */
@media (max-width: 780px) {
    .sme-rm-close {
        display: block;
    }

    .sme-rm-dropdown {
        padding-top: 36px;
    }
}

/* Mobile header specific overrides */
.mobile-header-components .sme-rm-trigger--in .sme-rm-avatar-img {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
}

.mobile-header-components .sme-rm-trigger,
.mobile-header-components .sme-rm-trigger--in {
    height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
}

.mobile-header-components .sme-rm-li {
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
}

/* Slim mobile login pill */
@media (max-width: 780px) {
    .sme-rm-login-pill {
        padding: 4px 10px !important;
        font-size: 11px !important;
        border-radius: 14px !important;
    }
}
