/* ============ БАЗОВЫЕ СТИЛИ ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* ============ ЭКРАН ВХОДА ============ */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    margin-bottom: 30px;
    color: #333;
}

.login-box input {
    display: block;
    width: 100%;
    margin-bottom: 15px;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
}

.login-box input:focus {
    outline: none;
    border-color: #667eea;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
}

.login-btn:hover {
    background: #5a67d8;
}

/* ============ ОСНОВНОЕ ПРИЛОЖЕНИЕ ============ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 30px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    font-size: 2em;
    color: #333;
}

.user-bar {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
    padding: 8px 16px;
    background: #fc8181;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

/* ============ ФИНАНСОВАЯ ПАНЕЛЬ ============ */
.finance-panel {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f0fff4 0%, #e6fffa 100%);
    border-radius: 15px;
    border: 2px solid #48bb78;
}

.finance-item {
    text-align: center;
    padding: 10px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.finance-label {
    font-size: 0.8em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.finance-value {
    font-size: 1.8em;
    font-weight: 700;
    color: #48bb78;
}

.finance-value.week-total { color: #667eea; font-size: 2.2em; }
.finance-value.month-total { color: #e53e3e; font-size: 2.2em; }

/* ============ НАВИГАЦИЯ ============ */
.week-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.week-navigation button {
    padding: 12px 25px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s;
}

.week-navigation button:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.today-btn { background: #48bb78 !important; }

.week-range {
    font-size: 1.2em;
    font-weight: 600;
    min-width: 250px;
    text-align: center;
}

/* ============ ЛЕГЕНДА ============ */
.status-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-color { width: 20px; height: 20px; border-radius: 5px; }

/* ============ ПАНЕЛЬ УПРАВЛЕНИЯ ============ */
.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

input, select, button {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

input:focus, select:focus {
    outline: none;
    border-color: #667eea;
}

#eventPrice { width: 100px; border-color: #48bb78; }

button {
    background: #667eea;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

button:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.export-btn { background: #48bb78; }

/* ============ СЕТКА РАСПИСАНИЯ ============ */
.schedule {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 15px;
}

.day-column {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 15px;
    min-width: 180px;
    flex: 1;
    min-height: 400px;
    flex-shrink: 0;
}

.day-column.today {
    background: #e8f0fe;
    box-shadow: 0 0 0 3px #667eea;
}

.day-header {
    font-weight: 700;
    text-align: center;
    margin-bottom: 5px;
    padding: 10px;
    background: white;
    border-radius: 10px;
}

.day-date {
    text-align: center;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
    font-weight: 600;
}

.day-total {
    text-align: center;
    font-weight: 700;
    color: #48bb78;
    margin-bottom: 10px;
    padding: 5px;
    background: #f0fff4;
    border-radius: 8px;
    border: 1px dashed #48bb78;
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 200px;
}

/* ============ КАРТОЧКА СОБЫТИЯ ============ */
.event {
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    color: white;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: all 0.3s;
    position: relative;
    word-wrap: break-word;
    animation: slideIn 0.3s ease-out;
}

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

.event:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
.event.has-price { border-right: 4px solid rgba(255,255,255,0.5); }

.event .delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.3);
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s;
}

.event:hover .delete-btn { opacity: 1; }

.event .repeat-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(0,0,0,0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
}

.event .price-badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0,0,0,0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    color: #000 !important;
}

/* ============ ПОЛОСА ПРОКРУТКИ ============ */
.schedule::-webkit-scrollbar { height: 8px; }
.schedule::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
.schedule::-webkit-scrollbar-thumb { background: #667eea; border-radius: 10px; }

@media (max-width: 768px) {
    .day-column { min-width: 140px; }
    .controls { flex-direction: column; }
    .week-navigation { flex-direction: column; }
    .header { flex-direction: column; text-align: center; }
}

/* ============ КОНТЕКСТНОЕ МЕНЮ ============ */
.context-menu {
    position: fixed;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.3);
    z-index: 1000;
    min-width: 200px;
    overflow: hidden;
}

.context-item {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.context-item:hover {
    background: #f0f0ff;
}

.context-item:first-child {
    border-bottom: 1px solid #eee;
}

/* ============ МОДАЛЬНОЕ ОКНО ============ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    font-size: 28px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 20px;
}

.modal-body label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.modal-body textarea {
    resize: vertical;
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: #667eea;
}

.save-btn {
    width: 100%;
    margin-top: 20px;
    padding: 12px;
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 600;
}

.save-btn:hover {
    background: #38a169;
}

/* ============ СЕКЦИЯ УЧЕНИКОВ ============ */
.students-section {
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 14px;
}

/* ============ НАВИГАЦИЯ МЕЖДУ СТРАНИЦАМИ ============ */
.nav-link {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
}

.nav-link:hover {
    background: #5a67d8;
}

/* ============ КАРТОЧКИ-СЕКЦИИ ============ */
.section-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #eee;
}

.section-card h3 {
    margin-bottom: 5px;
    color: #333;
}

/* ============ МАЛЕНЬКИЕ КНОПКИ ============ */
.btn-sm {
    padding: 6px 14px;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-sm.green { background: #48bb78; }
.btn-sm.green:hover { background: #38a169; }
.btn-sm.blue { background: #667eea; }
.btn-sm.blue:hover { background: #5a67d8; }
.btn-sm.gray { background: #a0aec0; }
.btn-sm.gray:hover { background: #718096; }
.btn-sm.red { background: #fc8181; }
.btn-sm.red:hover { background: #f56565; }

/* ============ КАРТОЧКА УЧЕНИКА ============ */
.student-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.student-card:hover {
    background: #e8f0fe;
}

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

.student-name {
    font-weight: 600;
    font-size: 16px;
}

.student-subject {
    color: #666;
    font-size: 14px;
    background: #e2e8f0;
    padding: 3px 10px;
    border-radius: 20px;
}

.student-actions {
    display: flex;
    gap: 8px;
}

.student-edit {
    display: flex;
    gap: 8px;
    flex: 1;
}

/* ============ КАРТОЧКА ОТЧЁТА ============ */
.report-card {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.report-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.report-student {
    font-weight: 700;
    color: #667eea;
}

.report-date {
    color: #999;
}

.report-topic {
    font-weight: 600;
    margin-bottom: 5px;
}

.report-body {
    font-size: 14px;
    color: #555;
}

.report-grade {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    margin-top: 8px;
}

.grade-5 { background: #c6f6d5; color: #22543d; }
.grade-4 { background: #bee3f8; color: #2a4365; }
.grade-3 { background: #fefcbf; color: #744210; }
.grade-2 { background: #fed7d7; color: #822727; }

/* ============ КАРТОЧКА УЧЕНИКА (student.html) ============ */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
    flex-wrap: wrap;
    gap: 15px;
}

.card-header h1 {
    font-size: 1.8em;
    color: #333;
    margin: 0;
}

.card-header-info {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.track-badge {
    display: inline-block;
    padding: 5px 14px;
    background: #667eea;
    color: white;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
}

.card-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}

@media (max-width: 968px) {
    .card-layout { grid-template-columns: 1fr; }
}

.tasks-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.tasks-table th {
    background: #667eea;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.tasks-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.tasks-table tr:last-child td { border-bottom: none; }
.tasks-table tr:hover { background: #f8f9fa; }

.tasks-table select {
    width: 100%;
    padding: 6px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    background: white;
}

.tasks-table select:focus {
    outline: none;
    border-color: #667eea;
}

.task-comment {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    overflow: hidden;
    line-height: 1.4;
}

.task-comment:focus {
    outline: none;
    border-color: #667eea;
}

.slice-card {
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #ed8936;
}

.slice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.slice-date {
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

.slice-result {
    font-weight: 700;
    color: #ed8936;
    font-size: 15px;
    flex: 1;
    text-align: right;
}

.slice-comment {
    font-size: 13px;
    color: #555;
    white-space: pre-wrap;
    margin-top: 4px;
}

.general-message {
    padding: 30px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 10px;
    color: #666;
    font-size: 15px;
}