/* ================== Transit Search Modal Styles ================== */
/* Reuse and adapt from transit-test.html */
.transit-search-modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 20000;
    /* Higher than other modals */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.transit-modal-content {
    background-color: #fff;
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 90vw;
    /* 宽屏展示 */
    /* Wider for route details */
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

/* Fix for manual time input modal being too wide */
#transitTimeModal .transit-modal-content {
    max-width: 500px;
}


.transit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    /* Reduced from 20px */
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    /* Reduced from 15px */
}

.transit-header h2 {
    margin: 0;
    color: #333;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-transit-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    padding: 8px 16px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
    font-weight: 600;
}

.close-transit-btn:hover {
    background: #e9ecef;
    color: #333;
    border-color: #ccc;
}

/* Route List & Cards */
.route-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.route-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.route-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border-color: #626F47;
    /* Earth Tone: Dark Olive */
}

.route-summary {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.route-time {
    font-size: 1.4rem;
    font-weight: 700;
    color: #626F47;
    /* Earth Tone: Dark Olive */
}

.route-cost {
    font-size: 1rem;
    font-weight: 600;
    color: #F0BB78;
    /* Earth Tone: Sand */
}

.route-meta {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.route-segments {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Increased gap */
}

.segment-item {
    display: flex;
    align-items: flex-start;
    /* Align top */
    gap: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.segment-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eee;
    border-radius: 50%;
    color: #666;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.segment-icon.subway {
    background: #A4B465;
    /* Earth Tone: Sage */
    color: white;
}

.segment-icon.bus {
    background: #0984e3;
    color: white;
}

.segment-icon.walk {
    background: #ffeaa7;
    color: #d35400;
}

.segment-details {
    flex-grow: 1;
}

.segment-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.segment-desc {
    font-size: 0.8rem;
    color: #888;
}

/* Embedded Mini Route Card (for Sidebar) */
.mini-route-card {
    background: white;
    border: 2px solid #6c5ce7;
    /* Distinct border */
    border-radius: 12px;
    padding: 12px;
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.1);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mini-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}

.mini-time {
    font-size: 1.1rem;
    font-weight: 700;
    color: #626F47;
    /* Earth Tone: Dark Olive */
}

.mini-cost {
    font-size: 0.9rem;
    color: #F0BB78;
    /* Earth Tone: Sand */
    font-weight: 600;
}

.mini-segments {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mini-segment {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.mini-segment-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Updated for separate title/desc lines */
.mini-segment-text {
    color: #444;
}

/* ================== Detailed Route Timeline (Modal) ================== */
.route-details-timeline {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #eee;
    display: flex;
    flex-direction: column;
    gap: 0;
    /* Gap handled by lines */
    font-size: 0.9rem;
}

.timeline-item {
    display: flex;
    gap: 12px;
    position: relative;
    padding-bottom: 20px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

/* Vertical Line */
.timeline-item::before {
    content: '';
    position: absolute;
    left: 9px;
    /* center of 20px icon */
    top: 24px;
    bottom: -4px;
    width: 2px;
    background-color: #eee;
    z-index: 0;
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    flex-shrink: 0;
    background: #fff;
    /* cover the line */
}

.timeline-content {
    flex: 1;
    padding-top: 0;
    /* Align with icon */
}

.timeline-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.timeline-desc {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

.timeline-stops {
    margin-top: 6px;
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #555;
}

.tag-bus {
    color: #626F47;
    /* Dark Olive */
    background: #F5ECD5;
    /* Cream */
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-right: 6px;
}

.tag-subway {
    color: #A4B465;
    /* Sage */
    background: #fdfdfd;
    border: 1px solid #A4B465;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-right: 6px;
}

.tag-walk {
    color: #F0BB78;
    /* Sand */
    background: #fff8e1;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-right: 6px;
}

/* 路线横向 Carousel 容器 */
.transit-carousel-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    margin-top: 10px;
}

.transit-carousel-viewport {
    flex: 1;
    overflow: hidden;
    margin: 0 10px;
    /* 留出按钮位置 */
    padding: 24px 0;
    /* Add padding to prevent top clipping */
    position: relative;
}

.transit-carousel-track {
    display: flex;
    transition: transform 0.3s ease-in-out;
    width: 100%;
}

.transit-carousel-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #ddd;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    font-size: 1.2rem;
    flex-shrink: 0;
    text-align: center;
    line-height: 1;
    outline: none;
}

.transit-carousel-btn:hover {
    background: #f5f5f5;
    color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.transit-carousel-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: #f9f9f9;
    box-shadow: none;
}

/* 调整卡片在 Carousel 中的样式 */
.transit-carousel-track .route-card {
    flex-shrink: 0;
    width: 400px;
    /* 固定宽度，允许展示多个 */
    margin-right: 40px;
    /* 卡片间距 */
    box-sizing: border-box;
    cursor: pointer;
    border: 2px solid transparent;
    /* 预留选中边框 */
    transition: all 0.2s;
    /* 恢复原有的卡片内边距 */
    padding: 15px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    /* 轻微阴影 */
}

.transit-carousel-track .route-card:last-child {
    margin-right: 0;
}

.transit-carousel-track .route-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.transit-carousel-track .route-card.selected {
    border-color: #626F47;
    /* Dark Olive */
    background-color: #F5ECD5;
    /* Cream */
    box-shadow: 0 0 0 2px rgba(98, 111, 71, 0.2);
}

.timeline-content.bg-subway {
    background-color: #f8f0fc !important;
    border: 1px solid #eaddf5 !important;
}

.timeline-content.bg-bus {
    background-color: #f0f8ff !important;
    border: 1px solid #e0f2fe !important;
}

.timeline-item.transfer-block::before {
    border-left: 2px dashed #ccc;
}

.timeline-item.transfer-block .timeline-icon {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}