/* ============================================
   PHOTO MAP STYLES
   ============================================ */

/* Map toggle button */
.map-toggle-container {
    display: flex;
    justify-content: center;
    padding: 20px 0;
    margin-top: 10px;
}

/* Inline map toggle container for placing beside search */
.map-toggle-container-inline {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.map-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    color: var(--text-color);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.map-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.map-icon {
    font-size: 1.1rem;
}

/* Light mode */
body.light-mode .inline-map-toggle-btn {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #666;
    opacity: 0.8;
}

body.light-mode .inline-map-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.2);
}

/* Inline map toggle button (next to search) */
.map-toggle-inline {
    margin-left: auto;
}

/* Inline map toggle container */
.map-toggle-container-inline {
    flex-shrink: 0;
}

/* Inline map toggle button (smaller, matches search bar height) */
.inline-map-toggle-btn {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    height: 38px;
    box-sizing: border-box;
}

.inline-map-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.inline-map-toggle-btn .map-icon {
    font-size: 0.9rem;
}

.map-toggle-inline .map-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.map-toggle-inline .map-icon {
    font-size: 0.9rem;
}

/* Light mode inline map toggle */
body.light-mode .map-toggle-inline .map-toggle-btn {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #333;
}

body.light-mode .map-toggle-inline .map-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.2);
}

/* Map container */
.photo-map-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.photo-map {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.map-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1001;
}

.map-close-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Custom map popup styles */
.photo-popup {
    max-width: 280px;
    text-align: left;
    padding: 0;
    border-radius: 12px;
    overflow: visible;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Location positioned at the top of popup content */
.popup-location {
    margin: 0 0 6px 0;
    font-size: 0.8rem;
    color: #888;
    opacity: 0.8;
    font-style: italic;
    font-weight: 400;
    text-align: left;
}

.popup-description {
    margin: 0 0 8px 0;
    font-size: 0.85rem;
    color: #666;
    opacity: 0.9;
    line-height: 1.3;
}

.popup-title {
    margin: 0 0 6px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.popup-date {
    margin: 0 0 10px 0;
    font-size: 0.75rem;
    color: #999;
    opacity: 0.8;
}

.popup-image {
    width: 100%;
    height: 140px;
    overflow: hidden;
    position: relative;
    background-color: rgba(0, 0, 0, 0.05);
}

.popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
    background-color: rgba(0, 0, 0, 0.1);
    min-height: 140px;
}

.popup-image img:hover {
    transform: scale(1.05);
}

/* Loading states */
.popup-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
}

/* Safari-specific image loading fix */
.popup-image img:not([src]),
.popup-image img[src=""] {
    background-color: rgba(0, 0, 0, 0.1);
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="2"/><path d="M21 15l-3.086-3.086a2 2 0 00-2.828 0L6 21"/></svg>');
    background-size: 48px 48px;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.3;
}

.popup-content {
    padding: 16px;
}

.popup-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #ffffff;
    color: #007cba;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 2px solid #007cba;
}

.popup-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.popup-date {
    margin: 0 0 12px 0;
    font-size: 0.75rem;
    color: #999;
    opacity: 0.8;
}

.popup-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #ffffff;
    color: #007cba;
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 2px solid #007cba;
}

.popup-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
    background: #007cba;
    color: #ffffff;
    text-decoration: none;
}

/* Light mode popup styles (default) */
body.light-mode .photo-popup {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-mode .popup-title {
    color: #333;
}

body.light-mode .popup-location {
    color: #888;
}

body.light-mode .popup-description {
    color: #666;
}

body.light-mode .popup-date {
    color: #999;
}

body.light-mode .popup-link {
    background: #ffffff;
    color: #007cba;
    border: 2px solid #007cba;
}

body.light-mode .popup-link:hover {
    background: #007cba;
    color: #ffffff;
}

/* Dark mode popup styles (default when no light-mode class) */
body:not(.light-mode) .photo-popup {
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body:not(.light-mode) .popup-title {
    color: #fff;
}

body:not(.light-mode) .popup-location {
    color: #888;
}

body:not(.light-mode) .popup-description {
    color: #ccc;
}

body:not(.light-mode) .popup-date {
    color: #999;
}

body:not(.light-mode) .popup-link {
    background: #000000;
    color: #ffffff;
    border: 2px solid #ffffff;
    font-weight: 700;
}

body:not(.light-mode) .popup-link:hover {
    background: #ffffff;
    color: #000000;
}

/* ============================================
   MULTI-ALBUM POPUP STYLES
   ============================================ */

/* Multi-album popup container */
.photo-popup.multi-album {
    max-width: 400px;
}

.popup-subtitle {
    margin: 0 0 16px 0;
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
}

.popup-albums {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

/* Individual album items in multi-album popup */
.popup-album-item {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.popup-album-item:hover {
    transform: translateY(-1px);
}

.popup-album-image {
    width: 100%;
    height: 80px;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.popup-album-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

/* Safari-specific image loading fix for album images */
.popup-album-image img:not([src]),
.popup-album-image img[src=""] {
    background-color: rgba(0, 0, 0, 0.1);
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2"/><circle cx="9" cy="9" r="2"/><path d="M21 15l-3.086-3.086a2 2 0 00-2.828 0L6 21"/></svg>');
    background-size: 32px 32px;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.3;
}

.popup-album-item:hover .popup-album-image img {
    transform: scale(1.05);
}

.popup-album-info {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px;
}

.popup-album-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.0;
}

.popup-album-description {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.8;
    line-height: 1.1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.popup-album-date {
    margin: -6px 0 0 0;
    font-size: 0.7rem;
    opacity: 0.7;
}

.popup-album-link {
    align-self: flex-start;
    padding: 4px 12px;
    background: transparent;
    border: 1px solid;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-top: auto;
}

/* Light mode multi-album styles */
body.light-mode .popup-album-item {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-mode .popup-album-item:hover {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.light-mode .popup-album-title {
    color: #333;
}

body.light-mode .popup-album-description {
    color: #666;
}

body.light-mode .popup-album-date {
    color: #999;
}

body.light-mode .popup-album-link {
    color: #007cba;
    border-color: #007cba;
}

body.light-mode .popup-album-link:hover {
    background: #007cba;
    color: #ffffff;
}

body.light-mode .popup-subtitle {
    color: #666;
}

/* Dark mode multi-album styles */
body:not(.light-mode) .popup-album-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body:not(.light-mode) .popup-album-item:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body:not(.light-mode) .popup-album-title {
    color: #fff;
}

body:not(.light-mode) .popup-album-description {
    color: #ccc;
}

body:not(.light-mode) .popup-album-date {
    color: #999;
}

body:not(.light-mode) .popup-album-link {
    color: #4da6d9;
    border-color: #4da6d9;
}

body:not(.light-mode) .popup-album-link:hover {
    background: #4da6d9;
    color: #000;
}

body:not(.light-mode) .popup-subtitle {
    color: #aaa;
}

/* Custom marker styles */
.photo-marker {
    background: #007cba;
    border: 3px solid white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.photo-marker:hover {
    transform: scale(1.2);
    z-index: 1000;
}

/* Light mode marker styling */
body.light-mode .photo-marker {
    background: #007cba;
    border: 3px solid #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Dark mode marker styling */
body:not(.light-mode) .photo-marker {
    background: #4da6d9;
    border: 3px solid #333333;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .map-close-btn {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 1.3rem;
    }

    .photo-popup {
        max-width: 240px;
    }

    .popup-image {
        height: 120px;
    }

    .popup-content {
        padding: 12px;
    }

    .popup-title {
        font-size: 0.9rem;
    }

    .popup-location {
        font-size: 0.8rem;
    }

    .popup-date {
        font-size: 0.7rem;
    }

    .popup-link {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .map-toggle-btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }

    .map-toggle-inline .map-toggle-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
        gap: 4px;
    }

    .map-toggle-inline .map-icon {
        font-size: 0.8rem;
    }
}

/* Animation for map opening/closing */
.photo-map-container {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.photo-map-container.show {
    opacity: 1;
}

/* ============================================
   LEAFLET POPUP THEME OVERRIDES
   ============================================ */

/* Light mode Leaflet popup styling */
body.light-mode .leaflet-popup-content-wrapper {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Dark mode Leaflet popup styling */
body:not(.light-mode) .leaflet-popup-content-wrapper {
    background: rgba(20, 20, 20, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
}

body:not(.light-mode) .leaflet-popup-tip {
    background: rgba(20, 20, 20, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Close button theming */
body.light-mode .leaflet-popup-close-button {
    color: #333 !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border-radius: 50% !important;
    width: 24px !important;
    height: 24px !important;
    text-align: center !important;
    line-height: 22px !important;
}

body:not(.light-mode) .leaflet-popup-close-button {
    color: #fff !important;
    background: rgba(0, 0, 0, 0.6) !important;
    border-radius: 50% !important;
    width: 24px !important;
    height: 24px !important;
    text-align: center !important;
    line-height: 22px !important;
}

/* ============================================
   MARKER CLUSTER STYLES
   ============================================ */

/* Base cluster styles */
.marker-cluster {
    border-radius: 50%;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.marker-cluster div {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.marker-cluster span {
    line-height: 1;
    font-weight: 700;
}

/* Light mode cluster styling */
body.light-mode .marker-cluster-small div {
    background: rgba(135, 206, 250, 0.8);
    border: 2px solid #ffffff;
    color: #333;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

body.light-mode .marker-cluster-medium div {
    background: rgba(100, 149, 237, 0.8);
    border: 2px solid #ffffff;
    color: #333;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

body.light-mode .marker-cluster-large div {
    background: rgba(70, 130, 180, 0.8);
    border: 2px solid #ffffff;
    color: #fff;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
}

/* Dark mode cluster styling */
body:not(.light-mode) .marker-cluster-small div {
    background: rgba(77, 166, 217, 0.9);
    border: 2px solid #444444;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

body:not(.light-mode) .marker-cluster-medium div {
    background: rgba(52, 144, 220, 0.9);
    border: 2px solid #444444;
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

body:not(.light-mode) .marker-cluster-large div {
    background: rgba(30, 120, 200, 0.9);
    border: 2px solid #444444;
    color: #ffffff;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.8);
}

/* Hover effects for clusters */
.marker-cluster:hover {
    transform: scale(1.1);
}

.marker-cluster:hover div {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
