/* 全局样式 - 移动端优先 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    min-height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
                 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #f8f8f8;
    font-size: 14px;
    color: #333;
    -webkit-font-smoothing: antialiased;
}

/* 防止点击输入框时页面缩放 */
input[type="tel"],
input[type="text"],
input[type="number"] {
    font-size: 16px;
}

#app {
    min-height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    background-color: #f8f8f8;
}

.page {
    display: none;
    min-height: 100vh;
    width: 100%;
    background-color: #f8f8f8;
}

.page.active {
    display: flex;
    flex-direction: column;
}

/* 通用按钮样式 */
button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
    -webkit-appearance: none;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 输入框样式 */
input {
    font-family: inherit;
    outline: none;
    -webkit-appearance: none;
}

/* 加载动画 */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.loading.active {
    display: flex;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #1890ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    margin-top: 12px;
    color: #999;
    font-size: 13px;
}

/* 加载更多 */
.load-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.load-more .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #f0f0f0;
    border-top: 2px solid #1890ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.load-more p {
    margin-top: 8px;
    color: #999;
    font-size: 12px;
}

/* 空数据提示 */
.empty-data {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 14px;
}

/* 弹窗样式 - 移动端底部弹出 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #fff;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 70vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.modal-header::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background-color: #ddd;
    border-radius: 2px;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 600;
    color: #333;
}

.close-modal {
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
}

.close-modal:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
    max-height: calc(70vh - 60px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
    max-width: 80%;
    text-align: center;
    word-break: break-all;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* 安全区域适配 - iPhone X以上 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .modal-content {
        padding-bottom: env(safe-area-inset-bottom);
    }
}
