* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: #f0f2f5; }

nav { background: #1a1a2e; padding: 16px 24px; }
nav a { color: white; text-decoration: none; margin-right: 16px; }
nav span { color: #ccc; }

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

table { width: 100%; border-collapse: collapse; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #eee; }
th { background: #f8f9fa; }

.btn { padding: 8px 20px; background: #1a1a2e; color: white; border: none; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-block; margin: 8px 0; font-size: 14px; }
.btn-primary { background: #1a1a2e; color: white; }
.btn:hover { opacity: 0.85; }

button { padding: 6px 14px; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; margin: 2px; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 6px 10px; font-size: 14px; border: none; border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-success { background: #28a745; color: white; }
.btn-warning { background: #ffc107; color: black; }
.btn-danger { background: #dc3545; color: white; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: #1a1a2e; box-shadow: 0 0 0 3px rgba(26,26,46,0.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.section { font-size: 16px; font-weight: 700; color: #1a1a2e; margin: 24px 0 12px; padding-bottom: 8px; border-bottom: 2px solid #1a1a2e; }

.genre-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.genre-tag { padding: 6px 14px; border: 2px solid #ddd; border-radius: 20px; cursor: pointer; font-size: 13px; user-select: none; transition: all 0.2s; }
.genre-tag:hover { border-color: #1a1a2e; }
.genre-tag:has(input:checked) { background: #1a1a2e; color: white; border-color: #1a1a2e; }
.genre-tag input { display: none; }

.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; }
.login-box { background: white; padding: 32px; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.1); width: 400px; }
.login-box h2 { text-align: center; margin-bottom: 24px; }
.login-box button { width: 100%; padding: 12px; font-size: 16px; margin-top: 12px; background: #1a1a2e; color: white; border-radius: 8px; border: none; cursor: pointer; }

.error { color: #dc3545; text-align: center; margin-top: 8px; }

.modal { display: flex; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: white; padding: 24px; border-radius: 12px; width: 500px; max-width: 90%; }
.modal-content h3 { margin-bottom: 16px; }
.modal-content .btn { margin-top: 8px; }

.actions { display: flex; gap: 8px; align-items: center; }
.empty-state { text-align: center; color: #999; padding: 32px; }

/* ==================== СТИЛИ ГЛАВ ==================== */
.chapter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: grab;
    transition: opacity 0.2s, background 0.2s;
}
.chapter-item:active { cursor: grabbing; }
.chapter-item.dragging { opacity: 0.5; background: #e9ecef; }
.chapter-item.drag-over { border-top: 3px solid #1a1a2e; }

.drag-handle { color: #999; font-size: 18px; cursor: grab; user-select: none; flex-shrink: 0; }
.drag-handle:active { cursor: grabbing; }

.chapter-num {
    background: #1a1a2e;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.chapter-title-input {
    flex: 1;
    min-width: 200px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: text;
}
.chapter-title-input:focus {
    outline: none;
    border-color: #1a1a2e;
}

.chapter-duration {
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
    white-space: nowrap;
}