/* Import czcionek Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Montserrat:wght@400;500;600;700&display=swap');

body {
    background-color: #f8f9fa;
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
    line-height: 1.6;
}

/* Style dla nagłówków */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Specjalne style dla głównego nagłówka */
.page-header h1 {
    font-weight: 700;
    letter-spacing: 1px;
    font-size: 1.8rem;
    margin: 0;
}

.page-header {
    background-color: #000000;
    color: white;
    padding: 20px 0;
    margin-bottom: 30px;
    border-radius: 0 0 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.calendar-table {
    font-size: 0.9rem;
    table-layout: fixed;
    min-width: 800px; /* Minimalna szerokość tabeli */
}

.calendar-table th:first-child,
.calendar-table td:first-child {
    width: 80px;
    min-width: 80px;
}

.calendar-table th:not(:first-child),
.calendar-table td:not(:first-child) {
    width: calc((100% - 80px) / 7);
}

/* Responsywność na urządzeniach mobilnych */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 1.2rem;
    }
    
    /* Responsywność menu w nagłówku */
    .page-header .d-flex {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .page-header .d-flex > div:last-child {
        margin-top: 15px;
        width: 100%;
    }
    
    .page-header .d-flex > div:last-child .btn {
        margin-top: 5px;
        margin-right: 0;
        margin-bottom: 0;
        width: 100%;
        display: block;
    }
    
    .week-navigation h4 {
      padding: 15px 0;
    }

    .calendar-table th:first-child,
    .calendar-table td:first-child {
        width: 60px;
        min-width: 60px;
    }
    
    .calendar-table th:not(:first-child),
    .calendar-table td:not(:first-child) {
        width: calc((100% - 36px) / 7);
    }
    
    .calendar-table {
        font-size: 0.8rem;
        min-width: 600px;
    }
    
    .sala-bar {
        height: 40px !important; /* 2 linie tekstu */
        font-size: 0.6rem;
    }
    
    /* Specjalne style dla strony dzieci.php - wyższe paski (tablet) */
    .dzieci-page .sala-bar {
        height: 100px !important; /* 5 linii tekstu */
    }
    
    .dzieci-page .sala-bar.reserved {
        min-height: 100px !important;
    }
    
    .sala-bar.reserved {
        font-size: 0.6rem;
        padding: 3px;
        min-height: 40px !important;
    }
    
    .sala-bar .btn-danger {
        padding: 0 2px;
        font-size: 0.5rem;
    }
    
    /* Responsywność dla formularza */
    .reservation-form .col-md-2 {
        margin-bottom: 10px;
    }
    
    #powtorz_tygodnie {
        min-width: 60px;
    }
    
    /* Responsywność dla przycisków w tabeli */
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        margin-top: 5px;
        width: 100%;
        display: block;
    }
    
    .btn-warning {
        margin-top: 5px;
        width: 100%;
    }
    
    /* Responsywność dla przycisków akcji w tabelach */
    .table td .btn {
        margin-top: 5px;
        width: 100%;
        display: block;
    }
    
    .table td .btn:first-child {
        margin-top: 0;
    }
    
    /* Responsywność dla formularzy w tabelach */
    .table td form {
        display: block;
        width: 100%;
    }
    
    .table td form .btn {
        width: 100%;
        margin-top: 5px;
    }
}

/* Dodatkowa responsywność dla bardzo małych ekranów (telefony) */
@media (max-width: 576px) {
    .page-header {
        padding: 15px 0;
    }
    
    .page-header h1 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    .page-header .d-flex > div:last-child {
        margin-top: 10px;
    }
    
    .page-header .d-flex > div:last-child .btn {
        font-size: 0.8rem;
        padding: 8px 12px;
        margin-top: 3px;
    }
    
    .week-navigation {
        padding: 10px;
    }
    
    .week-navigation h4 {
        font-size: 1rem;
        padding: 10px 0;
    }
    
    .week-navigation .btn {
        font-size: 0.8rem;
        padding: 8px 12px;
    }
    
    .calendar-table {
        font-size: 0.8rem;
        min-width: 500px;
    }
    
    .sala-bar {
        height: 35px !important; /* 2 linie tekstu */
        font-size: 0.5rem;
    }
    
    /* Specjalne style dla strony dzieci.php - wyższe paski (telefon) */
    .dzieci-page .sala-bar {
        height: 85px !important; /* 5 linii tekstu */
    }
    
    .dzieci-page .sala-bar.reserved {
        min-height: 85px !important;
    }
    
    .sala-bar.reserved {
        font-size: 0.5rem;
        padding: 2px;
        min-height: 35px !important;
    }
    
    .table {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 0.4rem 0.2rem;
    }
    
    .btn-sm {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    .legend-container {
        padding: 6px 10px;
    }
    
    .legend-title {
        font-size: 0.8rem;
        margin-bottom: 6px;
    }
    
    .legend-colors {
        gap: 6px;
    }
    
    .legend-item {
        margin: 0 1px;
    }
    
    .legend-color {
        width: 14px;
        height: 12px;
        margin-right: 3px;
    }
}

.calendar-table th {
    background-color: #f8f9fa;
}

.calendar-table thead {
    background-color: #f8f9fa;
}



.calendar-table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.time-slot {
    height: 70px;
    border: 1px solid #dee2e6;
    position: relative;
    padding: 3px;
    background-color: #ffffff;
}

.sala-bar {
    height: 25px;
    border-radius: 3px;
    margin-bottom: 2px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Specjalne style dla strony dzieci.php - wyższe paski (desktop) */
.dzieci-page .sala-bar {
    height: 50px;
}

.dzieci-page .sala-bar.reserved {
    min-height: 50px;
}

.sala-bar:hover {
    opacity: 0.8;
}

.sala-bar.aerial {
    background-color: #4BBEC6;
}

.sala-bar.pole {
    background-color: #FBC22D;
}

.sala-bar.fitness {
    background-color: #774DFB;
}

.sala-bar.zlota {
    background-color: #FFD700;
}

.sala-bar.mala {
    background-color: #D696B8;
}

.sala-bar.empty {
    width: 100%;
    opacity: 0.6;
    border: 1px dashed rgba(0,0,0,0.3);
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.1) 2px,
        rgba(0,0,0,0.1) 4px
    );
}

.sala-bar.reserved {
    width: 100%;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 5px;
    text-align: left;
    line-height: 1.1;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
    background-image: none !important;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    position: relative;
    min-height: 25px;
}

.sala-bar.reserved:hover {
    opacity: 0.9;
}

.sala-bar.reserved span {
    color: white;
    font-weight: bold;
}

.sala-bar.group-class {
    width: 100%;
    color: #000000;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    font-style: normal;
    padding: 5px;
    text-align: center;
    line-height: 1.2;
    background-image: none !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: not-allowed;
    opacity: 0.8;
    position: relative;
}

.sala-bar.group-class i {
    margin-right: 5px;
    font-size: 0.8rem;
}

.sala-bar.group-class span {
    margin-left: 0;
}

.sala-bar .btn-danger {
    padding: 0 3px;
    font-size: 0.6rem;
    line-height: 1.2;
    flex-shrink: 0;
}

.week-navigation {
    background-color: #f8f9fa;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
}

.reservation-form {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

/* Przycisk Dodaj rezerwację - czarny */
.reservation-form .btn-primary {
    background-color: #000000;
    border-color: #000000;
    color: white;
}

.reservation-form .btn-primary:hover {
    background-color: #333333;
    border-color: #333333;
    color: white;
}

footer {
    border-top: 3px solid #007bff;
}

footer a {
    transition: all 0.3s ease;
    padding: 10px 20px;
    border-radius: 5px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 400;
}

footer a:hover {
    background-color: #ffffff;
    color: #000000 !important;
    transform: translateY(-2px);
}

/* Style dla legendy sal */
.legend-container {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.legend-title {
    text-align: center;
    color: #6c757d;
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1rem;
}

.legend-colors {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 0 15px;
}

.legend-color {
    width: 20px;
    height: 16px;
    margin-right: 8px;
    border-radius: 3px;
}

/* Kolory dla legendy sal */
.legend-color.aerial {
    background-color: #4BBEC6;
}

.legend-color.pole {
    background-color: #FBC22D;
}

.legend-color.fitness {
    background-color: #774DFB;
}

.legend-color.zlota {
    background-color: #FFD700;
}

.legend-color.mala {
    background-color: #D696B8;
}

/* Responsywność dla legendy */
@media (max-width: 768px) {
    .legend-container {
        padding: 8px 12px;
    }
    
    .legend-title {
        margin-bottom: 8px;
        font-size: 0.9rem;
    }
    
    .legend-colors {
        gap: 8px;
    }
    
    .legend-item {
        margin: 0 2px;
        flex-shrink: 0;
    }
    
    .legend-color {
        width: 16px;
        height: 14px;
        margin-right: 4px;
    }
}

/* Style dla responsywnej tabeli */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Płynny scroll na iOS */
}

/* Style dla kalendarza */
.table-responsive .calendar-table {
    margin-top: 0;
}

/* Lepszy scroll na urządzeniach mobilnych */
@media (max-width: 768px) {
    .table-responsive {
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    /* Ukryj scrollbar na niektórych przeglądarkach mobilnych */
    .table-responsive::-webkit-scrollbar {
        height: 6px;
    }
    
    .table-responsive::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }
    
    .table-responsive::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 3px;
    }
    
    .table-responsive::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
}

/* Style dla tabeli usuniętych rezerwacji */
.table-secondary {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
}

.table-secondary thead th {
    background-color: #6c757d;
    color: white;
    border-color: #495057;
}

.table-secondary tbody tr:hover {
    background-color: #e9ecef;
}

/* Ikona usunięcia w tabeli */
.text-danger .fas.fa-calendar-times {
    color: #dc3545;
    margin-right: 5px;
}

/* Nagłówek tabeli usuniętych rezerwacji */
h4 .fas.fa-trash-alt.text-muted {
    color: #6c757d !important;
    margin-right: 8px;
}

/* Responsywność dla tabeli usuniętych rezerwacji */
@media (max-width: 768px) {
    .table-secondary {
        font-size: 0.85rem;
    }
    
    .table-secondary th,
    .table-secondary td {
        padding: 0.5rem 0.25rem;
    }
}

/* Style dla komórek sal w tabelach */
.sala-cell {
    padding: 4px !important;
    text-align: left;
    vertical-align: middle;
}

.sala-badge {
    display: inline-block;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
    white-space: nowrap;
    min-width: 60px;
}

/* Responsywność dla komórek sal */
@media (max-width: 768px) {
    .sala-cell {
        padding: 2px !important;
    }
    
    .sala-badge {
        padding: 4px 8px !important;
        font-size: 0.8rem;
        min-width: 50px;
    }
}

/* Strona logowania */
.login-page {
    background: #000000;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Poppins', sans-serif;
}

.login-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    padding: 3rem;
    max-width: 400px;
    width: 100%;
}

.login-page .logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-page .logo img {
    height: 80px;
    width: auto;
}

.login-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 1.25rem;
    margin-top: 0.5rem;
}

.login-subtitle {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
}

.login-label {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
}

.login-input {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 12px 15px;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
}

.login-input:focus {
    border-color: #000000;
    box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.25);
}

.login-checkbox-label {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
}

.btn-login {
    background: #000000;
    color: #ffffff;
    border: 2px solid #000000;
    border-radius: 10px;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
    margin-top: 1rem;
}

.btn-login:hover {
    background: #ffffff;
    color: #000000;
    border-color: #000000;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.login-footer {
    font-family: 'Poppins', sans-serif;
    font-weight: 400;
}

.login-page .alert {
    border-radius: 10px;
    border: none;
}

/* Style dla przełącznika widoku kalendarza */
.view-toggle {
    margin-bottom: 0;
}

.view-toggle .btn-group .btn {
    font-size: 0.9rem;
    padding: 8px 16px;
    font-weight: 500;
}

/* Naprawienie btn-group - Bootstrap domyślnie usuwa border-radius z środkowych przycisków */
.view-toggle .btn-group .btn:first-child {
    border-top-left-radius: 0.375rem !important;
    border-bottom-left-radius: 0.375rem !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.view-toggle .btn-group .btn:last-child {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-top-right-radius: 0.375rem !important;
    border-bottom-right-radius: 0.375rem !important;
}

.view-toggle .btn-check:checked + .btn {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

/* Style dla badge-ów z liczbą obecności */
.attendance-badges {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 0;
}

.attendance-badges .badge {
    font-size: 0.9rem;
    padding: 6px 6px;
    border-radius: 16px;
    font-weight: 700;
    min-width: 32px;
    text-align: center;
    line-height: 1.2;
}

.attendance-badges .badge.bg-success {
    background-color: #198754 !important;
    color: white;
}

.attendance-badges .badge.bg-secondary {
    background-color: #6c757d !important;
    color: white;
}

/* Style dla widoków kalendarza */
.class-details-view {
    display: block;
}

.attendance-count-view {
    display: none;
}

/* Responsywność dla przełącznika */
@media (max-width: 768px) {
    .view-toggle .btn-group .btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
    
    .attendance-badges { 
      gap: 0;
    }

    .attendance-badges .badge {
        font-size: 0.8rem;
        padding: 4px 4px;
        min-width: 28px;
    }
}