#btn-top {
    display: none; /* Domyślnie ukryty, pokazuje się po przewinięciu */
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 99;
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: background-color 0.3s;
}
#btn-top:hover {
    background-color: #0056b3;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

body {
    background-color: #f4f6f9;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: #ffffff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
    position: relative;
}

.alert-error {
    background-color: #ff4d4d;
    color: white;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(255, 77, 77, 0.3);
    animation: fadeIn 0.3s ease-in-out;
}

h1 {
    font-size: 22px;
    color: #333;
    margin-bottom: 10px;
}

p {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

label {
    display: block;
    font-size: 13px;
    color: #444;
    margin-bottom: 8px;
    font-weight: bold;
}

input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    font-size: 18px;
    border: 1px solid #ccc;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
    text-align: center;
    letter-spacing: 3px;
}

input[type="password"]:focus {
    border-color: #007bff;
}

button {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #0056b3;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- STYLE DLA DASHBOARD.PHP --- */

.dashboard-container {
    width: 100%;
    max-width: 600px;
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.dashboard-title {
    font-size: 24px;
    color: #333;
    text-align: center;
    margin-bottom: 20px;
}

.nav-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
}

.nav-btn {
    display: block;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    text-decoration: none;
    padding: 15px 20px;
    border-radius: 8px;
    text-align: left;
    box-shadow: 0 3px 6px rgba(0, 123, 255, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(0, 123, 255, 0.3);
}

.nav-btn .btn-title {
    font-size: 18px;
    font-weight: bold;
    display: block;
    margin-bottom: 3px;
}

.nav-btn .btn-subtitle {
    font-size: 12px;
    color: #e0e0e0;
    font-weight: normal;
}

.rada-info-box {
	background: #f9f9f9;
	padding: 15px;
	margin-bottom: 20px;
	border-radius: 6px;
	border: 1px solid #ddd;
}

.section-divider {
    font-size: 16px;
    color: #555;
    margin-bottom: 15px;
    font-weight: bold;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 8px;
}

.students-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 800px;
    overflow-y: auto;
    padding-right: 5px;
}

.student-card {
    background: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-left: 5px solid #007bff;
    padding: 12px 15px;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s, transform 0.2s, border-color 0.2s;
}

.student-card:hover {
    background: #f1f4f8;
    border-color: #007bff;
    transform: translateX(3px);
}

.student-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.student-number {
    background: #e2e8f0;
    color: #4a5568;
    font-size: 12px;
    font-weight: bold;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.student-name {
    font-size: 15px;
    font-weight: 500;
    color: #2d3748;
}

.student-phone {
    font-size: 13px;
    color: #718096;
}

/* --- NOWE STYLE DLA SKŁADEK I TABEL RESPONSYWNYCH --- */

.page-container {
    width: 100%;
    max-width: 1600px;
    background: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 12px;
}

.back-btn {
    background: #6c757d;
    color: white;
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.2s;
}

.back-btn:hover {
    background: #5a6268;
}

.scroll-hint {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin-bottom: 10px;
    font-style: italic;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
    white-space: nowrap;
}

.custom-table th, .custom-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e1e4e8;
}

.custom-table th {
    background-color: #f8f9fa;
    color: #333;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

.custom-table tr:hover {
    background-color: #f8f9fa;
}

.wplaty-table-responsive {
    overflow: visible !important;
}

/* Tabela wpłat - pozwala chmurkom wychodzić poza tabelę */
.wplaty-table-responsive {
    overflow: visible !important;
}


/* Chmurka komentarza zawsze na wierzchu */
.comment-icon {
    position: relative;
    z-index: 10000;
}

.comment-icon:hover {
    z-index: 999999;
}

.comment-icon:hover::after {
    z-index: 999999;
}


/* Zamrożona (przypięta) pierwsza kolumna z nazwiskami przy przewijaniu na telefonie */
.student-col {
    position: sticky;
    left: 0;
    background-color: #ffffff;
    z-index: 5;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    white-space: nowrap; /* Zapobiega łamaniu tekstu */
}

.custom-table th.student-col {
    z-index: 15;
    background-color: #f8f9fa;
    white-space: nowrap;
}

/* Wersja mobilna: dopasowanie do najdłuższego nazwiska bez sztucznej szerokości */
@media (max-width: 768px) {
    .student-col {
        width: auto !important;
        min-width: unset !important;
        max-width: unset !important;
    }
    
    .custom-table th.student-col,
    .custom-table td.student-col {
        width: auto !important;
        min-width: unset !important;
        max-width: unset !important;
    }
}

.total-col {
    font-weight: bold;
    color: #28a745;
    background-color: #f1f8f5;
    text-align: center;
}

.input-cell {
    width: 80px;
    padding: 6px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

/* Chmurka z komentarzem (tooltip) ze znakiem zapytania w kółku */
.comment-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background-color: #17a2b8;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    margin-left: 6px;
    vertical-align: middle;
}

.comment-icon:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.amount-text {
    font-weight: 500;
    color: #333;
}

@media (max-width: 768px) {
    .student-firstname {
        display: none;
    }
    .custom-table th, .custom-table td {
        padding: 10px 8px;
        font-size: 13px;
    }
}

/* --- STYLE DLA SEKCJI WYDATKÓW I PODSUMOWANIA --- */

.section-title {
    font-size: 20px;
    color: #333;
    margin-top: 40px;
    margin-bottom: 15px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 5px;
}

.summary-box {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 15px;
    padding: 12px 15px;
    background: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    font-size: 16px;
}

.summary-label {
    font-weight: bold;
    color: #333;
    margin-right: 20px;
}

.summary-value {
    font-size: 18px;
    font-weight: bold;
    color: #28a745;
    min-width: 120px;
    text-align: right;
}

.badge-partial {
    background-color: #cce5ff;
    color: #004085;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    display: inline-block;
}

.badge-paid {
    background-color: #d4edda;
    color: #155724;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    display: inline-block;
}

.badge-unpaid {
    background-color: #f8d7da;
    color: #721c24;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    display: inline-block;
}

.badge-skipped {
    background-color: #fff3cd;
    color: #856404;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    display: inline-block;
}

.student-tiles-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.student-tile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
    padding: 18px 22px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.student-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.06);
    border-color: #b0bec5;
}

.tile-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tile-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.tile-amount {
    font-size: 13px;
    color: #666;
}

.tile-status {
    display: flex;
    align-items: center;
}

.attachment-icon {
    position: relative;
    text-decoration: none;
    font-size: 16px;
    margin-left: 5px;
    display: inline-block;
    vertical-align: middle;
}

/* --- STYLE DLA PANELU ADMINISTRATORA (admin_status.php) --- */

.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
	max-height: 600px;
    overflow-y: auto;
}

@media(min-width: 768px) {
    .admin-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.admin-grid-edit {
    grid-template-columns: 1fr;
    margin: 20px 0 40px 0;
	max-height: 600px;
    overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 15px;
}

@media(min-width: 768px) {
    .admin-grid-edit {
        grid-template-columns: 1fr 1fr;
    }
}


.admin-card {
    background: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.admin-card h2 {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    border-bottom: 2px solid #007bff;
    padding-bottom: 6px;
}

.form-row {
    margin-bottom: 15px;
    text-align: left;
}

.form-row label {
    display: block;
    font-size: 13px;
    color: #444;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-row select, .form-row input {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    outline: none;
    background: #fff;
}

.alert-box {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
}

.alert-sukces { 
    background-color: #d4edda; 
    color: #155724; 
    border: 1px solid #c3e6cb; 
}

.alert-blad { 
    background-color: #f8d7da; 
    color: #721c24; 
    border: 1px solid #f5c6cb; 
}

.section-separator {
    margin: 30px 0 15px 0;
    border-top: 2px dashed #ccc;
    padding-top: 20px;
}

/* Styl responsywny dla urządzeń mobilnych (telefony i tablety) */
@media (max-width: 768px) {
    .page-container {
        padding: 10px !important;
        margin: 0 !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    
    .admin-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .admin-card {
        padding: 15px !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    
    .admin-card form div[style*="grid-template-columns"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px !important;
    }
    
    input[type="text"], 
    input[type="file"], 
    select, 
    button {
        width: 100% !important;
        box-sizing: border-box;
    }
    
    .page-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 10px;
    }
    
    .page-header h1 {
        font-size: 18px !important;
    }
}

.admin-card {
    background: #fff;
    border: 1px solid #e1e4e8;
    border-left: 5px solid #007bff;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
}

/* --- NOWE STYLE DLA RADA.PHP --- */
.custom-table th, .custom-table td {
    vertical-align: middle;
}

@media screen and (max-width: 768px) {

    .comment-icon:hover::after {
        left: 0 !important;
        right: auto !important;

        transform: translateX(-20px) !important;

        width: max-content !important;
        max-width: min(300px, calc(100vw - 40px)) !important;

        white-space: normal !important;
        overflow-wrap: normal !important;
        word-break: normal !important;

        line-height: 1.4 !important;
        text-align: left !important;

        z-index: 999999 !important;
    }

}

.skladki-table-responsive {
    overflow: visible !important;
}

@media screen and (max-width: 768px) {

    .skladki-table-responsive .comment-icon:hover::after {
        left: auto !important;
        right: 0 !important;

        transform: translateX(20px) !important;

        width: max-content !important;
        max-width: min(340px, calc(100vw - 40px)) !important;

        white-space: normal !important;
        overflow-wrap: normal !important;
        word-break: normal !important;

        line-height: 1.4 !important;
        text-align: left !important;

        z-index: 999999 !important;
    }

}

/* --- ZBIÓRKI OKOLICZNOŚCIOWE --- */

.event-card {
    position: relative;
}

.event-content {
    min-width: 0;
}

.event-date {
    margin-top: 3px;
    color: #495057;
}

.event-description {
    font-style: italic;
    margin-top: 3px;
    color: #555;
}

.event-arrow {
    flex-shrink: 0;
    margin-left: 15px;
    font-size: 18px;
}

/* --- ZBIÓRKI OKOLICZNOŚCIOWE --- */

.event-card {
    position: relative;
}

.event-content {
    min-width: 0;
}

.event-date {
    margin-top: 3px;
    color: #495057;
}

.event-description {
    font-style: italic;
    margin-top: 3px;
    color: #555;
}

.event-arrow {
    flex-shrink: 0;
    margin-left: 15px;
    font-size: 18px;
}

/* Zbiórka, której termin już minął */
.student-card.event-past {
    background: #f1f1f1;
    border-color: #d5d5d5;
    border-left-color: #a6a6a6;
    color: #888;
}

.student-card.event-past .student-name {
    color: #777;
}

.student-card.event-past .student-phone {
    color: #999;
}

.student-card.event-past .student-number {
    background: #d9d9d9;
    color: #777;
}

.student-card.event-past .event-arrow {
    color: #aaa;
}

/* Hover dla archiwalnej zbiórki */
.student-card.event-past:hover {
    background: #e9e9e9;
    border-color: #c5c5c5;
    border-left-color: #999;
    transform: translateX(3px);
}

@media (max-width: 768px) {
    .event-arrow {
        margin-left: 8px;
    }
}