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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fa;
}

/* 顶部导航 */
.navbar {
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
    padding: 0 20px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.navbar .logo {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
}

.navbar .logo span {
    color: #ff9800;
}

.navbar .nav-links a {
    color: #ffd740;
    text-decoration: none;
    margin-left: 24px;
    font-size: 18px;
    font-weight: 600;
    transition: color 0.2s;
}

.navbar .nav-links a:hover {
    color: #fff;
}

/* 主布局 */
.main-container {
    display: flex;
    margin-top: 56px;
    height: calc(100vh - 56px);
}

/* 左侧面板 */
.sidebar {
    width: 380px;
    min-width: 380px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.filter-section {
    padding: 16px;
    border-bottom: 1px solid #e8e8e8;
    background: #fafbfc;
}

.filter-section .filter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.filter-section .filter-row:last-child {
    margin-bottom: 0;
}

.filter-section select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

.filter-section select:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}

.filter-section .search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 14px;
}

.filter-section .search-input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}

.base-count {
    padding: 10px 16px;
    font-size: 13px;
    color: #666;
    border-bottom: 1px solid #e8e8e8;
    background: #fff;
}

/* 基地列表 */
.base-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.base-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
}

.base-card:hover {
    border-color: #1a73e8;
    box-shadow: 0 2px 8px rgba(26,115,232,0.15);
}

.base-card.active {
    border-color: #1a73e8;
    background: #e8f0fe;
}

.base-card .card-body {
    padding: 12px;
    display: flex;
    gap: 12px;
}

.base-card .card-cover {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: #e8e8e8;
}

.base-card .card-cover-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a73e8;
    font-size: 28px;
}

.base-card .card-info {
    flex: 1;
    min-width: 0;
}

.base-card .card-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.base-card .card-location {
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
}

.base-card .card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.tag-open {
    background: #e8f5e9;
    color: #2e7d32;
}

.tag-closed {
    background: #ffebee;
    color: #c62828;
}

.tag-unknown {
    background: #fff3e0;
    color: #e65100;
}

.tag-difficulty {
    background: #e8eaf6;
    color: #283593;
}

/* 右侧地图 */
.map-container {
    flex: 1;
    position: relative;
    min-height: 400px;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* 基地详情弹窗 */
.detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.detail-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.detail-header h2 {
    font-size: 22px;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.detail-header .location {
    font-size: 14px;
    color: #666;
}

.detail-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 4px 8px;
    border-radius: 4px;
}

.detail-close:hover {
    background: #f0f0f0;
    color: #333;
}

.detail-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.detail-photos {
    margin-bottom: 20px;
}

.detail-photos img {
    width: 100%;
    height: 300px;
    object-fit: contain;
    border-radius: 8px;
    background: #f5f5f5;
}

.photo-gallery {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
}

.photo-gallery img {
    width: 100px;
    height: 75px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.photo-gallery img:hover,
.photo-gallery img.active {
    border-color: #1a73e8;
}

.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.detail-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-info-item .label {
    font-size: 12px;
    color: #888;
}

.detail-info-item .value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.detail-description {
    margin-bottom: 20px;
}

.detail-description h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #333;
}

.detail-description p {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
}

.detail-contact {
    background: #f5f7fa;
    border-radius: 8px;
    padding: 16px;
}

.detail-contact h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #333;
}

.detail-contact .contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.detail-contact .contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
}

.detail-contact .contact-item .icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e3f2fd;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a73e8;
    flex-shrink: 0;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 40px;
    color: #888;
}

.loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* 移动端切换按钮 */
.mobile-toggle {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1500;
    background: linear-gradient(135deg, #1a73e8, #0d47a1);
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    cursor: pointer;
}

/* 移动端底部留白 */
.mobile-bottom-spacer {
    display: none;
}

/* 响应式 */
@media (max-width: 768px) {
    .navbar {
        height: 48px;
        padding: 0 12px;
    }

    .navbar .logo {
        font-size: 17px;
    }

    .navbar .nav-links a {
        margin-left: 16px;
        font-size: 13px;
    }

    .main-container {
        flex-direction: column;
        margin-top: 48px;
        height: calc(100vh - 48px);
    }

    .sidebar {
        width: 100%;
        min-width: unset;
        height: 100%;
        border-right: none;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        transition: transform 0.3s ease;
    }

    .sidebar.hidden {
        transform: translateX(-100%);
    }

    .map-container {
        width: 100%;
        height: 100%;
        min-height: unset;
    }

    .mobile-toggle {
        display: block;
    }

    .mobile-bottom-spacer {
        display: block;
        height: 60px;
    }

    .filter-section {
        padding: 12px;
    }

    .filter-section .filter-row {
        gap: 8px;
        margin-bottom: 8px;
    }

    .filter-section select,
    .filter-section .search-input {
        padding: 10px 12px;
        font-size: 16px; /* 防止iOS缩放 */
    }

    .base-list {
        padding: 6px;
    }

    .base-card .card-cover,
    .base-card .card-cover-placeholder {
        width: 64px;
        height: 64px;
    }

    /* 详情弹窗全屏 */
    .detail-overlay {
        align-items: flex-end;
    }

    .detail-modal {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
    }

    .detail-header {
        padding: 16px;
    }

    .detail-header h2 {
        font-size: 18px;
    }

    .detail-body {
        padding: 16px;
    }

    .detail-photos img {
        height: 220px;
    }

    .photo-gallery img {
        width: 72px;
        height: 54px;
    }

    .detail-info-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .detail-contact .contact-grid {
        grid-template-columns: 1fr;
    }

    .detail-contact .contact-item {
        padding: 8px 0;
        border-bottom: 1px solid #eee;
    }

    .detail-contact .contact-item:last-child {
        border-bottom: none;
    }

    /* 原图查看 */
    .original-photo-overlay img {
        max-width: 100vw;
        max-height: 85vh;
    }
}

/* 平板竖屏 */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 320px;
        min-width: 320px;
    }

    .detail-modal {
        width: 95%;
    }
}

/* 高德地图信息窗 */
.amap-info-sharp {
    display: none;
}

/* 原图查看 */
.original-photo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.original-photo-overlay img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
}

.original-photo-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #fff;
    font-size: 14px;
    opacity: 0.7;
}
