/* ================================
   云祭扫 H5 - 二级页面通用样式
   国风浅色主题
   ================================ */

.sub-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(90deg, #8B4513 0%, #A0522D 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.sub-header .back-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    color: #F5DEB3;
    font-size: 18px;
    text-decoration: none;
}

.sub-header .page-title {
    font-size: 17px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #F5DEB3;
}

.sub-header .header-action {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #F5DEB3;
    font-size: 16px;
}

.sub-content {
    padding: 10px;
    padding-bottom: 80px;
}

/* ============ 卡片容器 ============ */
.sub-card {
    background: rgba(255,255,255,0.85);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(139,69,19,0.08);
    box-shadow: 0 2px 10px rgba(139,69,19,0.05);
}

.sub-card-title {
    font-size: 16px;
    font-weight: bold;
    color: #5C4033;
    margin-bottom: 12px;
    padding-left: 10px;
    border-left: 3px solid #5B8C5A;
}

/* ============ 表单样式 ============ */
.sub-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 13px;
    color: #5C4033;
    font-weight: 500;
}

.form-label .required {
    color: #C0392B;
    margin-left: 2px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(139,69,19,0.15);
    border-radius: 8px;
    background: #FDF8F0;
    font-size: 14px;
    color: #3c2f2f;
    font-family: inherit;
    transition: border-color 0.2s;
    outline: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: #5B8C5A;
    background: #fff;
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #5B8C5A 0%, #6FA06E 100%);
    color: #fff;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(91,140,90,0.3);
    transition: transform 0.15s, box-shadow 0.15s;
}

.form-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 6px rgba(91,140,90,0.3);
}

.form-btn-gold {
    background: linear-gradient(135deg, #D4AF37 0%, #E5C254 100%);
    box-shadow: 0 4px 12px rgba(212,175,55,0.3);
}

.form-btn-outline {
    background: transparent;
    border: 1px solid #5B8C5A;
    color: #5B8C5A;
    box-shadow: none;
}

/* ============ 列表样式 ============ */
.sub-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: rgba(255,255,255,0.85);
    border-radius: 10px;
    border: 1px solid rgba(139,69,19,0.06);
    transition: transform 0.15s;
}

.list-item:active {
    transform: scale(0.99);
}

.list-item-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #5B8C5A, #6FA06E);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-size: 14px;
    font-weight: bold;
    color: #5C4033;
    margin-bottom: 4px;
}

.list-item-desc {
    font-size: 12px;
    color: #8B6F47;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.list-item-meta {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    font-size: 11px;
    color: #A0826D;
}

.list-item-action {
    flex-shrink: 0;
    align-self: center;
    color: #5B8C5A;
    font-size: 13px;
    padding: 4px 10px;
    border: 1px solid #5B8C5A;
    border-radius: 14px;
    background: transparent;
}

/* ============ 标签/徽章 ============ */
.sub-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    background: rgba(91,140,90,0.12);
    color: #5B8C5A;
}

.sub-tag-gold {
    background: rgba(212,175,55,0.15);
    color: #B8860B;
}

.sub-tag-brown {
    background: rgba(139,69,19,0.1);
    color: #8B4513;
}

/* ============ 空状态 ============ */
.sub-empty {
    text-align: center;
    padding: 60px 20px;
    color: #A0826D;
}

.sub-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.sub-empty-text {
    font-size: 14px;
    margin-bottom: 16px;
}

/* ============ 宫格/网格 ============ */
.sub-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.sub-grid-item {
    text-align: center;
    padding: 14px 8px;
    background: rgba(255,255,255,0.7);
    border-radius: 10px;
    border: 1px solid rgba(139,69,19,0.06);
}

.sub-grid-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 6px;
    border-radius: 12px;
    background: linear-gradient(135deg, #5B8C5A, #6FA06E);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

.sub-grid-label {
    font-size: 12px;
    color: #5C4033;
}

/* ============ 价格 ============ */
.sub-price {
    color: #C0392B;
    font-weight: bold;
}

.sub-price-symbol {
    font-size: 13px;
}

.sub-price-value {
    font-size: 18px;
}

/* ============ 按钮 ============ */
.sub-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
}

.sub-btn-primary {
    background: linear-gradient(135deg, #5B8C5A, #6FA06E);
    color: #fff;
    box-shadow: 0 3px 10px rgba(91,140,90,0.3);
}

.sub-btn-gold {
    background: linear-gradient(135deg, #D4AF37, #E5C254);
    color: #fff;
    box-shadow: 0 3px 10px rgba(212,175,55,0.3);
}

.sub-btn-outline {
    background: transparent;
    border: 1px solid #5B8C5A;
    color: #5B8C5A;
}

.sub-btn-block {
    display: flex;
    width: 100%;
}

/* ============ 顶部 Banner ============ */
.sub-banner {
    position: relative;
    margin: 12px;
    border-radius: 12px;
    overflow: hidden;
    height: 140px;
    background: linear-gradient(135deg, #5B8C5A 0%, #3D6B3D 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-align: center;
}

.sub-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(212,175,55,0.3), transparent 60%);
}

.sub-banner-content {
    position: relative;
    z-index: 2;
    padding: 0 20px;
}

.sub-banner h2 {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 6px;
    letter-spacing: 3px;
}

.sub-banner p {
    font-size: 13px;
    opacity: 0.9;
}

/* ============ 选项卡 ============ */
.sub-tabs {
    display: flex;
    gap: 0;
    background: rgba(255,255,255,0.7);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 12px;
    border: 1px solid rgba(139,69,19,0.06);
}

.sub-tab {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: #8B6F47;
    cursor: pointer;
    transition: all 0.2s;
}

.sub-tab.active {
    background: linear-gradient(135deg, #5B8C5A, #6FA06E);
    color: #fff;
    font-weight: bold;
}

/* ============ 付费套餐 ============ */
.package-card {
    position: relative;
    padding: 16px;
    background: rgba(255,255,255,0.9);
    border-radius: 12px;
    border: 2px solid rgba(91,140,90,0.2);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.package-card.selected {
    border-color: #5B8C5A;
    background: rgba(91,140,90,0.06);
}

.package-card.recommend {
    border-color: #D4AF37;
    background: rgba(212,175,55,0.06);
}

.package-badge {
    position: absolute;
    top: 0;
    right: 12px;
    padding: 2px 10px;
    background: linear-gradient(135deg, #D4AF37, #E5C254);
    color: #fff;
    font-size: 11px;
    border-radius: 0 0 8px 8px;
}

.package-name {
    font-size: 15px;
    font-weight: bold;
    color: #5C4033;
    margin-bottom: 4px;
}

.package-desc {
    font-size: 12px;
    color: #8B6F47;
    margin-bottom: 8px;
}

.package-price {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.package-price .currency {
    font-size: 14px;
    color: #C0392B;
    font-weight: bold;
}

.package-price .amount {
    font-size: 22px;
    color: #C0392B;
    font-weight: bold;
}

.package-price .original {
    font-size: 12px;
    color: #A0826D;
    text-decoration: line-through;
    margin-left: 6px;
}

/* ============ 商品/供品 ============ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.product-card {
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(139,69,19,0.08);
    transition: transform 0.15s;
}

.product-card:active {
    transform: scale(0.98);
}

.product-img {
    width: 100%;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #F5EDDE, #E8D5B7);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
}

.product-info {
    padding: 10px;
}

.product-name {
    font-size: 13px;
    font-weight: bold;
    color: #5C4033;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-desc {
    font-size: 11px;
    color: #8B6F47;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price {
    color: #C0392B;
    font-weight: bold;
    font-size: 14px;
}

.product-cart-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5B8C5A, #6FA06E);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
}

/* ============ 头像上传 ============ */
.avatar-uploader {
    display: flex;
    justify-content: center;
    padding: 16px 0 12px;
    border-bottom: 1px solid rgba(139,69,19,0.08);
    margin-bottom: 6px;
}

.avatar-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(139,69,19,0.06);
    border: 2px dashed rgba(139,69,19,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s;
    position: relative;
}

.avatar-circle:active {
    border-color: #5B8C5A;
    background: rgba(91,140,90,0.06);
}

.avatar-circle.image-loaded {
    border-style: solid;
    border-color: #5B8C5A;
}

.avatar-placeholder {
    font-size: 13px;
    color: #A0826D;
    text-align: center;
    line-height: 1.3;
}

.avatar-placeholder small {
    font-size: 11px;
    color: #BFA58E;
}

/* ============ 头像 ============ */
.sub-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5B8C5A, #6FA06E);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(91,140,90,0.25);
}

/* ============ 分割线 ============ */
.sub-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139,69,19,0.15), transparent);
    margin: 12px 0;
}

/* ============ 通知条 ============ */
.sub-notice {
    padding: 10px 14px;
    background: rgba(212,175,55,0.1);
    border: 1px solid rgba(212,175,55,0.25);
    border-radius: 8px;
    font-size: 12px;
    color: #8B6914;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

/* ============ 步骤 ============ */
.sub-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.sub-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.sub-step-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto 6px;
    border-radius: 50%;
    background: rgba(139,69,19,0.1);
    color: #8B4513;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.sub-step.active .sub-step-icon {
    background: linear-gradient(135deg, #5B8C5A, #6FA06E);
    color: #fff;
}

.sub-step-label {
    font-size: 12px;
    color: #8B6F47;
}

.sub-step.active .sub-step-label {
    color: #5B8C5A;
    font-weight: bold;
}

.sub-step-line {
    position: absolute;
    top: 16px;
    left: calc(50% + 18px);
    right: calc(-50% + 18px);
    height: 1px;
    background: rgba(139,69,19,0.15);
}

/* ============ 二维码/扫码区 ============ */
.sub-qr {
    width: 160px;
    height: 160px;
    margin: 0 auto 12px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(139,69,19,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

/* ============ 树洞/留言 ============ */
.hole-item {
    padding: 14px;
    background: rgba(255,255,255,0.85);
    border-radius: 10px;
    border-left: 3px solid #5B8C5A;
    margin-bottom: 10px;
}

.hole-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.hole-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hole-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #D4AF37, #E5C254);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
}

.hole-nickname {
    font-size: 13px;
    font-weight: bold;
    color: #5C4033;
}

.hole-time {
    font-size: 11px;
    color: #A0826D;
}

.hole-content {
    font-size: 14px;
    color: #3c2f2f;
    line-height: 1.7;
    margin-bottom: 8px;
}

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

.hole-action-btn {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: #8B6F47;
}

.hole-action-btn.liked {
    color: #C0392B;
}

/* ============ 家谱 ============ */
.genealogy-tree {
    padding: 20px 10px;
    overflow-x: auto;
}

.genealogy-node {
    text-align: center;
    margin-bottom: 12px;
}

.genealogy-person {
    display: inline-block;
    padding: 8px 14px;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    color: #F5DEB3;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    box-shadow: 0 3px 10px rgba(139,69,19,0.25);
}

.genealogy-children {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* ============ VR/360 ============ */
.vr-scene {
    position: relative;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #2C3E2C, #1A2E1A);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-bottom: 12px;
}

.vr-scene::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 50%, rgba(212,175,55,0.2), transparent 70%);
}

.vr-indicator {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 14px;
    background: rgba(0,0,0,0.5);
    border-radius: 12px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============ 支付 ============ */
.pay-method {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    border: 2px solid rgba(139,69,19,0.08);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.pay-method.selected {
    border-color: #5B8C5A;
    background: rgba(91,140,90,0.06);
}

.pay-method-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.pay-method-icon.wechat { background: #09BB07; color: #fff; }
.pay-method-icon.alipay { background: #1677FF; color: #fff; }
.pay-method-icon.union { background: linear-gradient(135deg, #D4AF37, #E5C254); color: #fff; }
.pay-method-icon.epay { background: linear-gradient(135deg, #9B59B6, #8E44AD); color: #fff; }

.pay-method-info {
    flex: 1;
}

.pay-method-name {
    font-size: 14px;
    font-weight: bold;
    color: #5C4033;
    margin-bottom: 2px;
}

.pay-method-desc {
    font-size: 12px;
    color: #8B6F47;
}

.pay-method-radio {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(139,69,19,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pay-method.selected .pay-method-radio {
    border-color: #5B8C5A;
}

.pay-method.selected .pay-method-radio::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #5B8C5A;
}

/* ============ 订单/工单 ============ */
.order-card {
    padding: 14px;
    background: rgba(255,255,255,0.85);
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid rgba(139,69,19,0.06);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(139,69,19,0.06);
    margin-bottom: 10px;
}

.order-no {
    font-size: 12px;
    color: #8B6F47;
}

.order-status {
    font-size: 12px;
    font-weight: bold;
}

.order-status.pending { color: #E67E22; }
.order-status.completed { color: #5B8C5A; }
.order-status.cancelled { color: #A0826D; }

.order-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-info h4 {
    font-size: 14px;
    color: #5C4033;
    margin-bottom: 4px;
}

.order-info p {
    font-size: 12px;
    color: #8B6F47;
}

.order-amount {
    font-size: 16px;
    font-weight: bold;
    color: #C0392B;
}

/* ============ 会员中心 ============ */
.member-card {
    position: relative;
    padding: 20px;
    background: linear-gradient(135deg, #8B4513 0%, #D4AF37 100%);
    border-radius: 14px;
    color: #fff;
    overflow: hidden;
    margin-bottom: 12px;
}

.member-card::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(255,255,255,0.2), transparent);
    border-radius: 50%;
}

.member-level {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 4px;
}

.member-name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 12px;
}

.member-stats {
    display: flex;
    gap: 20px;
}

.member-stat {
    text-align: center;
}

.member-stat-value {
    font-size: 18px;
    font-weight: bold;
}

.member-stat-label {
    font-size: 11px;
    opacity: 0.85;
}

/* ============ 搜索 ============ */
.sub-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.85);
    border-radius: 20px;
    border: 1px solid rgba(139,69,19,0.1);
    margin-bottom: 12px;
}

.sub-search-icon {
    color: #A0826D;
    font-size: 14px;
}

.sub-search input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    color: #3c2f2f;
    font-family: inherit;
}

.sub-search input::placeholder {
    color: #A0826D;
}

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

.sub-card, .list-item, .package-card, .product-card, .hole-item, .order-card {
    animation: fadeIn 0.4s ease-out backwards;
}

.sub-card:nth-child(1) { animation-delay: 0.05s; }
.sub-card:nth-child(2) { animation-delay: 0.1s; }
.sub-card:nth-child(3) { animation-delay: 0.15s; }

/* ============ 响应式 ============ */
@media (min-width: 420px) {
    .sub-grid { grid-template-columns: repeat(4, 1fr); }
    .product-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============ 安全区域 ============ */
@supports (padding: env(safe-area-inset-bottom)) {
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(60px + env(safe-area-inset-bottom));
    }
}