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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
}

/* 左侧面板 */
.sidebar {
    width: 350px;
    background: #f5f5f5;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

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

/* 搜索框 */
.search-box {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

.search-box input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-box button {
    padding: 10px 20px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.search-box button:hover {
    background: #45a049;
}

/* 快速定位 */
.quick-location {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.quick-location h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

.location-buttons {
    margin-bottom: 15px;
}

.location-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.location-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.location-btn .icon {
    font-size: 18px;
}

.region-selects {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.region-selects select {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.region-selects select:focus {
    outline: none;
    border-color: #667eea;
}

.goto-btn {
    padding: 10px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s;
}

.goto-btn:hover {
    background: #45a049;
}

/* 手动添加地点 */
.manual-add-section {
    background: #fff3e0;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 2px dashed #FF9800;
}

.manual-add-section h3 {
    margin-bottom: 10px;
    color: #FF9800;
    font-size: 16px;
}

.manual-add-section .hint {
    margin: 5px 0;
    font-size: 12px;
    color: #888;
}

.manual-add-form {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.manual-add-form input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.manual-add-btn {
    padding: 10px;
    background: #FF9800;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.manual-add-btn:hover {
    background: #F57C00;
}

/* 当前拜访人选择 */
.current-visitor-section {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.current-visitor-section h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 16px;
}

.current-visitor-section select {
    width: 100%;
    padding: 10px;
    border: 2px solid #4CAF50;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.current-visitor-section .hint {
    margin-top: 8px;
    font-size: 12px;
    color: #888;
    font-style: italic;
}

/* 导出Excel */
.export-section {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.export-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

.export-filters {
    margin-bottom: 15px;
}

.filter-group {
    margin-bottom: 10px;
}

.filter-group label {
    display: block;
    margin-bottom: 5px;
    color: #666;
    font-size: 13px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.export-buttons {
    display: flex;
    gap: 10px;
}

.export-btn {
    flex: 1;
    padding: 10px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s;
}

.export-btn:hover {
    background: #45a049;
}

.export-btn-primary {
    background: #2196F3;
}

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

/* 拜访人管理 */
.visitor-management {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.visitor-management h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

.visitor-list {
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.visitor-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    margin-bottom: 5px;
    background: #f9f9f9;
    border-radius: 4px;
}

.visitor-item .visitor-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.visitor-item .color-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
}

.visitor-item .visitor-name {
    font-weight: 500;
}

.visitor-item .delete-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.add-visitor {
    display: flex;
    gap: 10px;
    align-items: center;
}

.add-visitor input[type="text"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.add-visitor input[type="color"] {
    width: 40px;
    height: 32px;
    border: none;
    cursor: pointer;
}

.add-visitor button {
    padding: 8px 15px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* 拜访记录列表 */
.records-section {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.records-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

.records-list {
    max-height: 400px;
    overflow-y: auto;
}

/* 记录分组 */
.record-group {
    margin-bottom: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.record-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f5f5f5;
    cursor: pointer;
    transition: background 0.3s;
    user-select: none;
}

.record-group-header:hover {
    background: #e8e8e8;
}

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

.visitor-name {
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.record-count {
    color: #888;
    font-size: 12px;
}

.toggle-icon {
    color: #666;
    font-size: 12px;
    transition: transform 0.3s;
}

.record-group-content {
    padding: 10px;
    background: white;
}

/* 地点分组 */
.location-group {
    margin-bottom: 8px;
}

.location-header {
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 4px solid #4CAF50;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.location-header:hover {
    background: #e8f5e9;
}

.location-header-content {
    flex: 1;
}

.expand-indicator {
    color: #666;
    font-size: 12px;
    margin-left: 10px;
    margin-top: 5px;
}

.history-badge {
    display: inline-block;
    background: #FF9800;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 8px;
}

/* 历史记录 */
.location-history {
    margin-top: 5px;
    padding-left: 15px;
    border-left: 2px solid #e0e0e0;
    margin-left: 10px;
}

.history-item {
    padding: 8px;
    margin-bottom: 5px;
    background: #fafafa;
    border-radius: 4px;
    border-left: 3px solid #ccc;
    cursor: pointer;
    transition: all 0.3s;
}

.history-item:hover {
    background: #f0f0f0;
    border-left-color: #999;
}

.history-date {
    font-weight: bold;
    color: #333;
    font-size: 13px;
    margin-bottom: 3px;
}

.history-info {
    color: #666;
    font-size: 12px;
    margin-bottom: 3px;
}

.history-note {
    color: #888;
    font-size: 11px;
    margin-bottom: 5px;
}

.history-actions {
    display: flex;
    gap: 5px;
}

.history-actions .edit-btn,
.history-actions .delete-record-btn {
    padding: 3px 8px;
    font-size: 11px;
}

.record-item {
    padding: 12px;
    margin-bottom: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 4px solid #4CAF50;
    cursor: pointer;
    transition: all 0.3s;
}

.record-item:hover {
    background: #e8f5e9;
    transform: translateX(5px);
}

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

.record-location {
    font-weight: bold;
    color: #333;
    flex: 1;
}

.record-actions {
    display: flex;
    gap: 5px;
}

.edit-btn,
.delete-record-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

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

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

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

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

.record-item .record-info {
    font-size: 13px;
    color: #666;
    margin-bottom: 3px;
}

.record-item .record-note {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
    padding: 5px;
    background: white;
    border-radius: 3px;
}

/* 导出按钮 */
.export-btn {
    width: 100%;
    padding: 12px;
    background: #FF9800;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background 0.3s;
}

.export-btn:hover {
    background: #F57C00;
}

/* 地图容器 */
.map-container {
    flex: 1;
    position: relative;
}

#mapContainer {
    width: 100%;
    height: 100%;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 500px;
    max-width: 90%;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    animation: slideIn 0.3s;
}

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

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #000;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

.submit-btn {
    width: 100%;
    padding: 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    margin-top: 10px;
    transition: background 0.3s;
}

.submit-btn:hover {
    background: #45a049;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 地图标记信息窗口 */
.amap-info-window {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
}

.info-window-content {
    padding: 10px;
    max-width: 300px;
}

.info-window-content h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
}

.info-window-content p {
    margin: 5px 0;
    font-size: 13px;
    color: #666;
}

.info-window-content .add-record-btn {
    margin-top: 10px;
    padding: 8px 15px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
}

/* 响应式设计 */
/* ==================== 移动端优化 ==================== */

/* 移动端底部导航栏 */
.mobile-nav {
    display: none;
}

/* 人员选择弹窗样式 */
.visitor-modal-content {
    max-width: 400px;
    max-height: 70vh;
}

.visitor-modal-list {
    max-height: 50vh;
    overflow-y: auto;
}

.visitor-modal-item {
    padding: 15px;
    margin: 10px 0;
    background: #f5f5f5;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.visitor-modal-item:hover {
    background: #e3f2fd;
    border-color: #2196F3;
}

.visitor-modal-item.selected {
    background: #e8f5e9;
    border-color: #4CAF50;
}

.visitor-modal-item .color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}

.visitor-modal-item .visitor-name {
    font-size: 16px;
    font-weight: 500;
}

/* 记录全屏弹窗样式 */
.records-modal {
    display: none;
}

.records-modal-content {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.records-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #4CAF50;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

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

.records-modal-header .close {
    color: white;
    font-size: 32px;
    line-height: 1;
}

.records-modal-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f5f5f5;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
        position: relative;
    }

    /* 隐藏默认侧边栏 */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 350px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.3);
    }

    /* 侧边栏打开状态 */
    .sidebar.open {
        left: 0;
    }

    /* 地图全屏显示 */
    .map-container {
        width: 100%;
        height: 100vh;
    }

    /* 移动端底部导航栏 */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 999;
        padding: 8px 0;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 10px 4px;
        cursor: pointer;
        color: #666;
        transition: all 0.3s;
        border: none;
        background: none;
        font-size: 12px;
    }

    .mobile-nav-item.active {
        color: #4CAF50;
    }

    .mobile-nav-item .icon {
        font-size: 26px;
        margin-bottom: 4px;
    }

    .mobile-nav-item span {
        font-size: 12px;
    }

    /* 遮罩层 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
    }

    /* 移动端关闭按钮 */
    .sidebar-close {
        display: block;
        position: absolute;
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        background: #f44336;
        color: white;
        border: none;
        border-radius: 50%;
        font-size: 24px;
        cursor: pointer;
        z-index: 1001;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    }

    /* 移动端优化表单 */
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* 防止iOS自动缩放 */
    }

    /* 移动端优化按钮 */
    .location-btn,
    .add-visitor button,
    .export-btn {
        padding: 14px;
        font-size: 16px;
    }

    /* 移动端优化记录列表 */
    .record-group-header {
        padding: 12px;
    }

    .location-header {
        padding: 12px;
    }

    /* 移动端优化弹窗 */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 5% auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* 移动端优化信息窗口 */
    .info-window-content {
        max-width: 280px;
        font-size: 14px;
    }

    .info-window-content button {
        padding: 10px 15px;
        font-size: 14px;
    }

    /* 隐藏电脑端的查看全部按钮 */
    .view-all-btn {
        display: none;
    }
}

/* 超小屏幕优化 */
@media (max-width: 480px) {
    .sidebar {
        width: 90%;
    }

    .mobile-nav-item .icon {
        font-size: 24px;
    }

    .mobile-nav-item span {
        font-size: 11px;
    }

    .sidebar h2 {
        font-size: 20px;
    }

    .quick-location h3 {
        font-size: 14px;
    }
}

/* 电脑端显示查看全部按钮 */
@media (min-width: 769px) {
    .view-all-btn {
        display: block;
    }
}
