:root {
    --bg: #32373C; 
    --header: #333; 
    --accent: #6EC1E4; 
    --cta: #61CE70; 
    --text: #7A7A7A; 
    --bus-bg: rgba(255, 0, 0, 0.5);
}

body { 
    font-family: 'Segoe UI', Arial, sans-serif; 
    background-color: var(--bg); 
    color: #fff; 
    margin: 0; 
    padding: 10px; 
}

.container { width: 100%; max-width: 1300px; margin: auto; }

/* PANEL INFORMACYJNY (Snackbar na dole) */
.info-popup {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    background: #54595F;
    border: 2px solid var(--accent);
    border-radius: 12px;
    padding: 15px;
    z-index: 2000;
    transition: bottom 0.4s ease;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
    display: none; /* DOMYŚLNIE UKRYTY */
}

.info-popup.show { 
    bottom: 20px;
    display: block; /* POKAZUJE SIĘ DOPIERO PO DODANIU KLASY .show */
}

.info-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-text { color: white; font-size: 14px; }
#pop-next-time { color: var(--cta); font-weight: bold; }

.close-pop {
    background: var(--text);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
}

/* PASEK DATY */
.top-bar {
    text-align: center;
    border-bottom: 1px solid #54595F;
    padding-bottom: 10px;
    margin-bottom: 15px;
}
#full-date-time { color: var(--accent); font-weight: bold; font-size: 16px; }

/* PRZYCISKI NAWIGACJI */
.menu { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; justify-content: flex-start; }
.menu-days { margin-bottom: 25px; display: flex; gap: 10px; flex-wrap: wrap; }

.btn { 
    padding: 8px 12px; 
    background: #444; 
    color: #fff; 
    text-decoration: none; 
    border-radius: 4px; 
    font-size: 12px; 
    font-weight: bold;
    border: 1px solid var(--text);
    transition: 0.2s;
    cursor: pointer;
    align-items: center;     /* Centrowanie w pionie (góra-dół) */
    justify-content: center;  /* Centrowanie w poziomie (lewo-prawo) */
    text-align: center;
}
.btn.active { background: var(--cta); color: #000; border-color: var(--cta); }
.btn:hover { background: var(--accent); color: #000; }

/* PRZYCISK PRZESIADKI W TABELI */
.btn-transfer-link {
    background: #393939;
    color: #AFAFAF;
    text-decoration: none;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 10px;
    display: inline-block;
}

/* TABELA */
.table-wrapper { 
    width: 100%; 
    overflow-x: auto; 
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--text);
    border-radius: 8px;
    -webkit-overflow-scrolling: touch;
}

table { 
    border-collapse: collapse; 
    font-size: 11px; 
    width: 100%;
    white-space: nowrap; 
}

th, td { 
    padding: 6px 8px; 
    border: 1px solid rgba(122, 122, 122, 0.2); 
    text-align: center; 
}

th { background: #333; color: var(--accent); text-transform: uppercase; }

.stop-col { 
    text-align: left !important; 
    position: sticky; 
    left: 0; 
    background: #444 !important; 
    z-index: 10; 
    font-weight: bold; 
    min-width: 180px;
    box-shadow: 3px 0 5px rgba(0,0,0,0.4);
}

/* STANY WIERSZY */
.stop-row { cursor: pointer; }
.stop-row:nth-child(even) { background-color: rgba(255,255,255,0.03); }
.stop-row.selected { background-color: rgba(97, 206, 112, 0.1) !important; }
.stop-row.selected .stop-col { color: var(--cta); border-left: 4px solid var(--cta); }

/* RADIO */
.stop-radio-visible { margin-right: 12px; transform: scale(1.3); cursor: pointer; accent-color: var(--cta); }

/* CZAS I TYPY KURSÓW */
.time-cell { color: #fff; }
.past { opacity: 0.3; }
.type-tag { color: var(--text); font-size: 10px; font-weight: normal; margin-left: 5px; }

/* ANIMACJE AUTOBUSU */
.bus-active { 
    background-color: #6C9D71 !important; 
    color: #fff !important; 
    font-weight: bold;
    animation: cellPulse 2s infinite ease-in-out;
}

@keyframes cellPulse {
    0%, 100% { background-color: rgba(255, 0, 0, 0.5); }
    50% { background-color: rgba(255, 0, 0, 0.8); box-shadow: inset 0 0 10px rgba(255,255,255,0.3); }
}

.pulse-slow { animation: pulseSlow 3s infinite ease-in-out; background-color: #5C2124; }
.pulse-fast { animation: pulseFast 3s infinite ease-in-out; background-color: var(--bus-bg); }

@keyframes pulseSlow {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.5; }
}

@keyframes pulseFast {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* WIDOK PRZESIADEK (KAFELKI) */
.transfer-card {
    background: #444;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.transfer-header {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    color: white;
    margin-bottom: 15px;
}

.next-label { background: var(--cta); padding: 2px 10px; border-radius: 10px; font-size: 12px; color: #000; }
.tile-container { display: flex; flex-wrap: wrap; gap: 10px; }

.time-tile {
    background: #464b50;
    border: 1px solid #fff;
    border-radius: 6px;
    padding: 8px 5px;
    text-align: center;
    min-width: 70px;
}

.time-tile.active { border: 2px solid var(--cta); background: #2e3d31; }
.time-tile.past { opacity: 0.5; }

.main-time { color: var(--accent); font-size: 16px; font-weight: bold; }
.small-time { color: var(--text); font-size: 10px; }

/* --- DODATKI DLA STRONY PRZYSTANKÓW (PRZYSTANEK.PHP) --- */
.search-box { display: flex; gap: 5px; margin-bottom: 20px; }
.search-box input { flex: 1; padding: 12px; background: #2b2e31; border: 1px solid #54595F; border-radius: 8px; color: #fff; outline: none; }
.search-box button { padding: 0 15px; background: var(--cta); color: #000; border: none; border-radius: 8px; font-weight: bold; cursor: pointer; }

.line-card { background: #2b2e31; border-radius: 12px; margin-bottom: 15px; display: flex; overflow: hidden; border: 1px solid rgba(110, 193, 228, 0.1); }
.line-number-box { background: var(--accent); color: #000; width: 60px; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 900; }
.line-content { padding: 12px; flex: 1; }
.times-wrapper { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; }

.time-tile .hour { display: block; font-family: monospace; font-size: 16px; font-weight: bold; color: #fff; }
.time-tile .meta { display: block; font-size: 8px; color: var(--cta); font-weight: bold; }
.time-tile.next { border: 1px solid var(--cta); background: rgba(97, 206, 112, 0.1); }
.time-tile.next .hour { color: var(--cta); }

.list-item { background: #2b2e31; padding: 15px; border-radius: 10px; display: flex; justify-content: space-between; align-items: center; text-decoration: none; border-left: 5px solid var(--cta); color: #fff; margin-bottom: 8px; font-weight: bold; }
.btn-live-bottom { display: block; width: 100%; margin-top: 20px; padding: 15px; background: var(--cta); color: #000; border-radius: 12px; text-align: center; text-decoration: none; font-weight: bold; text-transform: uppercase; }

/* --- WIDOK PRZESIADEK (DODATKI) --- */
.main-date-box { text-align: center; border-bottom: 1px solid #54595F; padding-bottom: 10px; margin-bottom: 15px; }
.current-date { color: var(--accent); font-weight: bold; font-size: 16px; }
.current-date1 { color: var(--text); font-size: 12px; margin: 0 5px; }

.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 30px; }
.quick-tile { padding: 5px; border-radius: 8px; text-align: center; border: 2px solid; color: #fff; }

.route-inline { font-size: 11px; color: #C9C6C6; line-height: 1.6; margin-top: 15px; padding: 8px; background: rgba(0,0,0,0.08); border-radius: 6px; }
.route-inline span::after { content: " → "; opacity: 0.3; }
.route-inline span:last-child::after { content: ""; }
.current-p { color: #fff; font-weight: bold; text-decoration: underline; } /* POPRAWIONY BŁĄD - było: color: #fff); */

.section-title { margin-top: 25px; margin-bottom: 10px; font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; }

/* ============================================ */
/* NOWE STYLE - DODANE DLA NOWYCH FUNKCJI */
/* ============================================ */

/* Styl dla wiersza bez kursów (niedziela/sobota) */
.stop-row.no-service .time-cell {
    opacity: 0.3 !important;
    background-color: #2b2e31 !important;
}

.stop-row.no-service .bus-container {
    display: none;
}

/* Popup legenda - szerszy niż standardowy popup */
#legend-popup {
    max-width: 600px;
}

#legend-popup .info-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#legend-popup .info-content > div {
    width: 100%;
    line-height: 1.8;
    font-size: 13px;
}

#legend-popup strong {
    color: var(--cta);
    font-size: 14px;
}

/* Komunikat o braku kursów */
.no-data {
    padding: 40px;
    text-align: center;
    color: var(--text);
    font-size: 16px;
}

/* HEADER LINII - W JEDNYM WIERSZU Z KOMUNIKATEM */
.line-header-bar {
    background: var(--header);
    color: #fff;
    padding: 5px 15px 5px 15px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
    min-height: 20px;
}

.line-title {
    font-size: 16px;
    font-weight: bold;
}

.no-service-badge {
    background: #77070c;
    color: #fff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: normal;
}

/* ============================================ */
/* MEDIA QUERIES */
/* ============================================ */

@media (max-width: 768px) {
    /* Kontener tabeli musi mieć włączone przewijanie */
    .table-responsive {
        overflow-x: auto;
        display: block;
        width: 100%;
        -webkit-overflow-scrolling: touch;
    }

    /* Pierwsza kolumna (z przystankiem) staje się 'przyklejona' */
    table tr td:first-child, 
    table tr th:first-child {
        position: -webkit-sticky; /* Dla Safari */
        position: sticky;
        left: 0;
        z-index: 10;
        background-color: #54595F; /* Kolor Twojego tła, żeby godziny pod nim nie prześwitywały */
        box-shadow: 2px 0 5px rgba(0,0,0,0.3); /* Cień, żeby było widać oddzielenie od godzin */
        min-width: 120px; /* Minimalna szerokość dla nazwy przystanku */
        max-width: 150px;
        white-space: normal; /* Pozwalamy nazwie zawijać się do nowej linii */
    }
    
    /* Całkowite ukrycie kropki radio na telefonach */
    input[type="radio"] {
        display: none !important;
    }

    /* Opcjonalnie: jeśli chcesz, aby wybrany wiersz/kafelek 
       nadal się wyróżniał, dodaj to: */
    label:has(input[type="radio"]:checked) .tile-box,
    label:has(input[type="radio"]:checked) {
        border-color: #6EC1E4;
        background: rgba(110, 193, 228, 0.1);
    }
    
    .btn-transfer-link {
        display: block; /* Wymuszamy, by zajął własną linię */
        width: fit-content; /* Szerokość dopasowana do tekstu przycisku */
        margin-top: 4px;
        font-size: 8px; /* Możesz go nieco zmniejszyć na telefonie */
        padding: 4px 8px;
    }
    
    /* Responsywność dla popupu legenda */
    #legend-popup {
        width: 95%;
    }
    
    #legend-popup .info-content > div {
        font-size: 11px;
        line-height: 1.6;
    }
}

@media (max-width: 600px) {
    .stop-city { display: none; }
    .stop-col { min-width: 140px; font-size: 10px; }
    .btn-transfer-link { padding: 2px 5px; font-size: 9px; margin-left: 5px; }
    
    /* Responsywny header linii */
    .line-header-bar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 5px;
        padding: 5px 10px;
        text-align: left;
        min-height: 20px;
		position: sticky;
        left: 0px;
    }
    
    .line-title {
        font-size: 12px;
    }
    
    .no-service-badge {
        font-size: 10px;
        padding: 3px 8px;
    }
}