/* Search Section Styles */
.station-finder {
    max-width: 800px; 
    margin: 0 auto;  
    padding: 20px;
    text-align: center;
}

.search-container {
    margin-bottom: 20px;
}

.input-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto; 
}

.clear-button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2em;
    color: #ccc;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    display: none;
}

.clear-button:hover {
    color: #999;
}

#station-search {
    width: 100%;
    padding: 10px 40px 10px 10px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

.search-results {
    margin-top: 20px;
    text-align: left;
    padding-top: 10px;
}

.station-result {
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
    transition: background-color 0.3s, transform 0.3s;
}

.station-result:hover {
    background-color: #e0e0e0;
    transform: scale(1.02);
}

.line-colors {
    margin-top: 5px;
}

.line-color {
    display: inline-block;
    width: 30px;
    height: 8px;
    border-radius: 4px;
    margin-right: 5px;
}

#selectedStation {
    margin-top: 20px;
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
}

#arrivalsContainer {
    margin-top: 20px;
}

.line-arrivals {
    border: 5px solid;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
    background-color: #fff;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    overflow-x: auto;
}

.line-arrivals h4 {
    margin: 0;
    padding-bottom: 0;
    font-weight: bold;
    text-align: center;
    width: 100%;
    font-size: 18px;
}

.arrival {
    flex: 1 1 100%; 
    box-sizing: border-box;
    padding: 10px;
    text-align: center;
    border: 2px solid #454545;
    border-radius: 5px;
    background-color: #f9f9f9;
    margin-bottom: 10px; 
}

.arrival strong {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 14px;
}

.arrival:hover {
    background-color: #ececec;
    transform: scale(1.02);
}

/* Popup Styles */
.popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 500px;
    background-color: #f5f5f5;
    border: 5px solid transparent;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    text-align: left;
    overflow-y: auto;
    max-height: 80vh;
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    cursor: pointer;
}

.popup-title {
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: bold;
}

.popup-arrivals .arrival-item {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 10px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.popup-arrivals .arrival-item .destination-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.popup-arrivals .arrival-item .destination {
    font-weight: bold;
    font-size: 1em;
}

.popup-arrivals .arrival-item .time-to-arrival {
    font-weight: bold;
    font-size: 1em;
}

.popup-arrivals .arrival-item .details-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #666;
    font-size: 0.8em;
}

.popup-arrivals .arrival-item .location {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 10px;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Responsive Styles for Search Results and Popups */
@media (min-width: 600px) {
    .station-result {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .line-color {
        width: 40px;
        height: 10px;
    }

    .search-results, .popup-arrivals .arrival-item {
        font-size: 1em;
    }

    .line-arrivals {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        overflow-x: auto;
    }
    
    .arrival {
        flex: 1 1 100px;
        margin-bottom: 0;
    }
}

@media (min-width: 800px) {
    .station-finder {
        padding: 40px;
        max-width: 900px;
    }

    .popup {
        max-width: 600px;
    }
}

@media (max-width: 400px) {
    #station-search {
        font-size: 0.9em;
        padding: 8px;
    }

    .popup {
        width: 80%;
        max-width: 80%;
    }
}
