/* 综合虫害防制服务报告系统 - 移动端样式 */

:root {
    --primary-color: #007aff;
    --primary-dark: #0055cc;
    --secondary-color: #5ac8fa;
    --success-color: #34c759;
    --danger-color: #ff3b30;
    --warning-color: #ff9500;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #e5e5e5;
    --bg-color: #f5f5f7;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    font-size: 16px;
}

.container {
    max-width: 768px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: 70px;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #003d7a, var(--primary-color), var(--secondary-color));
    color: var(--white);
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0, 61, 122, 0.25);
}

.header h1 {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
}

/* 首页专属header */
.header-home {
    padding: 16px 20px;
    background: linear-gradient(160deg, #002d5a 0%, #0055cc 40%, #007aff 70%, #5ac8fa 100%);
    position: relative;
    overflow: hidden;
}

.header-home::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    border-radius: 50%;
}

.header-home-inner {
    position: relative;
    z-index: 1;
    text-align: center;
}

.header-home-text h1 {
    font-size: 19px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
    margin-bottom: 3px;
}

.header-home-text p {
    font-size: 11px;
    opacity: 0.7;
    letter-spacing: 0.5px;
    text-align: center;
}

/* 卡片样式 */
.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px 16px;
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--white);
    transition: border-color 0.3s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

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

/* 客户搜索下拉 */
.customer-search-wrapper {
    position: relative;
}
.customer-search-wrapper .form-input {
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}
.customer-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100;
}
.customer-search-dropdown.show {
    display: block;
}
.customer-search-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}
.customer-search-item:last-child {
    border-bottom: none;
}
.customer-search-item:active,
.customer-search-item.selected {
    background: #e8f0fe;
}
.customer-search-item .cs-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-color);
}
.customer-search-item .cs-detail {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.customer-search-item .cs-highlight {
    color: var(--primary-color);
    font-weight: 600;
}
.customer-search-empty {
    padding: 16px 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

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

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

.btn-primary:active {
    opacity: 0.8;
}

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

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

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

.btn-block {
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 12px;
    margin: 16px 0;
}

.btn-group .btn {
    flex: 1;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 768px;
    margin: 0 auto;
    background: var(--white);
    display: flex;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    z-index: 100;
    border-top: 1px solid rgba(0,0,0,0.04);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

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

.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 0 0 3px 3px;
}

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

.nav-icon {
    font-size: 22px;
    margin-bottom: 2px;
}

/* 页面切换 */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 0 16px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 10px;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}

.stat-card:active {
    transform: scale(0.97);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
}

.stat-card:nth-child(1)::before {
    background: linear-gradient(90deg, #007aff, #5ac8fa);
}

.stat-card:nth-child(2)::before {
    background: linear-gradient(90deg, #34c759, #30d158);
}

.stat-card:nth-child(3)::before {
    background: linear-gradient(90deg, #ff9500, #ffcc00);
}

.stat-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-card:nth-child(2) .stat-value {
    color: var(--success-color);
}

.stat-card:nth-child(3) .stat-value {
    color: var(--warning-color);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* 列表样式 */
.list-item {
    background: var(--white);
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    -webkit-tap-highlight-color: rgba(0, 122, 255, 0.15);
    user-select: none;
    -webkit-user-select: none;
}

.list-item:first-child {
    border-radius: var(--radius) var(--radius) 0 0;
}

.list-item:last-child {
    border-radius: 0 0 var(--radius) var(--radius);
    border-bottom: none;
}

.list-item:active {
    background: #e8f2ff;
    transform: scale(0.98);
}

/* 报告列表项特殊样式 */
.report-item {
    position: relative;
    overflow: hidden;
}

.report-item::after {
    content: '›';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #ccc;
    font-size: 20px;
    font-weight: bold;
}

.list-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

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

.list-info {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
}

.list-tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-color);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* 报告状态标签 */
.status-completed {
    background: #e8f5e9;
    color: #2e7d32;
}
.status-draft {
    background: #fff3e0;
    color: #e65100;
}

/* 签名区域 */
.signature-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-color);
    margin-top: 12px;
    overflow: hidden;
}

.signature-canvas {
    width: 100%;
    height: 200px;
    cursor: crosshair;
    touch-action: none;
    display: block;
}

.signature-footer {
    display: flex;
    justify-content: flex-end;
    padding: 8px 12px;
    gap: 8px;
    background: var(--bg-color);
}

/* 复选框组 */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}

/* 单选组 */
.radio-group {
    display: flex;
    gap: 20px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.radio-item input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}

/* 检查记录项 */
.checkpoint-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.checkpoint-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.checkpoint-name {
    font-weight: 600;
}

/* 药物使用记录 */
.treatment-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.treatment-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

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

.empty-icon {
    font-size: 60px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* 加载中 */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Toast提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: var(--white);
    padding: 12px 24px;
    border-radius: 8px;
    z-index: 9999;
    display: none;
}

.toast.show {
    display: block;
}

/* 模态框基础样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.show {
    display: flex;
}

/* ================================================
   签名全屏弹窗（全屏固定定位，不受页面滚动影响）
   ================================================ */
.sign-mask {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: #fff;
    z-index: 99999;
    display: none;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.sign-mask.show {
    display: block;
}

/* 旋转小提示（竖屏时在画布下方显示，不遮挡签名区域） */
.rotate-hint {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    z-index: 100002;
    background: rgba(26, 54, 93, 0.08);
    color: #1a365d;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.rotate-hint.show-small {
    display: block;
}

/* 签名画布容器 - 真正全屏，占满整个视口 */
.sign-landscape {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: #fff;
    display: none;
    z-index: 100000;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.sign-landscape.show {
    display: block;
}

.sign-mask.show .sign-landscape {
    display: block;
}

/* canvas 全屏铺满 */
.sign-landscape canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: block;
    background: #fff;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
}

/* 顶部标题栏 - 固定在屏幕顶部 */
.sign-top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    z-index: 100001;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid #eef2f7;
}

.sign-title {
    font-size: 16px;
    font-weight: 600;
    color: #1a365d;
}

.sign-btn-close {
    padding: 8px 18px;
    font-size: 14px;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    -webkit-appearance: none;
    min-height: 36px;
    font-weight: 500;
}

/* 底部按钮栏 - 固定在屏幕底部 */
.sign-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 12px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)) 16px;
    z-index: 100001;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid #eef2f7;
}

.sign-btn-clear,
.sign-btn-confirm {
    padding: 14px 22px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    -webkit-appearance: none;
    min-height: 48px;
}

.sign-btn-clear {
    flex: 1;
    background: #f5f5f5;
    color: #333;
    border: 1px solid #e0e0e0;
}

.sign-btn-confirm {
    flex: 2;
    background: #1677ff;
    color: #fff;
    box-shadow: 0 2px 8px rgba(22, 119, 255, 0.2);
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    text-align: center;
}

.modal-body {
    padding: 16px;
}

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

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

/* 签名模态框 - 全屏显示 */
#signatureModal {
    background: var(--white);
}

#signatureModal .signature-modal-content {
    background: var(--white);
    border-radius: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    max-height: 100%;
    overflow: hidden;
}

#signatureModal.show {
    display: flex;
}

/* 步骤条样式 */
.step-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 8px;
    background: var(--white);
    margin: 12px 16px 0;
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow: var(--shadow);
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

.step-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s;
    border: 2px solid var(--border-color);
}

.step-item.active .step-circle {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

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

.step-label {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

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

.step-line {
    flex: 1;
    height: 2px;
    background: var(--border-color);
    margin: 0 6px;
    margin-bottom: 16px;
    transition: all 0.3s;
}

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

/* 步骤面板 */
.step-panel {
    display: none;
}

.step-panel.active {
    display: block;
}

/* 步骤导航按钮 */
.step-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 16px 16px;
    gap: 12px;
}

.step-nav .btn {
    flex: 1;
    max-width: 140px;
}

/* 响应式步骤条 */
@media screen and (max-width: 480px) {
    .step-bar {
        padding: 12px 12px 6px;
        margin: 8px 12px 0;
    }
    .step-circle {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    .step-label {
        font-size: 10px;
    }
    .step-line {
        margin: 0 4px;
        margin-bottom: 12px;
    }
}

/* 空状态引导 */
.empty-state-guide {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.empty-state-guide .guide-btn {
    margin-top: 12px;
    padding: 8px 20px;
    font-size: 14px;
}


/* 响应式调整 */
@media screen and (max-width: 480px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 0 12px;
    }

    .stat-card {
        padding: 12px 6px;
    }

    .stat-icon {
        font-size: 20px;
        margin-bottom: 4px;
    }

    .stat-value {
        font-size: 22px;
    }

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

    .header-home {
        padding: 12px 16px;
    }

    .header-home-text h1 {
        font-size: 17px;
    }

    .treatment-row {
        grid-template-columns: 1fr;
    }

    .card {
        margin: 8px 12px;
        padding: 12px;
    }
}

@media screen and (max-width: 360px) {
    .stats-grid {
        gap: 6px;
    }

    .stat-value {
        font-size: 20px;
    }
}

/* 登录页 */
.login-container {
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo {
    text-align: center;
    margin-bottom: 36px;
}

.logo .logo-icon {
    width: 90px;
    height: 90px;
    border-radius: 4px;
    margin: 0 auto 18px;
    overflow: hidden;
}

.logo .logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.logo h1 {
    font-size: 24px;
    color: var(--primary-color);
    margin-bottom: 6px;
    font-weight: 700;
    letter-spacing: 2px;
}

.logo p {
    color: var(--text-secondary);
    font-size: 14px;
    letter-spacing: 1px;
}

.logo .version-tag {
    display: inline-block;
    margin-top: 10px;
    padding: 3px 12px;
    background: var(--bg-color);
    border-radius: 10px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* 添加按钮 */
.add-btn {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    font-size: 28px;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.4);
    cursor: pointer;
    z-index: 99;
}

/* 照片网格样式 */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

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

.photo-item .photo-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(255, 59, 48, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.photo-item .photo-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 4px 8px;
    font-size: 11px;
    text-align: center;
}

/* PDF导出按钮 */
.btn-success {
    background: #34c759;
    color: white;
    border: none;
}

/* 快捷选项按钮样式 */
.quick-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.quick-btn {
    padding: 6px 12px;
    border: 1px solid var(--primary-color);
    background: #f0f7ff;
    color: var(--primary-color);
    border-radius: 16px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-btn:active {
    background: var(--primary-color);
    color: white;
    transform: scale(0.95);
}

.quick-btn-xs {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 12px;
}

.quick-btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 14px;
}

.quick-options-vertical {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quick-options-vertical .quick-btn {
    text-align: left;
    width: 100%;
}
