/* === GŁÓWNY KONTENER === */
.ctp-panel-statystyki {
    background: #111;
    color: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    font-family: 'Poppins', sans-serif;
}

/* === TYTUŁ === */
.ctp-panel-statystyki h2 {
    color: #ffc400;
    margin-bottom: 15px;
    font-size: 22px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* === BLOK STATYSTYK === */
.stat-box {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 15px 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-box h3 {
    color: #ffd700;
    font-size: 18px;
    margin-bottom: 10px;
    font-weight: 600;
}

.stat-box p {
    font-size: 15px;
    color: #ccc;
    margin: 4px 0;
}

/* === WIERSZ Z LICZBAMI === */
.stat-row {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 10px;
    border-top: 1px solid #333;
    padding-top: 10px;
}

.stat-row div {
    flex: 1 1 30%;
    text-align: center;
    color: #eee;
    font-size: 15px;
}

.stat-row div strong {
    color: #ffc400;
}

.stat-row .cena {
    color: #888;
    font-size: 14px;
    margin-left: 4px;
}

/* === SUMA KOŃCOWA === */
.total-sum {
    margin-top: 15px;
    border-top: 1px solid #333;
    padding-top: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #ffd700;
}

/* === PRZYCISKI NAWIGACJI === */
.stat-nav {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    gap: 10px;
    flex-wrap: wrap;
}

.stat-nav button {
    background: #222;
    color: #ffc400;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    min-width: 120px;
}

.stat-nav button:hover:not(:disabled) {
    background: #ffc400;
    color: #111;
}

.stat-nav button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* === BLOK RANKINGU / LISTY WPISÓW === */
.ranking-box {
    margin-top: 25px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px 20px;
}

.ranking-box h4 {
    color: #ffc400;
    font-size: 18px;
    margin-bottom: 10px;
}

.ranking-box ol {
    list-style: decimal;
    margin: 0;
    padding-left: 20px;
    color: #ddd;
}

.ranking-box li {
    margin: 4px 0;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.ranking-box li strong {
    flex: 1 1 60%;
    text-align: left;
}

.ranking-box .kwota {
    color: #ffd700;
    font-weight: 600;
    flex: 1 1 30%;
    text-align: right;
}

/* ===== RANKING KALENDARZY ===== */
#ranking-miesiecy {
    margin-top: 25px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
}

#ranking-miesiecy h4 {
    color: #ffc400;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Przyciski sortowania ===== */
.sort-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 15px;
}

.sort-btn {
    background: #222;
    color: #ffc400;
    border: 1px solid #333;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 14px;
}

.sort-btn:hover:not(.active) {
    background: #ffc400;
    color: #111;
}

.sort-btn.active {
    background: #ffc400;
    color: #111;
    border-color: #ffc400;
    box-shadow: 0 0 6px rgba(255, 196, 0, 0.4);
}

/* ===== Lista wpisów rankingu ===== */
#ranking-miesiecy ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

#ranking-miesiecy li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #333;
    padding: 10px 0;
    font-size: 15px;
    color: #ddd;
    gap: 20px;
}

#ranking-miesiecy li:first-child {
    border-top: none;
}

#ranking-miesiecy li strong {
    color: #fff;
    font-weight: 600;
    flex: 1;
    min-width: 0;
}

#ranking-miesiecy li .details {
    color: #999;
    font-size: 13px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 120px;
    text-align: center;
}

#ranking-miesiecy li .kwota {
    color: #ffd700;
    font-weight: 600;
    font-size: 15px;
    min-width: 120px;
    text-align: right;
    flex-shrink: 0;
}

/* ===== RESPONSYWNOŚĆ ===== */

@media (max-width: 768px) {
    .sort-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }

    .sort-btn {
        padding: 5px 10px;
        font-size: 13px;
    }

    #ranking-miesiecy li {
        flex-direction: column;
        align-items: flex-start;
        font-size: 14px;
        gap: 4px;
    }

    #ranking-miesiecy li strong {
        margin-bottom: 2px;
    }

    #ranking-miesiecy li .details {
        margin-left: 0;
    }

    #ranking-miesiecy li .kwota {
        margin-top: 2px;
        text-align: left;
        font-size: 14px;
        margin-left: 0;
    }
}

/* Tablety poziome (max 992px) */
@media (max-width: 992px) {
    .ctp-panel-statystyki {
        padding: 15px;
    }

    .stat-row div {
        flex: 1 1 45%;
        margin-bottom: 8px;
    }

    .ranking-box li strong {
        flex: 1 1 55%;
    }

    .ranking-box .kwota {
        flex: 1 1 40%;
        text-align: right;
    }
}

/* Tablety pionowe i telefony (max 768px) */
@media (max-width: 768px) {
    .ctp-panel-statystyki h2 {
        font-size: 20px;
        text-align: center;
        flex-direction: column;
    }

    .stat-nav {
        justify-content: center;
        gap: 8px;
    }

    .stat-nav button {
        flex: 1 1 45%;
        font-size: 14px;
        padding: 8px 0;
    }

    .stat-row {
        flex-direction: column;
        border-top: none;
        padding-top: 0;
    }

    .stat-row div {
        flex: 1 1 100%;
        margin: 5px 0;
        border-bottom: 1px solid #333;
        padding-bottom: 5px;
    }

    .total-sum {
        font-size: 15px;
    }

    .ranking-box h4 {
        text-align: center;
    }

    .ranking-box li {
        flex-direction: column;
        align-items: flex-start;
    }

    .ranking-box .kwota {
        text-align: left;
        font-size: 14px;
    }
}


/* Telefony małe (max 480px) */
@media (max-width: 480px) {
    .ctp-panel-statystyki {
        padding: 12px;
    }

    .stat-box h3 {
        font-size: 16px;
    }

    .stat-row div {
        font-size: 14px;
    }

    .ranking-box li {
        font-size: 14px;
    }

    .ranking-box .kwota {
        font-size: 13px;
    }

    .stat-nav button {
        font-size: 13px;
        padding: 6px 10px;
    }
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 15px;
}

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

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

.loading-spinner p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* === RESPONSYWNOŚĆ === */

/* Tablety poziome (max 992px) */
@media (max-width: 992px) {
    .ctp-panel-statystyki {
        padding: 15px;
    }

    .stat-row div {
        flex: 1 1 45%;
        margin-bottom: 8px;
    }

    .ranking-box li strong {
        flex: 1 1 55%;
    }

    .ranking-box .kwota {
        flex: 1 1 40%;
        text-align: right;
    }
}

/* Tablety pionowe i telefony (max 768px) */
@media (max-width: 768px) {
    .ctp-panel-statystyki h2 {
        font-size: 20px;
        text-align: center;
        flex-direction: column;
    }

    .stat-nav {
        justify-content: center;
        gap: 8px;
    }

    .stat-nav button {
        flex: 1 1 45%;
        font-size: 14px;
        padding: 8px 0;
    }

    .stat-row {
        flex-direction: column;
        border-top: none;
        padding-top: 0;
    }

    .stat-row div {
        flex: 1 1 100%;
        margin: 5px 0;
        border-bottom: 1px solid #333;
        padding-bottom: 5px;
    }

    .total-sum {
        font-size: 15px;
    }

    .ranking-box h4 {
        text-align: center;
    }

    .ranking-box li {
        flex-direction: column;
        align-items: flex-start;
    }

    .ranking-box .kwota {
        text-align: left;
        font-size: 14px;
    }
}


/* Telefony małe (max 480px) */
@media (max-width: 480px) {
    .ctp-panel-statystyki {
        padding: 12px;
    }

    .stat-box h3 {
        font-size: 16px;
    }

    .stat-row div {
        font-size: 14px;
    }

    .ranking-box li {
        font-size: 14px;
    }

    .ranking-box .kwota {
        font-size: 13px;
    }

    .stat-nav button {
        font-size: 13px;
        padding: 6px 10px;
    }
}

