/*
 * Styles for the Etappe & Schleife Detail Pages (Refined Classic Layout)
 */

/* --- Main Container --- */
.route-details-container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 1.5rem;
    font-family: 'Roboto', sans-serif;
}

/* --- Header & Stats (with Icons) --- */
.route-header {
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.route-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.route-subtitle {
    font-size: 1.5rem;
    font-weight: 400;
    color: #4b5563;
    margin-top: 0;
    margin-bottom: 2rem;
}

/* This controls the layout for BOTH of your stats rows */
.route-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1rem;
}

/* This adds the space you wanted between the two rows */
.route-header .route-stats:first-of-type {
    margin-bottom: 1.5rem; 
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 1rem;
    min-width: 150px;
}

.stat-item i {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    color: #009540; /* Brand Green */
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #6b7280;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
}

/* --- Waypoints Section (Refined Card Layout) --- */
.waypoints-container {
    display: flex;
    flex-direction: column;
    gap: 2rem; /* Space between waypoint cards */
}

.waypoint-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
    padding: 2rem;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.03);
}

.waypoint-image-wrapper {
    min-width: 0; /* Prevents overflow in grid/flex containers */
}

.waypoint-image-wrapper img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    object-fit: cover;
    display: block;
}

.waypoint-description-wrapper {
    position: relative;
    padding-left: 3rem; /* Space for the number */
}

.waypoint-number {
    position: absolute;
    left: 0;
    top: -5px;
    font-size: 2.5rem;
    font-weight: 700;
    color: #009540; /* Brand Green */
    line-height: 1;
}

.waypoint-text p {
    font-size: 1rem;
    line-height: 1.6;
    color: #374151;
    margin: 0 0 1em 0;
}

.waypoint-text p:last-child {
    margin-bottom: 0;
}

/* Alternating layout for image on the right */
.waypoint-row.layout-image-right .waypoint-image-wrapper {
    grid-column: 2;
}

.waypoint-row.layout-image-right .waypoint-description-wrapper {
    grid-column: 1;
    grid-row: 1;
}

/* --- Gallery & Thumbnail Styles (Final Version) --- */
.waypoint-gallery-wrapper {
    width: 100%;
}

.waypoint-carousel-gallery.swiper {
    width: 100%;
    height: 350px;
    margin-bottom: 15px; /* Space between main image and thumbnails */
    border-radius: 8px;
}

.waypoint-carousel-gallery .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.thumbnail-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.thumbnail-item {
    width: calc(20% - 8px); /* 5 columns with 10px gap */
    aspect-ratio: 1 / 1;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    opacity: 0.7;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.thumbnail-item:hover {
    opacity: 1;
    transform: scale(1.05);
}

.thumbnail-item.is-active {
    opacity: 1;
    border-color: #009540;
    transform: scale(1.05);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* --- Carousel Arrow Styles --- */
.waypoint-carousel-gallery .swiper-button-next,
.waypoint-carousel-gallery .swiper-button-prev {
    background-color: rgba(0, 0, 0, 0.4);
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}
.waypoint-carousel-gallery .swiper-button-next::after,
.waypoint-carousel-gallery .swiper-button-prev::after {
    font-weight: 900;
    font-size: 18px;
}
.waypoint-carousel-gallery .swiper-button-next:hover,
.waypoint-carousel-gallery .swiper-button-prev:hover {
    background-color: rgba(0, 0, 0, 0.6);
}
.waypoint-carousel-gallery .swiper-pagination-bullet-active {
    background: #009540;
}


/* --- Map Section --- */
.route-map-container {
    margin: 3rem 0;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.route-map-container::before {
    content: 'Streckenkarte';
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
    text-align: center;
}

/* --- Route Navigation --- */
.route-navigation {
    display: flex;
    justify-content: space-between;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.nav-link{
    display: flex
}

.nav-link a {
    display: inline-block; /* UPDATED: This shrinks the link to its content */
    padding: 0.75rem 1rem; /* UPDATED: Reduced padding */
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.2s, border-color 0.2s;
}

.nav-link a:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

.nav-link span {
    display: block;
    font-size: 0.9rem;
    color: #6b7280;
}

.nav-link strong {
    display: block;
    font-size: 1.1rem;
    color: #1f2937;
    font-weight: 600;
}

.nav-link.next-link {
    text-align: right;
}

/* --- LAYOUT FIXES FOR MAP & PAGE BUILDER --- */
.route-details-container .e-con-inner {
    height: auto !important;
}

.route-details-container .gpxv-view {
    margin: 0;
    text-align: left; /* .route-map-container centers its heading only */
    border: none;
    box-shadow: none;
}


/* --- Responsive for Mobile --- */
@media (max-width: 767px) {
    .route-details-container {
        padding: 1rem;
    }

    .route-title {
        font-size: 2rem;
    }

    .waypoint-row,
    .waypoint-row.layout-image-right {
        grid-template-columns: 1fr;
        padding: 1.5rem;
    }

    .waypoint-row.layout-image-right .waypoint-image-wrapper,
    .waypoint-row.layout-image-right .waypoint-description-wrapper {
        grid-column: 1;
        grid-row: auto;
    }
    
    .route-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    /* Make thumbnails responsive on mobile */
    .thumbnail-grid {
        gap: 8px;
    }
    .thumbnail-item {
        width: calc(25% - 6px); /* 4 columns on mobile */
    }
}



/* keyboard focus */
.nav-link a:focus-visible,
.thumbnail-item:focus-visible,
.waypoint-image-wrapper a:focus-visible {
    outline: 3px solid #005a27;
    outline-offset: 2px;
}
