/**
 * Trip Single Page Styles
 */

body.trip-page {
    margin: 0;
    background-color: #f8fafc;
    overflow: auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #1e293b;
}

.trip-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@media (min-width: 992px) {
    .trip-container {
        flex-direction: row;
        height: 100vh;
        overflow: hidden;
    }

    .trip-details {
        flex: 0 0 20%;
        width: 20%;
        min-width: 220px;
        max-width: calc(100% - 220px);
    }

    .trip-visuals {
        flex: 1 1 0;
        min-width: 220px;
    }
}

/* ========== Drag Resizer ========== */
.trip-resizer {
    display: none;
}

@media (min-width: 992px) {
    .trip-resizer {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 6px;
        width: 6px;
        cursor: col-resize;
        background: #e2e8f0;
        transition: background 0.15s;
        position: relative;
        z-index: 20;
    }

    .trip-resizer::after {
        content: '';
        display: block;
        width: 2px;
        height: 40px;
        border-radius: 2px;
        background: #94a3b8;
        transition: background 0.15s, height 0.15s;
    }

    .trip-resizer:hover,
    .trip-resizer.is-resizing {
        background: #cbd5e1;
    }

    .trip-resizer:hover::after,
    .trip-resizer.is-resizing::after {
        background: #475569;
        height: 56px;
    }
}

/* ========== Left Column: Details ========== */
.trip-details {
    padding: 0;
    overflow-y: auto;
    background: white;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.06);
    margin-top: 0px;
}

/* ========== Header (dark bar, like offcanvas) ========== */
.trip-header {
    width: 100%;
    background: #1e293b;
    color: white;
    padding: 1.25rem 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-shrink: 0;
    box-sizing: border-box;
}

.trip-header .back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: rgba(255, 255, 255, 0.55);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color 0.2s;
    padding: 0;
    margin-bottom: 0.25rem;
}

.trip-header .back-link:hover {
    color: white;
}

.trip-header-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.trip-title-large {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    color: white;
    font-family: inherit;
}

.trip-distance-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.3rem 0.7rem;
    border-radius: 99px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.trip-meta-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.trip-date {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
}

.trip-counts {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trip-counts span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.trip-counts svg {
    opacity: 0.7;
}

/* Tags */
.trip-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.trip-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: 99px;
    font-size: 0.64rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

/* ========== Content Body ========== */
.trip-body {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    flex-grow: 1;
}

/* Description */
.trip-description {
    font-size: 0.9375rem;
    line-height: 1.7;
    color: #475569;
    border-left: 3px solid var(--trip-color, #3b82f6);
    padding-left: 1rem;
    max-height: 9rem;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.trip-description::-webkit-scrollbar {
    width: 4px;
}

.trip-description::-webkit-scrollbar-track {
    background: transparent;
}

.trip-description::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

/* ========== Routes Timeline ========== */
.trip-routes-timeline {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.timeline-routes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.timeline-route-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
}

.route-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.35rem;
    box-shadow: 0 0 0 2px white, 0 1px 3px rgba(0,0,0,0.15);
}

.route-content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-width: 0;
}

.route-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
}

.route-datetime {
    font-size: 0.75rem;
    color: #64748b;
}

.route-description {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.5;
    max-height: 3.5rem;
    overflow-y: auto;
}

/* Route item in unified timeline */
.timeline-point.timeline-route {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
}

.timeline-point.timeline-route .point-marker {
    background-color: var(--trip-color, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== Timeline ========== */
.timeline-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin: 0 0 0.75rem 0;
}

.trip-timeline {
    position: relative;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.timeline-points {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    position: relative;
    counter-reset: timeline-counter;
}

.timeline-point {
    position: relative;
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-radius: 0.625rem;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    counter-increment: timeline-counter;
    z-index: 1;
}

.timeline-point:hover {
    background-color: #f1f5f9;
}

.timeline-point.active {
    background-color: color-mix(in srgb, var(--trip-color, #3b82f6) 8%, white);
    border-color: color-mix(in srgb, var(--trip-color, #3b82f6) 25%, transparent);
}

/* Numbered waypoint marker */
.point-marker {
    position: relative;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--trip-color, #3b82f6);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--trip-color, #3b82f6);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.point-marker::before {
    content: counter(timeline-counter);
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.timeline-point:hover .point-marker,
.timeline-point.active .point-marker {
    transform: scale(1.2);
    box-shadow: 0 0 0 3px var(--trip-color, #3b82f6), 0 4px 10px color-mix(in srgb, var(--trip-color, #3b82f6) 35%, transparent);
}

.point-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.point-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.point-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
    color: #1e293b;
    line-height: 1.3;
}

.point-date {
    font-size: 0.75rem;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
}

.point-links {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 2px;
}

.point-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 5px;
    background: #f1f3f5;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
}

.point-link-btn:hover {
    background: #dee2e6;
    transform: scale(1.12);
}

/* Winding route SVG path */
.timeline-route-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 0;
}

@keyframes drawRoutePath {
    from {
        opacity: 0;
        stroke-dashoffset: var(--path-length, 2000);
    }

    to {
        opacity: 1;
        stroke-dashoffset: 0;
    }
}

/* ========== Right Column: Visuals ========== */
.trip-visuals {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 991px) {
    .trip-visuals {
        height: auto;
        min-height: 100vh;
    }
}

@media (min-width: 992px) {
    .trip-visuals {
        height: 100vh;
    }
}

.trip-map {
    flex: 2;
    width: 100%;
    height: 60vh;
    min-height: 0;
    background: #e2e8f0;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
    position: relative;
}

@media (min-width: 992px) {
    .trip-map {
        height: auto;
    }
}

/* ========== Media Carousel ========== */
.trip-media {
    flex: 1;
    background: #f8fafc;
    padding: 0;
    margin: 0;
    border-top: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
}

/* Vertical drag handle to resize the media panel (desktop only) */
.media-resizer {
    display: none;
}

@media (min-width: 992px) {
    .media-resizer {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 6px;
        height: 6px;
        cursor: row-resize;
        background: #e2e8f0;
        transition: background 0.15s;
        position: relative;
        z-index: 15;
    }

    .media-resizer::after {
        content: '';
        display: block;
        width: 40px;
        height: 2px;
        border-radius: 2px;
        background: #94a3b8;
        transition: background 0.15s, width 0.15s;
    }

    .media-resizer:hover,
    .media-resizer.is-resizing {
        background: #cbd5e1;
    }

    .media-resizer:hover::after,
    .media-resizer.is-resizing::after {
        background: #475569;
        width: 56px;
    }
}

.media-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
}

.media-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.35rem;
    background: none;
    border: none;
    border-radius: 0.375rem;
    color: #475569;
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.media-toggle:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.media-toggle-icon {
    transition: transform 0.2s ease;
}

.trip-media.is-collapsed .media-toggle-icon {
    transform: rotate(-90deg);
}

.media-header-count {
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: #475569;
    font-size: 0.65rem;
    font-weight: 600;
}

.media-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 1rem 0.875rem;
    position: relative;
}

.trip-media.is-collapsed {
    flex: 0 0 auto;
    height: auto;
}

.trip-media.is-collapsed .media-resizer,
.trip-media.is-collapsed .media-body {
    display: none;
}

.media-carousel {
    display: flex;
    overflow-x: auto;
    gap: 0.75rem;
    padding: 0.25rem 0;
    height: 100%;
    align-items: center;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    cursor: grab;
    user-select: none;
}

.media-carousel.is-dragging,
.media-carousel.is-dragging * {
    cursor: grabbing !important;
}

.media-carousel::-webkit-scrollbar {
    display: none;
}

/* Carousel navigation */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
    color: #1e293b;
    font-size: 1rem;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    opacity: 0;
}

.trip-media:hover .carousel-nav {
    opacity: 1;
}

.carousel-nav:hover {
    background: #1e293b;
    color: white;
    border-color: #1e293b;
    transform: translateY(-50%) scale(1.08);
}

.carousel-nav.prev {
    left: 1rem;
}

.carousel-nav.next {
    right: 1rem;
}

.media-item {
    flex: 0 0 auto;
    width: 180px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    scroll-snap-align: center;
}

.media-photo {
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease;
}

.media-item:hover .media-photo {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.media-item.active .media-photo {
    box-shadow: 0 0 0 2px var(--trip-color, #3b82f6),
                0 0 16px 4px color-mix(in srgb, var(--trip-color, #3b82f6) 45%, transparent);
    transition: box-shadow 0.3s ease;
}

.media-photo img {
    width: 100%;
    height: 155px;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.media-item:hover .media-photo img {
    transform: scale(1.05);
}

.media-caption {
    padding: 0.3rem 0.4rem;
    color: #475569;
    font-size: 0.7rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-media {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 90px;
    padding: 0.5rem 1rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
    gap: 0.35rem;
}

.no-media svg {
    opacity: 0.35;
    flex: 0 0 auto;
}

.no-media p {
    margin: 0;
}

.no-media-title {
    color: #64748b;
    font-weight: 600;
}

.no-media-hint {
    max-width: 34ch;
    font-size: 0.78rem;
    line-height: 1.35;
}

/* ========== Lightbox ========== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: fadeIn 0.25s ease;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10001;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1.5rem;
    padding: 1rem 0.6rem;
    cursor: pointer;
    z-index: 10001;
    transition: background 0.2s;
    user-select: none;
}

.lightbox-prev {
    left: 0;
    border-radius: 0 4px 4px 0;
}

.lightbox-next {
    right: 0;
    border-radius: 4px 0 0 4px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.18);
}

.lightbox-content {
    position: relative;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: default;
    animation: zoomIn 0.25s ease;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 78vh;
    object-fit: contain;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
    border-radius: 6px;
}

.lightbox-footer {
    margin-top: 1rem;
    color: white;
    text-align: center;
    width: 100%;
    max-width: 800px;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.875rem 1.25rem;
    border-radius: 0.5rem;
    backdrop-filter: blur(6px);
    display: none;
}

.lightbox-footer.has-content {
    display: block;
}

.lightbox-footer h4 {
    margin: 0 0 0.35rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.lightbox-description {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #cbd5e1;
}

.lightbox-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.78rem;
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 20px;
    pointer-events: none;
    white-space: nowrap;
}

/* ========== Responsive ========== */
@media (max-width: 991px) {
    .trip-header {
        padding: 1rem 1.25rem 1.25rem;
    }

    .trip-title-large {
        font-size: 1.4rem;
    }

    .trip-body {
        padding: 1.5rem 1.25rem;
    }

    .media-item {
        width: 150px;
    }

    .media-photo img {
        height: 130px;
    }
}

/* ========== Animations ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        transform: scale(0.92);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* ── Indicadores de galería ──────────────────────────────────────────────── */
.media-photo {
    position: relative;
}

.media-count-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, .65);
    color: #fff;
    font-size: .7rem;
    padding: 1px 6px;
    border-radius: 10px;
}