/* Frontend Styles for Kadence Mapbox Block */

.kadence-mapbox-block-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

/* Map Toggle Controls */
.kmb-map-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: flex-start;
}

.kmb-map-controls.kmb-align-left {
    justify-content: flex-start;
}

.kmb-map-controls.kmb-align-center {
    justify-content: center;
}

.kmb-map-controls.kmb-align-right {
    justify-content: flex-end;
}

.kmb-map-toggle-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.kmb-map-toggle-btn.kmb-show-map {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.kmb-map-toggle-btn.kmb-show-map:hover {
    background: linear-gradient(135deg, #5568d3 0%, #63408a 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.kmb-map-toggle-btn.kmb-hide-map {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.kmb-map-toggle-btn.kmb-hide-map:hover {
    background: linear-gradient(135deg, #e082ea 0%, #e4465b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.kmb-map-toggle-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.kadence-mapbox-map {
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Custom Marker Styles */
.kmb-marker {
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translate(-50%, -100%);
}

.kmb-marker-pin {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform 0.2s ease;
}

.kmb-marker:hover .kmb-marker-pin {
    transform: scale(1.1);
}

.kmb-marker-label {
    position: absolute;
    bottom: -20px;
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

/* Popup Styles */
.kmb-popup {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

.kmb-popup .mapboxgl-popup-content {
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
}

.kmb-popup .mapboxgl-popup-close-button {
    font-size: 20px;
    padding: 5px 10px;
    color: #666;
    right: 5px;
    top: 5px;
    z-index: 10;
}

.kmb-popup .mapboxgl-popup-close-button:hover {
    color: #000;
    background: rgba(255, 255, 255, 0.9);
}

.kmb-popup-content {
    width: 100%;
}

/* Info Card Styles */
.kmb-info-card {
    background: white;
    width: 100%;
}

.kmb-card-thumbnail {
    width: 100%;
    height: 180px;
    overflow: hidden;
    position: relative;
}

.kmb-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.kmb-card-content {
    padding: 15px;
}

.kmb-card-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    line-height: 1.3;
}

.kmb-card-title a {
    color: #333;
    text-decoration: none;
    font-weight: 600;
}

.kmb-card-title a:hover {
    color: #0073aa;
}

.kmb-card-excerpt {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.kmb-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
    margin-bottom: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.kmb-card-author {
    font-weight: 500;
}

.kmb-card-date {
    text-align: right;
}

.kmb-card-link {
    display: inline-block;
    background: #0073aa;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.kmb-card-link:hover {
    background: #005a87;
    color: white;
}

/* Simple marker info (no post data) */
.kmb-marker-info {
    padding: 15px;
}

.kmb-marker-info h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.kmb-marker-info p {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

/* Responsive Visibility Classes */
@media (min-width: 1025px) {
    .kmb-hide-desktop {
        display: none !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .kmb-hide-tablet {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .kmb-hide-mobile {
        display: none !important;
    }
    
    .kmb-card-thumbnail {
        height: 150px;
    }
    
    .kmb-card-title {
        font-size: 16px;
    }
    
    .kmb-card-excerpt {
        font-size: 13px;
    }
    
    .kmb-popup .mapboxgl-popup-content {
        max-width: 280px !important;
    }
    
    .kmb-map-controls {
        flex-direction: row;
        gap: 8px;
    }
    
    .kmb-map-toggle-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    /* Fullscreen map on mobile */
    .kadence-mapbox-map.kmb-mobile-fullscreen {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 999999 !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }
    
    /* Close button positioned absolutely for fullscreen mode */
    .kadence-mapbox-map.kmb-mobile-fullscreen .kmb-mobile-close-btn {
        display: block;
    }
    
    /* Prevent body scroll when map is fullscreen */
    body.kmb-mobile-map-open {
        overflow: hidden !important;
    }
}

/* Mobile close button (hidden by default) */
.kmb-mobile-close-btn {
    display: none;
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 1000;
    background: white;
    color: #333;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.kmb-mobile-close-btn:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.kmb-mobile-close-btn:active {
    transform: scale(0.95);
}

/* Map Controls Customization */
.mapboxgl-ctrl-group {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mapboxgl-ctrl button {
    transition: background-color 0.2s ease;
}

.mapboxgl-ctrl button:hover {
    background-color: #f0f0f0;
}

/* Hide Mapbox attribution and logos */
.mapboxgl-ctrl-logo,
.mapboxgl-ctrl-attrib,
.mapboxgl-ctrl-attrib-button,
.mapboxgl-compact {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.kadence-mapbox-map .mapboxgl-ctrl-logo,
.kadence-mapbox-map .mapboxgl-ctrl-attrib,
.kadence-mapbox-map .mapboxgl-ctrl-attrib-button {
    display: none !important;
}