/**
 * 乐龄旅居 - 公共样式文件
 * 适老化设计规范：正文字号≥14px，按钮高度≥44px，颜色对比度≥4.5:1
 */

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

html {
    font-size: 14px;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #f8f9fb;
    color: #4b5563;
    line-height: 1.6;
}

/* 大字体模式 */
.large-font-mode {
    font-size: 18px;
}

.large-font-mode h1 {
    font-size: 26px;
}

.large-font-mode h2 {
    font-size: 24px;
}

.large-font-mode h3 {
    font-size: 22px;
}

.large-font-mode .btn-primary,
.large-font-mode .btn-secondary {
    font-size: 20px;
    height: 56px;
}

.large-font-mode .tab-item {
    font-size: 18px;
}

.large-font-mode .tab-icon {
    font-size: 28px;
}

.large-font-mode .form-input {
    font-size: 18px;
    height: 52px;
}

.large-font-mode .form-label {
    font-size: 18px;
}

.large-font-mode .card {
    font-size: 18px;
}

/* 颜色变量 */
:root {
    --primary: #c9a063;
    --primary-light: #d4af7a;
    --primary-dark: #b8860b;
    --primary-bg: rgba(201, 160, 99, 0.08);
    --primary-border: rgba(201, 160, 99, 0.3);
    --success: #059669;
    --success-bg: rgba(5, 150, 105, 0.08);
    --warning: #ea580c;
    --warning-bg: rgba(234, 88, 12, 0.08);
    --danger: #dc2626;
    --danger-bg: rgba(220, 38, 38, 0.08);
    --info: #2563eb;
    --info-bg: rgba(37, 99, 235, 0.08);
    --text-primary: #1a1a2e;
    --text-secondary: #4b5563;
    --text-tertiary: #6b7280;
    --bg-page: #f8f9fb;
    --bg-card: #ffffff;
    --bg-gray: #f3f4f6;
    --border: #e5e7eb;
    --border-light: #f0f2f5;
}

/* 通用组件 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.card {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 16px;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

/* 按钮样式 */
.btn-primary {
    height: 48px;
    padding: 0 28px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #d4af7a 0%, #b8860b 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(201, 160, 99, 0.25);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-width: 120px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(201, 160, 99, 0.35);
}

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

.btn-secondary {
    height: 48px;
    padding: 0 28px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-dark);
    background: var(--primary-bg);
    border: 1px solid var(--primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-width: 120px;
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    height: 44px;
    padding: 0 20px;
    border-radius: 10px;
    font-size: 15px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-danger {
    height: 48px;
    padding: 0 28px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: var(--danger);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* 标签样式 */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
}

.tag-primary {
    background: var(--primary-bg);
    color: var(--primary-dark);
}

.tag-success {
    background: var(--success-bg);
    color: var(--success);
}

.tag-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.tag-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.tag-info {
    background: var(--info-bg);
    color: var(--info);
}

.tag-gray {
    background: var(--bg-gray);
    color: var(--text-secondary);
}

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

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

.form-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
    background: var(--bg-card);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-textarea {
    width: 100%;
    height: 120px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    background: var(--bg-card);
}

.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-select {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
    background: var(--bg-card);
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

/* 搜索框通用样式 - 适老化高度≥44px */
input[type="search"],
.search-input,
.search-box input {
    min-height: 44px;
    font-size: 16px;
}

/* 步骤条 */
.step-indicator {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0 8px;
    margin-bottom: 24px;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    z-index: 1;
    transition: all 0.3s;
}

.step-label {
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.step-item.completed .step-circle {
    background: var(--success);
    color: white;
}

.step-item.completed .step-label {
    color: var(--success);
}

.step-item.active .step-circle {
    background: linear-gradient(135deg, #d4af7a 0%, #b8860b 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(201, 160, 99, 0.3);
}

.step-item.active .step-label {
    color: var(--primary-dark);
    font-weight: 600;
}

.step-item.pending .step-circle {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--primary-border);
}

.step-item.pending .step-label {
    color: var(--text-secondary);
}

.step-line {
    position: absolute;
    top: 18px;
    left: calc(50% + 18px);
    right: calc(-50% + 18px);
    height: 2px;
}

.step-item.completed .step-line {
    background: var(--success);
}

.step-item.pending .step-line {
    background: var(--border-light);
}

.step-item:last-child .step-line {
    display: none;
}

/* 星级评分 */
.star-rating {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.star-item {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    color: #d1d5db;
}

.star-item.filled {
    color: #f59e0b;
}

.star-item:hover {
    background: var(--primary-bg);
    transform: scale(1.1);
}

/* Toast提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
}

.toast-success {
    background: rgba(5, 150, 105, 0.9);
}

.toast-error {
    background: rgba(220, 38, 38, 0.9);
}

.toast-warning {
    background: rgba(234, 88, 12, 0.9);
}

.toast-info {
    background: rgba(37, 99, 235, 0.9);
}

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

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

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

.loading-content span {
    font-size: 16px;
    color: var(--text-secondary);
}

/* 大字体模式开关 */
.font-size-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: white;
    border-radius: 12px;
    margin-bottom: 12px;
}

.toggle-switch {
    width: 50px;
    height: 28px;
    background: var(--bg-gray);
    border-radius: 14px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: var(--primary);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-switch.active::after {
    transform: translateX(22px);
}

/* 状态标签 */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
}

/* 空状态 */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state i {
    font-size: 48px;
    color: #d1d5db;
    margin-bottom: 16px;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state-desc {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* 查看更多按钮 */
.view-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: var(--primary-bg);
    color: var(--primary-dark);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.view-more-btn:hover {
    background: var(--primary);
    color: white;
}

/* 列表项整行点击 */
.list-row-clickable {
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.list-row-clickable:active {
    background: var(--bg-gray);
}

.list-row-clickable::after {
    content: '查看详情';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 600;
}

/* 价格样式 */
.price {
    color: var(--danger);
    font-weight: 700;
}

.price-symbol {
    font-size: 0.75em;
}

.price-value {
    font-size: 1.25em;
}

/* 图片占位 */
.img-placeholder {
    background: var(--bg-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 12px;
}

/* 表格 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.data-table th {
    background: #f9fafb;
    padding: 14px 16px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* 表格操作 */
.table-actions {
    display: flex;
    gap: 16px;
}

.table-action-btn {
    color: var(--primary-dark);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.table-action-btn:hover {
    background: var(--primary-bg);
}

.table-action-btn.danger {
    color: var(--danger);
}

.table-action-btn.danger:hover {
    background: var(--danger-bg);
}

/* 筛选栏 */
.filter-bar {
    background: white;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-input {
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    outline: none;
}

.filter-input:focus {
    border-color: var(--primary);
}

/* Tab切换 */
.tab-switch {
    display: flex;
    background: var(--bg-gray);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
}

.tab-switch-item {
    flex: 1;
    padding: 10px 12px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.tab-switch-item.active {
    background: white;
    color: var(--primary-dark);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 弹窗 */
.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;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

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

.modal-body {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* 底部Tab导航 - 统一适老化设计 */
/* 所有H5页面使用统一的 .tab-bar 结构 */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 68px;
    background: #FFFFFF;
    border-top: 1px solid #F0F2F5;
    display: flex;
    padding-top: 6px;
    padding-bottom: 6px;
    z-index: 100;
    /* 安全区域适配 */
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    height: calc(68px + env(safe-area-inset-bottom, 0px));
}

.tab-bar .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    transition: color 0.2s;
    min-height: 48px;
    min-width: 48px;
}

.tab-bar .tab-item.active {
    color: #B8860B;
    font-weight: 600;
}

.tab-bar .tab-icon {
    font-size: 24px;
    line-height: 1;
}

/* ===== 以下为旧版底部Tab样式（保留用于兼容） ===== */
/* 底部Tab导航 - 适老化设计 */
.bottom-tab {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 100;
}

.bottom-tab .tab-item,
.tab-item-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 16px;
    font-weight: 500;
}

.bottom-tab .tab-item.active,
.tab-item-footer.active {
    color: #b8860b;
    font-weight: 600;
}

.bottom-tab .tab-icon,
.tab-item-footer .tab-icon {
    font-size: 24px;
}

/* 响应式 */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }

    .card {
        padding: 12px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger {
        width: 100%;
        justify-content: center;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 15px;
    }

    .large-font-mode {
        font-size: 18px;
    }

    .btn-primary,
    .btn-secondary,
    .btn-danger {
        height: 44px;
        font-size: 15px;
    }
}