:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #eff6ff;
    --radius: 12px;
    --accent: #f59e0b;
    --success: #10b981;
    --text: #1f2937;
    --light: #f1f5f9;
    --surface: #ffffff;
    --card-bg-on-muted: #ffffff;
    --card-bg-on-white: #f5f8ff;
    --card-tint-blue: #f5f8ff;
    --card-tint-green: #f0fdf9;
    --card-tint-orange: #fffbf5;
    --border-subtle: rgba(15, 23, 42, 0.06);
    --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow-card-hover: 0 4px 12px rgba(15, 23, 42, 0.08), 0 16px 40px rgba(15, 23, 42, 0.1);
    --shadow-card-blue: 0 1px 3px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(30, 64, 175, 0.08);
    --shadow-card-blue-hover: 0 4px 12px rgba(15, 23, 42, 0.06), 0 16px 40px rgba(30, 64, 175, 0.12);
    --gray: #64748b;
    --navbar-h: 72px;
    --logo-min-w: clamp(180px, 22vw, 280px);
    --section-y: clamp(2rem, 4vw, 3.25rem);
    --section-intro-gap: 1.25rem;
    --card-pad: 1.5rem;
    --grid-gap: 1.125rem;
    --transition: all 0.25s ease;

    /* 兼容旧页面变量名 */
    --primary-color: var(--primary);
    --secondary-color: var(--success);
    --accent-color: var(--accent);
    --text-dark: var(--text);
    --text-light: var(--gray);
    --bg-light: var(--light);
    --bg-white: var(--surface);
    --white: var(--surface);
    --text-muted: var(--gray);
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: var(--shadow-card);
    --shadow-lg: var(--shadow-card-hover);
    --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    --success-color: var(--success);
    --warning-color: #f59e0b;
    --alipay-color: #1677ff;
    --wechat-color: #07c160;
    --primary-rgb: 30, 64, 175;
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--navbar-h);
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    color: var(--text);
    line-height: 1.6;
    background: var(--light);
}

/* 导航 */
header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .navbar {
    min-height: var(--navbar-h);
    padding-top: 0;
    padding-bottom: 0;
}

header .navbar > .container {
    min-height: var(--navbar-h);
    align-items: center;
}

header .navbar-brand.logo-brand {
    display: flex;
    align-items: center;
    height: var(--navbar-h);
    min-width: var(--logo-min-w);
    padding: 0;
    margin-right: 1.25rem;
    overflow: visible;
    flex-shrink: 0;
}

.logo-ai {
    display: block;
    height: 120px;
    width: auto;
    max-width: min(260px, 42vw);
    object-fit: contain;
    object-position: left center;
    transform: scale(1.6);
    transform-origin: left center;
}

header .nav-link {
    color: var(--text);
    font-weight: 500;
    font-size: 0.9375rem;
    padding: 0.375rem 0.875rem !important;
}

header .nav-link:hover,
header .nav-link.active {
    color: var(--primary);
}

header .navbar-toggler {
    padding: 0.35rem 0.6rem;
    border-color: #e2e8f0;
}

.user-profile-compact {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 1rem;
    padding: 0.3rem 0.8rem 0.3rem 0.5rem;
    border-radius: 13px;
    background: linear-gradient(135deg, #ffffff 0%, #f0f6ff 100%);
    border: 1px solid rgba(var(--primary-rgb), 0.08);
    transition: var(--transition);
}

.user-profile-compact:hover {
    border-color: rgba(var(--primary-rgb), 0.2);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.06);
}

.user-profile-compact a {
    text-decoration: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-profile-compact .user-name {
    font-size: 0.9rem;
    font-weight: 600;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vip-badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 9999px;
    background: #fef3c7;
    color: #92400e;
}

.vip-badge.vip-inactive {
    background: #f1f5f9;
    color: var(--gray);
}

.btn-outline-custom {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #f0f6ff 100%);
    color: var(--primary);
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    transition: var(--transition);
    text-decoration: none;
}

.btn-outline-custom:hover {
    background: linear-gradient(135deg, #f0f6ff 0%, #e0edff 100%);
    border-color: var(--primary);
    color: var(--primary-dark);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.1);
}

.btn-logout-sm {
    color: var(--gray);
    font-size: 1.1rem;
    padding: 0.25rem;
    text-decoration: none;
}

.btn-logout-sm:hover { color: #dc2626; }

/* 子页面通用标题 */
.section-title,
.section-heading {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    color: var(--primary-dark);
    position: relative;
    padding-bottom: 0.75rem;
}

.section-title.text-center::after,
.section-heading.text-center::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 2px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.page-header h2 {
    color: var(--text);
    font-weight: 600;
    font-size: clamp(1.35rem, 2.5vw, 1.75rem);
    position: relative;
    padding-bottom: 0.5rem;
    margin: 0;
}

.page-header h2::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 50px;
    height: 3px;
    background: var(--primary);
    border-radius: 2px;
}

/* 左右悬浮快捷入口 */
@keyframes floatOrb {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes floatOrbRing {
    0% { opacity: 0.5; transform: scale(0.88); }
    100% { opacity: 0; transform: scale(1.45); }
}

@keyframes floatOrbRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes floatOrbPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.floating-robot,
.floating-contact {
    position: fixed;
    bottom: 80px;
    width: 76px;
    height: 76px;
    z-index: 999;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    animation: floatOrb 3s ease-in-out infinite;
    overflow: visible;
}

.floating-robot { left: clamp(16px, 4vw, 50px); }
.floating-contact { right: clamp(16px, 4vw, 50px); }

.floating-robot::before,
.floating-robot::after,
.floating-contact::before,
.floating-contact::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(var(--primary-rgb), 0.32);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.88);
    animation: floatOrbRing 2.4s ease-out infinite;
}

.floating-contact::before,
.floating-contact::after {
    border-color: rgba(16, 185, 129, 0.38);
}

.floating-robot::after,
.floating-contact::after {
    animation-delay: 1.1s;
}

.floating-robot:hover,
.floating-contact:hover {
    transform: scale(1.08);
    animation-play-state: paused;
}

.robot-container,
.contact-container {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-card-blue);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.robot-container {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.contact-container {
    background: linear-gradient(135deg, var(--success), #059669);
}

.robot-container::before,
.contact-container::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.28) 0%, transparent 70%);
    animation: floatOrbRotate 8s linear infinite;
}

.robot-container .orb-avatar,
.contact-container .orb-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
    z-index: 1;
    animation: floatOrbPulse 2s ease-in-out infinite;
}

.robot-tooltip,
.contact-tooltip {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.96);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: var(--shadow-card);
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease, left 0.24s ease, right 0.24s ease, box-shadow 0.24s ease;
    border: 1px solid var(--border-subtle);
}

.robot-tooltip {
    left: calc(100% + 16px);
    border-left: 3px solid var(--primary);
}

.contact-tooltip {
    right: calc(100% + 16px);
    border-right: 3px solid var(--success);
}

.contact-tooltip::after {
    content: "";
    position: absolute;
    right: -7px;
    top: 50%;
    transform: translateY(-50%);
    border: 7px solid transparent;
    border-left-color: rgba(255, 255, 255, 0.96);
}

.robot-tooltip small,
.contact-tooltip-sub {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray);
    line-height: 1.4;
}

.floating-robot:hover .robot-tooltip {
    opacity: 1;
    left: calc(100% + 12px);
}

.floating-contact:hover .contact-tooltip {
    opacity: 1;
    box-shadow: var(--shadow-card-hover);
}

/* 页脚 */
footer {
    background: #0f172a;
    color: #94a3b8;
    padding: 2.25rem 0 1.75rem;
}

footer h3 {
    color: white;
    font-size: 1rem;
    margin-bottom: 1rem;
}

footer a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
}

footer a:hover { color: white; }

footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

footer li { margin-bottom: 0.5rem; }

@media (max-width: 768px) {
    :root {
        --navbar-h: 64px;
        --logo-min-w: 148px;
    }

    .logo-ai {
        height: 96px;
        max-width: min(200px, 52vw);
        transform: scale(1.45);
    }

    header .navbar-brand.logo-brand {
        margin-right: 0.5rem;
    }

    header .nav-link {
        font-size: 1rem;
        padding: 0.5rem 0 !important;
    }

    .floating-robot,
    .floating-contact {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .floating-robot,
    .floating-contact {
        animation: none;
    }

    .floating-robot::before,
    .floating-robot::after,
    .floating-contact::before,
    .floating-contact::after,
    .robot-container::before,
    .contact-container::before {
        animation: none;
        opacity: 0;
    }

    .robot-container .orb-avatar,
    .contact-container .orb-avatar {
        animation: none;
    }
}
