/* ============================================
   喜悦盛年 H5 学员端 - 共享样式
   设计理念：温暖适老 · 国风现代
   适配环境：微信内置浏览器
   ============================================ */

/* ========== 品牌色彩变量 ========== */
:root {
    /* 品牌主色系 */
    --brand-red: #D4302A;        /* 朱红 - 主品牌色 */
    --brand-red-dark: #B82620;   /* 深朱红 - 按压态 */
    --brand-red-light: #E85850;  /* 浅朱红 - 辅助 */
    --brand-orange: #F5A623;     /* 暖橙 - 强调色 */
    --brand-gold: #D4AF37;       /* 金色 - 点缀色 */
    --brand-gold-light: #F0D77A; /* 浅金 - 背景装饰 */

    /* 背景色系 */
    --bg-page: #FFFAF0;          /* 暖白 - 页面背景 */
    --bg-card: #FFFFFF;          /* 白色 - 卡片背景 */
    --bg-section: #FFF3E0;       /* 浅橙 - 分区背景 */
    --bg-input: #F8F5F0;         /* 米白 - 输入框背景 */
    --bg-hover: #FFF8E7;         /* 悬停背景 */

    /* 文字色系 */
    --text-primary: #2D2D2D;     /* 深灰 - 主文字 */
    --text-secondary: #666666;   /* 中灰 - 次要文字 */
    --text-placeholder: #B0B0B0; /* 浅灰 - 占位文字 */
    --text-inverse: #FFFFFF;     /* 白色 - 反色文字 */
    --text-brand: #D4302A;       /* 品牌色文字 */

    /* 功能色 */
    --color-success: #52C41A;    /* 翠绿 - 成功 */
    --color-warning: #FAAD14;    /* 琥珀 - 警示 */
    --color-danger: #FF4D4F;     /* 红色 - 危险 */
    --color-info: #1890FF;       /* 蓝色 - 信息 */

    /* 边框与分割线 */
    --border-color: #E8E0D5;     /* 暖灰边框 */
    --border-light: #F0EBE0;     /* 浅边框 */
    --divider: #F5F0E8;          /* 分割线 */

    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(212, 48, 42, 0.06);
    --shadow-md: 0 4px 16px rgba(212, 48, 42, 0.1);
    --shadow-lg: 0 8px 24px rgba(212, 48, 42, 0.12);

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* 间距 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 20px;
    --spacing-xl: 24px;
    --spacing-2xl: 32px;

    /* 字号 - 适老化大字体 */
    --font-xs: 13px;
    --font-sm: 15px;
    --font-base: 17px;
    --font-md: 18px;
    --font-lg: 20px;
    --font-xl: 24px;
    --font-2xl: 28px;
    --font-3xl: 34px;

    /* 品牌渐变 */
    --gradient-brand: linear-gradient(135deg, #D4302A 0%, #E85850 50%, #F5A623 100%);
    --gradient-warm: linear-gradient(180deg, #FFF3E0 0%, #FFFAF0 100%);
    --gradient-gold: linear-gradient(135deg, #D4AF37 0%, #F0D77A 100%);

    /* 安全区域 */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    /* 组件尺寸 */
    --header-height: 52px;
    --tabbar-height: 58px;
    --touch-target: 48px;
}

/* ========== CSS Reset ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

html {
    font-size: 17px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
    font-size: var(--font-base);
    color: var(--text-primary);
    background-color: var(--bg-page);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* 微信内置浏览器优化 */
body {
    user-select: none;
    -webkit-user-select: none;
}

input, textarea {
    user-select: text;
    -webkit-user-select: text;
}

a {
    color: var(--brand-red);
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

img {
    display: block;
    max-width: 100%;
}

button {
    border: none;
    outline: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

input, select, textarea {
    border: none;
    outline: none;
    font-family: inherit;
    font-size: inherit;
    color: var(--text-primary);
    background: none;
}

/* ========== 页面容器 ========== */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-page);
}

.page-content {
    flex: 1;
    padding: var(--spacing-lg);
    padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom) + var(--spacing-lg));
}

.page-content.no-tabbar {
    padding-bottom: var(--spacing-lg);
}

/* ========== 顶部导航栏 ========== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: calc(var(--header-height) + var(--safe-top));
    padding-top: var(--safe-top);
    background: var(--gradient-brand);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
    box-shadow: 0 2px 8px rgba(212, 48, 42, 0.15);
}

.app-header__back {
    width: var(--touch-target);
    height: var(--touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-size: var(--font-xl);
    flex-shrink: 0;
    margin-left: calc(var(--spacing-md) * -1);
}

.app-header__title {
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-inverse);
    letter-spacing: 1px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.app-header__title .logo-text {
    font-size: var(--font-md);
}

/* 校区切换按钮（可点击胶囊） */
a.campus {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 10px 3px 12px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-full);
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--text-inverse);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s;
}

a.campus:active {
    background: rgba(255, 255, 255, 0.3);
}

.campus-arrow {
    font-size: 11px;
    opacity: 0.8;
}

.app-header__menu {
    width: var(--touch-target);
    height: var(--touch-target);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-size: var(--font-xl);
    flex-shrink: 0;
    margin-right: calc(var(--spacing-md) * -1);
}

.app-header__logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

/* ========== 底部 Tab 栏 ========== */
.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--tabbar-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg-card);
    display: flex;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
    z-index: 100;
    border-top: 1px solid var(--border-light);
}

.tabbar__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-secondary);
    transition: color 0.2s;
    min-height: var(--touch-target);
}

.tabbar__item.active {
    color: var(--brand-red);
}

.tabbar__icon {
    font-size: 22px;
    line-height: 1;
}

.tabbar__label {
    font-size: var(--font-xs);
    line-height: 1;
}

/* ========== 按钮组件 ========== */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    min-height: var(--touch-target);
    padding: 14px var(--spacing-xl);
    border-radius: var(--radius-full);
    font-size: var(--font-md);
    font-weight: 600;
    transition: all 0.2s;
    width: 100%;
    text-align: center;
}

.btn:active {
    transform: scale(0.97);
}

.btn--primary {
    background: var(--gradient-brand);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(212, 48, 42, 0.25);
}

.btn--primary:active {
    box-shadow: 0 2px 8px rgba(212, 48, 42, 0.2);
}

.btn--secondary {
    background: var(--bg-section);
    color: var(--brand-red);
    border: 1.5px solid var(--brand-red-light);
}

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border-color);
}

.btn--gold {
    background: var(--gradient-gold);
    color: #5C3A00;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25);
}

.btn--sm {
    min-height: 36px;
    padding: 8px 16px;
    font-size: var(--font-sm);
    width: auto;
    border-radius: var(--radius-full);
}

.btn--block {
    width: 100%;
}

/* ========== 表单组件 ========== */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-size: var(--font-sm);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    padding-left: 4px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    height: 52px;
    padding: 0 var(--spacing-lg);
    background: var(--bg-input);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    font-size: var(--font-base);
    color: var(--text-primary);
    transition: border-color 0.2s, background 0.2s;
}

.form-input::placeholder {
    color: var(--text-placeholder);
}

.form-input:focus {
    border-color: var(--brand-red-light);
    background: var(--bg-card);
}

.form-input-row {
    display: flex;
    gap: var(--spacing-sm);
}

.form-input-row .form-input {
    flex: 1;
}

/* 验证码按钮 */
.btn-code {
    flex-shrink: 0;
    min-width: 120px;
    height: 52px;
    padding: 0 var(--spacing-md);
    background: var(--bg-card);
    border: 1.5px solid var(--brand-red);
    border-radius: var(--radius-md);
    color: var(--brand-red);
    font-size: var(--font-sm);
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-code:active {
    background: var(--bg-section);
}

.btn-code:disabled {
    border-color: var(--border-color);
    color: var(--text-placeholder);
    background: var(--bg-input);
}

/* 性别/兴趣选择标签 */
.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.chip {
    min-height: 44px;
    padding: 8px 20px;
    background: var(--bg-input);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: var(--font-sm);
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chip.active {
    background: rgba(212, 48, 42, 0.08);
    border-color: var(--brand-red);
    color: var(--brand-red);
    font-weight: 500;
}

.chip:active {
    transform: scale(0.96);
}

/* ========== 卡片组件 ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-md);
}

.card--highlight {
    border-left: 4px solid var(--brand-red);
}

.card--gold {
    border-left: 4px solid var(--brand-gold);
}

/* ========== 区块标题 ========== */
.section-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-md);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.section-title:first-child {
    margin-top: 0;
}

.section-title__icon {
    font-size: var(--font-lg);
}

.section-title__dot {
    width: 4px;
    height: 18px;
    background: var(--gradient-brand);
    border-radius: 2px;
    flex-shrink: 0;
}

/* ========== 工具类 ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-brand { color: var(--brand-red); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }
.text-secondary { color: var(--text-secondary); }

.font-bold { font-weight: 600; }
.font-lg { font-size: var(--font-lg); }
.font-xl { font-size: var(--font-xl); }
.font-2xl { font-size: var(--font-2xl); }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* ========== 装饰元素 ========== */
.brand-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--brand-gold-light), transparent);
    margin: var(--spacing-lg) 0;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--font-xs);
    font-weight: 500;
}

.brand-badge--red {
    background: rgba(212, 48, 42, 0.1);
    color: var(--brand-red);
}

.brand-badge--gold {
    background: rgba(212, 175, 55, 0.12);
    color: #8B6914;
}

.brand-badge--green {
    background: rgba(82, 196, 26, 0.1);
    color: var(--color-success);
}

.brand-badge--orange {
    background: rgba(245, 166, 35, 0.12);
    color: #B47000;
}

/* ========== 动画 ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

.fade-in-delay-1 {
    animation: fadeIn 0.4s ease-out 0.1s both;
}

.fade-in-delay-2 {
    animation: fadeIn 0.4s ease-out 0.2s both;
}

.fade-in-delay-3 {
    animation: fadeIn 0.4s ease-out 0.3s both;
}

/* ========== 滚动优化 ========== */
::-webkit-scrollbar {
    width: 0;
    height: 0;
}

/* ========== 弹出层 ========== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 200;
    display: none;
}

.overlay.active {
    display: block;
}

/* ========== Toast 提示 ========== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.75);
    color: var(--text-inverse);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: var(--font-sm);
    z-index: 300;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    max-width: 80%;
    text-align: center;
}

.toast.show {
    opacity: 1;
}
