/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #5181b8;
    --secondary-color: #f5f5f5;
    --accent-color: #ff6b6b;
    --success-color: #4caf50;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #ddd;
    --diary-bg: #f9f3e8;
    --diary-line: #d4c5a9;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--diary-bg);
    color: var(--text-dark);
    overflow-x: hidden;
}

/* Loader */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--diary-bg);
    z-index: 9999;
}

.spinner {
    border: 4px solid var(--secondary-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, #5181b8, #4a76a8);
    color: white;
    padding: 15px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 5px;
}

.user-info {
    font-size: 14px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-badge {
    background: rgba(255,255,255,0.3);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* Content Area */
.content-area {
    padding: 20px;
    padding-bottom: 80px;
    min-height: calc(100vh - 140px);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    z-index: 100;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 12px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 60px;
}

.nav-btn .icon {
    font-size: 24px;
}

.nav-btn.active {
    color: var(--primary-color);
}

.nav-btn:active {
    transform: scale(0.95);
}

/* Diary Page Styles */
.diary-page-container {
    max-width: 800px;
    margin: 0 auto;
}

.diary-page {
    background: white;
    border: 2px solid var(--diary-line);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    min-height: 400px;
}

.diary-page::before {
    content: '';
    position: absolute;
    left: 50px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--diary-line);
}

.page-header {
    margin-bottom: 30px;
    padding-left: 20px;
}

.diary-page h2 {
    color: var(--primary-color);
    font-size: 24px;
    margin-bottom: 10px;
}

.page-number {
    color: var(--text-light);
    font-size: 14px;
    font-style: italic;
}

.diary-navigation {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    margin-top: 20px;
}

.btn-nav {
    flex: 1;
    max-width: 250px;
}

.task-list {
    list-style: none;
    padding-left: 20px;
}

.task-item {
    padding: 12px;
    margin: 8px 0;
    background: var(--secondary-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.task-item:hover {
    background: #e8e8e8;
    transform: translateX(5px);
}

.task-status {
    font-size: 20px;
}

/* Task Detail View */
.task-detail {
    background: white;
    border: 2px solid var(--diary-line);
    border-radius: 8px;
    padding: 20px;
}

.task-detail h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.task-detail p {
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.6;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 15px;
}

.status-badge.in-review {
    background: #fff3cd;
    color: #856404;
}

.status-badge.graded {
    background: #d4edda;
    color: #155724;
}

.status-badge.not-started {
    background: #f8d7da;
    color: #721c24;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 120px;
}

.form-group input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn:hover {
    background: #4a76a8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-success {
    background: var(--success-color);
}

.btn-danger {
    background: var(--accent-color);
}

.btn-secondary {
    background: var(--text-light);
    margin-top: 10px;
}

/* Gradebook Table */
.gradebook-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.gradebook-table table {
    width: 100%;
    border-collapse: collapse;
}

.gradebook-table th {
    background: var(--primary-color);
    color: white;
    padding: 12px;
    text-align: left;
    font-size: 14px;
}

.gradebook-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

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

.grade-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
}

.grade-badge.grade-5 {
    background: #d4edda;
    color: #155724;
}

.grade-badge.grade-4 {
    background: #d1ecf1;
    color: #0c5460;
}

.grade-badge.grade-3 {
    background: #fff3cd;
    color: #856404;
}

.grade-badge.grade-2,
.grade-badge.grade-1 {
    background: #f8d7da;
    color: #721c24;
}

.pass-badge {
    font-size: 20px;
}

/* Profile Cards */
.profile-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.profile-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 16px;
}

.submission-card {
    background: var(--secondary-color);
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.submission-card:hover {
    background: #e8e8e8;
    transform: translateX(5px);
}

.submission-card h4 {
    color: var(--text-dark);
    margin-bottom: 5px;
    font-size: 14px;
}

.submission-card p {
    color: var(--text-light);
    font-size: 12px;
}

/* Moderation Queue */
.queue-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.queue-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.queue-item h4 {
    color: var(--primary-color);
    font-size: 14px;
}

.queue-item .student-name {
    color: var(--text-light);
    font-size: 13px;
}

.queue-item .submission-text {
    margin: 10px 0;
    padding: 10px;
    background: var(--secondary-color);
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.5;
}

.photo-preview {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.photo-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
}

.grade-form {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.grade-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.grade-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.grade-btn.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pass-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.pass-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.pass-btn.selected.pass {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.pass-btn.selected.fail {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Admin Panel */
.admin-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.admin-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 16px;
}

.admin-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--secondary-color);
    border-radius: 6px;
    margin-bottom: 8px;
}

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

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    width: auto;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 10px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    color: var(--primary-color);
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

/* Responsive */
@media (max-width: 480px) {
    .content-area {
        padding: 15px;
    }

    .diary-page {
        padding: 15px;
    }

    .nav-btn {
        font-size: 10px;
        padding: 6px 8px;
        min-width: 50px;
    }

    .nav-btn .icon {
        font-size: 20px;
    }
}
