/* ============================================
   admin.css — Стили для админ-панели
   ============================================ */

/* ---------- Шапка ---------- */
.admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.admin-header h1 {
    font-size: 24px;
}
.admin-header .user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}
.admin-header .user-info span {
    opacity: 0.9;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
    text-decoration: none;
}
.btn-logout:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ---------- Контейнер ---------- */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ---------- Тулбар ---------- */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}
.toolbar .left {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.toolbar .right {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- Список уроков (карточки) ---------- */
.lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.lesson-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid #667eea;
    position: relative;
    cursor: grab;
}
.lesson-card:active {
    cursor: grabbing;
}
.lesson-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}
.lesson-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

/* Новая структура заголовка карточки */
.lesson-card .lesson-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}
.lesson-card .lesson-card-header .title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}
.lesson-card .lesson-card-header .sentence-count {
    flex-shrink: 0;
    background: #e8eaf6;
    color: #5c6bc0;
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.lesson-card .meta {
    color: #888;
    font-size: 13px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.lesson-card .meta .level {
    background: #e8eaf6;
    padding: 2px 10px;
    border-radius: 12px;
    color: #5c6bc0;
}
.lesson-card .description {
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.lesson-card .actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 12px;
}

/* ---------- Редактор урока ---------- */
.editor-panel {
    display: none;
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}
.editor-panel.active {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.editor-panel .editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.editor-panel .editor-header h2 {
    color: #333;
}

/* ---------- Список предложений ---------- */
.sentences-section {
    margin-top: 30px;
    border-top: 2px solid #f0f0f0;
    padding-top: 20px;
}
.sentences-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.sentences-list {
    list-style: none;
    padding: 0;
}
.sentences-list .sentence-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: grab;
    transition: all 0.2s;
}
.sentences-list .sentence-item:hover {
    border-color: #667eea;
    background: #f5f7ff;
}
.sentences-list .sentence-item.dragging {
    opacity: 0.5;
    border-color: #667eea;
}
.sentences-list .sentence-item .drag-handle {
    color: #aaa;
    cursor: grab;
    font-size: 20px;
    user-select: none;
}
.sentences-list .sentence-item .sentence-number {
    background: #e9ecef;
    color: #666;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.sentences-list .sentence-item .sentence-content {
    flex: 1;
    min-width: 0;
}
.sentences-list .sentence-item .sentence-content .hanzi {
    font-size: 18px;
    font-weight: 500;
    color: #333;
}
.sentences-list .sentence-item .sentence-content .pinyin {
    font-size: 13px;
    color: #888;
}
.sentences-list .sentence-item .sentence-content .translation {
    font-size: 14px;
    color: #666;
}
.sentences-list .sentence-item .sentence-audio {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.sentences-list .sentence-item .sentence-audio .audio-status {
    font-size: 12px;
    color: #888;
}
.sentences-list .sentence-item .sentence-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

/* ---------- Аудио статус в модалке ---------- */
.sentence-audio-status {
    margin-top: 10px;
    font-size: 14px;
}
.sentence-audio-status audio {
    width: 100%;
    max-width: 200px;
    margin-top: 5px;
}

/* ---------- Адаптивность ---------- */
@media (max-width: 768px) {
    .admin-header {
        padding: 15px;
    }
    .admin-header h1 {
        font-size: 18px;
    }
    .admin-container {
        padding: 10px;
    }
    .lessons-grid {
        grid-template-columns: 1fr;
    }
    .editor-panel {
        padding: 20px;
    }
    .sentence-item {
        flex-wrap: wrap;
    }
    .sentence-item .sentence-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .admin-header {
        padding: 10px;
    }
    .admin-header h1 {
        font-size: 15px;
    }
    .btn-logout {
        padding: 5px 12px;
        font-size: 12px;
    }
}