:root {
    --primary-blue: #007aff;
    --light-blue: #5ac8fa;
    --dark-blue: #0a2c52;
    --dark-green: #28a745;
    --background-color: #f5f5f7;
    --text-color: #1d1d1f;
    --secondary-text-color: #86868b;
    --card-background: #ffffff;
    --border-color: #d2d2d7;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    width: 100vw;
    min-width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
    background-color: var(--background-color);
    color: var(--text-color);
}

.main-header {
    width: 100vw;
    min-width: 100vw;
    left: 0;
    right: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(245, 245, 247, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    transition: background-color 0.3s ease;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    position: sticky;
    height: 68px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background-color: transparent;
    border-radius: 50%;
    box-shadow: none;
    text-decoration: none;
    margin-right: 16px;
}

#site-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.main-nav-container {
    grid-column: 2 / 3;
    display: flex;
    align-items: center;
    gap: 20px;
    justify-self: center;
    width: 100%;
    margin: 0 auto;
}

.main-nav {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    width: fit-content;
    margin: 0;
    background-color: #e8e8ed;
    border-radius: 999px; /* Make it pill-shaped */
    padding: 8px; /* Padding inside the grey island */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.main-nav ul {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.main-nav ul li a {
    text-decoration: none;
    color: var(--text-color); /* Black text */
    font-size: 16px;
    font-weight: 500;
    padding: 10px 16px; /* Padding for the text */
    display: block;
    transition: color 0.3s ease;
    z-index: 2; /* Ensure text is above the highlight */
    position: relative;
}

.main-nav ul li a:hover,
.main-nav ul li a.active {
    color: var(--primary-blue); /* Blue for active/hover */
}

.main-nav ul li a.active {
    color: var(--primary-blue);
}

.nav-highlight {
    position: absolute;
    top: 0;
    left: 0;
    transform: none;
    background-color: white; /* The white inner island */
    border-radius: 999px; /* Pill-shaped */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* opacity: 0; */ /* REMOVED to prevent fade-in effect */
    pointer-events: none;
    z-index: 1; /* Below the text but above the grey island */
}

.content-wrapper {
    display: flex !important;
    gap: 24px;
    padding: 20px 40px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.right-column {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 32px;
    width: 140px;
    max-width: 100%;
}

.latest-activity {
    flex: 5;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.activity-wrapper {
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    background: var(--card-background);
    background-image: url('images/activity-placeholder.jpg');
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.activity-wrapper.second {
    background-image: url('images/activity-placeholder2.jpg');
}

.activity-card {
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    cursor: pointer;
    transition: border-radius 0.4s ease-out;
    z-index: 1; /* Ensure it's above the details initially */
    min-height: 350px; /* Give the card a minimum height so the background is visible */
    display: flex; /* Use flexbox to position text at the bottom */
    flex-direction: column;
    justify-content: flex-end;
}

.activity-card img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.activity-details {
    padding: 0 30px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s ease-in-out, padding 0.5s ease-in-out, opacity 0.3s 0.2s ease-in-out;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    background-color: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.activity-details h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: white;
    font-size: 24px;
}

.activity-details p {
    font-size: 16px;
    line-height: 1.6;
    color: #E0E0E0;
}

.close-activity-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.4);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 24px;
    line-height: 32px;
    text-align: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 2;
    padding: 0;
    font-family: Arial, sans-serif;
}

/* Expanded State */
.activity-wrapper.is-expanded .activity-card {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.activity-wrapper.is-expanded .activity-details {
    max-height: 400px;
    opacity: 1;
    padding: 30px;
}

.activity-wrapper.is-expanded .close-activity-btn {
    opacity: 1;
    transform: scale(1);
}

.activity-text {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 30px;
    color: white;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}

.activity-category {
    position: absolute;
    top: 30px;
    left: 30px;
    display: inline-block;
    padding: 8px 15px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    background-color: rgba(0, 0, 0, 0.4); /* Darker background */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 8px;
    border: none; /* Removed border */
}

.activity-text h2 {
    margin: 0 0 10px 0;
    font-size: 28px;
}

.activity-text p {
    margin: 0;
    font-size: 18px;
}

.tutor-recommendations {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
    padding: 32px 32px 24px 32px;
    text-align: center;
    width: 350px;
    margin-bottom: 36px;
    box-sizing: border-box;
}

.tutor-recommendations h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
    color: var(--dark-blue);
    text-align: left;
}

.tutor-card-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
}

.tutor-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background-color: var(--background-color);
    border-radius: 12px;
    transition: all 0.3s ease; /* changed from background-color to all */
    text-decoration: none;
    color: inherit;
    text-align: left;
}

.tutor-card:hover {
    transform: scale(1.02); /* Add a slight scale for better feedback */
    filter: brightness(0.95); /* Darken the component slightly */
}

/* 首页推荐助学人卡片的"头部"特殊样式 */
.tutor-card.premium {
    background: linear-gradient(90deg, #FFF9C4 0%, #FFF9C4 8%, #f3f3f3 100%);
}

.tutor-card img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.tutor-info {
    text-align: left;
}

.tutor-info h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: var(--text-color);
}

.tutor-info p {
    margin: 0;
    font-size: 14px;
    color: var(--secondary-text-color);
}

main {
    animation: pageFadeIn 0.5s ease-out forwards;
}

main.is-exiting {
    animation: pageFadeOut 0.5s ease-out forwards;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: scale(1.02);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pageFadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}

/* --- Responsive Design for Mobile --- */

@media (max-width: 768px) {
    .logo {
        display: none; /* Hide logo on mobile */
    }

    .main-header {
        height: 54px;
        padding-top: 4px;
        padding-bottom: 4px;
    }

    .main-nav-container {
        justify-content: flex-start;
        max-width: none;
        width: auto;
        margin: 0;
    }

    .main-nav {
        flex: none;
    }

    .main-nav ul {
        flex-wrap: wrap; /* Allow nav items to wrap to the next line */
        justify-content: center; /* Center the items when they wrap */
        gap: 5px; /* Reduce gap between nav items */
    }

    .main-nav ul li a {
        font-size: 16px;
        padding: 10px 16px;
    }

    .content-wrapper {
        flex-direction: column !important;
        padding: 20px;
        gap: 20px;
    }
    .right-column {
        width: 100%;
        max-width: 100%;
        gap: 20px;
    }
    .tutor-recommendations, .hanlin-vip-section {
        margin: 0 0 24px 0;
        width: 250px;
        max-width: 250px;
    }

    .activity-card {
        min-height: 250px;
    }

    .activity-text h2 {
        font-size: 24px;
    }

    .activity-details h3 {
        font-size: 20px;
    }

    .activity-details p {
        font-size: 14px;
    }

    .user-avatar {
        right: 0;
        width: 54px;
        height: 54px;
        min-width: 54px;
        min-height: 54px;
        border: 2.5px solid #fff;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        transform: translateY(-50%) translateX(17px);
    }

    .user-avatar-img,
    .user-avatar img,
    .user-avatar .user-initial {
        width: 50px;
        height: 50px;
        font-size: 28px;
    }

    .user-avatar img.vip-badge {
        width: 18px;
        height: 18px;
        right: -1px;
        bottom: -1px;
        border-width: 1px;
    }

    .logout-popover {
        min-width: 48px;
        height: 20px;
        font-size: 11px;
        border-radius: 10px;
        left: -40px;
    }

    .user-avatar.show-logout .logout-popover {
        left: -32px;
    }
}

.shuffle-tutors-btn {
    background: #f3f3f3;
    color: #333;
    border: none;
    border-radius: 10px;
    padding: 5px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: none;
    margin-left: 12px;
    transition: background 0.2s, color 0.2s;
}
.shuffle-tutors-btn:hover {
background: #e0e0e0;
color: #111;
}

/* 语言切换按钮 - 暂时隐藏，保留代码以便后续启用 */
.lang-toggle-btn {
    display: none; /* 隐藏按钮，需要时改为 display: block */
    position: absolute;
    right: 110px;
    top: 50%;
    transform: translateY(-50%);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--primary-blue);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10;
}

.lang-toggle-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.lang-toggle-btn:active {
    transform: translateY(-50%) scale(0.98);
}

/* 如需启用翻译功能，请将上面的 display: none 改为 display: block */

.user-avatar {
position: absolute;
right: 44px;
top: 50%;
transform: translateY(-50%);
margin: 0;
z-index: 10;
width: 54px;
height: 54px;
border-radius: 50%;
background: #f5f5f7;
box-shadow: 0 2px 8px rgba(0,0,0,0.06);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: none !important;
}
.user-avatar-img,
.user-avatar img,
.user-avatar .user-initial {
width: 50px;
height: 50px;
border-radius: 50%;
object-fit: cover;
display: block;
font-size: 28px;
}
.user-avatar-img {
transition: transform 0.25s cubic-bezier(.4,1.2,.4,1), box-shadow 0.25s;
}
.user-avatar-img:hover {
transform: scale(1.13);
box-shadow: 0 4px 16px rgba(0,0,0,0.13);
}
.user-avatar.logged-in {
box-shadow: 0 2px 8px rgba(0,0,0,0.06);
border: 2.5px solid #fff;
background: #fff;
}

.login-modal {
display: none;
position: fixed;
left: 0; top: 0; right: 0; bottom: 0;
background: rgba(0,0,0,0.18);
z-index: 2000;
align-items: center;
justify-content: center;
transition: opacity 0.35s cubic-bezier(.4,1.2,.4,1);
opacity: 0;
pointer-events: none;
}
.login-modal.show {
display: flex;
opacity: 1;
pointer-events: auto;
}
.login-modal-content {
background: rgba(255,255,255,0.85);
backdrop-filter: saturate(180%) blur(22px);
-webkit-backdrop-filter: saturate(180%) blur(22px);
border-radius: 18px;
box-shadow: 0 8px 32px rgba(0,0,0,0.12);
padding: 36px 28px 28px 28px;
min-width: 320px;
max-width: 90vw;
text-align: center;
position: relative;
animation: fadeInModal 0.4s cubic-bezier(.4,1.2,.4,1);
opacity: 0;
transform: translateY(32px) scale(0.98);
transition: opacity 0.35s cubic-bezier(.4,1.2,.4,1), transform 0.35s cubic-bezier(.4,1.2,.4,1);
}
.login-close-btn {
position: absolute;
top: 16px;
right: 18px;
font-size: 28px;
color: #aaa;
cursor: pointer;
background: none;
border: none;
transition: color 0.2s;
}
.login-close-btn:hover {
color: var(--primary-blue);
}
#loginForm {
display: flex;
flex-direction: column;
gap: 18px;
margin-top: 18px;
}
#loginForm input {
padding: 12px 14px;
border-radius: 12px;
border: 1px solid #e0e0e0;
font-size: 16px;
background: #f7f7fa;
outline: none;
transition: border 0.2s;
}
#loginForm input:focus {
border: 1.5px solid var(--primary-blue);
}
#loginForm button {
background: var(--primary-blue);
color: #fff;
border: none;
border-radius: 999px;
padding: 12px 0;
font-size: 17px;
font-weight: 600;
cursor: pointer;
margin-top: 8px;
transition: background 0.2s;
}
#loginForm button:hover {
background: #2196f3;
}
.login-error {
color: #e53935;
font-size: 15px;
margin-top: 10px;
min-height: 22px;
}
.login-modal.show .login-modal-content {
opacity: 1;
transform: translateY(0) scale(1);
}

.logout-popover {
position: absolute;
left: -140px;
top: 50%;
transform: translateY(-50%) scale(1);
opacity: 0;
pointer-events: none;
min-width: 90px;
height: 44px;
background: rgba(255,255,255,0.92);
border-radius: 22px;
box-shadow: 0 4px 24px rgba(0,0,0,0.13);
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
color: #007aff;
font-weight: 500;
user-select: none;
cursor: pointer;
border: none;
outline: none;
z-index: 20;
transition: opacity 0.25s, left 0.25s, transform 0.25s;
}
.user-avatar.show-logout .logout-popover {
opacity: 1;
left: -110px;
pointer-events: auto;
transform: translateY(-50%) scale(1.08);
}
.logout-popover:active {
background: #e6f0fa;
}

.vip-badge {
position: absolute;
right: -2px;
bottom: -2px;
width: 13px;
height: 13px;
border-radius: 50%;
background: #fff;
box-shadow: 0 2px 8px rgba(0,0,0,0.10);
border: 1.5px solid #fff;
z-index: 12;
object-fit: contain;
pointer-events: none;
transition: none !important;
}

.user-avatar img.vip-badge {
width: 18px !important;
height: 18px !important;
min-width: 0 !important;
min-height: 0 !important;
max-width: none !important;
max-height: none !important;
right: -4px;
bottom: -4px;
border: 1px solid #fff !important;
}

.hanlin-vip-section {
width: 350px;
margin-top: -44px;
margin-bottom: 36px;
background: #fff;
border-radius: 18px;
box-shadow: 0 2px 16px rgba(0,0,0,0.06);
padding: 36px 32px 32px 32px;
text-align: center;
box-sizing: border-box;
}
.hanlin-vip-title {
font-size: 2em;
color: #007aff;
font-weight: 700;
margin-bottom: 18px;
}
.hanlin-vip-join-btn {
background: #007aff;
color: #fff;
border: none;
border-radius: 999px;
padding: 12px 38px;
font-size: 18px;
font-weight: 600;
cursor: pointer;
margin-bottom: 24px;
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
transition: background 0.2s;
}
.hanlin-vip-join-btn:hover {
background: #005ecb;
}
.hanlin-vip-benefits {
margin-top: 18px;
overflow: hidden;
max-height: 0;
opacity: 0;
transition: max-height 0.35s cubic-bezier(.4,1.2,.4,1), opacity 0.25s;
}
.hanlin-vip-benefits[style*="display: block"],
.hanlin-vip-benefits[style*="display: "] {
max-height: 600px;
opacity: 1;
}
.hanlin-vip-table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
background: #f9fbff;
border-radius: 14px;
box-shadow: 0 2px 8px rgba(0,0,0,0.04);
overflow: hidden;
margin: 0 auto;
}
.hanlin-vip-table th,
.hanlin-vip-table td {
padding: 16px 10px;
font-size: 17px;
border-bottom: 1px solid #e0e6ef;
}
.hanlin-vip-table th {
background: #f3f7ff;
color: #007aff;
font-size: 18px;
font-weight: 700;
}
.hanlin-vip-table tr:last-child td {
border-bottom: none;
font-weight: 600;
color: #007aff;
background: #f7faff;
}
.hanlin-vip-table td {
color: #222;
text-align: center;
}
.hanlin-vip-table td:first-child {
text-align: left;
color: #86868b;
font-weight: 500;
}

.vip-pro-gradient {
background: linear-gradient(90deg, #e6c97a 0%, #bfa14b 100%);
-webkit-background-clip: text;
background-clip: text;
font-weight: 700;
}

.apple-btn-primary {
background: #007aff;
color: #fff;
border: none;
border-radius: 999px;
padding: 8px 32px;
font-size: 16px;
font-weight: 600;
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
cursor: pointer;
transition: background 0.2s;
    padding: 8px 32px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: background 0.2s;
}
.apple-btn-primary:hover {
    background: #005ecb;
}
.apple-btn-outline {
    background: #f3f3f3;
    color: #007aff;
    border: 1.5px solid #e0e6ef;
    border-radius: 999px;
    padding: 8px 24px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.apple-btn-outline:hover {
    background: #eaf3ff;
    color: #005ecb;
}
.apple-btn-outline-red {
    background: #fff0f0;
    color: #e53935;
    border: 1.5px solid #ffeaea;
    border-radius: 999px;
    padding: 8px 24px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.apple-btn-outline-red:hover {
    background: #ffeaea;
    color: #b71c1c;
}
.apple-input {
    border: 1.5px solid #e0e6ef;
    border-radius: 10px;
    padding: 7px 16px;
    font-size: 16px;
    font-family: inherit;
    background: #f9fbff;
    color: #222;
    outline: none;
    box-shadow: none;
    transition: border 0.2s, background 0.2s;
}
.apple-input:focus {
    border: 1.5px solid #007aff;
    background: #fff;
}

.class-card-apple {
    display: inline-flex;
    align-items: center;
    background: #f9fbff;
    color: #007aff;
    font-size: 1.08em;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1.5px solid #e0e6ef;
    padding: 8px 22px 8px 18px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s, color 0.2s, border 0.2s;
    margin-bottom: 2px;
}
.class-card-apple.active {
    background: #eaf3ff;
    color: #005ecb;
    border: 1.5px solid #007aff;
}
.class-card-apple:hover {
    background: #eaf3ff;
    color: #005ecb;
}
.class-card-del {
    background: none;
    border: none;
    color: #e53935;
    font-size: 1.1em;
    font-weight: 700;
    margin-left: 8px;
    cursor: pointer;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s, color 0.18s;
}
.class-card-del:hover {
    background: #ffeaea;
    color: #b71c1c;
}

@keyframes crystalFlow {
  0% { background-position: 0% 50%; opacity: 0.7; }
  50% { background-position: 100% 50%; opacity: 1; }
  100% { background-position: 0% 50%; opacity: 0.7; }
}

.profile-main-row {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 48px;
}

/* ===== Balance Card Animated Backgrounds ===== */
/* Container sizing already handled inline; here we add animated overlays */
.balance-card-mplus [class^="balance-card-bg-"],
.balance-card-mplus [class*=" balance-card-bg-"] {
  position: relative;
  overflow: hidden;
}

/* Subtle moving crystal-like light overlay */
.balance-card-mplus [class^="balance-card-bg-" ]::after,
.balance-card-mplus [class*=" balance-card-bg-" ]::after {
  content: "";
  position: absolute;
  left: -20%;
  top: -20%;
  width: 140%;
  height: 140%;
  background:
    radial-gradient(60% 50% at 20% 50%, rgba(255,255,255,0.45), rgba(255,255,255,0) 60%),
    radial-gradient(40% 35% at 80% 40%, rgba(255,255,255,0.25), rgba(255,255,255,0) 65%),
    linear-gradient(90deg, rgba(255,255,255,0.16), rgba(255,255,255,0) 60%);
  mix-blend-mode: screen;
  pointer-events: none;
  animation: crystalFlow 12s ease-in-out infinite;
}

/* Stronger neon shimmer for 至臻明珠 */
.balance-card-mplus .balance-card-bg-至臻明珠::before {
  content: "";
  position: absolute;
  inset: -30%;
  background:
    radial-gradient(45% 40% at 30% 60%, rgba(126,214,255,0.12), rgba(126,214,255,0) 60%),
    radial-gradient(45% 40% at 70% 35%, rgba(178,224,255,0.10), rgba(178,224,255,0) 60%);
  filter: blur(8px);
  pointer-events: none;
  animation: crystalFlow 10s ease-in-out infinite;
}
