/* ==========================================================================
   Site Core Plugin Styles
   ========================================================================== */

/* Map Container Styles */
.map-container {
    width: 100%;
    border-radius: var(--radius-lg, 0.5rem);
    overflow: hidden;
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
    background-color: var(--color-neutral-50, #101316);
}

/* Hide flag icons in map attribution */
.leaflet-control-attribution img[src*="flag"],
.leaflet-control-attribution img[alt*="flag"],
.leaflet-control-attribution img[alt*="Flag"],
.leaflet-control-attribution .flag,
.leaflet-control-attribution img[width="16"][height="11"],
.leaflet-control-attribution img[width="11"][height="16"] {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    visibility: hidden !important;
}

.map-container .leaflet-container {
    height: 100%;
    width: 100%;
    font-family: var(--font-family-system, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

/* Custom Map Marker Styles - Earthy Theme */
.earthy-marker {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: transform var(--transition-fast, 150ms ease-in-out);
}

.earthy-marker:hover {
    transform: scale(1.15);
    z-index: 1000;
}

.earthy-marker svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Map Pin Icon Styles */
.earthy-map-pin {
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    transition: transform var(--transition-fast, 150ms ease-in-out);
}

.earthy-map-pin:hover {
    transform: scale(1.2);
    z-index: 1000;
}

.earthy-map-pin svg {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
    transition: filter var(--transition-fast, 150ms ease-in-out);
}

.earthy-map-pin:hover svg {
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
}

/* Legacy marker support */
.custom-marker {
    background-color: var(--color-green-500, #3f6f4f);
    border: 2px solid var(--color-gold-accent, #0d4a2e);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.custom-marker::before {
    content: '📍';
    font-size: 16px;
}

/* Map Popup - single box only; wrapper is styled by theme. No extra box here. */
.earthy-popup .leaflet-popup-content-wrapper {
    padding: 0;
    /* Background/border/shadow come from theme so one box only */
}

.earthy-popup .leaflet-popup-content {
    margin: 0 !important;
    background: none;
    border: none;
    box-shadow: none;
    line-height: 1.6;
    font-family: var(--font-family-system, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

.earthy-popup .leaflet-popup-content h3 {
    margin: 0 0 var(--space-3, 0.75rem) 0;
    font-size: var(--font-size-lg, 1.125rem);
    font-weight: 600;
    line-height: 1.3;
}

.earthy-popup .leaflet-popup-content p {
    margin: 0 0 var(--space-2, 0.5rem) 0;
    font-size: var(--font-size-sm, 0.875rem);
}

.earthy-popup .leaflet-popup-content .address {
    font-weight: 700;
    margin-top: var(--space-2, 0.5rem);
    padding-top: var(--space-2, 0.5rem);
    border-top: 1px solid var(--color-border-subtle, rgba(0,0,0,0.08));
}

.earthy-popup .leaflet-popup-content .map-popup-actions {
    margin: var(--space-2, 0.5rem) 0 0 0 !important;
    padding-top: var(--space-2, 0.5rem) !important;
    border-top: 1px solid var(--color-border-subtle, rgba(0,0,0,0.08));
}

.earthy-popup .leaflet-popup-content .map-popup-directions {
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
    color: var(--color-primary-leaf-green, #0d4a2e);
}

.earthy-popup .leaflet-popup-tip {
    border-top: none;
    border-right: none;
}

/* Legacy: avoid duplicate box - no margin that looks like a second box */
.leaflet-popup-content {
    margin: 0 !important;
}

/* Gallery Wrapper */
.gallery-wrapper {
    width: 100%;
    clear: both;
    display: block;
    flex-direction: column;
}

/* Gallery Slideshow Styles */
.gallery-slideshow-wrapper {
    margin-bottom: var(--space-8, 2rem);
    width: 100%;
    clear: both;
    display: block;
    float: none;
}

.gallery-slideshow {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    background-color: var(--color-neutral-50, #101316);
    border-radius: var(--radius-lg, 0.5rem);
    overflow: hidden;
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0, 0, 0, 0.1));
    border: 1px solid var(--color-neutral-300, #282d2f);
}

.slideshow-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.slideshow-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    cursor: pointer;
}

.slideshow-slide.active {
    opacity: 1;
    z-index: 1;
}

.slideshow-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.slideshow-caption {
    display: none; /* Green bar removed per design */
}

.slideshow-caption h3 {
    margin: 0;
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
    color: var(--color-text-primary, #ffffff);
    line-height: 1.3;
}

.slideshow-caption p {
    margin: var(--space-1, 0.25rem) 0 0 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.95);
}

.slideshow-prev,
.slideshow-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(5, 6, 8, 0.85);
    color: var(--color-text-primary, #f4f0e8);
    border: 2px solid var(--color-gold-accent, #0d4a2e);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast, 150ms ease-in-out);
    z-index: 10;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    line-height: 1;
    padding: 0;
}

.slideshow-prev {
    left: var(--space-4, 1rem);
}

.slideshow-next {
    right: var(--space-4, 1rem);
}

.slideshow-prev:hover,
.slideshow-next:hover {
    background-color: var(--color-gold-accent, #0d4a2e);
    color: var(--color-bg-base, #050608);
    border-color: var(--color-gold-accent, #0d4a2e);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 16px rgba(13, 74, 46, 0.4);
}

.slideshow-prev:focus,
.slideshow-next:focus {
    outline: 2px solid var(--color-gold-accent, #0d4a2e);
    outline-offset: 2px;
}

.slideshow-indicators {
    display: flex;
    justify-content: center;
    gap: var(--space-2, 0.5rem);
    padding: var(--space-4, 1rem);
    background-color: var(--color-neutral-50, #101316);
}

.slideshow-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--color-neutral-300, #282d2f);
    background-color: transparent;
    cursor: pointer;
    transition: all var(--transition-fast, 150ms ease-in-out);
    padding: 0;
}

.slideshow-indicator:hover {
    border-color: var(--color-gold-accent, #0d4a2e);
    transform: scale(1.2);
}

.slideshow-indicator.active {
    background-color: var(--color-gold-accent, #0d4a2e);
    border-color: var(--color-gold-accent, #0d4a2e);
}

.slideshow-indicator:focus {
    outline: 2px solid var(--color-gold-accent, #0d4a2e);
    outline-offset: 2px;
}

/* Gallery Grid Styles */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-4, 1rem);
    list-style: none;
    margin: var(--space-8, 2rem) 0 0 0;
    padding: 0;
    width: 100%;
    clear: both;
    float: none;
}

.gallery-item {
    position: relative;
    overflow: visible;
    border-radius: var(--radius-lg, 0.5rem);
    cursor: pointer;
    transition: transform var(--transition-normal, 250ms ease-in-out);
    border: 1px solid var(--color-neutral-300, #282d2f);
    background-color: var(--color-green-darker, #0d1a12);
    display: flex;
    flex-direction: column;
}

.gallery-item:focus {
    outline: 2px solid var(--color-gold-accent, #0d4a2e);
    outline-offset: 2px;
}

.gallery-item:hover {
    transform: translateY(-2px);
}

.gallery-item__image-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg, 0.5rem) var(--radius-lg, 0.5rem) 0 0;
    aspect-ratio: 1;
    width: 100%;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal, 250ms ease-in-out);
    display: block;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal, 250ms ease-in-out);
}

.gallery-item:hover .gallery-item__overlay {
    opacity: 1;
}

.gallery-item__icon {
    color: var(--color-neutral-0, #ffffff);
    font-size: var(--font-size-2xl, 1.5rem);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.gallery-item__caption {
    padding: var(--space-2, 0.5rem) var(--space-3, 0.75rem);
    background-color: var(--color-gold-accent, #0d4a2e);
    border-radius: 0 0 var(--radius-lg, 0.5rem) var(--radius-lg, 0.5rem);
    min-height: 0;
}

.gallery-item__title {
    margin: 0;
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
    color: var(--color-text-primary, #ffffff);
    line-height: 1.3;
}

.gallery-item__description {
    margin: var(--space-1, 0.25rem) 0 0 0;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.4;
}

/* Lightbox Modal Styles */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 6, 8, 0.98);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal, 250ms ease-in-out), visibility var(--transition-normal, 250ms ease-in-out);
}

.lightbox-modal.active {
    opacity: 1;
    visibility: visible;
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8, 2rem);
    width: 100%;
    height: 100%;
}

.lightbox-image {
    max-width: 95vw;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-md, 0.375rem);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    opacity: 0;
    transition: opacity var(--transition-normal, 250ms ease-in-out);
    display: block;
}

.lightbox-image.loaded {
    opacity: 1;
}

.lightbox-image.fade-out {
    opacity: 0;
    transition: opacity 150ms ease-out;
}

.lightbox-image.fade-in {
    animation: fadeInImage 300ms ease-in;
}

@keyframes fadeInImage {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-caption {
    margin-top: var(--space-4, 1rem);
    padding: var(--space-4, 1rem) var(--space-6, 1.5rem);
    background-color: var(--color-gold-accent, #0d4a2e);
    color: var(--color-text-primary, #ffffff);
    text-align: center;
    font-size: var(--font-size-lg, 1.125rem);
    max-width: 600px;
    line-height: 1.6;
    border-radius: var(--radius-md, 0.375rem);
}

.lightbox-counter {
    position: absolute;
    top: var(--space-4, 1rem);
    left: 50%;
    transform: translateX(-50%);
    color: var(--color-neutral-0, #ffffff);
    background-color: rgba(0, 0, 0, 0.6);
    padding: var(--space-2, 0.5rem) var(--space-4, 1rem);
    border-radius: var(--radius-md, 0.375rem);
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 500;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background-color: rgba(5, 6, 8, 0.85);
    color: var(--color-text-primary, #f4f0e8);
    border: 2px solid var(--color-gold-accent, #0d4a2e);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast, 150ms ease-in-out);
    z-index: 10000;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    line-height: 1;
    padding: 0;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background-color: var(--color-gold-accent, #0d4a2e);
    color: var(--color-bg-base, #050608);
    border-color: var(--color-gold-accent, #0d4a2e);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(13, 74, 46, 0.4);
}

.lightbox-close:focus,
.lightbox-prev:focus,
.lightbox-next:focus {
    outline: 2px solid var(--color-gold-accent, #0d4a2e);
    outline-offset: 2px;
}

.lightbox-close:disabled,
.lightbox-prev:disabled,
.lightbox-next:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.lightbox-close {
    top: 20px;
    right: 20px;
    font-size: 32px;
    line-height: 0.8;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 36px;
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 36px;
}

.lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

/* Responsive Gallery */
@media (max-width: 768px) {
    .gallery-slideshow {
        border-radius: var(--radius-md, 0.375rem);
    }
    
    .slideshow-container {
        aspect-ratio: 4 / 3;
    }
    
    .slideshow-prev,
    .slideshow-next {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
    
    .slideshow-prev {
        left: var(--space-2, 0.5rem);
    }
    
    .slideshow-next {
        right: var(--space-2, 0.5rem);
    }
    
    .slideshow-caption {
        padding: var(--space-2, 0.5rem) var(--space-3, 0.75rem);
    }
    
    .slideshow-caption h3 {
        font-size: var(--font-size-sm, 0.875rem);
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: var(--space-3, 0.75rem);
    }
    
    .lightbox-content {
        max-width: 95vw;
        max-height: 95vh;
        padding: var(--space-4, 1rem);
    }
    
    .lightbox-image {
        max-width: 95vw;
        max-height: 75vh;
    }
    
    .lightbox-close,
    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .lightbox-caption {
        font-size: var(--font-size-base, 1rem);
        padding: 0 var(--space-4, 1rem);
    }
}

/* Loading States */
.map-container.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-neutral-50, #101316);
    color: var(--color-neutral-600, #b3a89a);
}

.map-container.loading::before {
    content: 'Loading map...';
    font-size: var(--font-size-lg, 1.125rem);
}

.gallery-grid.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background-color: var(--color-neutral-50, #101316);
    color: var(--color-neutral-600, #b3a89a);
}

.gallery-grid.loading::before {
    content: 'Loading gallery...';
    font-size: var(--font-size-lg, 1.125rem);
}

/* Accessibility Improvements */
.lightbox-modal:focus {
    outline: none;
}

.lightbox-close:focus,
.lightbox-prev:focus,
.lightbox-next:focus {
    outline: 2px solid var(--color-gold-accent, #0d4a2e);
    outline-offset: 2px;
}

.gallery-item:focus {
    outline: 2px solid var(--color-gold-accent, #0d4a2e);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .lightbox-modal {
        display: none !important;
    }
    
    .gallery-item__overlay {
        display: none !important;
    }
    
    .gallery-item__caption {
        display: block !important;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
}
