/* static/style.css */

/* Основные стили */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    padding: 30px;
    margin-top: 30px;
}

/* Навигация */
.navbar {
    background-color: #007bff;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 30px;
}

.navbar a {
    color: white;
    text-decoration: none;
    margin-right: 20px;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.navbar a:hover {
    background-color: rgba(255,255,255,0.2);
}

/* Формы */
.alert {
    border-radius: 5px;
    margin-bottom: 20px;
}

.btn {
    border-radius: 5px;
    padding: 10px 20px;
}

.form-control {
    border-radius: 5px;
    padding: 10px;
    border: 1px solid #ddd;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.text-center {
    text-align: center;
}

.text-danger {
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 5px;
}

/* Стили для EasyMDE_editor */
.CodeMirror {
    border: 1px solid #ddd;
    border-radius: 5px;
    min-height: 400px !important; /* Минимальная высота */
}

.CodeMirror-scroll {
    min-height: 400px !important;
}

.editor-toolbar {
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
}

/* Широкий редактор */
.editor-container {
    width: 100%;
    max-width: 100%;
}

.editor-preview {
    min-height: 400px;
    padding: 15px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 0 0 5px 5px;
}

/* Карточки постов */
.card {
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.card-title a {
    color: #007bff;
    text-decoration: none;
}

.card-title a:hover {
    text-decoration: underline;
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        margin: 10px;
    }

    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .navbar a {
        margin-bottom: 5px;
    }
}

/* Стили для чата */
.chat-messages {
    height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
    background-color: #f8f9fa;
}

.chat-message {
    margin-bottom: 10px;
    padding: 8px;
    border-radius: 5px;
    background-color: white;
}

.chat-input {
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
}

/* Стили для таблиц и списков */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f2f2f2;
}

/* Анимации */
.fade-in {
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Уведомления */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #4CAF50;
    color: white;
    padding: 15px;
    border-radius: 5px;
    display: none;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Для мобильных устройств */
@media (max-width: 768px) {
    .CodeMirror {
        min-height: 300px !important;
        font-size: 14px;
    }

    .editor-toolbar {
        flex-wrap: wrap;
    }

    .editor-toolbar button {
        padding: 5px;
        font-size: 12px;
    }

    .form-control-lg {
        font-size: 16px; /* Предотвращает zoom на iOS */
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .CodeMirror {
        min-height: 250px !important;
    }

    .container {
        padding: 10px;
    }
}

/* Добавьте в static/style.css */

/* Стили для превью постов */
.post-preview {
    line-height: 1.6;
    color: #333;
}

.post-preview h1, .post-preview h2, .post-preview h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.post-preview h1 {
    font-size: 1.5rem;
}

.post-preview h2 {
    font-size: 1.3rem;
}

.post-preview h3 {
    font-size: 1.1rem;
}

.post-preview p {
    margin-bottom: 1rem;
}

.post-preview ul, .post-preview ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.post-preview li {
    margin-bottom: 0.25rem;
}

.post-preview strong {
    color: #2c3e50;
}

.post-preview em {
    color: #7f8c8d;
}

.post-preview code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

.post-preview pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.25rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.post-preview blockquote {
    border-left: 4px solid #007bff;
    padding-left: 1rem;
    margin-left: 0;
    color: #6c757d;
    font-style: italic;
}

/* Ограничение высоты превью */
.post-preview {
    max-height: 300px;
    overflow: hidden;
    position: relative;
}

/* Пагинация */
.pagination {
    margin-top: 2rem;
}

.pagination .page-item.active .page-link {
    background-color: #007bff;
    border-color: #007bff;
}

.pagination .page-link {
    color: #007bff;
}

.pagination .page-link:hover {
    background-color: #e9ecef;
}

/* Таблицы */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

table th, table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* Код */
code {
    background-color: #f4f4f4;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

pre {
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    overflow-x: auto;
    margin: 1rem 0;
}

pre code {
    background-color: transparent;
    padding: 0;
}

/* Зачеркнутый текст */
.s {
    text-decoration: line-through;
}

/* Выделенный текст */
.mark {
    background-color: #ffeb3b;
    padding: 2px 4px;
}

/* Цитаты */
blockquote {
    border-left: 4px solid #007bff;
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    background-color: #f8f9fa;
    color: #6c757d;
}

/* Списки задач */
.task-list-item {
    list-style-type: none;
}

.task-list-item input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Эмодзи */
.emojione {
    height: 1.2em;
    width: 1.2em;
    vertical-align: middle;
}

/* Исправление стилей для dropdown меню */
.dropdown-menu {
    background-color: #ffffff !important; /* Белый фон */
    border: 1px solid rgba(0,0,0,.15);
    border-radius: .375rem;
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.175);
}

.dropdown-item {
    color: #212529 !important; /* Темный текст */
    padding: .5rem 1rem;
}

.dropdown-item:hover {
    background-color: #f8f9fa !important; /* Светло-серый при наведении */
    color: #1e1e1e !important;
}

.dropdown-item:focus {
    background-color: #e9ecef !important;
    color: #1e1e1e !important;
}

.dropdown-divider {
    border-top: 1px solid rgba(0,0,0,.15);
}

/* Для темной темы (если используется) */
[data-bs-theme="dark"] .dropdown-menu {
    background-color: #343a40 !important;
    border-color: rgba(255,255,255,.15);
}

[data-bs-theme="dark"] .dropdown-item {
    color: #ffffff !important;
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: #495057 !important;
    color: #ffffff !important;
}
