/**
 * TT Map Styles
 * Google Maps widget with custom markers and overlay
 *
 * @package TT_Elementor_Flux
 * @since 1.0.0
 */

/* Map Wrapper */
.tt-flux-tt-map {
    position: relative;
    width: 100%;
}

.tt-map-wrapper {
    position: relative;
    width: 100%;
}

/* Map Container */
.tt-map-container {
    width: 100%;
    height: 400px;
    background-color: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
}

.tt-map-container iframe,
.tt-map-container > div {
    width: 100% !important;
    height: 100% !important;
}

/* Editor Placeholder */
.tt-map-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 40px;
}

.tt-map-placeholder__icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.9;
}

.tt-map-placeholder__icon i {
    font-size: 64px;
}

.tt-map-placeholder__text p {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
}

.tt-map-placeholder__hint {
    font-size: 14px !important;
    opacity: 0.8;
    font-weight: 400 !important;
}

/* Error Message */
.tt-map-error {
    padding: 20px;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    text-align: center;
}

/* Loading State */
.tt-map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    background-color: #f3f4f6;
}

.tt-map-loading__spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: tt-map-spin 1s linear infinite;
}

@keyframes tt-map-spin {
    to {
        transform: rotate(360deg);
    }
}

/* API Error */
.tt-map-api-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px dashed #fca5a5;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
}

.tt-map-api-error__icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.tt-map-api-error__title {
    font-size: 20px;
    font-weight: 600;
    color: #dc2626;
    margin-bottom: 12px;
}

.tt-map-api-error__message {
    font-size: 14px;
    color: #7f1d1d;
    line-height: 1.6;
    margin-bottom: 20px;
    max-width: 400px;
}

.tt-map-api-error__help a {
    display: inline-block;
    padding: 12px 24px;
    background-color: #dc2626;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tt-map-api-error__help a:hover {
    background-color: #b91c1c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* Overlay Container */
.tt-map-overlay {
    position: absolute;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 24px;
    z-index: 10;
    width: 300px;
    box-sizing: border-box;
}

/* Overlay Positions - 9 positions */
.tt-map-overlay--top-left {
    top: 20px;
    left: 20px;
}

.tt-map-overlay--top-center {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.tt-map-overlay--top-right {
    top: 20px;
    right: 20px;
}

.tt-map-overlay--center-left {
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
}

.tt-map-overlay--center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.tt-map-overlay--center-right {
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
}

.tt-map-overlay--bottom-left {
    bottom: 20px;
    left: 20px;
}

.tt-map-overlay--bottom-center {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.tt-map-overlay--bottom-right {
    bottom: 20px;
    right: 20px;
}

/* Overlay Content */
.tt-map-overlay__title {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
}

.tt-map-overlay__description {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
}

.tt-map-overlay__button {
    display: inline-block;
    padding: 12px 24px;
    background-color: #003c71;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.tt-map-overlay__button:hover {
    background-color: #0056a3;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 60, 113, 0.3);
}

/* Custom Marker Styles */
.tt-map-marker {
    position: relative;
    cursor: pointer;
}

.tt-map-marker__icon {
    width: 40px;
    height: 40px;
    background-color: #003c71;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.tt-map-marker__icon:hover {
    transform: rotate(-45deg) scale(1.1);
}

.tt-map-marker__icon img {
    width: 24px;
    height: 24px;
    transform: rotate(45deg);
    object-fit: contain;
}

/* Info Window */
.tt-map-info-window {
    padding: 5px 20px;
    max-width: 280px;
}

.tt-map-info-window__title {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.tt-map-info-window__description {
    margin: 0;
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}

/* Google Maps InfoWindow close button - absolute positioning */
.gm-style .gm-style-iw-c {
    padding-top: 12px !important;
    padding-right: 12px !important;
}

.gm-style .gm-style-iw-d {
    overflow: visible !important;
}

/* Hide the empty gm-style-iw-ch element */
.gm-style .gm-style-iw-ch {
    display: none !important;
}

/* Custom class for InfoWindow root container - applied via JS */
.tt-map-iw-custom {
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

.tt-map-iw-custom .gm-style-iw-d {
    overflow: hidden !important;
}

.gm-style-iw button > span{
    margin: 0 !important;
}

/* InfoWindow content styling */
.tt-map-info-window-root {
    /* Inner content wrapper */
}

.gm-style button.gm-ui-hover-effect {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    width: 24px !important;
    height: 24px !important;
    margin: 4px !important;
    opacity: 0.7 !important;
    transition: opacity 0.2s ease;
}

.gm-style button.gm-ui-hover-effect:hover {
    opacity: 1 !important;
}

/* Hide Google Maps attribution elements (gmnoprint) */
.gmnoprint,
.gm-style-cc,
a[href^="https://maps.google.com/maps"],
a[href^="https://www.google.com/intl/"],
.gm-style a[target="_blank"]:not(.tt-map-overlay__button) {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .tt-map-overlay {
        position: relative;
        max-width: 100%;
        margin-top: 16px;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        transform: none !important;

        width: 100% !important;
        max-width: 100%;
        margin: 25px 0 0 0 !important;
    }

    .tt-map-overlay--top-center,
    .tt-map-overlay--center,
    .tt-map-overlay--bottom-center {
        transform: none;
    }

    .tt-map-container {
        height: 300px;
    }
}


/* Google Maps Customization */
.gm-style .gm-style-iw-c {
    border-radius: 12px !important;
    padding: 0 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
}

.gm-style .gm-style-iw-d {
    padding: 16px !important;
    overflow: hidden !important;
}

.gm-style .gm-style-iw-t::after {
    background: white !important;
}

/* Loading State */
.tt-map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background-color: #f8fafc;
}

.tt-map-loading__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #003c71;
    border-radius: 50%;
    animation: tt-map-spin 1s linear infinite;
}

@keyframes tt-map-spin {
    to {
        transform: rotate(360deg);
    }
}
