* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.page-title {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #1a3a6c;
    text-align: center;
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: #666;
}

.error {
    text-align: center;
    padding: 40px;
    color: #d32f2f;
    background-color: #ffebee;
    border-radius: 8px;
    margin: 20px 0;
}

.faculty-tabs {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

.faculty-tabs-header {
    display: flex;
    background-color: #f0f0f0;
    border-bottom: 1px solid #ddd;
    overflow-x: auto;
}

.faculty-tab-button {
    padding: 15px 25px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #555;
    transition: all 0.3s;
    white-space: nowrap;
    position: relative;
}

.faculty-tab-button:hover {
    background-color: #e5e5e5;
}

.faculty-tab-button.active {
    background-color: white;
    color: #1a3a6c;
    font-weight: 600;
}

.faculty-tab-button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #1a3a6c;
}

.faculty-tab-content {
    display: none;
    padding: 20px;
}

.faculty-tab-content.active {
    display: block;
}

.faculty-full-name {
    font-size: 1.2rem;
    color: #1a3a6c;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.study-form-tabs {
    margin-bottom: 20px;
}

.study-form-tabs-header {
    display: flex;
    background-color: #f8f9fa;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.study-form-tab-button {
    padding: 12px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: #666;
    transition: all 0.3s;
    text-align: center;
    flex: 1;
    min-width: 120px;
}

.study-form-tab-button:hover {
    background-color: #e9ecef;
}

.study-form-tab-button.active {
    background-color: #1a3a6c;
    color: white;
    font-weight: 500;
}

.study-form-tab-content {
    display: none;
}

.study-form-tab-content.active {
    display: block;
}

.education-level-tabs {
    margin-bottom: 20px;
}

.education-level-tabs-header {
    display: flex;
    background-color: #f8f9fa;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.education-level-tab-button {
    padding: 10px 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: #666;
    transition: all 0.3s;
    text-align: center;
    flex: 1;
    min-width: 120px;
}

.education-level-tab-button:hover {
    background-color: #e9ecef;
}

.education-level-tab-button.active {
    background-color: #2c5aa0;
    color: white;
    font-weight: 500;
}

.education-level-tab-content {
    display: none;
}

.education-level-tab-content.active {
    display: block;
}

.courses-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.course-column {
    background-color: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    min-height: 150px;
}

.course-title {
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
    color: #1a3a6c;
    text-align: center;
}

.groups-list {
    list-style: none;
}

.group-item {
    padding: 8px 10px;
    margin-bottom: 8px;
    background-color: white;
    border-radius: 4px;
    border-left: 3px solid #2c5aa0;
    transition: all 0.2s;
    cursor: pointer;
    font-size: 0.9rem;
}

.group-item:hover {
    background-color: #e9f2ff;
    transform: translateX(3px);
}

/*   */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 2% auto;
    width: 95%;
    max-width: 1400px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: modalOpen 0.3s;
}

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

.modal-header {
    padding: 15px 20px;
    background-color: #1a3a6c;
    color: white;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: rgba(255,255,255,0.2);
    border-radius: 50%;
}

.modal-body {
    padding: 20px;
}

/*    */
.week-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
    align-items: center;
}

.week-nav button {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #1a3a6c;
    background-color: #1a3a6c;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 40px;
}

.week-nav button:hover:not(:disabled) {
    background-color: #2c5aa0;
    border-color: #2c5aa0;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.week-nav button:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.week-nav button:disabled {
    background-color: #6c757d;
    border-color: #6c757d;
    cursor: not-allowed;
    opacity: 0.5;
}

.week-selector {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #1a3a6c;
    position: sticky;
    top: 70px;
    z-index: 5;
}

.week-selector label {
    font-weight: 600;
    color: #1a3a6c;
    margin-right: 5px;
}

.week-selector select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ced4da;
    background-color: white;
    font-size: 0.95rem;
    min-width: 250px;
    transition: border-color 0.3s;
    cursor: pointer;
}

.week-selector select:focus {
    outline: none;
    border-color: #1a3a6c;
    box-shadow: 0 0 0 2px rgba(26, 58, 108, 0.1);
}

.week-selector select:hover {
    border-color: #1a3a6c;
}

/* =====    ===== */
.schedule-day {
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.day-title {
    padding: 12px 16px;
    background-color: #f0f4f8;
    color: #1a3a6c;
    font-size: 1.2rem;
    font-weight: 600;
    border-bottom: 2px solid #1a3a6c;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.day-note {
    font-size: 0.9rem;
    font-weight: normal;
    color: #666;
    background-color: #e9ecef;
    padding: 4px 12px;
    border-radius: 16px;
}

/*   */
.schedule-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.schedule-table th {
    background-color: #f8f9fa;
    padding: 12px 8px;
    font-weight: 600;
    color: #1a3a6c;
    border-bottom: 2px solid #dee2e6;
    text-align: left;
    font-size: 0.9rem;
}

.schedule-table td {
    padding: 12px 8px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.schedule-table tr:last-child td {
    border-bottom: none;
}

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

/*   */
.schedule-table th:first-child,
.schedule-table td:first-child {
    padding-left: 16px;
}

.schedule-table th:last-child,
.schedule-table td:last-child {
    padding-right: 16px;
}

/*   */
.schedule-table .time-column {
    width: 120px;
    font-weight: 600;
    color: #1a3a6c;
}

/*   */
.schedule-table .subject-column {
    width: auto;
    font-weight: 500;
}

/*    */
.schedule-table .type-column {
    width: 130px;
}

/*   */
.schedule-table .teacher-column {
    width: 200px;
}

/*   */
.schedule-table .room-column {
    width: 100px;
    text-align: center;
    font-weight: 500;
    color: #0d3b5e;
}

/*     */
.lesson-type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

.lesson-type-lecture {
    background-color: #cfe2ff;
    color: #084298;
}

.lesson-type-seminar {
    background-color: #d1e7dd;
    color: #0f5132;
}

.lesson-type-practice {
    background-color: #d1e7dd;
    color: #0f5132;
}

.lesson-type-language {
    background-color: #fff3cd;
    color: #856404;
}

.lesson-type-lab {
    background-color: #e2d9f3;
    color: #4a2c8f;
}

/*   */
.lesson-subgroup {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    background-color: #e2d9f3;
    color: #4a2c8f;
    white-space: nowrap;
}

.lesson-elective {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    background-color: #fff3cd;
    color: #856404;
}


/*    */
.lesson-note-row td {
    padding-top: 0;
    padding-bottom: 12px;
    background-color: #fff9e6;
}

.lesson-note {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: #666;
    background-color: #fff9e6;
    padding: 8px 16px;
    border-left: 4px solid #ffc107;
    margin: 0 8px;
    border-radius: 4px;
}

.lesson-note::before {
    content: "??";
    font-size: 1rem;
}

/*   */
.no-lessons-row td {
    padding: 30px;
    text-align: center;
    color: #868e96;
    font-style: italic;
    background-color: #f8f9fa;
}

/*   */
.modal-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
    flex-direction: column;
    gap: 20px;
}

.modal-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1a3a6c;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/*     */
@media (max-width: 992px) {
    .courses-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .schedule-table {
        font-size: 0.9rem;
    }
    
    .schedule-table .teacher-column {
        width: 150px;
    }
}

@media (max-width: 768px) {
    .courses-container {
        grid-template-columns: 1fr;
    }
    
    .faculty-tabs-header {
        flex-direction: column;
    }
    
    .faculty-tab-button {
        text-align: left;
        border-bottom: 1px solid #ddd;
    }
    
    .faculty-tab-button.active::after {
        width: 5px;
        height: 100%;
        bottom: 0;
        left: 0;
    }
    
    .study-form-tabs-header,
    .education-level-tabs-header {
        flex-direction: column;
    }
    
    .modal-content {
        width: 98%;
        margin: 1% auto;
    }
    
    .week-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        top: 60px;
    }
    
    .week-nav {
        margin-left: 0;
        justify-content: center;
    }
    
    .week-selector select {
        min-width: auto;
        width: 100%;
    }
    
    /*   */
    .schedule-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .schedule-table th,
    .schedule-table td {
        white-space: normal;
        word-break: break-word;
    }
    
    .schedule-table .time-column {
        width: 100px;
    }
    
    .schedule-table .type-column {
        width: 110px;
    }
    
    .schedule-table .teacher-column {
        width: 140px;
    }
    
    .schedule-table .room-column {
        width: 80px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .faculty-tab-button {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .course-column {
        padding: 10px;
    }
    
    .group-item {
        padding: 6px 8px;
        font-size: 0.85rem;
    }
    
    .modal-header {
        padding: 12px 15px;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
    
    .modal-body {
        padding: 12px;
    }
    
    .week-nav {
        flex-wrap: nowrap;
    }
    
    .week-nav button {
        flex: 1;
        min-width: auto;
        padding: 10px 8px;
        font-size: 0.85rem;
    }
    
    .day-title {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .day-note {
        width: 100%;
    }
    
    /*     */
    .schedule-table th,
    .schedule-table td {
        padding: 8px 4px;
        font-size: 0.8rem;
    }
    
    .lesson-type-badge {
        padding: 2px 6px;
        font-size: 0.7rem;
    }
}

/*  */
@media print {
    body {
        background-color: white;
        padding: 0;
    }
    
    .faculty-tabs,
    .week-nav,
    .week-selector,
    .modal-header .close-btn {
        display: none !important;
    }
    
    .modal {
        position: relative;
        display: block !important;
        background: none;
    }
    
    .modal-content {
        margin: 0;
        width: 100%;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .schedule-table {
        page-break-inside: auto;
    }
    
    .schedule-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    .day-title {
        background: none;
        color: black;
        border-bottom: 2px solid #333;
    }
}