/* ===== BASE STYLES ===== */
.forum-main {
    background-color: #f5f5f8;
    padding: 40px 0;
    font-family: "Comfortaa", sans-serif;
    min-height: calc(100vh - 300px); /* Вычитаем примерную высоту хедера и футера */
    display: flex;
    flex-direction: column;
}

.forum-container {
    max-width: 1396px;
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
    flex: 1;
}

/* ===== HEADER STYLES ===== */
.forum-header {
    margin-bottom: 30px;
    text-align: center;
}

.forum-header h1 {
    font-size: 32px;
    color: #1D98A1;
    margin-bottom: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.forum-header p {
    font-size: 18px;
    color: #676770;
    line-height: 1.5;
}

/* ===== BREADCRUMBS ===== */
.forum-breadcrumbs {
    margin-bottom: 20px;
    font-size: 14px;
}

.forum-breadcrumbs a {
    color: #1D98A1;
    text-decoration: none;
    transition: color 0.3s;
}

.forum-breadcrumbs a:hover {
    color: #16858e;
    text-decoration: underline;
}

.forum-breadcrumbs span {
    color: #8E8E9C;
}

/* ===== CATEGORY LIST ===== */
.forum-categories {
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.forum-category {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e3e3e3;
}

.forum-category:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.forum-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.forum-category-header h2 {
    font-size: 24px;
    color: #1D98A1;
    margin: 0;
}

.forum-category-header h2 a {
    color: inherit;
    text-decoration: none;
}

.forum-category-header h2 a:hover {
    text-decoration: underline;
}

.forum-topics-count {
    background-color: #1D98A1;
    color: white;
    padding: 5px 15px;
    border-radius: 0px;
    font-size: 14px;
    font-weight: 700;
}

/* ===== TOPIC STYLES ===== */
.forum-last-topic,
.forum-topic {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 0px;
    transition: background-color 0.3s;
    margin-bottom: 15px;
    margin-top: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.forum-last-topic:hover,
.forum-topic:hover {
    background-color: #f0f0f0;
}

.forum-topic-avatar,
.forum-author-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: transparent;
    margin-right: 15px;
    flex-shrink: 0;
    position: relative;
}

.forum-topic-avatar img,
.forum-author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.forum-topic-info,
.forum-message-content {
    flex-grow: 1;
}

.forum-topic-info h3,
.forum-message-content h3 {
    font-size: 18px;
    margin: 0 0 5px 0;
}

.forum-topic-info h3 a {
    color: #333;
    text-decoration: none;
}

.forum-topic-info h3 a:hover {
    color: #1D98A1;
}

.forum-topic-info p,
.forum-topic-meta {
    padding-top: 8px;
    font-size: 14px;
    color: #777;
    margin: 0;
    margin-bottom: 5px;
}

.forum-topic-stats {
    margin-left: auto;
    text-align: right;
    font-size: 14px;
    min-width: 120px;
}

.forum-topic-stats span {
    display: block;
    margin-bottom: 5px;
}

.forum-last-reply {
    font-size: 13px;
    color: #8E8E9C;
}

/* ===== MESSAGE STYLES ===== */
.forum-message {
    display: flex;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
}

.forum-message:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.forum-message-author {
    width: 200px;
    padding-right: 20px;
    flex-shrink: 0;
}

.forum-author-info h3 {
    font-size: 18px;
    margin-bottom: 5px;
    color: #1D98A1;
}

.forum-author-info p {
    font-size: 14px;
    color: #777;
    margin: 0;
}

.forum-join-date {
    font-size: 12px !important;
    color: #aaa !important;
    margin-top: 5px !important;
}

.forum-message-content {
    flex-grow: 1;
    background-color: #fff;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #e3e3e3;
    min-width: 0;
    max-width: 1166px;
    width: 100%;
}

.forum-message-meta {
    font-size: 14px;
    color: #777;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

.forum-message-text {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all;
}

.forum-reply-to {
    color: #1D98A1;
    text-decoration: none;
    cursor: pointer;
}

.forum-reply-to:hover {
    text-decoration: underline;
}

.forum-delete-reply {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    margin-left: 10px;
}

.forum-delete-reply:hover {
    text-decoration: underline;
}

/* Стили для цитат */
.forum-quote-preview {
    background-color: #f8f9fa;
    border-left: 4px solid #1D98A1;
    padding: 15px;
    margin-bottom: 15px;
    position: relative;
    border-radius: 4px;
}

.forum-quote-header {
    color: #666;
    font-size: 14px;
    margin-bottom: 8px;
}

.forum-quote-text {
    color: #333;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.forum-quote-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.forum-quote-remove:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #666;
}

/* Модальное окно */
.forum-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(1px);
}

.forum-modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 0px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    width: 90%;
    text-align: center;
}

.forum-modal-content h3 {
    color: #333;
    font-size: 24px;
    margin-bottom: 15px;
    font-weight: 600;
}

.forum-modal-content p {
    color: #666;
    font-size: 16px;
    margin-bottom: 25px;
}

.forum-modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.forum-modal-button {
    padding: 10px 25px;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.forum-modal-button-delete {
    background-color: #1D98A1;
    color: white;
    border: none;
}

.forum-modal-button-delete:hover {
    background-color: #167a82;
}

.forum-modal-button-cancel {
    background-color: #f1f1f1;
    color: #333;
    border: 1px solid #ddd;
}

.forum-modal-button-cancel:hover {
    background-color: #e5e5e5;
}

/* ===== FORM STYLES ===== */
.forum-reply-form,
.forum-new-topic-form {
    background-color: white;
    padding: 30px;
    border-radius: 0px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-top: 30px;
}

.forum-reply-form h2,
.forum-new-topic-form h2 {
    font-size: 24px;
    color: #1D98A1;
    margin-bottom: 20px;
}

.forum-form-group {
    margin-bottom: 20px;
}

.forum-form-group label {
    display: block;
    font-size: 16px;
    color: #333;
    margin-bottom: 8px;
    font-weight: 500;
}

.forum-form-group input[type="text"],
.forum-form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #e3e3e3;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.forum-form-group input[type="text"]:focus,
.forum-form-group select:focus {
    border-color: #1D98A1;
    outline: none;
}

.forum-form-group textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    background-color: #ffffff;
    border-radius: 5px;
    border: 0.5px solid #868686;
    font-size: 16px;
    resize: vertical;
    transition: all 0.3s ease;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-all;
}

.forum-form-group textarea:focus {
    outline: none;
    border-color: #1d97a0;
    box-shadow: 0 0 0 2px rgba(29, 151, 160, 0.1);
}

.forum-form-group textarea.is-invalid {
    border-color: #dc3545 !important;
}

.forum-form-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.forum-char-counter {
    font-size: 14px;
    color: #777;
    margin-left: auto;
    transition: color 0.3s ease;
}

.forum-char-counter.error {
    color: #dc3545;
    font-weight: 500;
}

.forum-error-message {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    display: block;
}

.forum-btn {
    display: inline-block;
    padding: 10px 20px;
    background-color: #1D98A1;
    color: #fff !important;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    transform-origin: center;
}

.forum-btn:hover {
    background-color: #16858e;
    color: #fff !important;
}

.forum-btn-secondary {
    background-color: #f5f5f8;
    color: #1D98A1 !important;
}

.forum-btn-secondary:hover {
    background-color: #e5e5e8;
    color: #1D98A1 !important;
    transform: scale(1.01);
}

.forum-outlined-button {
    padding: 12px 24px;
    background-color: transparent;
    color: #1D98A1;
    border: 2px solid #1D98A1;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.forum-outlined-button:hover {
    background-color: #1D98A1;
    color: white;
}

/* ===== TAGS ===== */
.forum-tag {
    display: inline-block;
    padding: 4px 12px;
    background-color: #f5f5f8;
    color: #1D98A1;
    border: 1px solid #e3e3e3;
    border-radius: 20px;
    font-size: 14px;
    margin-right: 8px;
    margin-bottom: 8px;
}

/* ===== PAGINATION ===== */
.forum-pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 30px;
}

.forum-pagination a,
.forum-pagination span {
    padding: 8px 16px;
    border: 1px solid #e3e3e3;
    border-radius: 5px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
}

.forum-pagination a:hover:not(.active) {
    background-color: #f5f5f8;
}

.forum-pagination .active {
    background-color: #1D98A1;
    color: white;
    border-color: #1D98A1;
}

.forum-pagination .disabled {
    color: #ccc;
    cursor: not-allowed;
}

/* ===== EMPTY STATE ===== */
.forum-empty-topics,
.forum-empty-category {
    text-align: center;
    padding: 40px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.forum-empty-topics p,
.forum-empty-category p {
    font-size: 18px;
    color: #676770;
    margin-bottom: 20px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .forum-last-topic,
    .forum-topic {
        flex-direction: column;
        text-align: center;
    }

    .forum-topic-stats {
        margin: 10px 0 0 0;
        text-align: center;
    }

    .forum-message-author {
        width: 100%;
        padding-right: 0;
        margin-bottom: 15px;
        text-align: center;
    }

    .forum-header h1 {
        font-size: 24px;
    }

    .forum-category-header {
        flex-direction: column;
        gap: 10px;
    }

    .forum-topics-count {
        align-self: flex-start;
    }
}

/* ===== SEARCH RESULTS ===== */
.search-results {
    padding: 40px 0;
    background-color: #fff;
}

.search-results-title {
    font-size: 24px;
    color: #1D98A1;
    margin-bottom: 30px;
    text-align: center;
}

.search-topics,
.search-categories {
    margin-bottom: 40px;
}

.search-topics h3,
.search-categories h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f5f5f8;
}

.search-no-results {
    text-align: center;
    padding: 40px 0;
    color: #666;
    font-size: 18px;
}

.search-categories .forum-category {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.search-categories .forum-category h4 {
    font-size: 18px;
    margin: 0 0 10px 0;
}

.search-categories .forum-category h4 a {
    color: #1D98A1;
    text-decoration: none;
}

.search-categories .forum-category h4 a:hover {
    text-decoration: underline;
}

.search-categories .forum-category p {
    color: #666;
    margin: 0 0 10px 0;
}

.search-categories .forum-category-meta {
    font-size: 14px;
    color: #888;
}

.forum-author-info h3 {
    font-size: 18px;
    margin-bottom: 5px;
    color: #1D98A1;
    /* Удалены display: inline-flex; align-items: center; отсюда, так как они будут на .user-name-display */
}

.forum-author-info p {
    font-size: 14px;
    color: #777;
    margin: 0;
}

.forum-admin-star {
    color: #fbbd13; /* Золотой цвет для звездочки */
    font-size: 1em; /* Немного больше, чем обычный текст */
    transform: translateY(-0.1em); /* Смещаем вверх для лучшего выравнивания */
}

/* Новый стиль для выравнивания имени пользователя и звездочки */
.forum-user-name-display {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* Custom Admin Tooltip */
.admin-tooltip {
    position: absolute;
    background-color: white;
    border: 1px solid #e3e3e3;
    color: #1D98A1;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.9em;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none; /* Allows clicks on elements below the tooltip */
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    transform: translateY(-5px); /* Initial slight offset */
}

.admin-tooltip.show {
    opacity: 1;
    transform: translateY(0); /* Animate to normal position */
}