/**
 * 企业微信自助加入 - 现代化样式
 * 采用卡片式设计、渐变背景、流畅动画
 */

/* ===== 基础变量定义 ===== */
:root {
    --primary-color: #07C160;
    --primary-dark: #06AD56;
    --primary-light: #E8F5E9;
    --secondary-color: #1890FF;
    --warning-color: #FAAD14;
    --error-color: #FF4D4F;
    --success-color: #52C41A;
    --text-primary: #262626;
    --text-secondary: #595959;
    --text-tertiary: #8C8C8C;
    --bg-primary: #F0F2F5;
    --bg-card: #FFFFFF;
    --border-color: #E8E8E8;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 基础样式重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== 页面容器 ===== */
.wx-page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* 背景动画元素 */
.wx-bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.wx-bg-animation::before,
.wx-bg-animation::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
}

.wx-bg-animation::before {
    width: 600px;
    height: 600px;
    background: linear-gradient(45deg, #fff, transparent);
    top: -200px;
    right: -200px;
    animation: float 20s infinite ease-in-out;
}

.wx-bg-animation::after {
    width: 400px;
    height: 400px;
    background: linear-gradient(45deg, transparent, #fff);
    bottom: -100px;
    left: -100px;
    animation: float 15s infinite ease-in-out reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* ===== 头部样式 ===== */
.wx-header {
    position: relative;
    z-index: 10;
    padding: 40px 20px 30px;
    text-align: center;
    color: #fff;
}

.wx-header-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 20px rgba(255, 255, 255, 0); }
}

.wx-header-icon svg {
    width: 40px;
    height: 40px;
    fill: #fff;
}

.wx-header-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wx-header-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

/* ===== 主内容区域 ===== */
.wx-main {
    flex: 1;
    position: relative;
    z-index: 10;
    padding: 0 20px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== 卡片样式 ===== */
.wx-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: var(--transition);
    animation: slideUp 0.5s ease-out;
}

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

.wx-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.wx-card-header {
    padding: 24px 24px 0;
}

.wx-card-body {
    padding: 24px;
}

.wx-card-footer {
    padding: 16px 24px 24px;
    background: #FAFAFA;
    border-top: 1px solid var(--border-color);
}

/* ===== 用户信息卡片 ===== */
.wx-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-light) 0%, #fff 100%);
    border-radius: var(--radius-md);
    border: 1px solid rgba(7, 193, 96, 0.2);
}

.wx-user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    font-weight: 600;
    flex-shrink: 0;
}

.wx-user-details h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.wx-user-details p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== 状态标签 ===== */
.wx-status-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.wx-status-tag.success {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.wx-status-tag.warning {
    background: #FFF7E6;
    color: var(--warning-color);
}

.wx-status-tag.error {
    background: #FFF1F0;
    color: var(--error-color);
}

.wx-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: blink 2s infinite;
}

.wx-status-tag.success .wx-status-dot {
    background: var(--success-color);
}

.wx-status-tag.warning .wx-status-dot {
    background: var(--warning-color);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ===== 表单样式 ===== */
.wx-form-group {
    margin-bottom: 20px;
}

.wx-form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.wx-form-label .required {
    color: var(--error-color);
    margin-left: 4px;
}

.wx-input-wrapper {
    position: relative;
}

.wx-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #fff;
    transition: var(--transition);
    outline: none;
}

.wx-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.1);
}

.wx-input.error {
    border-color: var(--error-color);
    background: #FFF1F0;
}

.wx-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.wx-input.with-icon {
    padding-left: 48px;
}

/* 验证码输入框 */
.wx-verify-input {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.wx-verify-input .wx-input {
    flex: 0 0 calc((100% - 40px) / 6);
    max-width: 48px;
    min-width: 36px;
    height: 48px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    padding: 0;
    letter-spacing: 0;
    line-height: 48px;
}

/* 移动端适配 */
@media (max-width: 360px) {
    .wx-verify-input {
        gap: 6px;
    }
    
    .wx-verify-input .wx-input {
        flex: 0 0 calc((100% - 30px) / 6);
        max-width: 42px;
        min-width: 32px;
        height: 44px;
        font-size: 22px;
        line-height: 44px;
    }
}

@media (max-width: 320px) {
    .wx-verify-input {
        gap: 4px;
    }
    
    .wx-verify-input .wx-input {
        flex: 0 0 calc((100% - 20px) / 6);
        max-width: 38px;
        min-width: 28px;
        height: 40px;
        font-size: 20px;
        line-height: 40px;
    }
}

/* 验证码输入框特殊样式 */
.wx-verify-input .wx-input:focus {
    border-color: #07C160;
    border-width: 2px;
    background-color: #F6FFED;
    box-shadow: 0 0 0 4px rgba(7, 193, 96, 0.15);
    transform: scale(1.05);
    outline: none;
}

.wx-verify-input .wx-input.filled {
    background-color: #E6F7FF;
    border-color: #1890FF;
}

/* 移动端验证码输入框优化 */
.wx-verify-input .wx-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    caret-color: #07C160;
}

/* 禁用 IOS 自动大写和自动更正 */
.wx-verify-input .wx-input {
    text-transform: none;
    -webkit-text-transform: none;
}

/* ===== 按钮样式 ===== */
.wx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 24px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    position: relative;
    overflow: hidden;
}

.wx-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.wx-btn:active::before {
    width: 300px;
    height: 300px;
}

.wx-btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(7, 193, 96, 0.4);
}

.wx-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(7, 193, 96, 0.5);
}

.wx-btn-primary:active {
    transform: translateY(0);
}

.wx-btn-secondary {
    background: #fff;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.wx-btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.wx-btn-danger {
    background: linear-gradient(135deg, var(--error-color) 0%, #FF7875 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 77, 79, 0.4);
}

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

.wx-btn-sm {
    height: 36px;
    padding: 0 16px;
    font-size: 14px;
}

.wx-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 倒计时按钮 */
.wx-btn-countdown {
    min-width: 120px;
    background: var(--bg-primary);
    color: var(--text-secondary);
}

/* ===== 单选按钮组 ===== */
.wx-radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.wx-radio-item {
    flex: 1;
    min-width: 100px;
}

.wx-radio-item input {
    display: none;
}

.wx-radio-item label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
}

.wx-radio-item input:checked + label {
    border-color: var(--primary-color);
    background: var(--primary-light);
    color: var(--primary-dark);
}

.wx-radio-item label:hover {
    border-color: var(--primary-color);
}

/* ===== 提示信息 ===== */
.wx-alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wx-alert-info {
    background: #E6F7FF;
    border: 1px solid #91D5FF;
    color: var(--secondary-color);
}

.wx-alert-warning {
    background: #FFF7E6;
    border: 1px solid #FFD591;
    color: var(--warning-color);
}

.wx-alert-error {
    background: #FFF1F0;
    border: 1px solid #FFA39E;
    color: var(--error-color);
}

.wx-alert-success {
    background: #F6FFED;
    border: 1px solid #B7EB8F;
    color: var(--success-color);
}

.wx-alert-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.wx-alert-content {
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
}

/* ===== 步骤指示器 ===== */
.wx-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 32px;
}

.wx-step {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wx-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.wx-step.active .wx-step-number,
.wx-step.completed .wx-step-number {
    background: var(--primary-color);
    color: #fff;
}

.wx-step.completed .wx-step-number {
    background: var(--success-color);
}

.wx-step-line {
    width: 40px;
    height: 2px;
    background: var(--border-color);
    transition: var(--transition);
}

.wx-step.completed + .wx-step-line {
    background: var(--success-color);
}

.wx-step-label {
    font-size: 12px;
    color: var(--text-tertiary);
    display: none;
}

@media (min-width: 400px) {
    .wx-step-label {
        display: block;
    }
}

/* ===== 二维码区域 ===== */
.wx-qrcode-section {
    text-align: center;
    padding: 24px;
}

.wx-qrcode-container {
    position: relative;
    display: inline-block;
    padding: 16px;
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.wx-qrcode {
    width: 200px;
    height: 200px;
    border-radius: var(--radius-sm);
}

.wx-qrcode-hint {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    white-space: nowrap;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-5px); }
}

.wx-qrcode-tip {
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== 角色选择卡片 ===== */
.wx-role-grid {
    display: grid;
    gap: 16px;
}

.wx-role-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #fff;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.wx-role-card:hover {
    border-color: var(--primary-color);
    transform: translateX(8px);
    box-shadow: var(--shadow-md);
}

.wx-role-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary-light) 0%, #fff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.wx-role-info h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.wx-role-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.wx-role-arrow {
    margin-left: auto;
    color: var(--text-tertiary);
    transition: var(--transition);
}

.wx-role-card:hover .wx-role-arrow {
    color: var(--primary-color);
    transform: translateX(4px);
}

/* ===== Toast 提示 ===== */
.wx-toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.wx-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    animation: toastSlideIn 0.3s ease-out;
    pointer-events: auto;
    min-width: 280px;
    max-width: 400px;
}

.wx-toast.hiding {
    animation: toastSlideOut 0.3s ease-out forwards;
}

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

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

.wx-toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wx-toast-success .wx-toast-icon {
    background: var(--success-color);
    color: #fff;
}

.wx-toast-error .wx-toast-icon {
    background: var(--error-color);
    color: #fff;
}

.wx-toast-warning .wx-toast-icon {
    background: var(--warning-color);
    color: #fff;
}

.wx-toast-info .wx-toast-icon {
    background: var(--secondary-color);
    color: #fff;
}

.wx-toast-content {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
}

.wx-toast-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
    line-height: 1;
    transition: var(--transition);
}

.wx-toast-close:hover {
    color: var(--text-primary);
}

/* ===== 加载动画 ===== */
.wx-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.wx-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.wx-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.wx-loading-text {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== 模态框 ===== */
.wx-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9997;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.wx-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.wx-modal {
    width: 90%;
    max-width: 360px;
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: var(--transition);
}

.wx-modal-overlay.active .wx-modal {
    transform: scale(1);
}

.wx-modal-header {
    padding: 24px 24px 0;
    text-align: center;
}

.wx-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.wx-modal-icon.success {
    background: var(--primary-light);
}

.wx-modal-icon.warning {
    background: #FFF7E6;
}

.wx-modal-icon.error {
    background: #FFF1F0;
}

.wx-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.wx-modal-body {
    padding: 16px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.wx-modal-footer {
    padding: 16px 24px 24px;
    display: flex;
    gap: 12px;
}

.wx-modal-footer .wx-btn {
    flex: 1;
}

/* ===== 页脚 ===== */
.wx-footer {
    position: relative;
    z-index: 10;
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

/* ===== 响应式设计 ===== */
@media (max-width: 480px) {
    /* 移动端隐藏头部大图标和标题，节省空间 */
    .wx-header {
        padding: 16px 20px 10px;
        min-height: auto;
    }
    
    .wx-header-icon {
        display: none;
    }
    
    .wx-header-title {
        font-size: 18px;
        margin-bottom: 4px;
    }
    
    .wx-header-subtitle {
        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .wx-header {
        padding: 12px 16px 8px;
    }
    
    .wx-header-title {
        font-size: 16px;
    }
    
    .wx-main {
        padding: 0 16px 32px;
    }
    
    .wx-card-body {
        padding: 20px;
    }
}

@media (min-width: 768px) {
    .wx-card {
        max-width: 480px;
    }
    
    .wx-role-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== 辅助类 ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.3s ease-out; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
