/* ============================================================================
   ADMIN SIDEBAR - Style dla menu bocznego panelu admina
   ============================================================================
   Data utworzenia: 23 stycznia 2026
   Cel: Przebudowa panelu admina z pionowego scrollowania na system z menu bocznym
   ============================================================================ */

/* ============================================================================
   LAYOUT - Kontener główny z menu bocznym
   ============================================================================ */

.admin-layout-with-sidebar {
    display: flex;
    gap: 0;
    min-height: calc(100vh - 150px);
    background: #f5f5f5;
}

/* ============================================================================
   SIDEBAR - Menu boczne (lewe)
   ============================================================================ */

.admin-sidebar {
    width: 220px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    padding: 20px 0;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 60px;
    height: fit-content;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    border-radius: 0 8px 8px 0;
}

/* Scrollbar dla sidebara */
.admin-sidebar::-webkit-scrollbar {
    width: 6px;
}

.admin-sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.admin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.admin-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ============================================================================
   PRZYCISKI MENU
   ============================================================================ */

.admin-menu-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: transparent;
    border: none;
    color: #ecf0f1;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    position: relative;
}

.admin-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: #e1b12c;
    padding-left: 24px;
}

.admin-menu-btn.active {
    background: rgba(225, 177, 44, 0.2);
    border-left-color: #e1b12c;
    color: #e1b12c;
    font-weight: 600;
}

.admin-menu-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: #e1b12c;
    box-shadow: 0 0 10px rgba(225, 177, 44, 0.5);
}

/* ============================================================================
   CONTENT AREA - Główna treść (prawa strona)
   ============================================================================ */

.admin-content-area {
    flex: 1;
    padding: 15px;
    background: #fff;
    border-radius: 8px 0 0 8px;
    margin-left: 0;
    min-height: 600px;
}

/* ============================================================================
   SEKCJE - Kontenery dla poszczególnych kategorii
   ============================================================================ */

.admin-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
    width: 100%;
}

.admin-section.active {
    display: block;
    width: 100%;
}

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

/* ============================================================================
   TYTUŁY SEKCJI
   ============================================================================ */

.admin-section h2 {
    color: #e1b12c;
    text-align: center;
    margin-bottom: 20px;
    text-transform: uppercase;
    border-bottom: 2px solid #5d4037;
    padding-bottom: 10px;
    font-size: 1.5rem;
}

.admin-section h3 {
    color: #e1b12c;
    text-align: center;
    margin-top: 30px;
    margin-bottom: 20px;
    text-transform: uppercase;
    border-bottom: 2px solid #5d4037;
    padding-bottom: 10px;
    font-size: 1.2rem;
}

/* ============================================================================
   RESPONSYWNOŚĆ - Mobile (< 768px)
   ============================================================================ */

@media (max-width: 768px) {
    .admin-layout-with-sidebar {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        position: static;
        max-height: none;
        padding: 10px 0;
        border-radius: 8px 8px 0 0;
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
    }
    
    .admin-menu-btn {
        display: inline-block;
        width: auto;
        padding: 12px 20px;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    
    .admin-menu-btn:hover {
        padding-left: 20px;
        border-left: none;
        border-bottom-color: #e1b12c;
    }
    
    .admin-menu-btn.active {
        border-left: none;
        border-bottom-color: #e1b12c;
    }
    
    .admin-menu-btn.active::before {
        display: none;
    }
    
    .admin-content-area {
        padding: 20px;
        border-radius: 0 0 8px 8px;
    }
    
    /* Scrollbar poziomy dla mobile menu */
    .admin-sidebar::-webkit-scrollbar {
        height: 4px;
        width: auto;
    }
    
    .admin-sidebar::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.1);
    }
    
    .admin-sidebar::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }
}

/* ============================================================================
   COMPATIBILITY - Zachowanie kompatybilności z istniejącymi stylami
   ============================================================================ */

/* Kontenery istniejące dziedziczą style z głównego pliku CSS:
   - .journal-container
   - .student-catalog-section
   - .admin-grid-layout
*/

/* Zachowanie marginesów dla bloków */
.admin-section > div {
    margin-bottom: 20px;
}

.admin-section > div:last-child {
    margin-bottom: 0;
}

/* ============================================================================
   FIX - Naprawienie wyświetlania formularzy i list w nowych sekcjach
   ============================================================================ */

/* KLUCZOWA NAPRAWA: Wyrównaj formularze DO LEWEJ (nie wyśrodkowuj!) */
#page-admin .admin-section .onboarding-form {
    max-width: 600px !important;
    margin-left: 0 !important;
    margin-right: auto !important;  /* To wyrówna do LEWEJ */
    width: auto !important;
}

/* Napraw wyświetlanie catalog-form-section i catalog-list-section */
#page-admin .admin-section .catalog-form-section {
    width: 100% !important;
    max-width: none !important;
    float: none !important;
    clear: both !important;
    display: block !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-align: left !important;
}

#page-admin .admin-section .catalog-list-section {
    width: 100% !important;
    max-width: none !important;
    float: none !important;
    clear: both !important;
    display: block !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    text-align: left !important;
}

/* Napraw wyświetlanie student-catalog-section w nowych sekcjach */
#page-admin .admin-section .student-catalog-section {
    width: 100% !important;
    max-width: none !important;
    float: none !important;
    clear: both !important;
    display: block !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
    text-align: left !important;
}

/* Dodatkowe naprawy dla elementów wewnętrznych */
#page-admin .admin-section .onboarding-form-row {
    text-align: left !important;
    margin-bottom: 15px !important;
    width: 100% !important;
    max-width: none !important;
}

#page-admin .admin-section .onboarding-form-row label {
    text-align: left !important;
    display: block !important;
    margin-bottom: 5px !important;
}

#page-admin .admin-section .onboarding-input {
    width: 100% !important;
    box-sizing: border-box !important;
}

#page-admin .admin-section .onboarding-btn {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Pola formularza - normalna szerokość, wyrównane do lewej */
#page-admin .admin-section input[type="text"],
#page-admin .admin-section input[type="email"],
#page-admin .admin-section input[type="number"],
#page-admin .admin-section input[type="password"],
#page-admin .admin-section select,
#page-admin .admin-section textarea {
    max-width: 500px !important;
    box-sizing: border-box !important;
}

/* Rozciągnij divy z id subjects-list i podobne */
#page-admin .admin-section #subjects-list,
#page-admin .admin-section #subject-message,
#page-admin .admin-section #reset-password-message {
    width: 100% !important;
    max-width: 100% !important;
}

/* ============================================================================
   UTILITIES - Pomocnicze klasy
   ============================================================================ */

.admin-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.admin-section-subtitle {
    color: #666;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 15px;
    font-style: italic;
}

/* Separator między blokami w sekcji */
.admin-block-separator {
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #5d4037 50%, transparent 100%);
    margin: 40px 0;
}

/* ============================================================================
   SPECJALNE REGUŁY DLA SEKCJI PRZEDMIOTY - Pełna szerokość
   ============================================================================ */

/* Sekcja Przedmioty: usuń ograniczenia szerokości dla pól formularza */
#admin-section-subjects input[type="text"],
#admin-section-subjects input[type="email"],
#admin-section-subjects input[type="number"],
#admin-section-subjects select,
#admin-section-subjects textarea {
    max-width: 100% !important;
}

/* Sekcja Przedmioty: upewnij się że wszystkie kontenery są na pełną szerokość */
#admin-section-subjects .onboarding-form-row,
#admin-section-subjects > div {
    width: 100% !important;
    max-width: 100% !important;
}

/* ============================================================================
   KLASY SPECJALNE - Style dla kart i modali
   ============================================================================ */

/* Grid z kartami klas specjalnych */
.special-classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Karta klasy specjalnej */
.special-class-card {
    background: #fff;
    border: 2px solid #5d4037;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.special-class-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.special-class-card.inactive {
    opacity: 0.7;
    background: #f5f5f5;
}

/* Nagłówek karty */
.special-class-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.special-class-header h3 {
    margin: 0;
    color: #5d4037;
    font-size: 1.3rem;
}

/* Badge statusu */
.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.active-badge {
    background: #27ae60;
    color: #fff;
}

.status-badge.inactive-badge {
    background: #95a5a6;
    color: #fff;
}

/* Opis klasy */
.special-class-description {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 15px;
    line-height: 1.5;
}

/* Informacje o klasie */
.special-class-info {
    margin-bottom: 15px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #555;
    font-size: 0.9rem;
}

.info-item .icon {
    font-size: 1.1rem;
}

/* Badge z liczbą uczniów */
.students-count-badge {
    display: inline-block;
    background: #3498db;
    color: #fff;
    padding: 6px 14px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Przyciski akcji */
.special-class-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.action-btn {
    flex: 1;
    min-width: 120px;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn.assign-btn {
    background: #3498db;
    color: #fff;
}

.action-btn.assign-btn:hover:not(:disabled) {
    background: #2980b9;
}

.action-btn.edit-btn {
    background: #f39c12;
    color: #fff;
}

.action-btn.edit-btn:hover {
    background: #e67e22;
}

.action-btn.delete-btn {
    background: #e74c3c;
    color: #fff;
}

.action-btn.delete-btn:hover {
    background: #c0392b;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal przypisywania uczniów */
.assign-students-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 2px solid #5d4037;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: #fff;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: #e1b12c;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

/* Kontener z kolumnami uczniów */
.students-list-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.students-list-column h4 {
    margin: 0 0 15px 0;
    color: #5d4037;
    font-size: 1.1rem;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

/* Lista uczniów */
.students-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 10px;
    background: #f9f9f9;
}

.student-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    transition: background 0.2s ease;
}

.student-item:hover {
    background: #f0f0f0;
}

.student-item span {
    flex: 1;
    color: #333;
    font-weight: 500;
}

.add-student-btn,
.remove-student-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-student-btn {
    background: #27ae60;
    color: #fff;
}

.add-student-btn:hover:not(:disabled) {
    background: #229954;
    transform: scale(1.1);
}

.remove-student-btn {
    background: #e74c3c;
    color: #fff;
}

.remove-student-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.add-student-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.empty-list {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

/* Responsywność */
@media (max-width: 768px) {
    .special-classes-grid {
        grid-template-columns: 1fr;
    }
    
    .students-list-container {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .special-class-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
}
