/* EV-BOY 充電站互動地圖樣式 */

/* 性能優化 */
* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    /* 啟用硬體加速 */
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#form1 {
    display: flex;
    height: 100vh;
    margin: 0;
    width: 100%;
    overflow: hidden;
}

.map-container {
    flex: 1;
    min-width: 200px;
    height: 100%;
    position: relative;
    overflow: hidden;
    /* 優化容器性能 */
    will-change: transform;
    contain: layout style paint;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* 優化地圖渲染性能 */
    will-change: transform;
    transform: translateZ(0);
}

.map-filter {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    background-color: #ffffff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    max-width: 300px;
}

.filter-button {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    min-width: 160px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.filter-button:hover {
    background-color: #f8f9fa;
}

.filter-button-text {
    font-size: 14px;
    color: #475569;
    font-weight: 500;
}

.filter-count {
    background-color: #475569;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 10px;
}

.map-legend {
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 1000;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #ffffff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.legend-marker {
    width: 20px;
    height: 33px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.legend-marker-available {
    background-image: url('https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-green.png');
}

.legend-marker-unavailable {
    background-image: url('https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-red.png');
}

.legend-marker-unknown {
    background-image: url('https://raw.githubusercontent.com/pointhi/leaflet-color-markers/master/img/marker-icon-2x-blue.png');
}

.fast-charging-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: 3px solid #FFD700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
}

.fast-charging-icon span {
    color: #FFD700;
    font-size: 14px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 6px;
}

.legend-item span {
    font-size: 14px;
    color: #475569;
}

/* 地圖過濾器樣式 */
.filter-label {
    font-size: 12px;
    color: #475569;
    margin-bottom: 4px;
    font-weight: 500;
}

.provider-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    max-width: 300px;
}

.provider-button {
    padding: 4px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background-color: white;
    font-size: 11px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 100px;
}

.provider-button:hover {
    background-color: #f8fafc;
    border-color: #d1d5db;
}

.provider-button.active {
    background-color: #475569;
    color: white;
    border-color: #475569;
}

/* Mobile popup styles */
.popup-content-mobile {
    width: 100%;
}

.popup-title-mobile {
    font-size: 18px !important;
}

.popup-content-mobile p,
.popup-content-mobile ul {
    font-size: 16px !important;
}

.popup-content-mobile li {
    margin-bottom: 8px;
}

/* Increase touch target size on mobile */
@media (max-width: 768px) {
    .leaflet-popup-content {
        max-width: 280px;
        margin: 8px;
    }

    .leaflet-popup-close-button {
        font-size: 22px !important;
        padding: 8px 10px !important;
    }
}

/* 提供商彈出窗口樣式 */
.provider-popup {
    display: none;
    position: absolute;
    top: 60px;
    right: 15px;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    width: 300px;
    z-index: 2000;
    max-height: 70vh;
    flex-direction: column;
    border: 1px solid #e5e7eb;
}

.provider-popup-header {
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
}

.provider-popup-title {
    font-weight: 600;
    font-size: 16px;
    color: #1e293b;
}

.provider-popup-close {
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    color: #64748b;
    padding: 5px;
}

.provider-list {
    overflow-y: auto;
    padding: 12px 15px;
    max-height: 50vh;
}

.provider-item {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.provider-item input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
    cursor: pointer;
}

.provider-item label {
    font-size: 14px;
    color: #475569;
    cursor: pointer;
}

.provider-popup-footer {
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid #e5e7eb;
}

.action-button {
    padding: 8px 16px;
    border: 1px solid #e5e7eb;
    background-color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #475569;
    transition: all 0.2s ease;
    min-width: 80px;
}

/* 手機將標記做得更大更易點選 */
.popup-title-mobile {
    font-size: 18px !important;
    margin-bottom: 10px !important;
}

.popup-content-mobile p, .popup-content-mobile li {
    font-size: 16px !important;
    margin-bottom: 8px !important;
}

/* 手機上小型按鈕調整 */
@media (max-width: 768px) {
    .leaflet-control-zoom a {
        width: 36px !important;
        height: 36px !important;
        line-height: 36px !important;
        font-size: 18px !important;
    }

    .action-button {
        padding: 10px 18px;
        font-size: 16px;
        min-width: 100px;
    }
}

.action-button:hover {
    background-color: #f8fafc;
    border-color: #d1d5db;
}

.action-button.primary {
    background-color: #475569;
    color: white;
    border-color: #475569;
}

.action-button.primary:hover {
    background-color: #334155;
    border-color: #334155;
}

/* 確保地圖容器正確顯示 */
.map-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Loading spinner */
.loading-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    flex-direction: column;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #00a8e1; /* EV-BOY blue color */
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 18px;
    color: #333;
    font-weight: bold;
}

.header-container {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1000;
    padding: 12px 15px;
    background-color: #ffffff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 48px;
    box-sizing: border-box;
}

.logo {
    height: 32px;
    width: auto;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

/* 響應式設計，避免在手機上重疊 */
@media (max-width: 768px) {
    .header-container {
        display: none; /* 在手機上隐藏標題 */
    }
}