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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    background: white;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    color: #333;
    font-size: 28px;
}

.api-key-section {
    display: flex;
    gap: 10px;
}

.api-key-section input {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    width: 200px;
}

.api-key-section button {
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.api-key-section button:hover {
    background: #45a049;
}

main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

section {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 10px;
}

/* 搜索区域 */
.search-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.search-box {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.search-box button {
    padding: 12px 20px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.search-box button:hover {
    background: #1976D2;
}

.add-btn {
    padding: 12px 25px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s;
}

.add-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

/* 客户列表表格 */
.table-wrapper {
    overflow-x: auto;
}

.customer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.customer-table thead {
    background: #f5f5f5;
}

.customer-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #4CAF50;
    white-space: nowrap;
}

.customer-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    color: #666;
    vertical-align: middle;
}

.customer-table tbody tr:hover {
    background: #f8fff8;
}

.customer-table .empty-text {
    text-align: center;
    padding: 40px;
    color: #999;
}

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

.customer-table .actions-cell button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
}

.customer-table .file-cell {
    max-width: 150px;
}

.file-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    background: #e8f5e9;
    border-radius: 4px;
    font-size: 12px;
    color: #2e7d32;
    cursor: pointer;
    margin: 2px;
    text-decoration: none;
}

.file-item:hover {
    background: #c8e6c9;
}

.file-item .file-icon {
    font-size: 14px;
}

/* 卡片视图（保留用于移动端） */
.customer-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.customer-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid transparent;
}

.customer-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #4CAF50;
}

.customer-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.customer-item-name {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.customer-item-phone {
    color: #666;
    font-size: 14px;
}

.customer-item-info {
    margin-bottom: 10px;
}

.customer-item-info span {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.customer-item-info span.label {
    color: #999;
    font-size: 12px;
}

.customer-item-images {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.customer-item-image {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    border: 2px solid #ddd;
}

.customer-item-image:hover {
    border-color: #4CAF50;
}

.customer-item-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.customer-item-actions button {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.3s;
}

.edit-btn {
    background: #2196F3;
    color: white;
}

.edit-btn:hover {
    background: #1976D2;
}

.delete-btn {
    background: #f44336;
    color: white;
}

.delete-btn:hover {
    background: #d32f2f;
}

.empty-text {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    padding: 40px;
    font-size: 16px;
}

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

.pagination button {
    padding: 10px 15px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.pagination button:hover {
    border-color: #4CAF50;
    color: #4CAF50;
}

.pagination button.active {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

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

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation-name: modalopen;
    animation-duration: 0.3s;
}

@keyframes modalopen {
    from {opacity: 0; transform: translateY(-20px);}
    to {opacity: 1; transform: translateY(0);}
}

.modal-header {
    padding: 20px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.close-btn {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
}

.close-btn:hover {
    color: #eee;
}

.modal-body {
    padding: 25px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4CAF50;
}

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

.upload-area {
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.05);
}

.upload-area p {
    color: #666;
    font-size: 14px;
}

.image-type-selector {
    margin-top: 15px;
}

.image-type-selector select {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    width: 100%;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.form-actions button {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.cancel-btn {
    background: #f0f0f0;
    color: #666;
}

.cancel-btn:hover {
    background: #e0e0e0;
}

.submit-btn {
    background: #4CAF50;
    color: white;
}

.submit-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

/* 图片弹窗 */
.image-modal-content {
    max-width: 800px;
}

#previewImage {
    max-width: 100%;
    max-height: 60vh;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        text-align: center;
    }

    .api-key-section {
        width: 100%;
        flex-direction: column;
    }

    .api-key-section input {
        width: 100%;
    }

    .search-section {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

    .customer-list {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }
}

footer {
    text-align: center;
    padding: 20px;
    color: white;
    margin-top: 30px;
    font-size: 14px;
}
