/* ========================================
   Map Styles - Bangladesh Route Master
   Mobile-First Design
   ======================================== */

.map-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    border-radius: var(--radius-xl);
    overflow: hidden;
    min-height: 350px;
}

.map-container {
    flex: 1;
    position: relative;
    background: transparent;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-sm);
}

[data-theme="dark"] .map-container {
    background: transparent;
}

#bangladesh-map {
    width: 100%;
    height: 100%;
    max-height: 100%;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
}

/* District Styles - Polygon shapes with proper borders */
.district {
    stroke: #333;
    stroke-width: 1;
    cursor: default;
    pointer-events: none;
    transition: all var(--transition-fast);
    opacity: 0.9;
}

.district.start {
    fill: var(--map-start) !important;
    stroke: #15803d !important;
    stroke-width: 3 !important;
    filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.8));
    animation: pulse-start 2s ease-in-out infinite;
    opacity: 1 !important;
}

.district.end {
    fill: var(--map-end) !important;
    stroke: #b91c1c !important;
    stroke-width: 3 !important;
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.8));
    animation: pulse-end 2s ease-in-out infinite;
    opacity: 1 !important;
}

.district.path {
    fill: var(--map-path) !important;
    stroke: var(--secondary-dark) !important;
    stroke-width: 2 !important;
    filter: drop-shadow(0 0 4px rgba(99, 102, 241, 0.6));
    opacity: 1 !important;
}

.district.hint {
    fill: var(--accent) !important;
    stroke: var(--accent-dark) !important;
    stroke-width: 2 !important;
    animation: pulse-hint 1s ease-in-out infinite;
}

.district.invalid {
    fill: var(--error) !important;
    animation: shake 0.5s ease-in-out;
}

.district.highlighted {
    fill: #fbbf24 !important;
    stroke: #b45309 !important;
    stroke-width: 3 !important;
    filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.9));
    opacity: 1 !important;
    animation: pulse-highlight 0.5s ease-in-out;
}

@keyframes pulse-highlight {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Path Lines */
.path-line {
    stroke: var(--map-path-line);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 10, 5;
    fill: none;
    animation: dash-flow 1s linear infinite;
}

/* District Labels */
.district-label {
    font-size: 9px;
    font-weight: 600;
    fill: var(--text-primary);
    text-anchor: middle;
    pointer-events: none;
    opacity: 0.9;
    transition: opacity var(--transition-fast);
}

.district-label.hidden {
    opacity: 0;
    visibility: hidden;
}

.district-label.active {
    font-size: 10px;
    fill: white;
    opacity: 1;
}

/* Start/End labels with full name */
.district-label.start-label {
    font-size: 12px;
    font-weight: 700;
    fill: #15803d;
    opacity: 1;
    filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.9));
}

.district-label.end-label {
    font-size: 12px;
    font-weight: 700;
    fill: #b91c1c;
    opacity: 1;
    filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.9));
}

/* Post markers on map */
.post-marker {
    font-size: 18px;
    text-anchor: middle;
    pointer-events: none;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3));
}

.post-marker.start-marker {
    animation: bounce-marker 1.5s ease-in-out infinite;
}

.post-marker.end-marker {
    animation: bounce-marker 1.5s ease-in-out infinite;
}

@keyframes bounce-marker {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Map Legend */
.map-legend {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: var(--radius-full);
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
}

.legend-dot.start {
    background: var(--map-start);
}

.legend-dot.end {
    background: var(--map-end);
}

.legend-dot.path {
    background: var(--map-path);
}

/* Map Markers */
.map-marker {
    position: absolute;
    width: 30px;
    height: 30px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.map-marker.start-marker::before {
    content: '🚩';
    font-size: 24px;
    animation: bounce 1s ease-in-out infinite;
}

.map-marker.end-marker::before {
    content: '🎯';
    font-size: 24px;
    animation: bounce 1s ease-in-out infinite 0.5s;
}

/* Animations */
@keyframes pulse-start {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.6)); }
    50% { filter: drop-shadow(0 0 15px rgba(34, 197, 94, 0.9)); }
}

@keyframes pulse-end {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.6)); }
    50% { filter: drop-shadow(0 0 15px rgba(239, 68, 68, 0.9)); }
}

@keyframes pulse-hint {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

@keyframes pulse-neighbor {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

@keyframes dash-flow {
    to { stroke-dashoffset: -12; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Responsive - Mobile First */
@media (min-width: 600px) {
    .map-panel {
        min-height: 450px;
    }
}

@media (min-width: 900px) {
    .map-panel {
        min-height: 600px;
    }

    .map-legend {
        gap: var(--space-lg);
    }
}
