/* ===========================================
   清溪村数字导览地图 - 自定义样式
   用户端 + 管理端
   =========================================== */

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
}

/* ===== 顶部导航 ===== */
.navbar {
    height: 56px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.brand-icon {
    font-size: 1.3rem;
    margin-right: 4px;
}

/* ===== 地图容器 ===== */
.map-container {
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    transition: left 0.3s ease;
}

/* ===== 侧边栏（桌面端 360px 左侧栏） ===== */
.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    width: 360px;
    height: calc(100vh - 56px);
    background: #fff;
    z-index: 900;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 16px 12px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.filter-section {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

/* 分类筛选 - 横向滚动 */
.category-filter-wrap {
    width: 100%;
}

.category-scroll-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.category-scroll-wrap.mobile-scroll {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.category-scroll-wrap.mobile-scroll::-webkit-scrollbar {
    display: none;
}

/* 分类标签按钮 */
.category-tag-btn {
    border-radius: 20px !important;
    padding: 4px 14px !important;
    font-size: 0.85rem !important;
    margin: 2px !important;
    white-space: nowrap;
    flex-shrink: 0;
}

.filter-section .btn-group .btn-check:checked + .btn {
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* 点位列表 */
.point-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.point-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f5f5f5;
}

.point-item:hover {
    background-color: #f0f7ff;
}

.point-item.active {
    background-color: #e3f2fd;
    border-left: 3px solid #0d6efd;
}

.point-item .point-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
    margin-right: 12px;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.point-item .point-info {
    flex: 1;
    min-width: 0;
}

.point-item .point-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.point-item .point-category {
    font-size: 0.78rem;
    color: #888;
}

.point-item .point-desc {
    font-size: 0.82rem;
    color: #666;
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 形状小标签 */
.shape-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 4px;
}

/* ===== 侧边栏切换按钮（移动端） ===== */
.sidebar-toggle {
    position: fixed;
    left: 12px;
    bottom: 24px;
    z-index: 950;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.3rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* ===== 信息窗体 ===== */
.custom-info-window {
    max-width: 320px;
    font-size: 0.9rem;
    line-height: 1.6;
}

.custom-info-window .info-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #222;
    margin-bottom: 6px;
}

.custom-info-window .info-category {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #fff;
    margin-bottom: 8px;
}

.custom-info-window .info-desc {
    color: #555;
    margin: 8px 0;
    font-size: 0.85rem;
}

.custom-info-window .info-phone,
.custom-info-window .info-address {
    font-size: 0.82rem;
    color: #666;
    margin: 4px 0;
}

.custom-info-window .info-phone a {
    color: #0d6efd;
    text-decoration: none;
}

.custom-info-window .info-image {
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin: 8px 0;
}

/* ===== 自定义标注样式 ===== */
.custom-marker {
    transition: transform 0.2s;
}

.custom-marker:hover {
    transform: scale(1.15);
}

.custom-marker-icon {
    cursor: pointer;
    transition: transform 0.2s;
}

.custom-marker-icon:hover {
    transform: scale(1.15);
}

.marker-label {
    pointer-events: none;
    user-select: none;
}

/* ===== Sidebar Section（地块列表） ===== */
.sidebar-section {
    border-top: 1px solid #334;
    flex-shrink: 0;
}

/* ===== 管理端侧边栏 ===== */
.sidebar.open {
    transform: translateX(0);
}

/* ===========================================
   底图切换按钮组
   =========================================== */

.basemap-switcher {
    position: absolute;
    top: 10px;
    right: 60px;
    z-index: 888;
    display: flex;
    gap: 0;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    overflow: hidden;
    padding: 2px;
}

.basemap-switcher .bs-btn {
    padding: 6px 14px;
    font-size: 0.78rem;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.25s ease;
    font-weight: 500;
    white-space: nowrap;
}

.basemap-switcher .bs-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.basemap-switcher .bs-btn.active {
    background: #0d6efd;
    color: #fff;
    box-shadow: 0 2px 6px rgba(13,110,253,0.3);
}

.basemap-switcher .bs-btn.active:hover {
    background: #0b5ed7;
}

/* 管理员底图切换 - 位置调整 */
.admin-basemap-switcher {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 888;
    display: flex;
    gap: 0;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    overflow: hidden;
    padding: 2px;
}

.admin-basemap-switcher .bs-btn {
    padding: 5px 12px;
    font-size: 0.75rem;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.25s ease;
    font-weight: 500;
    white-space: nowrap;
}

.admin-basemap-switcher .bs-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.admin-basemap-switcher .bs-btn.active {
    background: #198754;
    color: #fff;
    box-shadow: 0 2px 6px rgba(25,135,84,0.3);
}

/* ===========================================
   卡通卡牌式信息窗体
   =========================================== */

.custom-info-window {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.18);
    padding: 18px;
    min-width: 200px;
    max-width: 290px;
    animation: card-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

@keyframes card-pop {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.custom-info-window .info-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.05);
    color: #999;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
}

.custom-info-window .info-close:hover {
    background: rgba(0,0,0,0.1);
    color: #333;
}

.custom-info-window .info-icon-large {
    font-size: 3rem;
    line-height: 1.2;
    text-align: center;
    margin-bottom: 8px;
}

.custom-info-window .info-icon-large img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.custom-info-window .info-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #222;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
    line-height: 1.3;
    padding-right: 20px;
}

.custom-info-window .info-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.custom-info-window .info-category {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.72rem;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.custom-info-window .info-desc {
    color: #555;
    margin: 10px 0;
    font-size: 0.85rem;
    line-height: 1.7;
    word-break: break-word;
}

.custom-info-window .info-image {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    border-radius: 12px;
    margin: 10px 0 8px;
    border: 2px solid #f0f0f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.custom-info-window .info-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.custom-info-window .info-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #666;
    line-height: 1.4;
}

.custom-info-window .info-meta-item .meta-icon {
    font-size: 0.9rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.custom-info-window .info-meta-item a {
    color: #0d6efd;
    text-decoration: none;
}

.custom-info-window .info-meta-item a:hover {
    text-decoration: underline;
}

/* amap 原生信息窗体覆盖 - 去边框 */
.amap-info-content {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.amap-info-sharp {
    display: none !important;
}

.amap-info-outer {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* ===========================================
   点位图标与文字标签
   =========================================== */

.custom-marker-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.custom-marker-wrapper:hover {
    transform: scale(1.12);
}

.custom-marker-wrapper .marker-icon {
    font-size: 28px;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.custom-marker-wrapper .marker-icon img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.custom-marker-wrapper .marker-label-text {
    background: rgba(255,255,255,0.95);
    color: #333;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    margin-top: 2px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.8);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* AMap Label 独立样式 - 与 wrapper 内保持一致 */
.marker-label-text {
    background: rgba(255,255,255,0.95);
    color: #333;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.8);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===========================================
   预设图标选择器
   =========================================== */

.icon-picker-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.icon-picker-item {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    transition: all 0.2s;
}

.icon-picker-item:hover {
    border-color: #0d6efd;
    background: #f0f7ff;
    transform: scale(1.1);
}

.icon-picker-item.active {
    border-color: #0d6efd;
    background: #e3f2fd;
    box-shadow: 0 0 0 3px rgba(13,110,253,0.2);
}

.icon-picker-label {
    font-size: 0.78rem;
    color: #888;
    margin-bottom: 4px;
}

.icon-picker-custom-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.icon-picker-custom-row input {
    flex: 1;
}

/* 移动端适配 - 底图切换按钮 */
@media (max-width: 768px) {
    .basemap-switcher {
        top: 8px;
        right: 10px;
    }

    .basemap-switcher .bs-btn {
        padding: 4px 10px;
        font-size: 0.7rem;
    }

    .admin-basemap-switcher {
        top: 8px;
        left: 8px;
    }

    .admin-basemap-switcher .bs-btn {
        padding: 4px 10px;
        font-size: 0.7rem;
    }
}
@media (max-width: 768px) {
    /* 地图全屏 */
    .map-container {
        left: 0 !important;
    }

    /* 侧边栏 → 底部抽屉 */
    .sidebar {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: auto;
        max-height: 55vh;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
        transform: translateY(calc(100% - 48px));
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        flex-direction: column;
    }

    .sidebar.drawer-open {
        transform: translateY(0);
    }

    /* 移动端拉手 */
    .drawer-handle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 8px 0 4px;
        cursor: pointer;
        flex-shrink: 0;
        background: #fff;
        border-radius: 16px 16px 0 0;
    }

    .drawer-handle-bar {
        width: 40px;
        height: 4px;
        background: #ccc;
        border-radius: 2px;
    }

    .drawer-handle:active .drawer-handle-bar {
        background: #999;
    }

    /* 移动端侧边栏头部 */
    .sidebar-header {
        padding: 8px 16px 8px;
        flex-shrink: 0;
    }

    .sidebar-header h5 {
        font-size: 0.95rem;
    }

    /* 分类标签横向滚动 */
    .filter-section {
        padding: 8px 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-shrink: 0;
    }

    .category-filter-wrap {
        flex-wrap: nowrap;
    }

    /* 点位列表在抽屉内 */
    .point-list {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        padding: 4px 0;
    }

    .point-item {
        padding: 10px 14px;
    }

    .point-item .point-name {
        font-size: 0.88rem;
    }

    /* 移动端侧边栏切换按钮 */
    .sidebar-toggle {
        display: flex !important;
        left: 12px;
        bottom: calc(55vh + 16px);
        z-index: 960;
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

    .sidebar.drawer-open ~ .sidebar-toggle {
        bottom: 12px;
    }

    /* 信息窗体移动端适配 */
    .custom-info-window {
        max-width: calc(100vw - 40px);
        font-size: 0.85rem;
    }

    .custom-info-window .info-title {
        font-size: 1rem;
    }

    .custom-info-window .info-image {
        max-height: 140px;
    }

    /* 底部安全区域（iPhone 刘海/底部横条） */
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .sidebar-toggle {
        bottom: calc(55vh + 16px);
    }

    .sidebar.drawer-open ~ .sidebar-toggle {
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    /* 管理端 - 地图与表单上下布局 */
    .map-create-body {
        flex-direction: column;
    }

    .tool-panel {
        width: 100%;
        min-width: auto;
        max-height: 45vh;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }

    #drawingMap {
        height: 55vh;
        flex: none;
    }

    .draw-mode-group {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .draw-mode-btn {
        min-width: 90px;
        padding: 8px 6px;
    }
}

/* ===== 隐藏移动端拉手的桌面端 ===== */
.drawer-handle {
    display: none;
}

/* ===========================================
   管理端样式（原有）
   =========================================== */
body.admin-body {
    background: #f0f2f5;
    padding-top: 56px;
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px 80px;
}

.admin-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0;
}

.table-points th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.875rem;
}

.table-points td {
    vertical-align: middle;
    font-size: 0.9rem;
}

.table-points .point-color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}

.category-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.78rem;
    color: #fff;
}

.point-desc-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-btns .btn {
    padding: 2px 8px;
    font-size: 0.8rem;
}

.search-box {
    max-width: 280px;
}

.badge-count {
    font-size: 0.75rem;
}

.nav-tabs .nav-link {
    font-weight: 500;
}

.cat-color-preview {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 6px;
    border: 1px solid #ddd;
}

@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.8rem;
    }

    .admin-container {
        padding-left: 12px;
        padding-right: 12px;
    }

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