/* ============================================
   RESPONSIVE IMPROVEMENTS - DODAJ NA KOŃCU top15.css
   ============================================ */

/* --- KONTENER GŁÓWNY --- */
@media screen and (max-width: 1200px) {
    .topa {
        margin: 10px 5px !important;
        padding: 10px !important;
    }
}

/* --- NAWIGACJA --- */
.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 0 10px;
}

@media screen and (max-width: 768px) {
    .main-nav {
        flex-direction: column;
    }
    
    .expand-button {
        width: 100%;
        text-align: center;
        padding: 12px 15px !important;
        font-size: 16px !important;
    }
}

/* --- TABELA RUNÓW - RESPONSYWNOŚĆ --- */
@media screen and (max-width: 1200px) {
    .combined-runs-container {
        flex-direction: column;
    }
    
    .run-tabs {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 10px;
        width: 100%;
        flex-basis: auto;
    }
    
    .run-tab-button {
        flex-shrink: 0;
        white-space: nowrap;
        min-width: 150px;
    }
    
    .run-table-content {
        width: 100%;
        min-width: auto;
        overflow-x: auto;
    }
}

/* Tabela runów na małych ekranach */
@media screen and (max-width: 768px) {
    .runs-table {
        min-width: 100% !important;
        font-size: 13px;
    }
    
    /* Ukryj mniej ważne kolumny na mobile */
    .runs-table th:nth-child(4), /* Skoki */
    .runs-table td:nth-child(4),
    .runs-table th:nth-child(5), /* Strafe'y */
    .runs-table td:nth-child(5),
    .runs-table th:nth-child(7), /* Sync */
    .runs-table td:nth-child(7) {
        display: none;
    }
    
    .runs-table th,
    .runs-table td {
        padding: 6px 4px !important;
    }
    
    /* Clan tag mniejszy na mobile */
    #combined-runs-tbody .clan-tag {
        font-size: 11px;
        padding: 1px 4px;
    }
    
    /* Krótsze nazwy map */
    .runs-table td#sp a {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media screen and (max-width: 480px) {
    .runs-table {
        font-size: 12px;
    }
    
    /* Ukryj jeszcze więcej na bardzo małych ekranach */
    .runs-table th:nth-child(6), /* Max Speed */
    .runs-table td:nth-child(6) {
        display: none;
    }
    
    #run-table-title {
        font-size: 14px !important;
    }
}

/* --- STATYSTYKI SERWERA --- */
@media screen and (max-width: 768px) {
    div[style*="grid-template-columns"] {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    }
    
    div[style*="grid-template-columns"] > div {
        padding: 10px !important;
    }
    
    div[style*="grid-template-columns"] > div > div:first-child {
        font-size: 11px !important;
    }
    
    div[style*="grid-template-columns"] > div > div:last-child {
        font-size: 18px !important;
    }
}

@media screen and (max-width: 480px) {
    div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* --- LISTA AKTYWNYCH GRACZY --- */
@media screen and (max-width: 768px) {
    .active-players-list {
        font-size: 13px;
        padding: 10px !important;
    }
    
    .active-players-list span {
        margin-right: 3px !important;
    }
}

@media screen and (max-width: 480px) {
    .active-players-list {
        font-size: 12px;
        line-height: 1.6 !important;
    }
}

/* --- STATYSTYKI KRAJÓW --- */
@media screen and (max-width: 768px) {
    div[style*="display: flex; flex-wrap: wrap"] img[alt] {
        width: 16px !important;
        height: 11px !important;
    }
    
    div[style*="display: flex; flex-wrap: wrap"] {
        font-size: 12px !important;
        gap: 8px !important;
    }
}

/* --- WYKRESY --- */
@media screen and (max-width: 768px) {
    canvas {
        height: 250px !important;
    }
}

@media screen and (max-width: 480px) {
    canvas {
        height: 200px !important;
    }
}

/* --- STOPKA --- */
@media screen and (max-width: 768px) {
    .footer-main {
        flex-direction: column;
        gap: 25px !important;
    }
    
    .footer-column {
        min-width: 100% !important;
    }
    
    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-copyright {
        text-align: center !important;
    }
}

/* --- POPUP --- */
@media screen and (max-width: 480px) {
    .version-popup {
        width: 90% !important;
        min-width: auto !important;
        padding: 20px !important;
    }
    
    .version-popup-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .version-popup-button {
        width: 100% !important;
    }
}

/* --- NAGŁÓWKI SEKCJI --- */
@media screen and (max-width: 768px) {
    h2[style*="color: #d3b35a"] {
        font-size: 14px !important;
    }
    
    h2[style*="color: #d3b35a"] span {
        display: block;
        margin-top: 5px;
        font-size: 12px !important;
    }
}

/* --- SCROLLBAR DLA TABELI NA MOBILE --- */
@media screen and (max-width: 768px) {
    .run-table-content {
        scrollbar-width: thin;
        scrollbar-color: #d3b35a rgba(0, 0, 0, 0.3);
    }
    
    .run-table-content::-webkit-scrollbar {
        height: 8px;
    }
    
    .run-table-content::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.3);
        border-radius: 4px;
    }
    
    .run-table-content::-webkit-scrollbar-thumb {
        background-color: #d3b35a;
        border-radius: 4px;
    }
}

/* --- ULEPSZENIE CZYTELNŚCI NA MAŁYCH EKRANACH --- */
@media screen and (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    /* Większe pady dla lepszej klikalności */
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    /* Lepsze odstępy */
    div[style*="margin: 20px"] {
        margin: 15px 5px !important;
    }
}

/* --- ORIENTACJA POZIOMA NA TELEFONIE --- */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .runs-table th:nth-child(4),
    .runs-table td:nth-child(4),
    .runs-table th:nth-child(5),
    .runs-table td:nth-child(5) {
        display: table-cell !important;
    }
}