/**
 * Art Route Map CSS
 * Styling for the frontend map display
 */

/* Common container styles */
.art-route-container {
    margin-bottom: 40px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Multiple routes container layout */
.art-routes-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 30px;
}

@media (min-width: 768px) {
    .art-routes-container {
        flex-direction: row;
        flex-wrap: nowrap;
    }
    
    .art-routes-legend {
        width: 30%;
        min-width: 250px;
        max-width: 300px;
        margin-right: 20px;
    }
    
    .art-routes-map-container {
        flex: 1;
    }
}

/* Single route map */
.art-route-map {
    width: 100%;
    height: 600px;
    margin-bottom: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Multiple routes map */
.art-routes-map {
    width: 100%;
    min-height: 400px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.art-routes-map-title {
    margin-top: 0;
    margin-bottom: 15px;
}

.art-routes-map-container {
    position: relative;
}

/* Legend styling */
.art-routes-legend {
    margin-bottom: 20px;
}

.art-routes-legend h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.route-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 450px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.route-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.route-item:last-child {
    border-bottom: none;
}

.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.route-title-container {
    display: flex;
    align-items: center;
    flex: 1;
}

.route-color-indicator {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.route-title {
    font-weight: 500;
}

.route-link {
    color: #0073aa;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.route-link:hover {
    background-color: #f0f0f0;
    color: #00a0d2;
}

/* Zoom to route buttons */
.zoom-to-route-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 6px 12px;
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s;
    color: #555;
}

.zoom-to-route-button .dashicons {
    margin-right: 5px;
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.zoom-to-route-button:hover {
    background-color: #e8e8e8;
}

.zoom-to-route-button.active {
    background-color: #0073aa;
    color: white;
    border-color: #005177;
}

.zoom-to-all-routes-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 8px 12px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.2s;
    margin-bottom: 10px;
    color: #444;
    font-weight: 500;
}

.zoom-to-all-routes-button .dashicons {
    margin-right: 5px;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.zoom-to-all-routes-button:hover {
    background-color: #e0e0e0;
}

.art-route-title {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 24px;
    font-weight: 600;
}

.art-route-description {
    margin-bottom: 20px;
}

.art-route-details {
    margin-bottom: 20px;
    font-size: 14px;
}

/* Route meta information */
.route-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.route-meta span {
    display: inline-flex;
    align-items: center;
    background: #f5f5f5;
    padding: 5px 12px;
    border-radius: 20px;
    color: #333;
}

/* Route Actions (GPX Export etc.) */
.route-actions {
    margin-top: 15px;
    margin-bottom: 20px;
}

.gpx-export-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #0073aa;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.gpx-export-button:hover {
    background: #005a87;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

.gpx-export-button:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.3);
}

.gpx-export-button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Multiple routes variant */
.route-meta.multiple {
    gap: 10px;
    margin: 8px 0;
    font-size: 0.85em;
}

.route-meta.multiple > span {
    background-color: #f8f8f8;
    padding: 3px 8px;
    border-radius: 4px;
    color: #555;
}

.route-meta.multiple .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    margin-right: 4px;
}

.route-description {
    margin-top: 8px;
    font-size: 0.9em;
    color: #666;
    line-height: 1.5;
    margin-bottom: 10px;
}

.route-length::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 5px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23555'%3E%3Cpath d='M21 15v-2h-8v-2h6v-2h-6V7h8V5h-8a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h8zM3 5h2v14H3z'%3E%3C/path%3E%3C/svg%3E");
    background-size: contain;
}

.route-duration::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 5px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23555'%3E%3Cpath d='M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm.5-13H11v6l5.2 3.2.8-1.3-4.5-2.7V7z'%3E%3C/path%3E%3C/svg%3E");
    background-size: contain;
}

.route-type::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 5px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23555'%3E%3Cpath d='M13.5 5.5c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zM9.8 8.9L7 23h2.1l1.8-8 2.1 2v6h2v-7.5l-2.1-2 .6-3C14.8 12 16.8 13 19 13v-2c-1.9 0-3.5-1-4.3-2.4l-1-1.6c-.4-.6-1-1-1.7-1-.3 0-.5.1-.8.1L6 8.3V13h2V9.6l1.8-.7'%3E%3C/path%3E%3C/svg%3E");
    background-size: contain;
}

/* Map Loading */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #3388FF;
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Map errors */
.map-error {
    background: #fff1f0;
    border: 1px solid #ffccc7;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    text-align: center;
}

.map-error p {
    margin-top: 0;
    margin-bottom: 10px;
    color: #cf1322;
}

/* Route progress */
.route-progress {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
}

.route-progress h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 18px;
}

.progress-bar {
    height: 8px;
    background-color: #e9e9e9;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background-color: #52c41a;
    transition: width 0.3s ease;
}

/* Artwork markers */
.artwork-marker {
    background: transparent;
}

.artwork-marker-inner {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    overflow: hidden;
    border: 3px solid #fff;
}

.artwork-marker-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
}

.artwork-marker-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(51, 136, 255, 0.5);
    z-index: 2;
}

.artwork-marker-number {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    z-index: 3;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.artwork-marker-inner.visited .artwork-marker-overlay {
    background-color: rgba(82, 196, 26, 0.5);
}

.artwork-marker-inner:hover {
    transform: scale(1.1);
}

/* User marker */
.user-marker {
    background: transparent;
}

.user-marker-inner {
    width: 20px;
    height: 20px;
    background-color: #1890ff;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #1890ff, 0 0 8px rgba(0, 0, 0, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(24, 144, 255, 0.7), 0 0 0 2px #1890ff;
    }
    70% {
        box-shadow: 0 0 0 10px rgba(24, 144, 255, 0), 0 0 0 2px #1890ff;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(24, 144, 255, 0), 0 0 0 2px #1890ff;
    }
}

/* Info Point markers */
.info-point-marker {
    background: transparent;
}

.info-point-marker-inner {
    width: 30px;
    height: 30px;
    background-color: #ffc107; /* Amber color */
    border-radius: 50%;
    border: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    font-family: sans-serif;
}

/* Artwork modal */
.artwork-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.artwork-modal-content {
    position: relative;
    background-color: white;
    margin: 40px auto;
    padding: 20px;
    width: 90%;
    max-width: 700px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #333;
}

.artwork-image {
    margin-bottom: 20px;
}

.artwork-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}

.artwork-info h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 22px;
    color: #333;
}

.artwork-info {
    margin-bottom: 20px;
}

/* Artwork Popup in Map */
.leaflet-popup-content-wrapper {
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
}

.leaflet-popup-content {
    margin: 0;
    width: 300px !important;
}

.artwork-popup {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 300px;
}

.artwork-popup-image {
    width: 100%;
    height: 150px;
    overflow: hidden;
}

.artwork-popup-image img {
    width: 100% !important;
    height: 100%;
    object-fit: cover;
    max-height: 150px;
    border-radius: 4px;
}

.artwork-popup-content {
    padding: 15px;
    margin-top: 10px;
}

.artwork-popup-content h3 {
    margin: 0 0 5px 0;
    padding-bottom: 0 !important;
    font-size: 18px;
    color: #333;
}

.artwork-description {
    font-size: 14px;
    line-height: 1.4;
    max-height: 120px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.artwork-artists {
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.artwork-artists h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #333;
}

.artwork-artists ul {
    margin: 0;
    padding-left: 20px;
    font-size: 14px;
}

.artwork-artists li {
    margin-bottom: 3px;
}

.artwork-artists a {
    color: #0073aa;
    text-decoration: none;
}

.artwork-artists a:hover {
    text-decoration: underline;
}

.artist-post-type {
    color: #666;
    font-style: italic;
    font-size: 12px;
}

.artwork-link {
    display: inline-block;
    margin-top: 5px;
    color: #3498db;
    text-decoration: none;
}

.artwork-link:hover {
    text-decoration: underline;
}

.artwork-popup-container .leaflet-popup-tip {
    background-color: white;
}

.leaflet-container a.leaflet-popup-close-button {
    font-size: 1.5rem;
    background-color: rgba(0, 0, 0, .75);
    color: #fff;
    padding: 8px;
    border: none;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    top: 8px;
    right: 8px;
}

/* Info Point Popup in Map */
.info-point-popup-container .leaflet-popup-content-wrapper {
    /* Reuse artwork popup styles if desired, or add specific ones */
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
}

.info-point-popup-container .leaflet-popup-content {
    margin: 0;
    width: 300px !important;
}

.info-point-popup {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.info-point-popup-image {
    width: 100%;
    height: 150px;
    overflow: hidden;
}

.info-point-popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.info-point-popup-content {
    padding: 15px;
}

.info-point-popup-content h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #333;
}

.info-point-excerpt {
    font-size: 14px;
    line-height: 1.4;
    max-height: 120px;
    overflow-y: auto;
    margin-bottom: 10px;
    color: #555;
}

.info-point-link {
    display: inline-block;
    color: #3388FF;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.info-point-link:hover {
    text-decoration: underline;
}

.info-point-popup-container .leaflet-popup-tip {
    background-color: white;
}

/* Route Point markers */
.route-point-marker {
    background: transparent;
}

.route-point-popup-container .leaflet-popup-tip {
    background-color: white;
}

/* Route Point Popup (Start/End) */
.route-point-popup-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.route-point-popup-content {
    padding: 12px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.route-point-popup-content h3 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

/* Direction Arrow markers */
.route-direction-arrow {
    background: transparent;
    z-index: 1000;
}

.route-direction-arrow .leaflet-div-icon {
    background: transparent;
    border: none;
    border-radius: 0;
}

/* Arrow styling for better visibility */
.route-direction-arrow div {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Map Controls */
.map-controls {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.map-controls-title {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    display: flex;
    align-items: center;
}

.map-controls-title::before {
    content: "";
    display: inline-block;
    font-family: dashicons;
    font-size: 18px;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    content: "\f111";
    color: #666;
}

.map-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.map-control-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.map-control-item:hover {
    border-color: #3388FF;
    background: #f8f9ff;
}

.map-control-item input[type="checkbox"] {
    margin: 0 12px 0 0;
    transform: scale(1.2);
    accent-color: #3388FF;
}

.map-control-icon {
    font-size: 20px;
    margin-right: 10px;
    flex-shrink: 0;
}

.map-control-label {
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    flex: 1;
}

/* Navigation buttons */
.map-navigation-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    border-top: 1px solid #dee2e6;
    padding-top: 20px;
}

.map-nav-button {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border: 2px solid #007cba;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: #007cba;
}

.map-nav-button:hover {
    background: #007cba;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.2);
}

.map-nav-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 124, 186, 0.2);
}

.map-nav-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.map-nav-button:disabled:hover {
    background: white;
    color: #007cba;
}

/* Checked state styling */
.map-control-item:has(input[type="checkbox"]:checked) {
    border-color: #3388FF;
    background: #e3f2fd;
}

.map-control-item:has(input[type="checkbox"]:checked) .map-control-label {
    color: #1976d2;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .map-controls-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 16px;
    }
    
    .map-navigation-buttons {
        grid-template-columns: 1fr;
        gap: 8px;
        padding-top: 16px;
    }
    
    .map-control-item,
    .map-nav-button {
        padding: 10px 14px;
    }
    
    .map-control-icon {
        font-size: 18px;
        margin-right: 8px;
    }
    
    .map-control-label {
        font-size: 13px;
    }
}

/* Fallback for browsers that don't support :has() */
@supports not selector(:has(*)) {
    .map-control-item.checked {
        border-color: #3388FF;
        background: #e3f2fd;
    }
    
    .map-control-item.checked .map-control-label {
        color: #1976d2;
    }
}

@media (max-width: 768px) {
    .artwork-modal-content {
        width: 95%;
        margin: 20px auto;
        padding: 15px;
    }
    
    .close-modal {
        top: 5px;
        right: 10px;
    }
    
    .art-route-map {
        height: 400px;
    }
    
    .leaflet-popup-content {
        width: 250px !important;
    }
    
    .artwork-popup-image {
        height: 120px;
    }
    
    .info-point-popup-container .leaflet-popup-content {
        width: 250px !important;
    }
    
    .info-point-popup-image {
        height: 120px;
    }
    
    .route-point-popup-container .leaflet-popup-content {
        width: 220px !important;
    }
    .route-point-popup-content {
        padding: 10px;
        font-size: 14px;
    }
}