/**
 * 主样式文件 - H5移动端适配
 */

/* CSS Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.5;
    min-height: 100vh;
}

/* 主色调 - 绿白风格 */
:root {
    --primary-color: #10b981;
    --primary-hover: #34d399;
    --primary-light: #d1fae5;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --text-color: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --bg-color: #f0fdf4;
    --white: #fff;
    --shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}

/* 容器 */
.container {
    max-width: 750px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 页面包装 */
.page-wrapper {
    min-height: 100vh;
    padding-bottom: 70px;
}

/* 顶部导航 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    box-shadow: var(--shadow);
    z-index: 100;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
}

.header-back {
    display: flex;
    align-items: center;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
}

.header-action {
    color: var(--primary-color);
    font-size: 14px;
    cursor: pointer;
}

/* 内容区 */
.content {
    padding-top: 60px;
    padding-bottom: 20px;
}

/* 底部导航 */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--white);
    display: flex;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.3s;
}

.tab-item.active {
    color: var(--primary-color);
}

.tab-icon {
    font-size: 22px;
    margin-bottom: 3px;
}

/* 卡片 */
.card {
    background: var(--white);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}

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

/* 表单 */
.form-group {
    margin-bottom: 15px;
}

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

.form-label.required::after {
    content: ' *';
    color: var(--error-color);
}

.form-input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

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

.form-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    resize: vertical;
    transition: border-color 0.3s;
}

.form-textarea:focus {
    border-color: var(--primary-color);
}

.form-select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    background: var(--white);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-block {
    width: 100%;
}

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

.btn-primary:hover, .btn-primary:active {
    background: var(--primary-hover);
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-warning {
    background: var(--warning-color);
    color: var(--white);
}

.btn-danger {
    background: var(--error-color);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 14px;
}

.btn-xs {
    height: 26px;
    padding: 0 8px;
    font-size: 12px;
    border-radius: 4px;
}

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

/* 列表 */
.list {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
}

.list-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    color: var(--text-color);
    transition: background 0.3s;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:active {
    background: #f9f9f9;
}

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

.list-item-title {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-item-desc {
    font-size: 13px;
    color: var(--text-muted);
}

.list-item-extra {
    margin-left: 10px;
    color: var(--text-muted);
    font-size: 13px;
}

.list-item-arrow {
    margin-left: 8px;
    color: var(--text-muted);
}

/* 标签 */
.tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 4px;
    margin-right: 5px;
}

.tag-primary {
    background: rgba(22, 119, 255, 0.1);
    color: var(--primary-color);
}

.tag-success {
    background: rgba(82, 196, 26, 0.1);
    color: var(--success-color);
}

.tag-warning {
    background: rgba(250, 173, 20, 0.1);
    color: var(--warning-color);
}

.tag-danger {
    background: rgba(255, 77, 79, 0.1);
    color: var(--error-color);
}

/* 统计卡片 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 15px;
}

.stat-card {
    background: var(--white);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* 空状态 */
.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

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

.empty-text {
    font-size: 14px;
}

/* 加载中 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

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

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

/* 弹窗 */
.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;
    visibility: hidden;
    transition: all 0.3s;
}

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

.modal {
    background: var(--white);
    border-radius: 12px;
    width: calc(100% - 40px);
    max-width: 400px;
    max-height: 80vh;
    overflow: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
}

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

.modal-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 15px;
}

.modal-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

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

/* 图片上传 */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s;
}

.upload-area:hover {
    border-color: var(--primary-color);
}

.upload-area.dragging {
    border-color: var(--primary-color);
    background: rgba(22, 119, 255, 0.05);
}

.upload-icon {
    font-size: 36px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.upload-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* 图片预览 */
.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.image-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
}

/* 字段编辑器 */
.field-list {
    margin-top: 15px;
}

.field-item {
    background: #f9f9f9;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    position: relative;
}

.field-item-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.field-drag {
    cursor: move;
    padding: 5px;
    color: var(--text-muted);
    margin-right: 8px;
}

.field-type {
    font-size: 12px;
    padding: 2px 6px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 4px;
    margin-right: 8px;
}

.field-name {
    flex: 1;
    font-weight: 500;
}

.field-required {
    color: var(--error-color);
    font-size: 12px;
    margin-right: 10px;
}

.field-actions {
    display: flex;
    gap: 8px;
}

.field-action-btn {
    padding: 4px 8px;
    font-size: 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.field-action-btn.edit {
    background: rgba(22, 119, 255, 0.1);
    color: var(--primary-color);
}

.field-action-btn.delete {
    background: rgba(255, 77, 79, 0.1);
    color: var(--error-color);
}

/* 复选框和单选框 */
.checkbox-group, .radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checkbox-item, .radio-item {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-item input, .radio-item input {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    accent-color: var(--primary-color);
}

/* 日期时间选择器 */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    background: var(--white);
}

/* 二维码显示 */
.qrcode-container {
    text-align: center;
    padding: 20px;
}

.qrcode-image {
    max-width: 200px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    background: var(--white);
}

.qrcode-url {
    margin-top: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    font-size: 12px;
    word-break: break-all;
    color: var(--text-secondary);
}

/* 开关 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 28px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.switch input:checked + .switch-slider {
    background-color: var(--primary-color);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(22px);
}

/* 消息提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.75);
    color: var(--white);
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.toast.show {
    opacity: 1;
    visibility: visible;
}

/* 筛选栏 */
.filter-bar {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    overflow-x: auto;
}

.filter-item {
    flex-shrink: 0;
}

.filter-item select {
    height: 32px;
    padding: 0 25px 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
    background: var(--white);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23999' d='M5 7L0 2h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

/* 搜索框 */
.search-box {
    display: flex;
    align-items: center;
    background: var(--white);
    border-radius: 8px;
    padding: 0 12px;
    margin-bottom: 15px;
}

.search-box input {
    flex: 1;
    height: 40px;
    border: none;
    outline: none;
    font-size: 14px;
}

.search-icon {
    color: var(--text-muted);
    margin-right: 8px;
}

/* 登录页面 - 生物科技医疗风格 */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%);
}

.login-box {
    width: 100%;
    max-width: 350px;
    background: var(--white);
    border-radius: 12px;
    padding: 30px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-title {
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 30px;
}

.login-logo {
    text-align: center;
    font-size: 48px;
    margin-bottom: 20px;
}

/* 工具类 */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-primary {
    color: var(--primary-color);
}

.text-success {
    color: var(--success-color);
}

.text-warning {
    color: var(--warning-color);
}

.text-danger {
    color: var(--error-color);
}

.text-muted {
    color: var(--text-muted);
}

.mt-10 {
    margin-top: 10px;
}

.mt-15 {
    margin-top: 15px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-15 {
    margin-bottom: 15px;
}

.mb-20 {
    margin-bottom: 20px;
}

.flex {
    display: flex;
}

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

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-10 {
    gap: 10px;
}

/* 响应式 */
@media (min-width: 600px) {
    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
