/* 保单查询系统 - 样式 */

:root {
    --primary: #1a56db;
    --primary-hover: #1e40af;
    --secondary: #6b7280;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --bg-light: #f3f4f6;
    --bg-white: #ffffff;
    --text-dark: #1f2937;
    --text-gray: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: white;
    border-radius: 12px;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main */
.main {
    flex: 1;
}

/* Cards */
.query-card, .login-card {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    margin: 0 auto 30px;
}

.query-card h2, .login-card h2 {
    margin-bottom: 24px;
    color: var(--text-dark);
    text-align: center;
}

.query-hint {
    margin-top: 16px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.btn-primary:disabled {
    background-color: var(--secondary);
    cursor: not-allowed;
}

.btn-secondary {
    padding: 10px 20px;
    background-color: var(--secondary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-link {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.btn-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Error & Loading */
.error-message {
    background-color: #fef2f2;
    color: var(--danger);
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-gray);
}

/* Result Section */
.result-section {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    margin-top: 30px;
}

.result-section h3 {
    margin-bottom: 20px;
    color: var(--text-dark);
}

.customer-info {
    background: var(--bg-light);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.customer-info p {
    margin: 4px 0;
}

.policy-list {
    display: grid;
    gap: 16px;
}

.policy-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.policy-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.policy-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    font-size: 1.2rem;
}

.policy-info {
    flex: 1;
}

.policy-info h4 {
    margin-bottom: 4px;
}

.policy-info p {
    color: var(--text-gray);
    font-size: 0.9rem;
}

.policy-link {
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.policy-link:hover {
    background: var(--primary-hover);
}

/* Back Home */
.back-home {
    text-align: center;
    margin-top: 20px;
}

.back-home a {
    color: var(--primary);
    text-decoration: none;
}

.back-home a:hover {
    text-decoration: underline;
}

/* Admin Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    padding: 20px 30px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left h1 {
    font-size: 1.8rem;
    margin: 0;
}

.admin-name {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Admin Main */
.admin-main {
    padding: 0;
}

/* Section */
.section {
    background: var(--bg-white);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
}

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

.section-header h2 {
    font-size: 1.5rem;
}

.section-header .header-buttons {
    display: flex;
    gap: 12px;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-dark);
}

.data-table tr:hover {
    background: var(--bg-light);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

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

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

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

.empty-row {
    text-align: center;
    color: var(--text-gray);
    padding: 40px !important;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-large {
    max-width: 700px;
}

.modal-small {
    max-width: 400px;
}

.not-found-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.not-found-text {
    font-size: 1.1rem;
    color: var(--text-dark);
    margin: 0;
}

/* Result Modal Content */
.result-modal-content {
    text-align: center;
}

.result-preview {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-light);
}

.result-preview img {
    max-width: 100%;
    max-height: 60vh;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.result-preview img:hover {
    transform: scale(1.02);
}

.result-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.result-buttons .btn-primary {
    min-width: 140px;
}

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

.modal-header h3 {
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-gray);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    margin-bottom: 20px;
    transition: border-color 0.2s;
}

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

.upload-placeholder {
    cursor: pointer;
}

.upload-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: var(--bg-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary);
}

.upload-hint {
    color: var(--text-gray);
    font-size: 0.85rem;
    margin-top: 8px;
}

.selected-file {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.selected-file .file-name {
    font-weight: 500;
}

.selected-file .file-remove {
    color: var(--danger);
    cursor: pointer;
}

/* Multiple Files List */
.selected-files {
    margin-top: 16px;
}

.selected-files-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.selected-file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg-light);
    border-radius: 8px;
    font-size: 0.85rem;
}

.selected-file-item .file-icon {
    font-size: 1.2rem;
}

.selected-file-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-file-item .file-remove {
    color: var(--danger);
    cursor: pointer;
    font-size: 1rem;
}

.upload-progress {
    margin-top: 16px;
}

/* Upload Actions */
.upload-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.upload-actions .btn-primary,
.upload-actions .btn-secondary {
    width: auto;
    padding: 10px 24px;
}

/* Download Buttons */
.download-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Download Section (Query Page) */
.download-section {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
}

.download-section .download-btn {
    padding: 12px 24px;
    font-size: 1rem;
}

/* Preview Section */
.preview-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.preview-item {
    background: var(--bg-light);
    border-radius: 12px;
    overflow: hidden;
}

.preview-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    cursor: pointer;
    transition: transform 0.2s;
}

.preview-image:hover {
    transform: scale(1.02);
}

.preview-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.preview-pdf:hover {
    background: var(--border);
}

.preview-pdf .pdf-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.preview-pdf .pdf-label {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.preview-pdf .pdf-hint {
    font-size: 0.9rem;
    color: var(--text-gray);
}

/* ==================== 微信浏览器适配 ==================== */

/* 微信浏览器兼容 */
body {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
}

/* 修复iOS微信浏览器input样式 */
input, textarea {
    -webkit-appearance: none;
    appearance: none;
}

/* 修复iOS微信橡皮筋效果导致的100vh问题 */
html {
    height: 100%;
    overflow-x: hidden;
}

/* 微信中禁止长按选择文字（可选） */
.no-select {
    -webkit-user-select: none;
    user-select: none;
}

/* 微信中禁止自动识别电话 */
a[href^="tel"] {
    color: inherit;
    text-decoration: none;
}

/* 移动端安全区域适配（iPhone X及以上） */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

.download-btn {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
}

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

.download-btn.pdf {
    background: var(--success);
}

.download-btn.pdf:hover {
    background: #047857;
}

.progress-bar {
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    display: block;
    text-align: center;
    margin-top: 8px;
    color: var(--text-gray);
    font-size: 0.9rem;
}

/* Policy List Admin */
.policy-list-admin {
    display: grid;
    gap: 12px;
}

.policy-item-admin {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
}

.policy-item-admin .policy-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.policy-item-admin .policy-info {
    flex: 1;
}

.policy-item-admin .policy-info h4 {
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.policy-item-admin .policy-info p {
    font-size: 0.8rem;
}

.policy-item-admin .btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-gray);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 30px 20px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .admin-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .header-left {
        flex-direction: column;
        gap: 8px;
    }

    .header-right {
        width: 100%;
        justify-content: center;
    }

    .section {
        padding: 20px;
    }

    .data-table {
        font-size: 0.9rem;
    }

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

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
}

/* Batch Import Styles */
.batch-import-info {
    background: var(--bg-light);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.batch-import-info p {
    margin: 6px 0;
    font-size: 0.9rem;
}

.batch-import-info code {
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.batch-import-result {
    margin-top: 16px;
    padding: 16px;
    border-radius: 8px;
}

.batch-import-result.success {
    background: #d1fae5;
    color: #065f46;
}

.batch-import-result.error {
    background: #fee2e2;
    color: #991b1b;
}

/* Batch Upload Section - New Layout */
.batch-upload-box {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-white);
    position: relative;
}

.batch-upload-box:hover {
    border-color: var(--primary);
    background: #f8fafc;
}

.batch-upload-box.has-file {
    border-color: #22c55e;
    border-style: solid;
    background: #f0fdf4;
}

.upload-box-content {
    user-select: none;
}

.upload-box-content .upload-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.upload-box-content .upload-text {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.upload-box-content .upload-hint {
    font-size: 0.85rem;
    color: var(--text-light);
}

.selected-file {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.selected-file .file-name {
    font-weight: 500;
    color: var(--text-dark);
}

.selected-file .file-remove {
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 14px;
    line-height: 20px;
    padding: 0;
}

.selected-file .file-remove:hover {
    background: #dc2626;
}

/* Batch Import Info Box */
.batch-import-info {
    background: var(--bg-light);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.batch-import-info .info-title {
    font-size: 1rem;
    margin-bottom: 12px;
}

.batch-import-info .info-steps {
    margin-bottom: 16px;
}

.batch-import-info .step-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.batch-import-info .step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.batch-import-info .btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Search Bar */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
}

.search-bar input[type="text"] {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
}

.search-bar input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
}

/* Batch Actions */
.batch-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: #fef3c7;
    border-radius: 8px;
    margin-bottom: 16px;
}

.batch-actions span {
    color: #92400e;
    font-weight: 500;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.pagination-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-gray);
}

.pagination-info select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-white);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-gray);
}

.page-info input[type="number"] {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-align: center;
}

/* Checkbox styling */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Header buttons */
.header-right .btn-secondary {
    padding: 8px 16px;
}
