/* Основные стили форума */
.forum-container {
    padding: 2rem;
    background: #f8fafc;
    min-height: calc(100vh - 60px);
    color: #1e293b;
}

/* Поиск */
.search-form {
    margin-bottom: 1.5rem;
}

.search-form .input-group {
    background: #fff;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.search-form .form-control {
    background: transparent;
    border: none;
    padding: 0.75rem 1rem;
    color: #1e293b;
}

.search-form .form-control::placeholder {
    color: #94a3b8;
}

.search-form .btn {
    background: #3b82f6;
    border: none;
    padding: 0.75rem 1.25rem;
    color: #fff;
    transition: all 0.2s;
}

.search-form .btn:hover {
    background: #2563eb;
}

/* Категории */
.forum-category {
    background: #fff;
    border-radius: 1rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.category-header {
    background: #f1f5f9;
    padding: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}

.category-title {
    color: #1e293b;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.category-description {
    color: #64748b;
    margin: 0.5rem 0 0;
    font-size: 0.875rem;
}

/* Список форумов */
.forum-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.forum-item {
    padding: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.forum-item:last-child {
    border-bottom: none;
}

.forum-item:hover {
    background: #f8fafc;
}

.forum-item.active {
    background: #eff6ff;
}

.forum-info {
    display: grid;
    gap: 0.5rem;
}

.forum-name {
    color: #1e293b;
    font-size: 1.125rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.forum-name:hover {
    color: #3b82f6;
}

.forum-description {
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.5;
}

.forum-meta {
    display: flex;
    gap: 1rem;
    color: #64748b;
    font-size: 0.875rem;
}

.forum-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.forum-meta i {
    color: #3b82f6;
}

/* Список тем */
.topic-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.topic-item {
    padding: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s;
}

.topic-item:hover {
    background: #f8fafc;
}

.topic-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 0.5rem;
    color: #64748b;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.topic-item:hover .topic-icon {
    background: #3b82f6;
    color: #fff;
}

.topic-info {
    flex: 1;
}

.topic-title {
    color: #1e293b;
    font-size: 1.125rem;
    font-weight: 600;
    text-decoration: none;
    display: block;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

.topic-title:hover {
    color: #3b82f6;
}

.topic-meta {
    display: flex;
    gap: 1rem;
    color: #64748b;
    font-size: 0.875rem;
}

.topic-meta > div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topic-meta i {
    color: #3b82f6;
}

.topic-badges {
    display: flex;
    gap: 0.5rem;
}

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-pinned {
    background: #3b82f6;
    color: #fff;
}

.badge-closed {
    background: #ef4444;
    color: #fff;
}

/* Кнопки */
.btn-forum {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btn-forum:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Стили для постов */
.post {
    background: #fff;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.post-header {
    padding: 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.author-avatar {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    object-fit: cover;
    border: 2px solid #3b82f6;
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-name {
    color: #1e293b;
    font-weight: 600;
    font-size: 1rem;
}

.post-date {
    color: #64748b;
    font-size: 0.875rem;
}

.post-content {
    padding: 1.5rem;
    color: #1e293b;
    line-height: 1.6;
}

/* Формы */
.forum-form {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.form-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    color: #475569;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    width: 100%;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: #1e293b;
    transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.page-link {
    padding: 0.5rem 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    color: #475569;
    text-decoration: none;
    transition: all 0.2s;
}

.page-link:hover {
    background: #f8fafc;
    color: #3b82f6;
    border-color: #3b82f6;
}

.page-item.active .page-link {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

/* Адаптивность */
@media (max-width: 768px) {
    .forum-container {
        padding: 1rem;
    }

    .forum-item {
        flex-direction: column;
        gap: 1rem;
    }

    .forum-meta {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .btn-forum {
        width: 100%;
        justify-content: center;
    }
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.forum-item,
.post {
    animation: fadeIn 0.3s ease-out;
}

/* Уведомления */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border: none;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Загрузка */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.5rem;
    height: 1.5rem;
    margin: -0.75rem 0 0 -0.75rem;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Универсальные стили для модальных окон Bootstrap */
.modal-backdrop {
    display: none !important;
}
.modal.show {
    z-index: 3000 !important;
}

/* --- КРАСИВЫЙ СКРОЛЛБАР ДЛЯ КОДА --- */
pre, code, .code-block, pre code {
    scrollbar-width: thin;
    scrollbar-color: #444950 #282c34;
}
pre::-webkit-scrollbar, code::-webkit-scrollbar, .code-block::-webkit-scrollbar, pre code::-webkit-scrollbar {
    height: 6px;
    width: 6px;
    background: #282c34;
}
pre::-webkit-scrollbar-thumb, code::-webkit-scrollbar-thumb, .code-block::-webkit-scrollbar-thumb, pre code::-webkit-scrollbar-thumb {
    background: #444950;
    border-radius: 4px;
    transition: background 0.2s;
}
pre:hover::-webkit-scrollbar-thumb,
code:hover::-webkit-scrollbar-thumb,
.code-block:hover::-webkit-scrollbar-thumb,
pre code:hover::-webkit-scrollbar-thumb {
    background: #6c7078;
}
pre::-webkit-scrollbar-corner, code::-webkit-scrollbar-corner, .code-block::-webkit-scrollbar-corner, pre code::-webkit-scrollbar-corner {
    background: #282c34;
}
/* --- КОНЕЦ --- */

/* --- Markdown стили для нейроучителя --- */
.markdown-content h3 {
  font-size: 1.35rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 700;
}
.markdown-content p {
  margin-bottom: 1rem;
  font-size: 1.08rem;
}
.markdown-content ul, .markdown-content ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
}
.markdown-content pre {
  background: #23272f;
  border-radius: 8px;
  margin: 1.2em 0 1.5em 0;
  padding: 0.7em 0.7em 0.7em 0.7em;
  position: relative;
  overflow: auto;
}
.markdown-content code {
  background: #23272f;
  color: #e5e7eb;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 1em;
}
.markdown-content pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 1.05em;
  display: block;
  overflow-x: auto;
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #23272f;
  color: #b0b4ba;
  font-size: 0.95em;
  padding: 0.3em 1em 0.3em 1em;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid #2d323c;
  margin-bottom: -0.5em;
}
.language {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.copy-button {
  background: none;
  border: none;
  color: #b0b4ba;
  cursor: pointer;
  font-size: 0.95em;
  padding: 0 0.5em;
  transition: color 0.2s;
}
.copy-button:hover {
  color: #a5ffe0;
}
/* --- КОНЕЦ --- */

/* --- Анимация звёзд подписки --- */
.subscription-star {
  display: inline-block;
  vertical-align: middle;
  margin-left: 2px;
  margin-top: -0.05em;
  position: relative;
  z-index: 2;
}
.subscription-star-svg {
  width: 1.3em;
  height: 1.3em;
  vertical-align: text-bottom;
  transition: filter 0.2s;
}
.star-bronze {
  animation: star-pulse 1.8s infinite ease-in-out;
}
.star-silver {
  animation: star-glow 2.2s infinite alternate;
}
.star-gold {
  animation: star-glow 1.7s infinite alternate;
}
.star-gold .star-crown {
  transform-origin: 50% 80%;
  animation: crown-bounce 2.5s infinite cubic-bezier(.6,-0.28,.74,1.25);
}
@keyframes star-pulse {
  0%, 100% { filter: brightness(1); transform: scale(1); }
  50% { filter: brightness(1.15); transform: scale(1.08); }
}
@keyframes star-glow {
  0% { filter: drop-shadow(0 0 0px #fff8b0); }
  100% { filter: drop-shadow(0 0 8px #fff8b0); }
}
@keyframes crown-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  20% { transform: translateY(-3px) scale(1.08); }
  40% { transform: translateY(0) scale(1); }
}
/* --- КОНЕЦ --- */

/* --- Партиклы вокруг звёзд --- */
.star-particles-container {
  position: relative;
  display: inline-block;
  cursor: pointer;
}
.star-particles-container:hover .subscription-star {
  filter: brightness(1.15) drop-shadow(0 0 8px #ffe066);
  transform: scale(1.08);
  transition: filter 0.2s, transform 0.2s;
}
.particle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.7);
  pointer-events: none;
  z-index: 1;
  animation: particle-burst 1.2s infinite;
}
.particle1 { animation-delay: 0s;    background: #ffe066;  --tx: 14px;  --ty: -6px; }
.particle2 { animation-delay: 0.12s; background: #b4eaff;  --tx: 7px;   --ty: 13px; }
.particle3 { animation-delay: 0.24s; background: #ffd6fa;  --tx: -12px; --ty: 8px; }
.particle4 { animation-delay: 0.36s; background: #ffe066;  --tx: -14px; --ty: -7px; }
.particle5 { animation-delay: 0.48s; background: #b4eaff;  --tx: -3px;  --ty: -15px; }
.particle6 { animation-delay: 0.6s;  background: #ffd6fa;  --tx: 12px;  --ty: 7px; }
.particle7 { animation-delay: 0.72s; background: #ffe066;  --tx: 10px;  --ty: -13px; }
.particle8 { animation-delay: 0.84s; background: #b4eaff;  --tx: 15px;  --ty: 3px; }
.particle9 { animation-delay: 0.96s; background: #ffd6fa;  --tx: -8px;  --ty: 13px; }
.particle10{ animation-delay: 1.08s; background: #ffe066;  --tx: -15px; --ty: 3px; }
@keyframes particle-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.7);
  }
  10% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 0.7;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.7);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.5);
  }
}

/* Партиклы в модалке — больше радиус разлёта и размер */
#subscriptionInfoModal .star-particles-container .particle {
  width: 7px;
  height: 7px;
}
#subscriptionInfoModal .particle1 { --tx: 32px; --ty: -12px; }
#subscriptionInfoModal .particle2 { --tx: 16px; --ty: 28px; }
#subscriptionInfoModal .particle3 { --tx: -28px; --ty: 18px; }
#subscriptionInfoModal .particle4 { --tx: -32px; --ty: -14px; }
#subscriptionInfoModal .particle5 { --tx: -8px; --ty: -34px; }
#subscriptionInfoModal .particle6 { --tx: 28px; --ty: 16px; }
#subscriptionInfoModal .particle7 { --tx: 22px; --ty: -28px; }
#subscriptionInfoModal .particle8 { --tx: 34px; --ty: 6px; }
#subscriptionInfoModal .particle9 { --tx: -18px; --ty: 28px; }
#subscriptionInfoModal .particle10{ --tx: -34px; --ty: 6px; }

.modal-backdrop {
    opacity: 0 !important;
    pointer-events: none !important;
  }

/* Кастомный backdrop для модалки подписки */
#custom-modal-backdrop {
  position: fixed;
  left: 0; top: 0; width: 100vw; height: 100vh;
  background: rgba(30, 41, 59, 0.35); /* красивое затемнение */
  z-index: 2999;
  transition: opacity 0.3s;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#custom-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

a.no-underline, a.no-underline:hover, a.no-underline:focus {
    text-decoration: none;
}

/* --- HERO BLOCK --- */
.articles-hero {
    background: #f8fafc;
    border-radius: 2rem;
    box-shadow: 0 8px 40px 0 rgba(37,99,235,0.10);
    position: relative;
    overflow: hidden;
    min-height: 260px;
    margin-bottom: 2.5rem;
}
.hero-bg-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, #3b82f6 0%, #06b6d4 100%);
    opacity: 0.13;
    z-index: 1;
}
.articles-hero .btn-primary {
    font-size: 1.15rem;
    border-radius: 1.5rem;
    padding: 0.7em 2.2em;
    font-weight: 600;
    box-shadow: 0 2px 12px rgba(59,130,246,0.13);
    transition: background 0.18s, transform 0.18s;
}
.articles-hero .btn-primary:hover {
    background: linear-gradient(90deg, #2563eb 0%, #0ea5e9 100%);
    transform: scale(1.06);
}

/* --- ARTICLE CARD --- */
.article-card {
    background: #fff;
    border-radius: 1.5rem;
    box-shadow: 0 4px 24px rgba(40,44,52,0.09);
    overflow: hidden;
    transition: box-shadow 0.22s, transform 0.18s;
    display: flex;
    flex-direction: column;
    min-height: 480px;
    position: relative;
}
.article-card:hover {
    box-shadow: 0 12px 40px 0 rgba(37,99,235,0.16), 0 2px 8px 0 rgba(0,0,0,0.04);
    transform: translateY(-7px) scale(1.025);
    z-index: 2;
}
.article-img-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 1.5rem 1.5rem 0 0;
    height: 220px;
}
.article-img {
    object-fit: cover;
    width: 100%;
    height: 100%;
    transition: transform 0.3s;
    display: block;
}
.article-card:hover .article-img {
    transform: scale(1.045);
}
.article-img-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,rgba(0,0,0,0.00) 60%,rgba(37,99,235,0.08) 100%);
    z-index: 2;
    pointer-events: none;
}
.article-category {
    z-index: 3;
    font-size: 0.98em;
    font-weight: 600;
    border-radius: 1.2em;
    background: linear-gradient(90deg,#3b82f6 0%,#06b6d4 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59,130,246,0.08);
}
.article-card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 2rem 1.5rem 1.5rem 1.5rem;
}
.article-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #222;
    line-height: 1.25;
}
.article-avatar {
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(59,130,246,0.10);
    border: 2px solid #e0eaff;
}
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 10px;
}
.article-tag {
    background: #f3f6fa;
    color: #3b82f6;
    border-radius: 12px;
    padding: 2px 12px;
    font-size: 0.97rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(59,130,246,0.04);
}
.article-tag:hover {
    background: #e0eaff;
    color: #2563eb;
}
.article-preview {
    color: #444;
    font-size: 1.08rem;
    margin-bottom: 18px;
    flex: 1;
    line-height: 1.6;
    min-height: 60px;
    max-height: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.article-read-btn {
    background: linear-gradient(90deg, #3b82f6 0%, #06b6d4 100%);
    color: #fff;
    border: none;
    border-radius: 1.2em;
    font-weight: 600;
    font-size: 1.08em;
    box-shadow: 0 2px 8px rgba(59,130,246,0.08);
    transition: background 0.18s, transform 0.18s;
    opacity: 0.92;
}
.article-read-btn:hover {
    background: linear-gradient(90deg, #2563eb 0%, #0ea5e9 100%);
    transform: scale(1.07);
    opacity: 1;
}

/* --- SKELETON SHIMMER --- */
.skeleton-img, .skeleton-title, .skeleton-avatar, .skeleton-line, .skeleton-btn {
    background: linear-gradient(90deg, #f3f6fa 25%, #e0eaff 50%, #f3f6fa 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.2s infinite linear;
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- АДАПТИВ --- */
@media (max-width: 768px) {
    .articles-hero { padding: 1.2rem 0.5rem; }
    .article-card-content { padding: 1.2rem 1rem 1rem 1rem; }
    .article-title { font-size: 1.08rem; }
    .article-img-wrapper { height: 150px; }
}

/* --- GOOGLE FONTS: INTER --- */
body, .articles-hero, .article-card, .article-title, .article-tag, .article-read-btn {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}

/* --- КАРУСЕЛЬ ДЛЯ МОБИЛЬНЫХ --- */
.articles-carousel-wrapper {
  display: flex;
  gap: 1.2rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  margin-left: -8px;
  margin-right: -8px;
}
.carousel-article-card {
  width: 270px;
  min-width: 270px;
  max-width: 270px;
  background: #fff;
  border-radius: 1.2rem;
  box-shadow: 0 2px 12px rgba(37,99,235,0.08);
  scroll-snap-align: start;
  flex-shrink: 0;
  position: relative;
  padding: 1.1rem 1rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 320px;
  height: 320px;
  justify-content: space-between;
  cursor: pointer;
  text-decoration: none;
  outline: none;
  transition: box-shadow 0.18s, transform 0.18s;
}
.carousel-article-card:hover, .carousel-article-card:focus {
  box-shadow: 0 8px 32px 0 rgba(37,99,235,0.13), 0 2px 8px 0 rgba(0,0,0,0.04);
  transform: translateY(-4px) scale(1.012);
  text-decoration: none;
}
@media (max-width: 400px) {
  .carousel-article-card {
    width: 90vw;
    min-width: 90vw;
    max-width: 90vw;
  }
}
.carousel-preview {
  flex: 1 1 auto;
  width: 100%;
  overflow: hidden;
}
.carousel-article-img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 0.9rem;
  margin-bottom: 0.7rem;
  box-shadow: 0 1px 6px rgba(37,99,235,0.07);
}
.carousel-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.92em;
  z-index: 2;
  border-radius: 1em;
  padding: 0.3em 0.9em;
  font-weight: 600;
}
@media (min-width: 992px) {
  .articles-carousel-wrapper { display: none !important; }
}
@media (max-width: 991.98px) {
  .row.mb-4.g-4.d-none.d-lg-flex { display: none !important; }
}