/* YS权益小程序 - 公共样式 */

/* 基础重置和字体 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* iPhone 15 Pro 适配 */
.container {
    max-width: 375px;
    min-height: 812px;
    margin: 0 auto;
    background: #fff;
    position: relative;
    overflow-x: hidden;
}

/* iOS 状态栏 */
.status-bar {
    height: 44px;
    background: #000;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 600;
}

.status-left {
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 导航栏 */
.nav-bar {
    height: 44px;
    background: #fff;
    border-bottom: 1px solid #e5e5e7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-title {
    font-size: 17px;
    font-weight: 600;
    color: #1d1d1f;
}

.nav-btn {
    background: none;
    border: none;
    color: #007aff;
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.nav-btn:hover {
    background-color: #f0f0f0;
}

.nav-btn:active {
    background-color: #e0e0e0;
}

/* YS品牌色彩 */
.brand-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.brand-secondary {
    background: linear-gradient(135deg, #1e40af 0%, #60a5fa 100%);
}

.text-brand {
    color: #1e3a8a;
}

.bg-brand {
    background-color: #1e3a8a;
}

.bg-brand-light {
    background-color: #dbeafe;
}

/* 卡片样式 */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 16px;
}

.card-header {
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.card-body {
    padding: 16px;
}

.card-footer {
    padding: 16px;
    border-top: 1px solid #f0f0f0;
    background-color: #fafafa;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
}

.btn-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.btn-secondary {
    background: #f0f0f0;
    color: #1d1d1f;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-disabled {
    background: #e5e5e7;
    color: #8e8e93;
    cursor: not-allowed;
}

.btn-success {
    background: #34d399;
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 2px solid #1e3a8a;
    color: #1e3a8a;
}

/* Tab导航 */
.tab-nav {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #e5e5e7;
    position: sticky;
    top: 44px;
    z-index: 99;
}

.tab-item {
    flex: 1;
    padding: 16px;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: #8e8e93;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.tab-item.active {
    color: #1e3a8a;
}

.tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: #1e3a8a;
    border-radius: 2px;
}

/* 权益卡片 */
.benefit-card {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #fff;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.benefit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.benefit-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    font-size: 24px;
}

.benefit-content {
    flex: 1;
}

.benefit-title {
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 4px;
}

.benefit-desc {
    font-size: 14px;
    color: #8e8e93;
}

.benefit-action {
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e5e5e7;
    color: #8e8e93;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

/* 用户信息卡片 */
.user-card {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: #fff;
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.user-info {
    flex: 1;
}

.user-phone {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.user-status {
    font-size: 14px;
    opacity: 0.8;
}

.switch-account {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    margin: 20px;
    max-width: 320px;
    width: 100%;
    text-align: center;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1d1d1f;
}

.modal-content {
    margin-bottom: 24px;
    color: #8e8e93;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-actions .btn {
    flex: 1;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1e3a8a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Toast提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 16px;
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 分组标题 */
.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1f;
    margin: 24px 16px 16px;
}

/* 内容区域 */
.content {
    padding: 0 16px 100px;
    min-height: calc(100vh - 88px);
}

/* 底部安全区域 */
.safe-area-bottom {
    height: 34px;
    background: #fff;
}

/* 响应式适配 */
@media (max-width: 480px) {
    .container {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
    
    .status-bar {
        padding: 8px 20px;
    }
    
    .nav-bar {
        padding: 12px 20px;
    }
    
    .content {
        padding: 16px;
    }
    
    .user-card {
        padding: 16px;
    }
    
    .benefit-card {
        padding: 16px;
    }
    
    .highlights-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .highlight-item {
        padding: 12px;
    }
    
    .features-list .feature-item {
        padding: 12px;
    }
    
    .bottom-actions {
        padding: 12px 16px;
    }
    
    .action-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .container {
        width: 90%;
        max-width: 420px;
    }
    
    .highlights-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* 高分辨率屏幕适配 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .status-bar {
        font-weight: 500;
    }
    
    .nav-title {
        font-weight: 600;
    }
    
    .benefit-card {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    }
}

/* 深色模式适配 - 禁用自动深色模式，保持浅色主题 */
@media (prefers-color-scheme: dark) {
    /* 强制保持浅色主题，避免颜色对比度问题 */
    :root {
        --bg-primary: #ffffff;
        --bg-secondary: #f5f5f7;
        --text-primary: #1d1d1f;
        --text-secondary: #666666;
        --border-color: #e5e5e7;
    }
    
    body {
        background-color: #f5f5f7 !important;
        color: #1d1d1f !important;
    }
    
    .container {
        background: #ffffff !important;
        border: none;
    }
    
    .status-bar {
        background: #000000 !important;
        color: #ffffff !important;
    }
    
    .nav-bar {
        background: #ffffff !important;
        border-bottom: 1px solid #e5e5e7 !important;
    }
    
    .nav-title {
        color: #1d1d1f !important;
    }
    
    .nav-btn {
        color: #007aff !important;
    }
    
    .benefit-card, .user-card {
        background: #ffffff !important;
        border: 1px solid #e5e5e7 !important;
        color: #1d1d1f !important;
    }
    
    .card-title {
        color: #1d1d1f !important;
    }
    
    .card-subtitle {
        color: #666666 !important;
    }
    
    .card-description {
        color: #666666 !important;
    }
    
    .btn-primary {
        background: linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%) !important;
        color: #ffffff !important;
    }
    
    .btn-secondary {
        background: #f5f5f7 !important;
        color: #1d1d1f !important;
        border: 1px solid #e5e5e7 !important;
    }
    
    /* 确保所有文本元素都有正确的颜色 */
    p, span, div, h1, h2, h3, h4, h5, h6 {
        color: inherit !important;
    }
    
    /* 特殊元素颜色修正 */
    .text-gray-600 {
        color: #666666 !important;
    }
    
    .text-gray-500 {
        color: #888888 !important;
    }
    
    .text-white {
        color: #ffffff !important;
    }
}

/* 无障碍设计 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .benefit-card {
        border: 2px solid #000;
    }
    
    .btn-primary {
        border: 2px solid #000;
    }
    
    .btn-secondary {
        border: 2px solid #666;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .btn-primary, .btn-secondary, .nav-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .tab-item {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    .benefit-card {
        padding: 20px;
    }
}

/* 打印样式 */
@media print {
    .status-bar, .nav-bar, .bottom-actions {
        display: none;
    }
    
    .container {
        width: 100%;
        max-width: none;
        box-shadow: none;
        border: none;
    }
    
    .content {
        padding: 0;
    }
    
    .benefit-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

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