/**
 * MetalMax Interactive Locations Map
 * PNG-based with clickable hotspots
 */

/* ==========================================================================
   Map Container
   ========================================================================== */

.metalmax-map-container {
    position: relative;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

.metalmax-map-wrapper {
    position: relative;
    width: 100%;
    line-height: 0; /* Remove gap below image */
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* Map Image */
.metalmax-map-image {
    width: 100%;
    height: auto;
    display: block;
    background: transparent !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Override Astra article image styling */
.ast-article-single .metalmax-map-image,
.ast-article-single figure .metalmax-map-image,
.metalmax-map-wrapper img {
    background: transparent !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ==========================================================================
   Clickable Hotspots
   ========================================================================== */

.metalmax-hotspots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.metalmax-hotspot {
    position: absolute;
    width: 40px;
    height: 50px;
    transform: translate(-50%, -100%); /* Center horizontally, anchor at bottom */
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    cursor: pointer;
    pointer-events: auto;
    z-index: 10;
    transition: none !important;
    outline: none !important;
    box-shadow: none !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    color: transparent !important;
    font-size: 0 !important;
    line-height: 0 !important;
}

/* Additional specificity to override theme styles */
#metalmax-locations-map .metalmax-hotspot,
#metalmax-locations-map .metalmax-hotspot:hover,
#metalmax-locations-map .metalmax-hotspot:focus,
#metalmax-locations-map .metalmax-hotspot:active {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Make the clickable area visible during development - uncomment to debug */
/*
.metalmax-hotspot {
    background: rgba(255, 0, 0, 0.4) !important;
    border: 2px solid red !important;
}
*/


.metalmax-hotspot:hover,
.metalmax-hotspot:focus,
.metalmax-hotspot:active,
.metalmax-hotspot:focus-visible {
    z-index: 20;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    transform: translate(-50%, -100%);
}

.metalmax-hotspot.active {
    z-index: 25;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
}

.metalmax-hotspot .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Location Popup
   ========================================================================== */

.metalmax-popup {
    position: absolute;
    z-index: 100;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.metalmax-popup.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    display: none; /* Fully hide from layout */
}

.metalmax-popup:not(.hidden) {
    opacity: 1;
    visibility: visible;
    display: block;
}

.metalmax-popup-content {
    position: relative;
    background: #ffffff;
    border: 4px solid #761414;
    padding: 24px;
    min-width: 280px;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

/* Speech bubble triangle pointing to marker */
.metalmax-popup-content::before,
.metalmax-popup-content::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

/* Triangle on RIGHT edge pointing RIGHT (popup is LEFT of marker) */
.metalmax-popup-content.triangle-right::before {
    right: -50px; /* Maroon border triangle */
    top: 50%;
    transform: translateY(-50%);
    border-width: 24px;
    border-color: transparent transparent transparent #761414;
}

.metalmax-popup-content.triangle-right::after {
    right: -44px; /* White fill triangle */
    top: 50%;
    transform: translateY(-50%);
    border-width: 24px;
    border-color: transparent transparent transparent #ffffff;
}

/* Triangle on LEFT edge pointing LEFT (popup is RIGHT of marker) */
.metalmax-popup-content.triangle-left::before {
    left: -50px; /* Maroon border triangle */
    top: 50%;
    transform: translateY(-50%);
    border-width: 24px;
    border-color: transparent #761414 transparent transparent;
}

.metalmax-popup-content.triangle-left::after {
    left: -44px; /* White fill triangle */
    top: 50%;
    transform: translateY(-50%);
    border-width: 24px;
    border-color: transparent #ffffff transparent transparent;
}

/* Triangle pointing DOWN (popup is above marker) */
.metalmax-popup-content.triangle-bottom::before {
    bottom: -50px; /* Maroon border triangle */
    left: 50%;
    transform: translateX(-50%);
    border-width: 24px;
    border-color: #761414 transparent transparent transparent;
}

.metalmax-popup-content.triangle-bottom::after {
    bottom: -44px; /* White fill triangle */
    left: 50%;
    transform: translateX(-50%);
    border-width: 24px;
    border-color: #ffffff transparent transparent transparent;
}

/* Triangle pointing UP (popup is below marker) */
.metalmax-popup-content.triangle-top::before {
    top: -50px; /* Maroon border triangle */
    left: 50%;
    transform: translateX(-50%);
    border-width: 24px;
    border-color: transparent transparent #761414 transparent;
}

.metalmax-popup-content.triangle-top::after {
    top: -44px; /* White fill triangle */
    left: 50%;
    transform: translateX(-50%);
    border-width: 24px;
    border-color: transparent transparent #ffffff transparent;
}

/* Close Button */
.metalmax-popup-close {
    position: absolute;
    top: -1px;
    right: 0;
    width: 28px;
    height: 28px;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    font-size: 24px;
    font-weight: 300;
    color: #000;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s ease;
    outline: none !important;
    box-shadow: none !important;
}

.metalmax-popup-close:hover,
.metalmax-popup-close:focus,
.metalmax-popup-close:active {
    color: #722F37 !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Popup Title (City, State) */
.metalmax-popup-title {
    margin: 0 0 12px 0 !important;
    padding: 0 20px !important;
    font-size: 24px !important;
    font-weight: 700 !important;
    color: #000000 !important;
    letter-spacing: 0.5px;
    line-height: 1.2 !important;
    text-transform: uppercase;
    text-align: center;
}

/* Popup Address */
.metalmax-popup-address {
    margin: 0 0 20px 0 !important;
    padding: 0 10px;
    font-size: 16px;
    color: #000000;
    line-height: 1.2 !important;
    white-space: pre-line; /* Preserve line breaks */
    text-align: center;
}

/* Action Buttons */
.metalmax-popup-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metalmax-btn {
    display: block;
    padding: 19px 18px;
    text-align: center;
    text-decoration: none !important;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: none;
}

.metalmax-btn:hover,
.metalmax-btn:focus,
.metalmax-btn:active {
    text-decoration: none !important;
    transform: none !important;
    outline: none !important;
    background-color: #761414 !important;
}

/* Get Directions - Black */
.metalmax-btn-directions {
    background-color: #000;
    color: #ffffff !important;
}

.metalmax-btn-directions:hover {
    background-color: #000 !important;
    color: #ffffff !important;
}

/* Phone - Maroon */
.metalmax-btn-phone {
    background-color: #761414;
    color: #ffffff !important;
}

.metalmax-btn-phone:hover {
    background-color: #5a0f0f;
    color: #ffffff !important;
}

/* Message Us - Maroon */
.metalmax-btn-message {
    background-color: #761414;
    color: #ffffff !important;
}

.metalmax-btn-message:hover {
    background-color: #5a0f0f;
    color: #ffffff !important;
}

/* View Location - Maroon */
.metalmax-btn-location {
    background-color: #761414;
    color: #ffffff !important;
}

.metalmax-btn-location:hover {
    background-color: #5a0f0f;
    color: #ffffff !important;
}

/* Connector Line */
.metalmax-popup-connector {
    position: absolute;
    width: 50px;
    height: 3px;
    background-color: #722F37;
    transform-origin: left center;
    pointer-events: none;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 1024px) {
    .metalmax-hotspot {
        width: 35px;
        height: 45px;
    }
    
    .metalmax-popup-content {
        min-width: 240px;
        max-width: 280px;
        padding: 16px 20px 20px;
    }
    
    .metalmax-popup-title {
        font-size: 16px;
    }
    
    .metalmax-btn {
        padding: 10px 14px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .metalmax-map-container {
        padding: 10px;
    }
    
    .metalmax-hotspot {
        width: 30px;
        height: 38px;
    }
    
    .metalmax-popup-content {
        min-width: 220px;
        max-width: 260px;
        padding: 14px 16px 18px;
    }
    
    .metalmax-popup-connector {
        display: none;
    }
}

@media (max-width: 576px) {
    .metalmax-hotspot {
        width: 26px;
        height: 34px;
    }
    
    /* Full-width bottom sheet on mobile */
    .metalmax-popup {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        transform: none !important;
        z-index: 9999;
    }
    
    .metalmax-popup.hidden {
        transform: translateY(100%) !important;
        opacity: 1;
        visibility: visible;
    }
    
    .metalmax-popup:not(.hidden) {
        transform: translateY(0) !important;
    }
    
    .metalmax-popup-content {
        max-width: 100%;
        min-width: 100%;
        border-left: none;
        border-right: none;
        border-bottom: none;
        border-radius: 16px 16px 0 0;
        padding: 20px;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }
    
    .metalmax-popup-title {
        font-size: 18px;
    }
    
    .metalmax-popup-address {
        font-size: 15px;
    }
    
    .metalmax-btn {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .metalmax-popup-close {
        top: 12px;
        right: 14px;
        font-size: 28px;
    }
}

/* ==========================================================================
   No Locations Message
   ========================================================================== */

.metalmax-no-locations {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 16px;
}
