/**
 * Streckenprofil Styles im Alltrails/Komoot-Stil
 * Responsive Design mit modernen CSS-Features
 */

/* Hauptcontainer */
.elevation-profile-wrapper {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.elevation-profile-wrapper:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Header-Bereich */
.elevation-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.elevation-profile-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.4em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Statistiken */
.elevation-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    padding: 8px 12px;
    background: rgba(44, 62, 80, 0.95); /* gleicher dunkler Hintergrund wie Tooltip */
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.stat-item:hover {
    background: rgba(44, 62, 80, 1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.stat-label {
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.8); /* helle Farbe für Labels wie im Tooltip */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 0.9em;
    font-weight: 700;
    color: #ffffff; /* weiße Grundfarbe für bessere Lesbarkeit */
}

/* Spezielle Farben für verschiedene Statistiken - helle Farben wie im Tooltip */
.stat-item:nth-child(1) .stat-value {
    color: #74c0fc; /* helles Blau für Länge */
}

.stat-item:nth-child(2) .stat-value {
    color: #51cf66; /* helles Grün für Anstieg */
}

.stat-item:nth-child(3) .stat-value {
    color: #ff6b6b; /* helles Rot für Abstieg */
}

.stat-item:nth-child(4) .stat-value {
    color: #ffd43b; /* helles Gelb für höchsten Punkt */
}

.stat-item:nth-child(5) .stat-value {
    color: #da77f2; /* helles Lila für niedrigsten Punkt */
}

/* Chart-Container */
.elevation-chart-container {
    position: relative;
    height: 250px;
    width: 100%;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    padding: 10px;
    overflow: hidden;
}

.elevation-chart-container canvas {
    border-radius: 6px;
}

/* Custom Tooltip */
.elevation-tooltip {
    position: fixed;
    z-index: 5000;
    pointer-events: none;
    background: rgba(44, 62, 80, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85em;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: opacity 0.2s ease;
}

.tooltip-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
}

.tooltip-content > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    white-space: nowrap;
}

.tooltip-content span {
    font-weight: 600;
    margin-left: 8px;
}

/* Tooltip-Farben */
.tooltip-distance {
    color: #74c0fc;
}

.tooltip-elevation {
    color: #51cf66;
}

.tooltip-gradient {
    color: #ffd43b;
}

/* Hover-Marker auf der Karte */
.elevation-hover-marker {
    z-index: 1000;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: all 0.2s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .elevation-profile-wrapper {
        margin: 15px 0;
        padding: 15px;
        border-radius: 8px;
    }
    
    .elevation-profile-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .elevation-profile-header h3 {
        font-size: 1.2em;
        text-align: center;
    }
    
    .elevation-stats {
        justify-content: center;
        gap: 12px;
    }
    
    .stat-item {
        min-width: 70px;
        padding: 6px 10px;
    }
    
    .stat-label {
        font-size: 0.7em;
    }
    
    .stat-value {
        font-size: 0.85em;
    }
    
    .elevation-chart-container {
        height: 200px;
        padding: 8px;
    }
    
    .elevation-tooltip {
        font-size: 0.8em;
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .elevation-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 100%;
    }
    
    .stat-item {
        min-width: unset;
    }
    
    .elevation-chart-container {
        height: 180px;
    }
}

/* Animationen */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.elevation-profile-wrapper {
    animation: fadeInUp 0.4s ease-out;
}

/* Loading-State */
.elevation-chart-container.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.elevation-chart-container.loading::after {
    content: '📊 Streckenprofil wird geladen...';
    color: #6c757d;
    font-size: 0.9em;
    font-weight: 500;
}

/* Hover-Effekte für bessere UX */
.elevation-chart-container:hover {
    cursor: crosshair;
}

/* Chart.js Override für besseres Styling */
.elevation-chart-container .chartjs-tooltip {
    display: none !important; /* Wir verwenden unser eigenes Tooltip */
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .elevation-profile-wrapper,
    .stat-item,
    .elevation-hover-marker,
    .elevation-tooltip {
        transition: none;
        animation: none;
    }
}

/* Print-Styles */
@media print {
    .elevation-profile-wrapper {
        box-shadow: none;
        border: 1px solid #000;
        break-inside: avoid;
    }
    
    .elevation-tooltip {
        display: none !important;
    }
}

/* Dark Mode Support (falls gewünscht) */
@media (prefers-color-scheme: dark) {
    .elevation-profile-wrapper {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .elevation-profile-header h3 {
        color: #ecf0f1;
    }
    
    .stat-item {
        background: #34495e;
        border-color: #4a5568;
        color: #ecf0f1;
    }
    
    .stat-label {
        color: #a0aec0;
    }
    
    .elevation-chart-container {
        background: #34495e;
        border-color: #4a5568;
    }
    
    .elevation-chart-container.loading::after {
        color: #a0aec0;
    }
}

/* Spezielle Styles für kleine Streckenprofile (Kompakt-Modus) */
.elevation-profile-wrapper.compact {
    padding: 15px;
    margin: 10px 0;
}

.elevation-profile-wrapper.compact .elevation-chart-container {
    height: 150px;
}

.elevation-profile-wrapper.compact .elevation-stats {
    gap: 15px;
}

.elevation-profile-wrapper.compact .stat-item {
    min-width: 65px;
    padding: 6px 8px;
}

/* Erweiterte Hover-Effekte */
.stat-item {
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.stat-item:hover::before {
    left: 100%;
}

/* Gradient-Hintergründe für visuelle Tiefe */
.elevation-profile-wrapper {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
}

.elevation-chart-container {
    background: linear-gradient(145deg, #fafafa 0%, #f1f3f4 100%);
} 