/**
 * GPX Map Visualization Styles
 * Custom styles for interactive GPX map display
 */

.gpx-map-wrapper {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    background: #fff;
}

.gpx-map {
    border-radius: 12px;
    z-index: 1;
    position: relative;
    background: #f8f9fa;
    min-height: 450px;
}

/* Ensure Leaflet map is visible */
#leaflet-map {
    width: 100% !important;
    height: 100% !important;
    border-radius: 12px;
    background: #f8f9fa !important;
}

/* Canvas tile styling */
.leaflet-layer,
.leaflet-tile-container {
    background: transparent !important;
}

.leaflet-tile {
    background: #f8f9fa !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.gpx-map-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1000;
    display: flex;
    gap: 8px;
}

.gpx-control-btn {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: #333;
    font-size: 16px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.gpx-control-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 102, 204, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
    z-index: -1;
}

.gpx-control-btn:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    color: #0066cc;
    transform: translateY(-2px) scale(1.05);
}

.gpx-control-btn:hover::before {
    width: 100%;
    height: 100%;
}

.gpx-control-btn:active {
    transform: translateY(0);
}

/* Statistics Panel */
.gpx-statistics {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.gpx-statistics::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #e74c3c 0%, #f39c12 50%, #27ae60 100%);
}

.gpx-statistics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 700px;
    margin: 0 auto;
}

.gpx-stat-item {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.gpx-stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--stat-color, #e74c3c) 0%, transparent 100%);
    border-radius: 16px 16px 0 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gpx-stat-item:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 1);
}

.gpx-stat-item:hover::before {
    opacity: 1;
}

.gpx-stat-item:nth-child(1) { --stat-color: #e74c3c; }
.gpx-stat-item:nth-child(2) { --stat-color: #27ae60; }
.gpx-stat-item:nth-child(3) { --stat-color: #3498db; }

.gpx-stat-item i {
    font-size: 28px;
    color: var(--stat-color, #e74c3c);
    min-width: 40px;
    text-align: center;
    padding: 12px;
    background: rgba(var(--stat-color-rgb, 231, 76, 60), 0.1);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.gpx-stat-item:nth-child(1) i { background: rgba(231, 76, 60, 0.1); }
.gpx-stat-item:nth-child(2) i { background: rgba(39, 174, 96, 0.1); }
.gpx-stat-item:nth-child(3) i { background: rgba(52, 152, 219, 0.1); }

.gpx-stat-item:hover i {
    transform: scale(1.1) rotate(5deg);
    background: rgba(var(--stat-color-rgb, 231, 76, 60), 0.2);
}

.gpx-stat-content {
    flex: 1;
    min-width: 0;
}

.gpx-stat-value {
    font-size: 26px;
    font-weight: 800;
    color: #2c3e50;
    line-height: 1.2;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
    transition: color 0.3s ease;
}

.gpx-stat-item:hover .gpx-stat-value {
    color: var(--stat-color, #e74c3c);
}

.gpx-stat-label {
    font-size: 14px;
    color: #6c757d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.gpx-stat-item:hover .gpx-stat-label {
    color: #495057;
}

/* Error State */
.gpx-error {
    padding: 20px;
    text-align: center;
}

.gpx-error .alert {
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    font-weight: 500;
}

.gpx-error i {
    font-size: 18px;
}

/* Custom Marker Styles */
.custom-gpx-marker {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 12px 16px;
    line-height: 1.4;
}

.leaflet-popup-tip {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .gpx-map-controls {
        top: 10px;
        right: 10px;
        gap: 6px;
    }
    
    .gpx-control-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .gpx-statistics {
        padding: 20px 15px;
    }
    
    .gpx-statistics-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .gpx-stat-item {
        padding: 16px;
        gap: 14px;
    }
    
    .gpx-stat-item i {
        font-size: 24px;
        padding: 10px;
    }
    
    .gpx-stat-value {
        font-size: 22px;
    }
    
    .gpx-stat-label {
        font-size: 13px;
    }
}

/* Dark mode support */

/* Animation classes */
.gpx-fade-in {
    animation: gpxFadeIn 0.5s ease-in-out;
}

@keyframes gpxFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gpx-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    background: #f8f9fa;
    border-radius: 12px;
}

.gpx-loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid #e74c3c;
    border-top-color: transparent;
    border-radius: 50%;
    animation: gpxSpin 1s linear infinite;
}

@keyframes gpxSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Notification System */
.gpx-notification {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(44, 62, 80, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    white-space: nowrap;
}

.gpx-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.gpx-notification::before {
    content: '✓';
    margin-right: 8px;
    font-weight: bold;
}

/* Map Error Styles */
.gpx-map-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 40px 20px;
}

.gpx-error-content {
    text-align: center;
    max-width: 400px;
}

.gpx-error-content i {
    font-size: 48px;
    color: #e74c3c;
    margin-bottom: 20px;
    display: block;
}

.gpx-error-content h4 {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 18px;
}

.gpx-error-content p {
    color: #6c757d;
    margin-bottom: 25px;
    line-height: 1.5;
    font-size: 14px;
}

.gpx-retry-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.gpx-retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
}

.gpx-retry-btn:active {
    transform: translateY(0);
}

/* Map Tabs Styling */
.map-tabs-container {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    background: #fff;
}

.map-service-tabs {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 0;
    margin: 0;
}

.map-service-tabs .nav-item {
    margin: 0;
}

.map-service-tabs .nav-link {
    background: transparent;
    border: none;
    color: #6c757d;
    font-weight: 500;
    padding: 15px 20px;
    border-radius: 0;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-service-tabs .nav-link:hover {
    color: #0066cc;
    background: rgba(255, 255, 255, 0.5);
}

.map-service-tabs .nav-link.active {
    color: #0066cc;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 3px solid #0066cc;
}

.map-service-tabs .nav-link i {
    font-size: 16px;
}

.map-tab-content {
    background: #fff;
}

.map-tab-content .tab-pane {
    padding: 0;
}

/* Enhanced responsive design for tabs */
@media (max-width: 768px) {
    .map-service-tabs .nav-link {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .map-service-tabs .nav-link i {
        font-size: 14px;
    }
}