/* =========================================================
   GRUNDLAGEN
   ========================================================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f4f6f8;
    color: #222;
}

/* =========================================================
   HEADER
   ========================================================= */

.header {
    background: #111827;
    color: white;
    padding: 28px 20px;
}

.header-inner {
    max-width: 1400px;
    margin: auto;
}

.header h1 {
    margin: 0 0 6px;
    font-size: 30px;
}

.header p {
    margin: 0;
    color: #cbd5e1;
}

/* =========================================================
   CONTAINER
   ========================================================= */

.container {
    max-width: 1400px;
    margin: auto;
    padding: 25px 20px 50px;
}

/* =========================================================
   SECTIONS
   ========================================================= */

.map-section,
.tour-section {
    background: white;
    border-radius: 14px;
    margin-bottom: 25px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

/* =========================================================
   SECTION TITLE
   ========================================================= */

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.section-title h2 {
    margin: 0 0 4px;
}

.section-title p {
    margin: 0;
    color: #6b7280;
}

/* =========================================================
   MAP BUTTONS
   ========================================================= */

.map-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* =========================================================
   BUTTON
   ========================================================= */

.button {
    border: none;
    background: #2563eb;
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 44px;
    line-height: 1.2;
}

.button:hover {
    background: #1d4ed8;
}

.button:active {
    transform: scale(0.98);
}

.button-secondary {
    background: #e5e7eb;
    color: #374151;
}

.button-secondary:hover {
    background: #d1d5db;
}

/* =========================================================
   LAYER-SWITCHER
   ========================================================= */

.layer-switcher {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.layer-btn {
    border: 2px solid #e5e7eb;
    background: white;
    color: #374151;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    min-height: 40px;
}

.layer-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.layer-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.layer-btn.active:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

/* =========================================================
   MAP
   ========================================================= */

#map {
    width: 100%;
    height: 650px;
    border-radius: 10px;
    overflow: hidden;
}

.map-status {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 13px;
}

/* =========================================================
   YEAR GROUP
   ========================================================= */

.year-group {
    margin-bottom: 30px;
}

.year-group:last-child {
    margin-bottom: 0;
}

/* =========================================================
   YEAR HEADER
   ========================================================= */

.year-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e7eb;
}

.year-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex-wrap: wrap;
}

.year-heading h3 {
    margin: 0;
    font-size: 24px;
}

.year-heading span {
    color: #6b7280;
    font-size: 13px;
}

.year-distance {
    color: #6b7280;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.year-toggle-button {
    flex-shrink: 0;
    white-space: nowrap;
}

/* =========================================================
   TOUR GRID
   ========================================================= */

.tour-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 15px;
    overflow: hidden;
    width: 100%;
}

/* =========================================================
   TOUR CARD
   ========================================================= */

.tour-card {
    display: flex;
    
    gap: 14px;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fafafa;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
    max-width: 100%;
    overflow: hidden;
    cursor: pointer;
}

.tour-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.tour-card.active {
    background: #eff6ff;
    border-color: #93c5fd;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.10);
}

/* =========================================================
   TOUR ICON
   ========================================================= */

.tour-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
    border-radius: 10px;
    font-size: 24px;
}

.tour-card.active .tour-icon {
    background: #dbeafe;
}

/* =========================================================
   TOUR INFO
   ========================================================= */

.tour-info {
    flex: 1;
    min-width: 0;
    
}

.tour-info h3 {
    margin: 0 0 6px;
    font-size: 17px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tour-meta {
    font-size: 12px;
    color: #2563eb;
    font-weight: 700;
}

.tour-distance {
    margin-top: 4px;
    font-size: 13px;
    color: #374151;
    font-weight: 600;
}

.filename {
    margin: 5px 0 0;
    font-size: 12px;
    color: #9ca3af;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================================================
   TOUR DESCRIPTION - EXPANDIERBAR
   ========================================================= */

.tour-description {
    margin: 5px 0 0;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-height: 2.8em;
    word-break: break-word;
    cursor: pointer;
    transition: color 0.2s;
    width: calc(100% + 135px);
}

.tour-description:hover {
    color: #2563eb;
}

.tour-description-full {
    margin-top: 8px;
    padding: 10px 12px;
    background: #f0f7ff;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    border-left: 3px solid #2563eb;
    color: #1e293b;
    word-break: break-word;
    animation: fadeIn 0.3s ease;
    width: calc(100% + 135px);
}

.tour-description-full.show {
    display: block !important;
}

.tour-description-full.hidden {
    display: none !important;
}

/* Indikator, dass die Beschreibung anklickbar ist */
.tour-description::after {
    content: " ▶";
    font-size: 10px;
    color: #94a3b8;
    transition: transform 0.2s;
}

.tour-description.expanded::after {
    transform: rotate(90deg);
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   TOUR ACTIONS
   ========================================================= */

.tour-actions {
    flex-shrink: 0;
}

.tour-button {
    white-space: nowrap;
    min-width: 120px;
}

.show-text {
    display: inline;
}

.hide-text {
    display: none;
}

.tour-card.active .show-text {
    display: none;
}

.tour-card.active .hide-text {
    display: inline;
}

/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-icon {
    font-size: 50px;
    margin-bottom: 15px;
}

.empty h3 {
    color: #374151;
}

/* =========================================================
   FOOTER
   ========================================================= */

.footer {
    text-align: center;
    padding: 30px 20px;
    color: #6b7280;
    font-size: 13px;
}

.footer a {
    color: #2563eb;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 700px) {
    .header h1 {
        font-size: 24px;
    }

    .container {
        padding: 12px;
    }

    .map-section,
    .tour-section {
        padding: 12px;
    }

    .section-title {
        align-items: flex-start;
        flex-direction: column;
    }

    .map-buttons {
        width: 100%;
    }

    .map-buttons .button {
        flex: 1;
        font-size: 13px;
        padding: 10px 12px;
    }

    .layer-switcher {
        width: 100%;
    }
    
    .layer-btn {
        flex: 1;
        justify-content: center;
        font-size: 12px;
        padding: 8px 10px;
        min-height: 38px;
    }

    #map {
        height: 500px;
    }

    .tour-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .tour-card {
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 14px;
        max-width: 100%;
        width: 100%;
    }

    .tour-info {
        flex: 1 1 calc(100% - 62px);
        min-width: 0;
        overflow: hidden;
    }

    .tour-actions {
        flex: 1 1 100%;
        margin-top: 10px;
        margin-left: 0;
    }

    .tour-button {
        width: 100%;
        min-width: unset;
        padding: 12px 10px;
        font-size: 14px;
        justify-content: center;
    }

    .year-title {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .year-heading {
        width: 100%;
        flex-wrap: wrap;
    }

    .year-heading h3 {
        font-size: 21px;
    }

    .year-toggle-button {
        width: 100%;
        min-height: 44px;
        justify-content: center;
    }

    .year-distance {
        white-space: normal;
    }

    .tour-icon {
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
        font-size: 20px;
    }

    .tour-info h3 {
        font-size: 15px;
    }

    .tour-description {
        font-size: 11px;
        -webkit-line-clamp: 3;
        max-height: 4.2em;
        width: calc(100% - 0px) !important;
        
    }

    .tour-description-full {
        font-size: 12px;
        padding: 8px 10px;
        width: calc(100% - 0px) !important;
    }
}

/* =========================================================
   KLEINE MOBILE (unter 400px)
   ========================================================= */

@media (max-width: 400px) {
    .header h1 {
        font-size: 20px;
    }

    .container {
        padding: 8px;
    }

    .map-section,
    .tour-section {
        padding: 10px;
    }

    .tour-grid {
        gap: 10px;
    }

    .tour-card {
        padding: 12px;
        gap: 10px;
    }

    .tour-button {
        font-size: 13px;
        padding: 10px 8px;
    }

    .year-heading h3 {
        font-size: 18px;
    }

    .year-heading span {
        font-size: 12px;
    }

    .year-distance {
        font-size: 12px;
    }

    .layer-btn {
        font-size: 11px;
        padding: 6px 8px;
        min-height: 34px;
    }
}