
/* Sidebar Navigation - Moved to sidebar.css */

/* Login Button (Small) */
.btn-primary-sm {
    display: inline-flex; align-items: center; justify-content: center;
    height: 36px; padding: 0 16px;
    background: #18181b; color: #fff;
    border-radius: 9999px;
    font-size: 13px; font-weight: 600;
    cursor: pointer; border: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.btn-primary-sm:hover {
    opacity: 0.9; transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* --- Login Modal --- */
.login-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden;
    transition: all 0.3s ease;
}
.login-overlay.active { opacity: 1; visibility: visible; }

.login-card {
    width: auto; /* Adaptive width */
    height: 480px; /* Fixed height */
    padding: 0;
    background: #fff;
    border-radius: 12px;
    display: flex; flex-direction: row; 
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    transform: scale(0.95);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.login-overlay.active .login-card { transform: scale(1); }

.login-close-btn {
    position: absolute; top: 12px; right: 12px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: transparent;
    color: #999;
    border: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    z-index: 20;
}
.login-close-btn:hover {
    color: #333;
    background: rgba(0,0,0,0.05);
}

/* Left Panel */
.login-left-panel {
    width: auto; /* Adaptive to image */
    height: 100%;
    background: #fff;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: 0 0 auto; /* Do not grow or shrink */
}

/* Right Panel */
.login-right-panel {
    width: 400px; /* Fixed width for content */
    flex: 0 0 auto; /* Do not grow or shrink */
    background: #fff;
    display: flex; flex-direction: column; 
    padding: 40px 30px;
    align-items: center;
    justify-content: center;
}

.login-header {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 30px;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    width: 100%;
}

.login-footer-p {
    font-size: 12px;
    color: #666; /* Use a slightly darker gray for readability */
    line-height: 1.6;
    margin: 4px 0;
}

.login-footer-p a {
    color: #1677ff; /* Link color */
    text-decoration: none;
}
.login-footer-p a:hover {
    text-decoration: underline;
}

/* QR Content */
.login-qr-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.login-tip {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

#wx-qr-container {
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    background: #fafafa;
}

#wx-qr-img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    display: none;
}

#wx-qr-loading {
    color: #999;
    font-size: 12px;
}

.login-promotion {
    font-size: 14px;
    color: #1677ff;
    text-decoration: none;
    margin-bottom: 12px;
    font-weight: 500;
}
.login-promotion:hover {
    text-decoration: underline;
}

.login-note {
    font-size: 12px;
    color: #999;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .login-card {
        flex-direction: column;
        width: 90%;
        height: auto;
    }
    .login-left-panel {
        display: none; /* Hide image on mobile to save space */
    }
    .login-right-panel {
        padding: 30px 20px;
        width: 100%;
    }
}

/* --- Refined User Widget & Menu (Existing) --- */
.user-profile-widget {
    background: #18181b;
    border-radius: 12px; /* Capsule */
    padding: 4px 12px; /* Reduced padding */
    display: flex;
    align-items: center;
    gap: 8px; /* Reduced gap */
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
    min-width: 120px; /* Reduced min-width */
    position: relative;
    border: 1px solid transparent;
    height: 40px; /* Fixed height to match smaller buttons */
    font-weight: 700;
}
.user-profile-widget:hover {
    background: #27272a;
}
/* Logged In State (White) */
.user-profile-widget.is-logged-in {
    background: #ffffff;
    border: 1px solid #e5e7eb;
}
.user-profile-widget.is-logged-in:hover {
    background: #f9fafb;
}

.up-avatar {
    width: 24px; height: 24px; /* Reduced size */
    border-radius: 50%;
    background: linear-gradient(135deg, #000, #000);
    display: none; /* Hide by default (Not Logged In) */
    align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 10px; /* Reduced font size */
}

/* Show avatar when logged in */
.user-profile-widget.is-logged-in .up-avatar {
    display: flex;
}
.up-info {
    flex: 1; display: flex; flex-direction: column; gap: 0; overflow: hidden; justify-content: center;
    align-items: center; /* Center content by default (Not Logged In) */
}
.user-profile-widget.is-logged-in .up-info {
    align-items: flex-start; /* Left align when logged in */
}
.up-name {
    font-size: 12px; font-weight: 600; color: #ffffff; /* Reduced font size */
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    line-height: 1.2;
}
.user-profile-widget.is-logged-in .up-name {
    color: #1f2937;
}

.login-status-text {
    font-size: 12px; font-weight: 600; color: #ffffff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    line-height: 1.2;
}
.user-profile-widget.is-logged-in .login-status-text {
    display: none;
}

.up-role {
    font-size: 10px; color: #a1a1aa; display: none; align-items: center; gap: 4px;
    line-height: 1;
}
.user-profile-widget.is-logged-in .up-role {
    color: #000;
    font-weight: 700;
    display: flex; /* Show only when logged in */
}
.up-chevron {
    display: none;
}

/* Sidebar Upgrade Button */
.sidebar-upgrade-btn {
    width: 100%;
    background: linear-gradient(135deg, #ff6b8b 0%, #ffe08a 40%, #6dd5c3 80%);
    color: #fff;
    border: none;
    border-radius: 10px; /* Pill shape */
    padding: 10px 0;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.sidebar-upgrade-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

/* Popup Menu Refined */
.refined-user-menu {
    position: absolute;
    top: calc(100% + 25px); right: 0; /* Dropdown position */
    left: auto; bottom: auto;
    margin-left: 0;
    width: 240px; /* Reduced width */
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 12px; /* Tighter padding */
    z-index: 2000;
    opacity: 0; visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0,0,0,0.06);
}
@media (max-width: 768px) {
    .refined-user-menu {
        left: auto; right: 0; top: 100%; bottom: auto;
        margin-top: 8px;
    }
}
/* Hover trigger & Active state */
#sidebarAuthSection.logged-in:hover .refined-user-menu,
.refined-user-menu.active {
    opacity: 1; visibility: visible;
    transform: translateY(0);
}

.rum-header {
    font-size: 11px; font-weight: 600; color: #9ca3af;
    text-transform: uppercase; letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 0; border-bottom: none;
    display: block;
}

.rum-user-row {
    display: flex; align-items: center; gap: 10px;
    padding-bottom: 12px; margin-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.rum-avatar {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: #000; 
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
    flex-shrink: 0;
}
.rum-info { display: flex; flex-direction: column; overflow: hidden; }
.rum-name { font-size: 13px; font-weight: 600; color: #111; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rum-email { font-size: 11px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rum-credits-row {
    display: flex; align-items: center; gap: 6px;
    padding-bottom: 12px;
}
.rum-credits-label { font-size: 12px; color: #6b7280; }
.rum-credits-val { font-size: 13px; font-weight: 700; color: #111; }

.rum-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px;
    border-radius: 6px;
    color: #374151; font-size: 13px; font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.rum-item:hover {
    background: #f3f4f6; color: #111;
}
.rum-icon { width: 16px; height: 16px; color: #9ca3af; transition: color 0.2s; }
.rum-item:hover .rum-icon { color: #4b5563; }
.rum-item svg { width: 16px; height: 16px; } /* Fallback */

.rum-divider { height: 1px; background: #f3f4f6; margin: 6px 0; }

.rum-logout { color: #ef4444; }
.rum-logout:hover { background: #fee2e2; color: #b91c1c; }
.rum-logout .rum-icon { color: #fca5a5; }
.rum-logout:hover .rum-icon { color: #ef4444; }

.rum-footer {
    margin-top: 8px; padding-top: 8px; border-top: 1px solid #f3f4f6;
    display: flex; justify-content: center;
}
.rum-footer-inner { display: flex; align-items: center; gap: 4px; font-size: 10px; color: #9ca3af; }
.rum-link { color: #9ca3af; text-decoration: none; transition: color 0.2s; font-size: 10px; }
.rum-link:hover { color: #6b7280; text-decoration: underline; }
