/* GŁÓWNE USTAWIENIA */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
}
#map {
    height: 100vh;
    width: 100%;
}

/* WYSZUKIWARKA - ZWĘŻONA, ŻEBY ZROBIĆ MIEJSCE NA CELOWNIK */
.search-container {
    position: absolute;
    top: 15px;
    left: 60px; 
    z-index: 2000;
    display: flex;
    background: white;
    padding: 5px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    width: calc(100% - 150px);
    max-width: 380px;
}

.search-input {
    border: none;
    padding: 10px;
    flex-grow: 1;
    outline: none;
    font-size: 16px;
    width: 100%;
}

/* PRZYCISK LOKALIZACJI - PRAWY GÓRNY RÓG */
.btn-lokalizacja {
    position: absolute;
    top: 15px;      /* Odległość od góry */
    right: 15px;    /* Odległość od prawej - TO GO PRZESUNIE NA MIEJSCE */
    z-index: 2000;
    width: 55px;
    height: 55px;
    background: #E30613; /* Pana czerwień */
    color: white;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.btn-lokalizacja:active { transform: scale(0.9); }

/* PRZYCISK ZMIANY MIASTA - LEWY DOLNY RÓG */
.btn-powrot {
    position: absolute;
    bottom: 25px;
    left: 20px;
    z-index: 1000;
    width: 55px;
    height: 55px;
    background: white;
    color: #4A4A4A;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* WYBÓR WARSTW MAPY - PRAWY DOLNY RÓG */
.leaflet-control-layers {
    border: 2px solid #E30613 !important;
    border-radius: 8px !important;
    background: white !important;
    margin-right: 15px !important;
    margin-bottom: 25px !important;
    z-index: 1000 !important;
}

/* TABLICZKA PRZYSTANKOWA */
.timetable-row {
    position: relative;
    display: flex;
    align-items: center;
    padding: 4px;
    border-bottom: 1px solid #eee;
    background: white;
    min-width: 220px;
    overflow: hidden;
}

.progress-bg {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background-color: rgba(40, 167, 69, 0.15);
    z-index: 1;
    transition: width 0.5s ease-in-out;
}

.row-content {
    position: relative;
    z-index: 2;
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
}

.line-badge {
    flex: 0 0 42px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    color: white;
    font-weight: bold;
    border-radius: 4px;
    margin-right: 12px;
    font-size: 14px;
}

.route-dir {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-right: 10px;
}

.headsign-text {
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.departure-info {
    flex: 0 0 65px;
    text-align: right;
}

.departure-time { font-weight: bold; font-size: 15px; }
.time-countdown { font-size: 11px; color: #28a745; font-weight: bold; }

/* ŚRODKOWANIE EKRANU ŁADOWANIA (LOADER) */
#loader-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.85); /* Zmniejszyłem krycie, żeby było widać mapę w tle */
    z-index: 9999;
    display: none; /* KLUCZ: Domyślnie ukryty, JS go włączy jako 'flex' */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* Pozwala klikać "przez" tło, jeśli by zasłoniło coś ważnego */
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #E30613;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

#loader-text {
    color: #4A4A4A;
    font-size: 18px;
    margin-top: 15px;
    font-weight: bold;
}

/* RWD */
@media (max-width: 768px) {
    .search-container {
        left: 10px;
        top: 10px;
        /* Wyliczenie: 100% szerokości - 10px lewo - 65px na przycisk lokalizacji - 10px margines */
        width: calc(100% - 85px); 
        max-width: none;
        box-sizing: border-box; /* Ważne, żeby padding nie rozpychał kontenera */
    }
    .btn-lokalizacja {
        width: 50px;
        height: 50px;
        top: 10px;
        right: 10px;
    }
}


/* KOLORY LINII */
.line-tram { background-color: #00923f; }
.line-bus { background-color: #e30613; }
.line-night { background-color: #000000; }
.line-sub { background-color: #005ca9; }