/* ======================================
   公安交警停车指引 H5 — 政务化样式表
   ====================================== */

   :root {
    /* 政务专属蓝色主题 (警察蓝) */
    --primary-color: #0052d9;
    --primary-light: #e6f0ff;
    --primary-dark: #003cab;
    --success-color: #00a870; /* 建议/畅通颜色 */
    --success-light: #e1f5eb;
    --warning-color: #ed7b2f; /* 缓行颜色 */
    --warning-light: #fef0e5;
    --danger-color: #e34d59;  /* 拥堵/无空位颜色 */
    --danger-light: #fceceb;
    --text-main: #333333;
    --text-regular: #666666;
    --text-secondary: #999999;
    --bg-color: #f3f5f8;
    --border-color: #e3e6eb;
    
    /* 适配底部安全区 */
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
    -webkit-font-smoothing: antialiased;
    background-color: var(--bg-color);
}

/* 基础图标样式 */
.icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
}
.icon-mini {
    width: 0.8em;
    height: 0.8em;
}

/* ===== 顶部导航栏 ===== */
.toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 82, 217, 0.2);
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 14px;
    border-radius: 20px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    transition: background 0.2s;
    color: #fff;
}

.toolbar-left:active {
    background: rgba(255,255,255,0.2);
}

.activity-text {
    font-size: 15px;
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toolbar-right {
    display: flex;
    gap: 12px;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 14px;
    padding: 6px;
    cursor: pointer;
    opacity: 0.9;
}

.toolbar-btn:active {
    opacity: 0.6;
}

/* ===== 区域选择弹窗 ===== */
.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1500;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.2s;
}

.activity-picker {
    position: fixed;
    top: 0; left: 0; right: 0;
    max-height: 70vh;
    background: #fff;
    border-radius: 0 0 16px 16px;
    z-index: 1600;
    display: flex;
    flex-direction: column;
    animation: slideDown 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

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

.picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.picker-close {
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.picker-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px;
}

.activity-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.1s;
}

.activity-item:active {
    background: var(--bg-color);
}

.activity-item.active {
    background: var(--primary-light);
}

.activity-item-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-item.active .activity-item-name {
    color: var(--primary-color);
}

.activity-item-status {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: normal;
    border: 1px solid transparent;
}

.status-not-started { color: var(--text-regular); border-color: var(--border-color); background: var(--bg-color); }
.status-ongoing { color: var(--success-color); border-color: var(--success-light); background: var(--success-light); }
.status-ended { color: var(--text-secondary); background: var(--bg-color); }

.activity-item-info {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-regular);
}

.info-element {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===== 地图容器 ===== */
#mapContainer {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* ===== 公告提示悬浮条 (政务黄/红) ===== */
.tips-bar {
    position: fixed;
    top: 60px;
    left: 12px;
    right: 12px;
    z-index: 500;
    background: #fff8e6;
    border-left: 4px solid var(--warning-color);
    border-radius: 6px;
    padding: 12px 36px 12px 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    animation: slideIn 0.3s ease-out;
}

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

.tips-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.warning-icon {
    font-size: 18px;
    color: var(--warning-color);
    flex-shrink: 0;
    margin-top: 1px;
}

.tips-text {
    font-size: 14px;
    color: #b75e11;
    line-height: 1.5;
    text-align: justify;
}

.tips-close {
    position: absolute;
    right: 8px;
    top: 12px;
    font-size: 18px;
    color: var(--text-secondary);
    padding: 4px;
    cursor: pointer;
}

/* ===== 底部停车场面板 ===== */
.parking-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -2px 16px rgba(0,0,0,0.06);
    transition: max-height 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    max-height: calc(100px + var(--safe-area-inset-bottom));
    overflow: hidden;
    padding-bottom: var(--safe-area-inset-bottom);
}

.parking-panel.expanded {
    max-height: 65vh;
}

.panel-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0 6px;
    cursor: pointer;
}

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

.handle-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== 筛选标签 ===== */
.filter-tabs {
    display: flex;
    gap: 8px;
    padding: 10px 14px 12px;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-tab {
    flex-shrink: 0;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-regular);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-tab.active {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(0, 82, 217, 0.12);
}

/* ===== 停车场列表 ===== */
.parking-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: calc(65vh - 110px);
    padding: 0 16px 0 16px;
}

.parking-card {
    display: flex;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.parking-card:last-child {
    border-bottom: none;
    margin-bottom: 20px;
}

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

.parking-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    row-gap: 6px;
}

.parking-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 500;
    flex-shrink: 0;
}

.tag-free {
    background: var(--success-light);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.tag-paid {
    background: var(--bg-color);
    color: var(--text-regular);
    border: 1px solid var(--border-color);
}

.tag-temp {
    background: rgba(244, 196, 48, 0.16);
    color: #b77900;
    border: 1px solid rgba(244, 196, 48, 0.8);
}

.tag-temp-route {
    background: rgba(244, 196, 48, 0.16);
    color: #9c6a00;
    border: 1px solid rgba(244, 196, 48, 0.85);
}

.tag-temp-area {
    background: rgba(111, 168, 255, 0.12);
    color: #2d62d7;
    border: 1px solid rgba(111, 168, 255, 0.55);
}

.parking-detail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-regular);
}

.parking-detail span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.temp-card {
    position: relative;
    align-items: flex-start;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.temp-card.active {
    background: linear-gradient(90deg, rgba(0, 82, 217, 0.08), rgba(0, 82, 217, 0.02));
}

.temp-card.active::before {
    content: '';
    position: absolute;
    left: -16px;
    top: 12px;
    bottom: 12px;
    width: 4px;
    border-radius: 999px;
    background: var(--primary-color);
}

.temp-detail {
    gap: 10px;
}

.temp-detail span:last-child {
    color: var(--text-secondary);
}

.temp-nav .nav-btn {
    background: linear-gradient(135deg, #2675ff, #0052d9);
}

.parking-berths {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
    border-left: 1px solid var(--border-color);
    padding-left: 12px;
}

.berths-num {
    font-size: 24px;
    font-weight: bold;
    line-height: 1.1;
}

.berths-num.plenty { color: var(--success-color); }
.berths-num.few { color: var(--warning-color); }
.berths-num.full { color: var(--danger-color); }

.berths-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.parking-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    min-width: 72px;
    text-align: center;
}

.nav-btn {
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    box-shadow: 0 4px 8px rgba(0, 82, 217, 0.2);
}

.nav-btn:active {
    background: var(--primary-dark);
}

.nav-label {
    font-size: 11px;
    color: var(--primary-color);
    font-weight: 500;
}

.nav-distance {
    font-size: 10px;
    color: var(--text-secondary);
    line-height: 1.2;
    white-space: nowrap;
}

/* ===== 空状态 ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 50px 0;
}

.empty-icon {
    font-size: 48px;
    color: #cfd4db;
    margin-bottom: 16px;
}

.empty-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== 底部页脚 ===== */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 11px;
    color: rgba(102, 102, 102, 0.7);
    z-index: 400;
    pointer-events: none;
    padding: 6px 0;
    background: linear-gradient(to top, rgba(255,255,255,0.6), transparent);
}

/* ===== 高德地图专属：政务化信息窗体样式 ===== */
.amap-info-content {
    padding: 0;
    border-radius: 8px;
    border: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.marker-info {
    padding: 14px 16px;
    min-width: 220px;
}

.marker-info-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 8px;
}

.marker-info-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.marker-info-berths {
    font-size: 14px;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.marker-info-berths span.highlight {
    font-size: 16px;
    font-weight: 600;
}

.b-green { color: var(--success-color); }
.b-orange { color: var(--warning-color); }
.b-red { color: var(--danger-color); }

.marker-info-fee {
    font-size: 12px;
    color: var(--text-regular);
    display: flex;
    align-items: flex-start;
    gap: 4px;
}

.marker-info-nav {
    display: block;
    margin-top: 12px;
    padding: 10px 0;
    background: var(--primary-color);
    color: #fff;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    text-decoration: none;
    font-weight: 500;
}

.marker-info-nav:active {
    background: var(--primary-dark);
}

/* 覆盖高德原生 UI */
.amap-logo, .amap-copyright {
    display: none !important;
}
.amap-scalecontrol {
    bottom: calc(105px + var(--safe-area-inset-bottom)) !important;
    margin-left: 12px;
}

/* ===== 悬浮标注开关按钮 ===== */
.float-btn {
    position: fixed;
    right: 14px;
    top: 62px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    border: 2px solid #fff;
    /* 默认关闭状态：白色 */
    background: #fff;
    color: var(--text-secondary);
}

.float-btn .icon {
    width: 18px;
    height: 18px;
    transition: all 0.3s ease;
}

/* 激活状态：蓝色，表示标注已显示 */
.float-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 12px rgba(0, 82, 217, 0.35);
}

.float-btn:active {
    transform: scale(0.9);
}

/* ===== PC 端大屏适配（iframe 嵌入后台时） ===== */
@media (min-width: 768px) {
    .toolbar {
        height: 48px;
        padding: 0 24px;
    }

    .activity-text {
        max-width: 300px;
        font-size: 14px;
    }

    /* 地图占满左侧 */
    #mapContainer {
        top: 48px;
        right: 380px;
    }

    /* 停车面板变为右侧固定侧边栏 */
    .parking-panel {
        position: fixed;
        top: 48px;
        right: 0;
        bottom: 0;
        left: auto;
        width: 380px;
        max-height: none !important;
        border-radius: 0;
        box-shadow: -2px 0 12px rgba(0,0,0,0.06);
        overflow: hidden;
        display: flex;
        flex-direction: column;
        padding-bottom: 0;
    }

    .parking-panel.expanded {
        max-height: none;
    }

    /* 隐藏手机端拉手交互 */
    .panel-handle {
        display: none;
    }

    /* 筛选标签 PC 端不换行 */
    .filter-tabs {
        padding: 12px 16px;
        flex-shrink: 0;
    }

    /* 列表撑满 */
    .parking-list {
        flex: 1;
        max-height: none;
        overflow-y: auto;
    }

    /* 停车卡片 PC 端紧凑 */
    .parking-card {
        padding: 14px 0;
    }

    .parking-name {
        font-size: 15px;
    }

    /* 高德比例尺位置调整 */
    .amap-scalecontrol {
        bottom: 12px !important;
    }

    /* 公告条 PC 端宽度不超出地图区 */
    .tips-bar {
        top: 56px;
        right: 392px;
    }

    /* 活动选择弹窗 PC 端居中 */
    .activity-picker {
        top: 48px;
        left: auto;
        right: 0;
        width: 380px;
        max-height: calc(100vh - 48px);
        border-radius: 0;
    }

    /* 底部 footer 隐藏 */
    .footer {
        display: none;
    }
}

/* 超大屏幕：侧边更宽 */
@media (min-width: 1400px) {
    #mapContainer {
        right: 420px;
    }

    .parking-panel {
        width: 420px;
    }

    .tips-bar {
        right: 432px;
    }

    .activity-picker {
        width: 420px;
    }
}

.marker-float-label {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px 4px 6px;
    border-radius: 12px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    cursor: pointer;
    border: 1.5px solid rgba(255,255,255,0.7);
    transition: transform 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.marker-float-label:active {
    transform: scale(0.92);
}

.marker-float-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
}

.marker-float-text {
    font-size: 12px;
    letter-spacing: 0.5px;
}

.marker-float-nav {
    display: flex;
    align-items: center;
    margin-left: 2px;
    opacity: 0.85;
}

.marker-float-nav .icon {
    width: 12px;
    height: 12px;
}

.marker-float-arrow {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #00a870;
    margin: 0 auto;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}
