.us-svg-map-container {
    position: relative;
    width: 100%;
    height: 500px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* Lazy Loading States */
.us-svg-map-lazy {
    background-color: #f8f8f8;
    background-image: linear-gradient(45deg, #f1f1f1 25%, transparent 25%, transparent 75%, #f1f1f1 75%, #f1f1f1),
                      linear-gradient(45deg, #f1f1f1 25%, transparent 25%, transparent 75%, #f1f1f1 75%, #f1f1f1);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    animation: lazyLoadPulse 1.5s ease-in-out infinite;
}

@keyframes lazyLoadPulse {
    0% { opacity: 0.6; }
    50% { opacity: 0.8; }
    100% { opacity: 0.6; }
}

.us-svg-map-lazy .us-svg-map-loading {
    opacity: 1;
    visibility: visible;
}

/* Map Controls */
.us-svg-map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    display: flex;
    gap: 5px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.us-svg-map-container:hover .us-svg-map-controls {
    opacity: 1;
    transform: translateY(0);
}

.us-svg-map-control {
    width: 30px;
    height: 30px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    transform: scale(1);
}

.us-svg-map-control:hover {
    background-color: #f0f0f0;
    transform: scale(1.1);
}

.us-svg-map-control:active {
    transform: scale(0.95);
}

/* Search */
.us-svg-map-search {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 100;
    width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    transform: translateX(-10px);
    opacity: 0;
}

.us-svg-map-container:hover .us-svg-map-search {
    transform: translateX(0);
    opacity: 1;
}

.us-svg-map-search:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
    transform: translateX(0) scale(1.02);
}

/* Filter */
.us-svg-map-filter {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    transform: translateX(10px);
    opacity: 0;
}

.us-svg-map-container:hover .us-svg-map-filter {
    transform: translateX(0);
    opacity: 1;
}

/* Lightbox */
.us-svg-map-lightbox {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: auto;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.us-svg-map-lightbox.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

.us-svg-map-lightbox-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    transform: rotate(0deg);
}

.us-svg-map-lightbox-close:hover {
    background-color: #f0f0f0;
    transform: rotate(90deg);
}

/* Tooltips */
.am5-tooltip {
    background-color: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    color: #333 !important;
    transition: all 0.2s ease !important;
    transform-origin: center bottom !important;
    animation: tooltipFadeIn 0.2s ease forwards !important;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(5px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Legend */
.am5-Legend {
    background-color: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    padding: 10px !important;
    transition: all 0.3s ease !important;
    transform: translateY(10px);
    opacity: 0;
}

.am5-Legend.visible {
    transform: translateY(0);
    opacity: 1;
}

.am5-Legend-item {
    padding: 5px 10px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    transform: translateX(0);
}

.am5-Legend-item:hover {
    background-color: #f0f0f0 !important;
    transform: translateX(5px);
}

/* Loading State */
.us-svg-map-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.us-svg-map-loading.active {
    opacity: 1;
    visibility: visible;
}

.us-svg-map-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.us-svg-map-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    transform: scale(0.9);
}

.us-svg-map-error.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.us-svg-map-error-icon {
    font-size: 48px;
    color: #dc3545;
    margin-bottom: 10px;
    animation: errorIconShake 0.5s ease;
}

@keyframes errorIconShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.us-svg-map-error-message {
    font-size: 16px;
    color: #333;
    margin-bottom: 15px;
    animation: fadeInUp 0.5s ease 0.2s forwards;
    opacity: 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.us-svg-map-error-retry {
    padding: 8px 16px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    transform: scale(1);
    animation: fadeInUp 0.5s ease 0.4s forwards;
    opacity: 0;
}

.us-svg-map-error-retry:hover {
    background-color: #0056b3;
    transform: scale(1.05);
}

.us-svg-map-error-retry:active {
    transform: scale(0.95);
}

/* Map Region Animations */
.am5-MapPolygon {
    transition: fill 0.3s ease, stroke 0.3s ease, stroke-width 0.3s ease !important;
}

.am5-MapPolygon:hover {
    filter: brightness(0.95) !important;
    transform-origin: center !important;
    animation: regionPulse 1s ease infinite !important;
}

@keyframes regionPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* Marker Animations */
.am5-MapPoint {
    transition: all 0.3s ease !important;
}

.am5-MapPoint:hover {
    transform: scale(1.2) !important;
    filter: brightness(1.1) !important;
}

/* Line Animations */
.am5-MapLine {
    transition: stroke 0.3s ease, stroke-width 0.3s ease !important;
}

.am5-MapLine:hover {
    stroke-width: 3px !important;
    filter: brightness(1.1) !important;
}

/* Label Animations */
.am5-Label {
    transition: all 0.3s ease !important;
}

.am5-Label:hover {
    transform: scale(1.1) !important;
    filter: brightness(1.1) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .us-svg-map-container {
        height: 400px;
    }

    .us-svg-map-search {
        width: 150px;
    }

    .us-svg-map-lightbox {
        width: 90%;
        max-height: 90vh;
    }
}

@media (max-width: 480px) {
    .us-svg-map-container {
        height: 300px;
    }

    .us-svg-map-search {
        width: 120px;
        font-size: 12px;
    }

    .us-svg-map-control {
        width: 25px;
        height: 25px;
    }
}

/* Accessibility */
.us-svg-map-container:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.us-svg-map-container:focus:not(:focus-visible) {
    outline: none;
}

.us-svg-map-container:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .us-svg-map-container {
        border: none;
        height: auto;
        min-height: 400px;
    }

    .us-svg-map-controls,
    .us-svg-map-search,
    .us-svg-map-filter {
        display: none;
    }
}

.tfm-map {
    width: 100%;
    height: 100%;
    min-height: 300px;
}

.tfm-map-legend {
    margin-top: 20px;
    padding: 10px;
    background: transparent;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 150px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border: 1px solid;
}

.legend-text {
    white-space: nowrap;
}

/* Responsive styles */
@media screen and (max-width: 480px) {
    .legend-items {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .legend-item {
        width: 100%;
        justify-content: center;
    }
}

/* Tablet styles */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .legend-items {
        gap: 15px;
    }

    .legend-item {
        min-width: 130px;
    }
} 