/* Минималистичные стили для приложения совместного редактирования */

/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Заголовок */
.header {
    text-align: center;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #2c3e50;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.save-status {
    font-size: 0.9rem;
    color: #666;
}

.history-section {
    position: relative;
}

/* Кнопки */
.history-btn, .save-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.history-btn:hover, .save-btn:hover {
    background: #2980b9;
}

.save-btn {
    font-size: 16px;
    padding: 12px 30px;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-left: 10px;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Основной контент */
.main-content {
    background: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.editor-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.text-panel {
    display: flex;
    flex-direction: column;
}

.panel-header {
    margin-bottom: 10px;
}

.panel-header h2 {
    font-size: 1.2rem;
    color: #2c3e50;
    font-weight: 600;
}

/* Текстовые поля */
.text-editor {
    width: 100%;
    min-height: 400px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.3s;
}

.text-editor:focus {
    outline: none;
    border-color: #3498db;
}

.text-editor::placeholder {
    color: #aaa;
    font-style: italic;
}

/* Секция действий */
.action-section {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.info-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

.info-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.info-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Выпадающий список истории */
.history-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 600px;
    max-height: 500px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
}

.history-dropdown.hidden {
    display: none;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.history-header h3 {
    font-size: 1rem;
    color: #2c3e50;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #333;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px 0;
}

.history-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: background-color 0.2s;
}

.history-item:hover {
    background: #f8f9fa;
}

.history-item:last-child {
    border-bottom: none;
}

.history-content {
    flex: 1;
}

.history-meta {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 8px;
}

.history-panel {
    font-weight: 600;
    color: #3498db;
}

.history-text {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.history-delete {
    margin-left: 15px;
}

.delete-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
}

.delete-btn:hover {
    background: #c0392b;
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.modal-content p {
    margin-bottom: 20px;
    color: #666;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Индикатор загрузки */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .editor-section {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .status-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .history-dropdown {
        width: 90%;
        right: 5%;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .text-editor {
        min-height: 300px;
    }
}