/* Стили для редактора литературы */
.literature-editor-container {
    display: flex;
    gap: 15px;
    height: calc(100vh - 200px);
    min-height: 600px;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
}

#literaturePage {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 10px !important;
    box-sizing: border-box;
}

.literature-pages-panel {
    width: 220px;
    min-width: 220px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    overflow-y: auto;
    flex-shrink: 0;
}

.literature-pages-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #4a90e2;
}

.literature-pages-header > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.literature-pages-header h3 {
    margin: 0;
    color: #4a90e2;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.literature-pages-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.literature-page-item {
    padding: 10px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 0;
    margin-bottom: 8px;
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
}

.literature-page-item:hover {
    background: #e8f0fe;
    border-color: #4a90e2;
}

.literature-page-item.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.literature-page-item.folder {
    background: #fff3cd;
    border-color: #ffc107;
}

.literature-page-item.folder:hover {
    background: #ffe69c;
}

.literature-page-item.child {
    margin-left: 30px;
    border-left: 3px solid #4a90e2;
    padding-left: 15px;
}

.literature-page-item.folder-child {
    margin-left: 30px;
    border-left: 3px solid #ffc107;
    padding-left: 15px;
}

.literature-page-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    width: 100%;
    box-sizing: border-box;
}

.literature-page-item-actions button {
    padding: 5px 10px;
    font-size: 11px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    flex: 0 0 auto;
    min-width: fit-content;
    font-weight: 500;
    transition: all 0.2s;
}

.literature-page-item-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.literature-editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    min-width: 0;
    width: 100%;
}

.literature-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
    box-sizing: border-box;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 5px;
    padding-right: 15px;
    border-right: 1px solid #e0e0e0;
}

.toolbar-group:last-child {
    border-right: none;
}

.toolbar-select {
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    background: white;
    min-width: 100px;
}

.toolbar-btn {
    padding: 6px 10px;
    border: 1px solid #ccc;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn:hover {
    background: #e8f0fe;
    border-color: #4a90e2;
}

.toolbar-btn:active {
    background: #4a90e2;
    color: white;
}

.literature-editor-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.literature-editor-area {
    flex: 1;
    padding: 30px 50px;
    overflow-y: auto;
    min-height: 400px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    outline: none;
    width: 100%;
    max-width: 100%;
    color: #333;
}

.literature-editor-area h1 {
    font-size: 28px;
    line-height: 1.3;
    margin: 20px 0 15px 0;
    color: #2c3e50;
    font-weight: 600;
}

.literature-editor-area h2 {
    font-size: 24px;
    line-height: 1.3;
    margin: 18px 0 12px 0;
    color: #34495e;
    font-weight: 600;
}

.literature-editor-area h3 {
    font-size: 20px;
    line-height: 1.3;
    margin: 15px 0 10px 0;
    color: #34495e;
    font-weight: 600;
}

.literature-editor-area p {
    margin: 12px 0;
    line-height: 1.7;
}

/* Стили для спойлеров */
.literature-spoiler {
    margin: 20px 0;
    border: 1px solid #d0d0d0;
    border-radius: 10px;
    background: #f8f9fa;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.literature-spoiler:hover {
    border-color: #4a90e2;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.15);
    transform: translateY(-1px);
}

.literature-spoiler-title {
    padding: 14px 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: all 0.2s ease;
    list-style: none;
    position: relative;
}

.literature-spoiler-title > span {
    flex: 1;
}

.literature-spoiler-delete {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 20px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.literature-spoiler-delete:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.literature-spoiler-delete:active {
    background: rgba(220, 53, 69, 0.8);
}

.literature-spoiler-title::-webkit-details-marker {
    display: none;
}

.literature-spoiler-title::marker {
    display: none;
}

.literature-spoiler-title:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
}

.literature-spoiler[open] .literature-spoiler-title {
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.literature-spoiler-title::before {
    content: '▶';
    display: inline-block;
    transition: transform 0.3s ease;
    font-size: 11px;
    margin-right: 8px;
    opacity: 0.9;
}

.literature-spoiler[open] .literature-spoiler-title::before {
    transform: rotate(90deg);
}

.literature-spoiler-content {
    padding: 18px 22px;
    background: white;
    color: #333;
    line-height: 1.7;
    font-size: 15px;
    animation: fadeIn 0.3s ease;
}

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

.literature-spoiler-content p {
    margin: 12px 0;
}

.literature-spoiler-content p:first-child {
    margin-top: 0;
}

.literature-spoiler-content p:last-child {
    margin-bottom: 0;
}

.literature-spoiler-content h1,
.literature-spoiler-content h2,
.literature-spoiler-content h3 {
    margin-top: 15px;
    margin-bottom: 10px;
}

.literature-spoiler-content h1:first-child,
.literature-spoiler-content h2:first-child,
.literature-spoiler-content h3:first-child {
    margin-top: 0;
}

.literature-editor-area:focus {
    outline: none;
}

.literature-navigation {
    width: 200px;
    min-width: 200px;
    background: #f8f9fa;
    border-left: 1px solid #e0e0e0;
    padding: 10px;
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.literature-navigation h4 {
    margin: 0 0 8px 0;
    color: #4a90e2;
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
}

.literature-navigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    min-height: 0;
}

.literature-navigation li {
    margin-bottom: 2px;
    font-size: 13px;
    line-height: 1.3;
    padding: 0;
}

.literature-navigation a {
    color: #555;
    text-decoration: none;
    transition: all 0.2s;
    display: block;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 0;
    line-height: 1.3;
}

.literature-navigation a:hover {
    color: #4a90e2;
    background: #e8f0fe;
}

.literature-navigation a.active {
    color: #4a90e2;
    background: #e8f0fe;
    font-weight: 600;
}

.literature-navigation a.h1-link {
    font-weight: 600;
    color: #2c3e50;
    border-left: 3px solid #4a90e2;
    padding-left: 12px;
}

.literature-navigation a.h2-link {
    font-weight: 500;
    color: #34495e;
    border-left: 2px solid #667eea;
    padding-left: 12px;
}

.literature-navigation a.h3-link {
    font-weight: 400;
    color: #555;
    border-left: 1px solid #999;
    padding-left: 12px;
}

.literature-navigation a {
    display: block;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.2s;
    font-size: 14px;
}

.literature-navigation a:hover {
    background: #e8f0fe;
    border-left-color: #4a90e2;
}

.literature-navigation a.active {
    background: #e8f0fe;
    border-left-color: #4a90e2;
    color: #4a90e2;
    font-weight: 600;
}

.literature-navigation a.h1-link {
    font-weight: 600;
    padding-left: 12px;
}

.literature-navigation a.h2-link {
    padding-left: 24px;
    font-size: 13px;
}

.literature-navigation a.h3-link {
    padding-left: 36px;
    font-size: 12px;
}

/* Модальное окно создания страницы */
.literature-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.literature-modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

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

.literature-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
}

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

.literature-form-group {
    margin-bottom: 15px;
}

.literature-form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.literature-form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.literature-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}
