* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1920px;
    margin: 0 auto;
    padding: 20px;
}

/* Шапка */
.header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 25px;
    text-align: center;
    border-left: 4px solid #2c3e50;
}

.header h1 {
    color: #2c3e50;
    font-size: 24px;
    margin-bottom: 8px;
}

.header-info {
    color: #666;
    font-size: 13px;
    margin-top: 8px;
}

/* Flash-сообщения */
.flash {
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.flash.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Переключатель недели */
.week-toggle,
.week-toggle-mobile {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
    background: white;
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.week-toggle-mobile {
    padding: 10px 15px;
    margin-bottom: 15px;
}

.week-label,
.week-text {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.week-text {
    min-width: 70px;
    text-align: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #bdc3c7;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #3498db;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Таблица расписания (ПК) */
.schedule-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    table-layout: fixed;
}

.schedule-table th,
.schedule-table td {
    padding: 12px 10px;
    text-align: left;
    border: 1px solid #dee2e6;
    vertical-align: top;
}

.schedule-table th {
    background: #2c3e50;
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    font-size: 13px;
    white-space: nowrap;
    line-height: 1.2;
}

.schedule-table th:first-child,
.schedule-table td:first-child {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    font-weight: 600;
}

.schedule-table th:not(:first-child),
.schedule-table td:not(:first-child) {
    width: calc((100% - 120px) / 6);
}

.current-day {
    background: #e9f7ef !important;
    border-left: 4px solid #27ae60;
}

.lesson-item {
    margin-bottom: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #3498db;
}

.lesson-time {
    font-weight: bold;
    color: #3498db;
    font-size: 12px;
    margin-bottom: 3px;
    line-height: 1.4;
}

.lesson-subject {
    font-size: 14px;
    font-weight: 600;
    margin: 3px 0;
    color: #2c3e50;
}

.lesson-teacher,
.lesson-classroom {
    font-size: 12px;
    color: #666;
    margin: 1px 0;
}

.lesson-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    margin-top: 4px;
    font-weight: 600;
    text-transform: uppercase;
    color: white;
}

.lesson-type.лекция { background: #3498db; }
.lesson-type.лабораторная { background: #e67e22; }
.lesson-type.практика { background: #9b59b6; }
.lesson-type.консультация { background: #16a085; }
.lesson-type.экзамен { background: #e74c3c; }

/* Мобильная версия */
.mobile-schedule {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.day-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.day-btn {
    flex: 0 0 40px;
    height: 40px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    transition: background 0.2s;
}

.day-btn:hover { background: #1a252f; }

.day-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.day-name {
    flex: 1;
    font-size: 22px;
    font-weight: bold;
    text-align: center;
    color: #2c3e50;
}

.no-lessons {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
    font-size: 16px;
    background: #f8f9fa;
    border-radius: 6px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.action-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-today {
    background: #27ae60;
    color: white;
}

.btn-today:hover { background: #219653; }

/* Объявления */
.announcements {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.announcement {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #ffe066;
}

.announcement:last-child { border-bottom: none; }

.announcement-icon {
    font-size: 18px;
    margin-right: 10px;
    min-width: 24px;
    text-align: center;
}

.announcement-text {
    color: #856404;
    font-size: 14px;
    line-height: 1.5;
}

/* Ссылки */
.links-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 30px 0;
    border-left: 4px solid #3498db;
}

.links-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.link-item {
    display: block;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
    border: 1px solid #e9ecef;
}

.link-item:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.2);
    border-color: #3498db;
}

.footer {
    text-align: center;
    margin-top: 25px;
    color: #95a5a6;
    font-size: 12px;
    padding: 15px;
}

/* ===================== Админка ===================== */

.login-card {
    max-width: 380px;
    margin: 60px auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    text-align: center;
}

.login-card h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.login-card label {
    display: block;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.login-card input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 15px;
}

.btn-primary {
    width: 100%;
    padding: 11px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover { background: #1a252f; }

.login-card .back-link {
    display: inline-block;
    margin-top: 15px;
}

.admin-container {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 1600px;
    margin: 0 auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #2c3e50;
}

.admin-header h2 {
    color: #2c3e50;
    font-size: 22px;
}

.admin-header-links {
    display: flex;
    gap: 8px;
}

.back-link {
    color: #3498db;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 16px;
    background: #f8f9fa;
    border-radius: 6px;
    transition: background 0.2s;
}

.back-link:hover {
    background: #e9ecef;
    text-decoration: none;
}

.btn-logout { color: #e74c3c; }

.admin-section {
    margin: 25px 0;
}

.admin-section h3 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 17px;
}

.hint {
    color: #95a5a6;
    font-size: 12px;
    margin-bottom: 10px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.grid-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
    table-layout: fixed;
}

.grid-table th,
.grid-table td {
    border: 1px solid #e9ecef;
    vertical-align: top;
    padding: 6px;
    font-size: 13px;
}

.grid-table thead th {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 8px 6px;
    font-size: 12px;
    line-height: 1.3;
}

.th-time {
    font-weight: 400;
    opacity: 0.75;
    font-size: 11px;
}

.grid-day {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    width: 90px;
    min-width: 90px;
}

.grid-cell { min-width: 130px; }

.cell-lesson {
    background: #f8f9fa;
    border-left: 3px solid #3498db;
    border-radius: 4px;
    padding: 7px 8px;
    margin-bottom: 6px;
}

.cell-subject {
    font-weight: 600;
    color: #2c3e50;
    font-size: 12px;
    line-height: 1.35;
}

.cell-teacher {
    font-size: 11px;
    color: #666;
}

.cell-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-top: 4px;
    font-size: 11px;
    color: #666;
}

.badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: white;
}

.badge-type { background: #9b59b6; }
.wk-both { background: #27ae60; }
.wk-even { background: #2980b9; }
.wk-odd { background: #e67e22; }

.cell-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.btn-mini {
    display: inline-block;
    padding: 2px 9px;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    color: #2c3e50;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-mini:hover {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.btn-danger:hover {
    background: #e74c3c;
    border-color: #e74c3c;
}

.btn-add-cell {
    display: block;
    text-align: center;
    padding: 4px 0;
    font-size: 12px;
    color: #95a5a6;
    text-decoration: none;
    border: 1px dashed #ccc;
    border-radius: 4px;
    transition: all 0.15s;
}

.btn-add-cell:hover {
    color: #27ae60;
    border-color: #27ae60;
    background: #f0fff6;
    text-decoration: none;
}

.admin-forms {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.form-row input {
    flex: 1;
    min-width: 180px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.btn-add {
    padding: 8px 18px;
    border: none;
    border-radius: 6px;
    background: #27ae60;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-add:hover { background: #219653; }

.items-list { margin-top: 12px; }

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: white;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid #e9ecef;
    font-size: 14px;
}

.item-text { word-break: break-word; }

.empty-note {
    color: #95a5a6;
    font-style: italic;
    font-size: 13px;
    padding: 6px 0;
}

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin: 12px 0 5px;
}

.times-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.time-field {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.time-field input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
}

#password form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

#password input {
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

#password .btn-add { align-self: flex-start; }

/* Форма пары */
.lesson-form-container { max-width: 700px; }

.lesson-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.lesson-form-field { margin-bottom: 14px; }

.lesson-form-field label,
.lesson-form-field .field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
    margin-top: 0;
}

.lesson-form-field input[type="text"],
.lesson-form-field select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.radio-group {
    display: flex;
    gap: 18px;
    padding: 4px 0;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 400;
}

.lesson-form .btn-primary {
    width: auto;
    padding: 10px 28px;
    margin-top: 6px;
}

@media (max-width: 640px) {
    .lesson-form-row {
        grid-template-columns: 1fr;
    }
}

/* Адаптивность публичной части */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding: 10px;
    }

    .schedule-table {
        font-size: 11px;
        display: block;
        overflow-x: auto;
    }

    .schedule-table th,
    .schedule-table td {
        padding: 8px;
        min-width: 100px;
    }

    .lesson-subject { font-size: 12px; }

    .lesson-teacher,
    .lesson-classroom { font-size: 11px; }
}

@media (max-width: 480px) {
    body { padding: 10px; }

    .header h1 { font-size: 20px; }

    .day-name { font-size: 18px; }

    .action-buttons { flex-direction: column; }

    .action-btn { width: 100%; }

    .admin-container { padding: 15px; }
}
