/**
 * Germany Map Widget Styles
 * 
 * Interaktive Deutschland-Karte
 * @package EinfachVerbeamtet
 */

/* ==========================================================================
   Section Layout
   ========================================================================== */

.ev-germany-map-section {
    padding: 80px 20px;
    background: linear-gradient(135deg, 
        rgba(var(--ci-primary-rgb, 0, 91, 187), 0.02) 0%, 
        rgba(var(--ci-secondary-rgb, 0, 150, 199), 0.05) 100%
    );
    overflow: hidden;
}

@media (max-width: 767px) {
    .ev-germany-map-section {
        padding: 50px 12px;
    }
}

@media (max-width: 480px) {
    .ev-germany-map-section {
        padding: 40px 8px;
    }
}

.ev-germany-map-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ==========================================================================
   Header
   ========================================================================== */

.ev-germany-map-header {
    text-align: center;
    margin-bottom: 50px;
}

.ev-germany-map-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    color: var(--ci-text-primary, #1a1a2e);
    margin: 0 0 15px 0;
    line-height: 1.2;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    -webkit-hyphens: auto;
    max-width: 100%;
}

.ev-germany-map-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--ci-text-secondary, #64748b);
    margin: 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   Map Wrapper
   ========================================================================== */

.ev-germany-map-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start;
    position: relative;
    max-width: 100%;
    overflow: hidden;
}

@media (max-width: 991px) {
    .ev-germany-map-wrapper {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* ==========================================================================
   Column Titles (above map / above list)
   ========================================================================== */

.ev-germany-map-column-title {
    font-size: clamp(1rem, 2vw, 1.35rem);
    font-weight: 600;
    color: var(--ci-text-primary, #1a1a2e);
    margin: 0 0 16px 0;
    padding-left: 4px;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    -webkit-hyphens: auto;
}

/* ==========================================================================
   SVG Container
   ========================================================================== */

.ev-germany-map-svg-container {
    position: relative;
    padding: 20px;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    transition: none;
    max-width: 100%;
    overflow: hidden;
}

.ev-germany-map-svg-container:hover {
    box-shadow: none;
}

.ev-germany-svg {
    width: 100%;
    height: auto;
    max-height: 600px;
}

@media (max-width: 767px) {
    .ev-germany-map-svg-container {
        padding: 10px;
    }
    
    .ev-germany-svg {
        max-height: 450px;
    }
}

@media (max-width: 480px) {
    .ev-germany-map-svg-container {
        padding: 5px;
    }
    
    .ev-germany-svg {
        max-height: 380px;
    }
}

/* ==========================================================================
   Map Regions - Base Styles
   ========================================================================== */

.ev-map-region {
    fill: var(--ci-primary, #005BBB);
    fill-opacity: 0.15;
    stroke: var(--ci-primary, #005BBB);
    stroke-width: 1.5;
    stroke-opacity: 0.4;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: none;
}

/* City States (Hamburg, Bremen, Berlin) - slightly different base style */
.ev-map-region.ev-map-city-state {
    fill-opacity: 0.25;
    stroke-width: 2;
}

/* ==========================================================================
   Map Regions - Hover State
   ========================================================================== */

.ev-map-region:hover,
.ev-map-region.is-active {
    fill: var(--ci-primary, #005BBB);
    fill-opacity: 0.5;
    stroke-opacity: 1;
    stroke-width: 2.5;
    filter: url(#ev-map-shadow);
    transform-origin: center;
}

.ev-map-region:hover {
    animation: ev-map-pulse 1.5s ease-in-out infinite;
}

@keyframes ev-map-pulse {
    0%, 100% {
        fill-opacity: 0.5;
    }
    50% {
        fill-opacity: 0.65;
    }
}

/* ==========================================================================
   Tooltip
   ========================================================================== */

.ev-germany-map-tooltip {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    
    background: white;
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: 
        0 10px 25px -5px rgba(0, 0, 0, 0.15),
        0 4px 6px -2px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 91, 187, 0.1);
    
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 150px;
    text-align: center;
}

.ev-germany-map-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.ev-germany-map-tooltip .tooltip-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ci-text-primary, #1a1a2e);
}

.ev-germany-map-tooltip .tooltip-hint {
    font-size: 0.75rem;
    color: var(--ci-primary, #005BBB);
    opacity: 0.8;
}

/* ==========================================================================
   Legend
   ========================================================================== */

.ev-germany-map-legend {
    background: white;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 10px 15px -3px rgba(0, 0, 0, 0.08);
    max-width: 100%;
    overflow: hidden;
}

@media (max-width: 767px) {
    .ev-germany-map-legend {
        padding: 20px 14px;
        border-radius: 16px;
    }
}

@media (max-width: 480px) {
    .ev-germany-map-legend {
        padding: 16px 10px;
        border-radius: 12px;
    }
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (max-width: 1200px) {
    .legend-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991px) {
    .legend-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    .legend-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

@media (max-width: 400px) {
    .legend-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--ci-text-primary, #1a1a2e);
    background: rgba(var(--ci-primary-rgb, 0, 91, 187), 0.03);
    border: 1px solid transparent;
    transition: all 0.25s ease;
    cursor: pointer;
    min-width: 0;
    overflow: hidden;
}

@media (max-width: 767px) {
    .legend-item {
        padding: 10px 12px;
        gap: 8px;
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    .legend-item {
        padding: 8px 10px;
        gap: 6px;
    }
}

.legend-item:hover,
.legend-item.is-active {
    background: rgba(var(--ci-primary-rgb, 0, 91, 187), 0.08);
    border-color: rgba(var(--ci-primary-rgb, 0, 91, 187), 0.2);
    transform: translateX(5px);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--ci-accent, #FFCC00);
    opacity: 0.8;
    transition: all 0.25s ease;
    flex-shrink: 0;
    animation: legend-dot-pulse 2s ease-in-out infinite;
}

@keyframes legend-dot-pulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 204, 0, 0.4);
    }
    50% {
        opacity: 1;
        transform: scale(1.15);
        box-shadow: 0 0 8px 2px rgba(255, 204, 0, 0.5);
    }
}

.legend-item:hover .legend-dot,
.legend-item.is-active .legend-dot {
    opacity: 1;
    transform: scale(1.3);
    box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.3);
    animation: none;
}

/* Bundesland Flag Icon */
.legend-flag {
    width: 24px;
    height: 16px;
    object-fit: contain;
    border-radius: 2px;
    flex-shrink: 0;
    margin-left: auto;
    opacity: 0.85;
    transition: all 0.25s ease;
}

.legend-item:hover .legend-flag,
.legend-item.is-active .legend-flag {
    opacity: 1;
    transform: scale(1.1);
}

.legend-name {
    font-size: clamp(0.78rem, 2vw, 0.9rem);
    font-weight: 500;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    -webkit-hyphens: auto;
    line-height: 1.3;
    min-width: 0;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.ev-map-region:focus {
    outline: 3px solid var(--ci-primary, #005BBB);
    outline-offset: 2px;
}

.legend-item:focus {
    outline: 2px solid var(--ci-primary, #005BBB);
    outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .ev-map-region,
    .legend-item,
    .legend-dot,
    .legend-flag,
    .ev-germany-map-tooltip {
        transition: none;
    }
    
    .ev-map-region:hover,
    .legend-dot {
        animation: none;
    }
}

/* ==========================================================================
   Dark Mode Support
   Force light appearance since the rest of the site has no dark mode.
   This prevents dark containers with unreadable dark text.
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    /* Force light section background */
    .ev-germany-map-section {
        background: linear-gradient(135deg, 
            rgba(var(--ci-primary-rgb, 0, 91, 187), 0.02) 0%, 
            rgba(var(--ci-secondary-rgb, 0, 150, 199), 0.05) 100%
        );
    }

    /* Force light container backgrounds */
    .ev-germany-map-legend {
        background: white !important;
        box-shadow: 
            0 4px 6px -1px rgba(0, 0, 0, 0.05),
            0 10px 15px -3px rgba(0, 0, 0, 0.08) !important;
        color-scheme: light;
    }

    .ev-germany-map-svg-container {
        background: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    /* Force dark text on light backgrounds */
    .ev-germany-map-title,
    .ev-germany-map-column-title {
        color: var(--ci-text-primary, #1a1a2e) !important;
    }
    
    .ev-germany-map-subtitle {
        color: var(--ci-text-secondary, #64748b) !important;
    }
    
    /* Legend items - force light appearance */
    .legend-item {
        color: var(--ci-text-primary, #1a1a2e) !important;
        background: rgba(var(--ci-primary-rgb, 0, 91, 187), 0.03) !important;
        border-color: transparent !important;
    }
    
    .legend-item:hover,
    .legend-item.is-active {
        background: rgba(var(--ci-primary-rgb, 0, 91, 187), 0.08) !important;
        border-color: rgba(var(--ci-primary-rgb, 0, 91, 187), 0.2) !important;
    }
    
    .legend-name {
        color: var(--ci-text-primary, #1a1a2e) !important;
    }

    /* Map SVG regions - keep original light mode styles */
    .ev-map-region {
        fill: var(--ci-primary, #005BBB);
        fill-opacity: 0.15;
        stroke: var(--ci-primary, #005BBB);
        stroke-width: 1.5;
        stroke-opacity: 0.4;
    }
    
    .ev-map-region:hover,
    .ev-map-region.is-active {
        fill: var(--ci-primary, #005BBB);
        fill-opacity: 0.5;
        stroke-opacity: 1;
        stroke-width: 2.5;
    }
    
    /* Tooltip - force light */
    .ev-germany-map-tooltip {
        background: white !important;
        border-color: rgba(0, 91, 187, 0.1) !important;
        color-scheme: light;
    }
    
    .ev-germany-map-tooltip .tooltip-name {
        color: var(--ci-text-primary, #1a1a2e) !important;
    }
    
    .ev-germany-map-tooltip .tooltip-hint {
        color: var(--ci-primary, #005BBB) !important;
    }
}

/* ==========================================================================
   Elementor Compatibility
   ========================================================================== */

.elementor-widget-container .ev-germany-map-section {
    padding: 0;
}

.elementor-section.elementor-section-boxed .ev-germany-map-container {
    max-width: 100%;
}

/* ==========================================================================
   Compact Map for Hero Section
   ========================================================================== */

.ev-germany-map-compact {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ev-germany-map-compact .ev-germany-map-svg-container {
    background: transparent;
    box-shadow: none;
    padding: 0;
    max-width: 420px;
    width: 100%;
}

.ev-germany-map-compact .ev-germany-svg {
    width: 100%;
    height: auto;
    max-height: 500px;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.15));
}

/* Map regions in Hero - lighter/inverted style for dark backgrounds */
.ev-hero--bg-image .ev-germany-map-compact .ev-map-region {
    fill: rgba(255, 255, 255, 0.85);
    fill-opacity: 1;
    stroke: var(--ci-primary, #264850);
    stroke-width: 1.5;
    stroke-opacity: 0.6;
}

.ev-hero--bg-image .ev-germany-map-compact .ev-map-region:hover,
.ev-hero--bg-image .ev-germany-map-compact .ev-map-region.is-active {
    fill: var(--ci-accent, #007caf);
    fill-opacity: 1;
    stroke: var(--ci-primary, #264850);
    stroke-width: 2.5;
    stroke-opacity: 1;
}

/* Hero Map Container */
.ev-hero__map {
    flex: 0 0 45%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

/* Hero Map Intro Text */
.ev-hero__map-intro {
    text-align: center;
    margin-bottom: 16px;
    max-width: 340px;
}

.ev-hero__map-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ci-primary, #264850);
    margin: 0 0 6px 0;
}

.ev-hero__map-desc {
    font-size: 0.92rem;
    color: var(--ci-muted, #6B7280);
    margin: 0 0 4px 0;
    line-height: 1.5;
}

.ev-hero__map-cta {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ci-primary, #264850);
    margin: 0;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .ev-hero__map {
        flex: 1;
        min-height: 350px;
        margin-top: 30px;
    }
    
    .ev-germany-map-compact .ev-germany-map-svg-container {
        max-width: 320px;
    }
}

@media (max-width: 767px) {
    .ev-hero__map {
        min-height: 280px;
    }
    
    .ev-germany-map-compact .ev-germany-map-svg-container {
        max-width: 260px;
    }
}
