/* ===== GRUNDLEGENDE RESETS ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

/* ===== SCREEN VERWALTUNG (wurde entfernt, jetzt wiederhergestellt) ===== */
.screen {
    display: none;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    min-height: 100dvh; /* Mobile Viewport Fix */
}

.screen.active {
    display: block;
}

/* ===== STARTSCREEN ===== */
#startScreen {
    background-color: var(--white);
    text-align: center;
}

#startScreen.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    padding: 20px;
    min-height: 100vh;
    min-height: 100dvh; /* Mobile Viewport Fix */
}

.logo-container {
    width: 180px;
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
}

.logo-circle {
    width: 140px;
    height: 140px;
    border: 3px dashed var(--primary-blue);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: spin 20s linear infinite;
}

.logo-dot {
    width: 16px;
    height: 16px;
    background-color: var(--primary-blue);
    border-radius: 50%;
}

.app-title {
    font-size: 3.2rem;
    font-weight: 900;
    letter-spacing: 0.05em;
    margin: 0 0 15px 0;
    text-transform: lowercase;
    color: var(--primary-blue);
    text-shadow: 1px 1px 3px rgba(0, 0, 128, 0.1);
}

.start-hint {
    font-size: 1.4rem;
    color: var(--primary-blue);
    opacity: 0.8;
    margin-top: 60px;
    font-style: italic;
    font-weight: 300;
}

/* ===== VARIABLEN ===== */
:root {
    --primary-blue: #000080;      /* Hauptfarbe Dunkelblau */
    --primary-dark: #000050;      /* Dunkleres Blau */
    --white: #ffffff;
    --light-gray: #f5f5f5;
    --medium-gray: #cccccc;
    --dark-gray: #333333;
    --selected-bg: #000080;
    --selected-text: #ffffff;
}

.route-info { display: none; }
/* Überschrift */
#preferencesScreen h2 {
    color: var(--primary-blue);
    font-size: 2.2rem;
    margin: 0 0 40px 0;
    text-align: center;
    font-weight: 700;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-blue);
}

/* Präferenz-Gruppen */
.preference-group {
    width: 100%;
    margin-bottom: 30px;
    padding: 25px;
    border: 2px solid var(--medium-gray);
    border-radius: 12px;
    background-color: var(--light-gray);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.preference-group label {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 15px;
}

/* ===== SLIDER STYLING - KORRIGIERT ===== */
.preference-group:has(#duration-slider) {
    position: relative;
}

#duration-slider {
    width: 100%;
    height: 10px;
    margin: 20px 0;
    -webkit-appearance: none;
    appearance: none;
    background: #e0e0e0; /* Nur grauer Hintergrund */
    border-radius: 5px;
    outline: none;
    position: relative;
    z-index: 1;
}

/* Erstelle den blauen Fortschrittsbalken mit einem Pseudo-Element */
.slider-container {
    position: relative;
    width: 100%;
    margin: 20px 0;
}

.slider-track {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    z-index: 0;
}

.slider-progress {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 10px;
    background: var(--primary-blue);
    border-radius: 5px 0 0 5px;
    z-index: 1;
    transition: width 0.1s ease;
}

#duration-slider {
    width: 100%;
    height: 10px;
    margin: 20px 0;
    -webkit-appearance: none;
    appearance: none;
    background: transparent; /* Transparent, damit Progress sichtbar ist */
    border-radius: 5px;
    outline: none;
    position: relative;
    z-index: 2;
}

/* Slider Thumb (der bewegliche Punkt) */
#duration-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    background: var(--primary-blue);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--white);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    position: relative;
    z-index: 3;
}

#duration-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

#duration-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    background: var(--primary-blue);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--white);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

#duration-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

/* Slider Track für Firefox */
#duration-slider::-moz-range-track {
    background: transparent;
    height: 10px;
    border-radius: 5px;
}

/* Slider Value Display */
#duration-display {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    display: block;
    margin-top: 25px;
    text-align: center;
    background: var(--white);
    padding: 12px 24px;
    border-radius: 8px;
    border: 2px solid var(--primary-blue);
    display: inline-block;
    min-width: 120px;
    transition: all 0.3s ease;
}

/* Slider Werte Labels (optional) */
.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--dark-gray);
}

.slider-label {
    position: relative;
    padding-top: 20px;
}

.slider-label::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 10px;
    background: var(--medium-gray);
}

/* ===== KATEGORIEN GRID ===== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Kategorie Boxen */
.category-box {
    display: block;
    cursor: pointer;
    border: 2px solid var(--primary-blue);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    background-color: var(--white);
}

.category-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,128,0.15);
}

.box-content {
    padding: 25px 15px;
    font-weight: 600;
    color: var(--primary-blue);
    text-align: center;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

/* Verstecke die echte Checkbox */
.category-box input[type="checkbox"] {
    display: none;
}

/* Ausgewählte Kategorie */
.category-box input[type="checkbox"]:checked + .box-content {
    background-color: var(--selected-bg);
    color: var(--selected-text);
}

/* ===== PUBLIC TRANSPORT CHECKBOX ===== */
.public-transport {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 15px 0;
}

.public-transport label {
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    color: var(--primary-blue);
    cursor: pointer;
    margin: 0;
    padding: 10px 0;
    font-weight: 600;
}

.public-transport input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-right: 15px;
    cursor: pointer;
    accent-color: var(--primary-blue);
}

/* ===== GENERATE BUTTON ===== */
#generate-route-button {
    background-color: var(--primary-blue);
    color: var(--white);
    border: none;
    padding: 18px 35px;
    font-size: 1.3rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 40px auto 20px;
    width: 100%;
    max-width: 350px;
    display: block;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(0,0,128,0.2);
}

#generate-route-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,128,0.3);
}

#generate-route-button:active {
    transform: translateY(0);
}

/* ===== ANIMATIONEN ===== */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .screen {
        padding: 15px;
    }
    
    .app-title {
        font-size: 2.5rem;
    }
    
    .logo-container {
        width: 140px;
        height: 140px;
    }
    
    .logo-circle {
        width: 110px;
        height: 110px;
    }
    
    #preferencesScreen h2 {
        font-size: 1.8rem;
    }
    
    .preference-group {
        padding: 20px;
    }
    
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .box-content {
        padding: 20px 10px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .app-title {
        font-size: 2rem;
    }
    
    .start-hint {
        font-size: 1.1rem;
    }
    
    .logo-container {
        width: 120px;
        height: 120px;
        margin-bottom: 30px;
    }
    
    .logo-circle {
        width: 90px;
        height: 90px;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    #preferencesScreen h2 {
        font-size: 1.6rem;
        margin-bottom: 30px;
    }
    
    #generate-route-button {
        padding: 16px 25px;
        font-size: 1.1rem;
    }
    
    body::after {
        font-size: 10px;
        padding: 5px 8px;
        top: 5px;
        right: 5px;
    }
}

/* ===== FALLBACK FÜR ÄLTERE BROWSER ===== */
/* Stellt sicher, dass die Farben auch ohne CSS-Variablen funktionieren */
.no-css-vars body {
    background-color: #ffffff;
    color: #000080;
}

.no-css-vars .app-title,
.no-css-vars #preferencesScreen h2,
.no-css-vars .preference-group label,
.no-css-vars #duration-display,
.no-css-vars .box-content {
    color: #000080;
}

.no-css-vars .logo-circle {
    border-color: #000080;
}

.no-css-vars .logo-dot,
.no-css-vars #generate-route-button,
.no-css-vars .category-box input[type="checkbox"]:checked + .box-content {
    background-color: #000080;
}

.no-css-vars #generate-route-button:hover {
    background-color: #000050;
}


/* ===== MAP SCREEN ===== */
#mapScreen {
    /* display: flex;  <-- ENTFERNT, damit display: none von .screen greift */
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Mobile Viewport Fix */
    padding: 0;
    max-width: 100%;
}

#mapScreen.active {
    display: flex;
}

.screen-header {
    display: flex;
    align-items: center;
    padding: 20px;
    background: var(--primary-blue);
    color: white;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.back-button {
    background: transparent;
    border: 2px solid white;
    color: white;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    margin-right: 20px;
    transition: all 0.3s ease;
}

.back-button:hover {
    background: white;
    color: var(--primary-blue);
}

.screen-header h2 {
    margin: 0;
    color: white;
    font-size: 1.8rem;
}

/* Map Container */
#map-container {
    position: relative;
    flex: 1;
    min-height: 400px;
    height: 55vh; /* Feste Mindest-Höhe, damit die Karte immer sichtbar ist */
}

#map {
    width: 100%;
    height: 100%;
    min-height: 320px; /* Zusatz-Sicherheit für mobile Browser */
    background: #f0f0f0;
}

.map-action-btn {
    position: absolute;
    bottom: 20px;
    width: 50px;
    height: 50px;
    background: white;
    border: 2px solid var(--primary-blue);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    z-index: 1000;
}

.map-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    background: #f8f8f8;
}

.map-action-btn:active {
    transform: translateY(0);
}

.map-action-left {
    left: 20px;
}

.map-action-right {
    right: 20px;
}

/* ===== KATEGORIEN LEGENDE ===== */
.category-legend {
    position: absolute;
    top: 10px;
    right: 10px;
    background: white;
    border: 2px solid var(--primary-blue);
    border-radius: 8px;
    padding: 12px 16px;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    max-width: 220px;
}

.legend-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--primary-blue);
    margin-bottom: 10px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 8px;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #333;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ===== ROUTE SCREEN ===== */
#routeScreen {
    /* display: flex; <-- ENTFERNT */
    flex-direction: column;
    padding: 0;
}

#routeScreen.active {
    display: flex;
}

#route-map-container {
    position: relative;
    flex: 1;
    min-height: 400px;
    height: 60vh;
}

#route-map {
    width: 100%;
    height: 100%;
    min-height: 400px;
    background: #f0f0f0;
}

.route-details {
    padding: 20px;
    background: white;
    border-top: 2px solid var(--primary-blue);
}

.route-summary {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f8f8;
    border-radius: 8px;
    border-left: 4px solid var(--primary-blue);
}

.summary-label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.summary-value {
    font-weight: bold;
    color: var(--primary-blue);
    font-size: 16px;
}

.map-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.map-control-btn {
    background: white;
    border: 2px solid var(--primary-blue);
    color: var(--primary-blue);
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.map-control-btn.active {
    background: var(--primary-blue);
    color: white;
}

.map-control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Route Info */
.route-info {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    padding: 20px;
    background: #f8f9fa;
    max-height: 40vh;
    overflow-y: auto;
}

.info-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--primary-blue);
}

.info-card h3 {
    margin-top: 0;
    color: var(--primary-blue);
    border-bottom: 2px solid var(--primary-blue);
    padding-bottom: 10px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-weight: bold;
    color: var(--dark-gray);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.info-value {
    font-size: 1.1rem;
    color: var(--primary-blue);
    font-weight: bold;
}

/* POI List */
.poi-list-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--primary-blue);
    overflow-y: auto;
}

.poi-list-container h3 {
    margin-top: 0;
    color: var(--primary-blue);
    border-bottom: 2px solid var(--primary-blue);
    padding-bottom: 10px;
    position: sticky;
    top: 0;
    background: white;
    z-index: 1;
}

#poi-list {
    max-height: 300px;
    overflow-y: auto;
}

.poi-item {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.poi-item:hover {
    background: #f0f8ff;
    transform: translateX(5px);
}

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

.poi-name {
    font-weight: bold;
    color: var(--primary-blue);
    margin-bottom: 5px;
}

.poi-category {
    display: inline-block;
    background: var(--light-gray);
    color: var(--dark-gray);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-right: 5px;
    margin-bottom: 5px;
}

.poi-season {
    display: inline-block;
    background: #e8f5e8;
    color: #2e7d32;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* Jahreszeit Farben */
.season-spring { background: #c8e6c9; color: #2e7d32; }
.season-summer { background: #fff3cd; color: #856404; }
.season-autumn { background: #ffe0b2; color: #ef6c00; }
.season-winter { background: #e3f2fd; color: #1565c0; }

/* Heatmap Legende */
.heatmap-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: white;
    padding: 10px 15px;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 0.8rem;
}

.legend-title {
    font-weight: bold;
    margin-bottom: 5px;
    color: var(--primary-blue);
}

.legend-gradient {
    width: 200px;
    height: 10px;
    background: linear-gradient(to right, 
        rgba(0, 100, 255, 0.1), 
        rgba(0, 100, 255, 0.5), 
        rgba(0, 100, 255, 0.9)
    );
    border-radius: 3px;
    margin: 5px 0;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
}

/* Responsive */
@media (max-width: 768px) {
    .route-info {
        grid-template-columns: 1fr;
        max-height: 50vh;
    }
    
    .map-controls {
        bottom: 10px;
        right: 10px;
        flex-direction: column;
    }
    
    .screen-header {
        padding: 15px;
    }
    
    .screen-header h2 {
        font-size: 1.4rem;
    }
}
/* Route Legend */
.route-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    font-size: 12px;
    max-width: 150px;
}

.route-legend h4 {
    margin: 0 0 8px 0;
    color: var(--primary-blue);
    font-size: 13px;
}

.route-legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.route-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Validation Message */
.validation-message {
    color: #d32f2f;
    background-color: #ffebee;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
    text-align: center;
    display: none; /* Hidden by default */
    border: 1px solid #ffcdd2;
}
.validation-message.visible {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}
