/* --- OSNOVNI STILOVI --- */
:root {
    --background-color: #1a1a1a;
    --card-background: #2c2c2c;
    --text-color: #f0f0f0;
    --primary-color: #ff6600;
    --border-color: #444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
}

header h1 {
    color: var(--primary-color);
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 40px;
}

main {
    display: flex;
    flex-direction: column; /* Na mobilnom će kolone biti jedna ispod druge */
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.column {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

h2 {
    margin-top: 0;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* --- DUGMIĆI ZA SORTIRANJE --- */
.sort-controls {
    display: flex;
    flex-wrap: wrap; 
    gap: 10px;      
    margin-bottom: 20px;
    align-items: center; 
}

.sort-controls span {
    margin-right: 5px;
    font-weight: bold;
}

button, #location-filter {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    max-width: 100%; /* ISPRAVKA: Sprečava da element iskoči iz kontejnera */
}

button:hover, #location-filter:hover {
    opacity: 0.9;
}

/* --- TABELE --- */
#table-container, #kom-list-container {
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch; 
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

thead {
    background-color: #333;
}

th {
    font-weight: bold;
    color: var(--primary-color);
}

td a {
    color: #8ab4f8;
    text-decoration: none;
}

td a:hover {
    text-decoration: underline;
}

/* --- TOP LIDERI I PODIUM --- */
#top-leaders-container {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-width: 1200px;
    margin: 30px auto 0 auto;
}

.podium-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; 
    gap: 15px;
    margin-bottom: 30px;
}

.podium-header h2 {
    margin: 0;
    border: none;
    padding: 0;
    text-align: left;
}

#podium {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end; 
    justify-content: center;
    gap: 10px;
    min-height: 250px;
    padding-bottom: 20px;
}

.podium-step {
    flex: 1 1 180px;
    max-width: 220px;
    padding: 20px 15px;
    border-radius: 8px;
    background-color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: transform 0.2s ease-in-out;
}
.podium-step:hover {
    transform: translateY(-5px);
}

.podium-first {
    order: 2; 
    min-height: 200px; 
    border: 2px solid #ffd700;
}

.podium-second {
    order: 1; 
    min-height: 160px;
    border: 2px solid #c0c0c0;
}

.podium-third {
    order: 3; 
    min-height: 120px; 
    border: 2px solid #cd7f32;
}

.podium-step .rank {
    font-size: 2.8em;
    font-weight: bold;
    color: var(--text-color);
}

.podium-step .name {
    font-size: 1.25em;
    font-weight: 600;
    margin: 10px 0;
    hyphens: auto;
}

.podium-step .kom-count {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.1em;
}


/* --- MEDIA QUERIES ZA VEĆE EKRANE (DESKTOP) --- */
@media (min-width: 768px) {
    main {
        flex-direction: row; 
        align-items: flex-start;
    }
    .column {
        flex: 1; 
    }
}