/**
 * DeutschGuide — Interactive Map Styles
 */

.map-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-6);
}

.map-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-md);
}

.map-shell {
    isolation: isolate;
    overflow: hidden;
}

.map-shell svg {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: auto;
    max-height: 680px;
    max-height: min(72vh, 680px);
}

.map-germany-badge {
    position: absolute;
    top: var(--space-4);
    left: var(--space-4);
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    max-width: calc(100% - 2rem);
    padding: var(--space-2) var(--space-3);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.86);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 0.7rem;
    font-weight: var(--font-bold);
    white-space: nowrap;
}

.map-germany-badge img {
    width: 24px;
    height: 16px;
    border-radius: 3px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.10);
}

.map-label-layer {
    position: absolute;
    inset: var(--space-6);
    z-index: 2;
    pointer-events: none;
}

.map-label {
    position: absolute;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 150px;
    min-height: 24px;
    padding: 4px 7px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.78);
    color: var(--text-primary);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.10);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    pointer-events: auto;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.map-label:hover,
.map-label.active {
    transform: translate(-50%, -50%) translateY(-2px);
    border-color: rgba(255, 107, 53, 0.82);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 26px rgba(11, 61, 145, 0.18);
}

.map-label img {
    width: 17px;
    height: 12px;
    flex: 0 0 auto;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.10);
}

.map-label span {
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: var(--font-extrabold);
    line-height: 1;
}

.map-label small {
    max-width: 92px;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.58rem;
    font-weight: var(--font-bold);
    line-height: 1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel-state-head {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.panel-state-head img {
    width: 32px;
    height: 20px;
    border-radius: 4px;
    object-fit: cover;
    box-shadow: 0 0 0 1px var(--border-color);
}

.state-city-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.state-city-panel-head h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--text-sm);
    text-transform: uppercase;
}

.state-city-panel-head span:not(.badge) {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
}

.state-city-search {
    width: 100%;
    margin-bottom: var(--space-3);
}

.state-city-search input {
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
}

.state-city-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
    max-height: 460px;
    overflow-y: auto;
    padding-right: 4px;
}

.state-city-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    min-height: 38px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    line-height: 1.2;
    transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.state-city-link:hover {
    transform: translateY(-1px);
    color: var(--primary);
    border-color: var(--border-color-hover);
    background: var(--bg-hover);
}

.state-city-link strong {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    background: rgba(255, 107, 53, 0.14);
    color: var(--primary);
    font-size: 0.58rem;
}

.map-state {
    fill: var(--border-color);
    stroke: var(--bg-surface);
    stroke-width: 1.5;
    transition: fill var(--transition-fast), transform var(--transition-fast), filter var(--transition-fast);
    cursor: pointer;
}

.map-state:hover {
    fill: var(--primary-light);
    filter: drop-shadow(0px 8px 16px rgba(11, 61, 145, 0.2));
    transform: translateY(-2px);
}

.map-state.active {
    fill: var(--primary);
    stroke: var(--accent);
    stroke-width: 2;
}

.map-tooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    color: #FFFFFF;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    z-index: var(--z-tooltip);
    opacity: 0;
    transition: opacity var(--transition-fast);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.map-legend {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.map-legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.map-legend-color {
    width: 1rem;
    height: 1rem;
    border-radius: var(--radius-xs);
}

.map-legend-color.default { background: var(--border-color); }
.map-legend-color.hover { background: var(--primary-light); }
.map-legend-color.selected { background: var(--primary); }

[data-theme="dark"] .map-germany-badge,
[data-theme="dark"] .map-label {
    background: rgba(15, 23, 42, 0.82);
    border-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 768px) {
    .map-label-layer {
        inset: var(--space-4) var(--space-2);
    }

    .map-label {
        min-height: 22px;
        padding: 3px 5px;
    }

    .map-label small {
        display: none;
    }

    .map-germany-badge {
        top: var(--space-3);
        left: var(--space-3);
        font-size: 0.62rem;
    }

    .map-shell svg {
        min-width: 0;
    }

    .state-city-grid {
        grid-template-columns: 1fr;
        max-height: 380px;
    }
}
