/* 基础布局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    overflow: hidden;
}

/* 顶部标题栏 */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: #4CAF50;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    padding-top: env(safe-area-inset-top);
}

.app-title {
    font-size: 18px;
    font-weight: 600;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.settings-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s ease;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.settings-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

/* 下拉菜单 */
.dropdown-menu {
    position: fixed;
    top: 50px;
    right: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 2000;
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.3s ease;
    min-width: 160px;
    max-width: 180px;
}

.dropdown-menu.show {
    transform: translateY(0);
    opacity: 1;
}

.dropdown-menu .menu-content {
    padding: 8px 0;
}

.dropdown-menu .menu-btn {
    padding: 12px 16px;
    background: none;
    border: none;
    font-size: 14px;
    color: #333;
    text-align: left;
    width: 100%;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.dropdown-menu .menu-btn:active {
    background: #f5f5f5;
}

/* 菜单底部 */
.menu-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-top: 1px solid #f0f0f0;
    margin-top: 4px;
}

.back-btn {
    background: none;
    border: none;
    color: #4CAF50;
    font-size: 14px;
    padding: 4px 8px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: #666;
    padding: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 地图容器 */
.map-container {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

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

/* 管理功能弹窗 */
.management-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.management-modal .modal-content {
    background: white;
    border-radius: 12px;
    width: 95%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.management-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.management-modal .modal-body {
    padding: 20px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 管理表格样式 */
.management-table {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.table-header {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
    font-weight: 600;
    flex-shrink: 0;
}

.table-body {
    flex: 1;
    overflow-y: auto;
    max-height: 40vh;
}

.table-row {
    display: flex;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
    min-height: 60px;
}

.table-cell {
    padding: 12px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* 列宽分配 */
.table-header .table-cell:nth-child(1),
.table-row .table-cell:nth-child(1) {
    width: 20%; /* 序号 */
}

.table-header .table-cell:nth-child(2),
.table-row .table-cell:nth-child(2) {
    width: 35%; /* 内容 */
}

.table-header .table-cell:nth-child(3),
.table-row .table-cell:nth-child(3) {
    width: 30%; /* 操作 */
}

.table-header .table-cell:nth-child(4),
.table-row .table-cell:nth-child(4) {
    width: 15%; /* 图标 */
}

/* 图标显示 */
.icon-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    overflow: hidden;
}

.icon-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.empty-icon {
    color: #999;
    font-size: 14px;
}

/* 操作按钮 */
.action-btn {
    padding: 6px 12px;
    border: 1px solid #4CAF50;
    background: white;
    color: #4CAF50;
    border-radius: 6px;
    font-size: 12px;
    margin: 0 2px;
    min-width: 60px;
}

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

.delete-btn {
    border-color: #f44336;
    color: #f44336;
}

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

/* 图标选择网格 */
.icons-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 10px 0;
    max-height: 200px;
    overflow-y: auto;
}

.icon-option {
    width: 50px;
    height: 50px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: white;
}

.icon-option.selected {
    border-color: #4CAF50;
    background: #e8f5e8;
}

.icon-option:active {
    transform: scale(0.95);
}

/* 底部添加按钮 */
.add-btn {
    width: 100%;
    padding: 12px;
    background: #4CAF50;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    margin-top: 15px;
    flex-shrink: 0;
}

.add-btn:active {
    background: #45a049;
}

/* 通用弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal .modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    max-height: 80%;
    overflow: auto;
}

.modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.modal .modal-body {
    padding: 20px;
}

/* 输入框样式 */
.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.setting-item label {
    font-size: 14px;
    min-width: 80px;
}

.setting-item input[type="text"],
.setting-item select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

#text-input-field {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
}

/* 操作按钮组 */
.action-buttons {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.cancel-btn, .confirm-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
}

.cancel-btn {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e0e0e0;
}

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

.cancel-btn:active {
    background: #e9ecef;
}

.confirm-btn:active {
    background: #45a049;
}

.hidden {
    display: none;
}

/* 标注管理相关样式 */
.location-info-item {
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.location-info-item.empty {
    background: #fff3cd;
    border-color: #ffeaa7;
}

.info-label {
    font-weight: 600;
    color: #333;
}

.info-value {
    color: #666;
    flex: 1;
}

.edit-btn {
    padding: 4px 8px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
}

.images-preview {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0;
    flex: 1;
}

.image-item {
    padding: 4px 8px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 12px;
}

.empty-text {
    color: #999;
    font-style: italic;
}

/* 信息窗口操作按钮 */
.mark-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.mark-action-buttons .action-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
}

.mark-action-buttons .primary {
    background: #2196F3;
    border-color: #2196F3;
}

.mark-action-buttons .primary:active {
    background: #1976D2;
}

/* 分组选择样式 */
.group-selection-list {
    max-height: 300px;
    overflow-y: auto;
}

.group-option {
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.group-option:hover {
    background: #f8f9fa;
}

.group-option.selected {
    border-color: #4CAF50;
    background: #e8f5e8;
}

.empty-groups {
    text-align: center;
    color: #999;
    padding: 20px;
}

/* 图片管理样式 */
.images-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-management-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

.image-preview {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

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

.image-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.add-image-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 0;
}

/* 图片查看器样式 */
#image-viewer-content {
    text-align: center;
    margin-bottom: 20px;
}

#viewer-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
}