/* =========================
   ARTICLE CONTENT - MODERN DESIGN
   Inter font + плавні анімації
   ========================= */

/* ===== FONTS ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes aiPulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
  }
  50% {
    opacity: 0.7;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
  }
}

/* ===== КОНТЕЙНЕР СТАТТІ ===== */
#content_article {
  display: flex;
  gap: 32px;
  margin-top: 32px;
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== НАВІГАЦІЯ (ЗМІСТ) ===== */
#nav_art {
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  overflow-x: hidden;
  position: sticky;
  top: 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(59, 130, 246, 0.3) transparent;
}

#nav_art::-webkit-scrollbar {
  width: 6px;
}

#nav_art::-webkit-scrollbar-track {
  background: transparent;
}

#nav_art::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.3);
  border-radius: 3px;
}

#nav_art::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.5);
}

body.dark-mode #nav_art::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.4);
}

body.dark-mode #nav_art::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.6);
}

#content_overview_text {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
  border-bottom: 3px solid rgba(16, 185, 129, 0.15);
  display: block;
  padding-bottom: 12px;
  letter-spacing: -0.02em;
}

#navigation_list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#navigation_list ul {
  padding-left: 20px;
  margin-top: 6px;
}

#navigation_list li {
  position: relative;
  margin-bottom: 4px;
}

#navigation_list li a {
  text-decoration: none;
  color: #64748b;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  padding: 10px 16px;
  display: block;
  border-radius: 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  letter-spacing: -0.01em;
}

#navigation_list li a::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  transform: scaleY(0);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 0 4px 4px 0;
}

#navigation_list li a:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.12) 100%);
  color: #2563eb;
  transform: translateX(6px);
}

#navigation_list li a:hover::before {
  transform: scaleY(1);
}

#navigation_list li.active a {
  font-weight: 700;
  color: #2563eb;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(59, 130, 246, 0.18) 100%);
}

#navigation_list li.active a::before {
  transform: scaleY(1);
}

#navigation_list li.nav_h3 a {
  font-size: 13px;
  padding-left: 22px;
  font-weight: 500;
}

#navigation_list li.nav_h4 a {
  font-size: 12px;
  padding-left: 34px;
  font-weight: 400;
  color: #94a3b8;
}

/* ===== ОСНОВНИЙ ТЕКСТ СТАТТІ ===== */
#article_content_text {
  flex: 1;
  max-width: 900px;
  background: #ffffff;
  padding: 48px;
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08),
              0 1px 4px rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(226, 232, 240, 0.8);
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
}

#show_article_text {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 17px;
  line-height: 1.8;
  color: #1e293b;
  letter-spacing: -0.011em;
}

/* ===== ЗАГОЛОВКИ ===== */
#show_article_text h2 {
  font-family: 'Inter', sans-serif;
  font-size: 36px;
  font-weight: 900;
  color: #0f172a;
  margin-top: 56px;
  margin-bottom: 28px;
  line-height: 1.2;
  letter-spacing: -0.03em;
  position: relative;
  padding-bottom: 20px;
}

#show_article_text h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 80px;
  height: 5px;
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 3px;
}

#show_article_text h2:first-child {
  margin-top: 0;
}

#show_article_text h3 {
  font-family: 'Inter', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: #1e293b;
  margin-top: 40px;
  margin-bottom: 20px;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

#show_article_text h4 {
  font-family: 'Inter', sans-serif;
  font-size: 21px;
  font-weight: 700;
  color: #334155;
  margin-top: 32px;
  margin-bottom: 16px;
  line-height: 1.4;
  letter-spacing: -0.015em;
}

/* ===== ПАРАГРАФИ ===== */
#show_article_text p {
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  color: #334155;
  margin-bottom: 24px;
  line-height: 1.8;
}

/* ===== ПОСИЛАННЯ ===== */
#show_article_text a {
  font-family: 'Inter', sans-serif;
  color: #3b82f6;
  text-decoration: none;
  font-weight: 600;
  position: relative;
  transition: all 0.2s ease;
  border-bottom: 2px solid rgba(59, 130, 246, 0.3);
  padding-bottom: 1px;
}

#show_article_text a:hover {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

/* ===== ТЕКСТОВІ СТИЛІ ===== */
#show_article_text b,
#show_article_text strong {
  font-weight: 800;
  color: #0f172a;
}

#show_article_text i,
#show_article_text em {
  font-style: italic;
  color: #475569;
}

#show_article_text u {
  text-decoration: underline;
  text-decoration-color: rgba(59, 130, 246, 0.4);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* ===== СПИСКИ ===== */
#show_article_text ul,
#show_article_text ol {
  margin: 24px 0;
  padding-left: 32px;
}

#show_article_text ul li,
#show_article_text ol li {
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  margin-bottom: 14px;
  line-height: 1.7;
  padding-left: 12px;
}

#show_article_text ul li::marker {
  color: #3b82f6;
  font-weight: 700;
  font-size: 1.2em;
}

#show_article_text ol li::marker {
  color: #3b82f6;
  font-weight: 800;
}

#show_article_text ul ul,
#show_article_text ol ol {
  margin: 12px 0;
  padding-left: 28px;
}

/* ===== BLOCKQUOTE ===== */
#show_article_text blockquote {
  margin: 32px 0;
  padding: 24px 28px;
  border-left: 5px solid #3b82f6;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.04) 0%, rgba(59, 130, 246, 0.08) 100%);
  border-radius: 0 16px 16px 0;
  font-style: italic;
  color: #475569;
  font-size: 16px;
  line-height: 1.75;
}

/* ===== CODE ===== */
#show_article_text code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 15px;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  padding: 4px 10px;
  border-radius: 8px;
  color: #dc2626;
  border: 1px solid #cbd5e1;
  font-weight: 600;
}

#show_article_text pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 24px;
  border-radius: 16px;
  overflow-x: auto;
  margin: 28px 0;
  border: 1px solid #334155;
}

#show_article_text pre code {
  background: none;
  color: inherit;
  border: none;
  padding: 0;
  font-size: 14px;
}

/* ===== SUB/SUP ===== */
#show_article_text sub,
#show_article_text sup {
  font-size: 0.75em;
  font-weight: 600;
  color: #6366f1;
}

/* ===== ЗОБРАЖЕННЯ ===== */
#article_content_text img {
  max-width: 90%;
  height: auto;
  display: block;
  margin: 32px auto;
  border-radius: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: zoom-in;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.5);
}

#article_content_text img:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.15);
}

/* ===== ТАБЛИЦІ ===== */
.table-wrapper {
  overflow-x: auto;
  margin: 32px 0;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.article-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
}

.article-table thead {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.article-table thead th {
  color: #ffffff;
  font-weight: 700;
  text-align: left;
  padding: 16px 20px;
  border-bottom: 3px solid #1e40af;
  letter-spacing: -0.01em;
}

.article-table tbody tr {
  transition: background 0.2s ease;
}

.article-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.article-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.05);
}

.article-table tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
  line-height: 1.6;
}

.article-table tbody tr:last-child td {
  border-bottom: none;
}

/* ===== PATHOGENESIS BLOCKS (РОЗКРИВНІ БЛОКИ) ===== */
.pathogenesis-explanation,
.clinical-case {
  margin: 32px 0;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid #93c5fd;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pathogenesis-explanation:hover,
.clinical-case:hover {
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
}

/* КРИТИЧНО ВАЖЛИВИЙ БЛОК - КОМПАКТНИЙ HEADER */
.expandable-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  cursor: pointer;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  transition: all 0.2s ease;
  user-select: none;
}

.expandable-header:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* Іконка + текст (зліва) */
.expandable-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  flex: 0 1 auto;
  min-width: 0;
}

.expandable-title span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* AI іконка */
.ai-icon {
  width: 18px;
  height: 18px;
  filter: brightness(0) invert(1);
  opacity: 0.95;
  flex-shrink: 0;
}

/* AI-powered badge (справа, перед стрілкою) */
.ai-badge {
  display: inline-flex;
  align-items: center;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 8px;
  animation: aiPulse 2s ease-in-out infinite;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

/* Стрілка (в самому кінці) */
.expandable-arrow {
  font-size: 14px;
  color: #ffffff;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  margin-left: 10px;
}

.pathogenesis-explanation.open .expandable-arrow,
.clinical-case.open .expandable-arrow {
  transform: rotate(180deg);
}

/* Контент */
.expandable-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: #ffffff;
}

.pathogenesis-explanation.open .expandable-content,
.clinical-case.open .expandable-content {
  max-height: 5000px;
  padding: 24px;
  animation: fadeInUp 0.4s ease-out;
}

.expandable-content p {
  margin-bottom: 16px;
  line-height: 1.7;
}

/* ===== ТЕРМІНИ ===== */
.term {
  color: #6366f1;
  font-weight: 600;
  cursor: help;
  border-bottom: 2px dotted #6366f1;
  transition: all 0.2s ease;
  position: relative;
}

.term:hover {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
}

/* ===== LIKES SECTION ===== */
#likes_section {
  margin-top: 56px;
  padding-top: 40px;
  border-top: 3px solid rgba(226, 232, 240, 0.8);
}

#likes_header {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 24px;
  letter-spacing: -0.015em;
}

#likes_header .likes-icon {
  color: #ef4444;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

#likes_container {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

#like_button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid #e2e8f0;
  border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

#like_button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.2);
  border-color: #fca5a5;
}

#like_button .heart-icon {
  width: 24px;
  height: 24px;
  stroke: #ef4444;
  fill: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#like_button.liked {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border-color: #ef4444;
  color: #dc2626;
}

#like_button.liked .heart-icon {
  fill: #ef4444;
  stroke: #dc2626;
  animation: pulse 0.5s cubic-bezier(0.4, 0, 0.6, 1);
}

#like_button:active {
  transform: scale(0.95);
}

#likes_stats {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: 'Inter', sans-serif;
}

#likes_count {
  font-size: 28px;
  font-weight: 900;
  color: #ef4444;
  letter-spacing: -0.02em;
}

#likes_count.pulse {
  animation: pulse 0.6s cubic-bezier(0.4, 0, 0.6, 1);
}

#likes_list {
  display: flex;
  gap: -8px;
  margin-left: 12px;
}

.like_user {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.like_user:hover {
  transform: translateY(-4px);
  z-index: 10;
}

.like_user img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid #ffffff;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  margin-right: -12px;
}

.like_user img:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.like_user img.user {
  border-color: #10b981;
}

.like_user img.admin {
  border-color: #f59e0b;
}

.like_user img.publisher {
  border-color: #3b82f6;
}

.like_user .tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: #1e293b;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 1000;
}

.like_user .tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
}

.like_user:hover .tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(-12px);
}

/* ===== IMAGE ZOOM MODAL ===== */
.image-zoom-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-zoom-modal.active {
  opacity: 1;
}

.image-zoom-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  cursor: zoom-out;
}

.image-zoom-content {
  position: relative;
  z-index: 1;
  max-width: 95vw;
  max-height: 95vh;
  animation: fadeInUp 0.3s ease-out;
}

.image-zoom-content img {
  max-width: 95vw;
  max-height: 95vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: default;
}

.image-zoom-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.image-zoom-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.image-zoom-close i {
  color: #ffffff;
  font-size: 20px;
}

/* ===== DARK MODE ===== */
body.dark-mode #nav_art {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  border-color: rgba(51, 65, 85, 0.8);
}

body.dark-mode #content_overview_text {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  border-bottom-color: rgba(34, 197, 94, 0.2);
}

body.dark-mode #navigation_list li a {
  color: #cbd5e1;
}

body.dark-mode #navigation_list li a:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.2) 100%);
  color: #93c5fd;
}

body.dark-mode #navigation_list li.active a {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.25) 100%);
  color: #93c5fd;
}

body.dark-mode #article_content_text {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  border-color: rgba(51, 65, 85, 0.8);
}

body.dark-mode #show_article_text,
body.dark-mode #show_article_text p {
  color: #e2e8f0;
}

body.dark-mode #show_article_text h2,
body.dark-mode #show_article_text h3,
body.dark-mode #show_article_text h4 {
  color: #f8fafc;
}

body.dark-mode #show_article_text b,
body.dark-mode #show_article_text strong {
  color: #ffffff;
}

body.dark-mode #show_article_text a {
  color: #93c5fd;
  border-bottom-color: rgba(147, 197, 253, 0.3);
}

body.dark-mode #show_article_text a:hover {
  color: #60a5fa;
  border-bottom-color: #60a5fa;
}

body.dark-mode #show_article_text blockquote {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.12) 100%);
  color: #cbd5e1;
  border-left-color: #3b82f6;
}

body.dark-mode #show_article_text code {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
  color: #fca5a5;
  border-color: #475569;
}

body.dark-mode .article-table {
  background: #0f172a;
}

body.dark-mode .article-table tbody tr:nth-child(even) {
  background: #1e293b;
}

body.dark-mode .article-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.1);
}

body.dark-mode .article-table tbody td {
  color: #e2e8f0;
  border-bottom-color: #334155;
}

body.dark-mode .pathogenesis-explanation,
body.dark-mode .clinical-case {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: #3b82f6;
}

body.dark-mode .expandable-content {
  background: #0f172a;
}

body.dark-mode .ai-badge {
  background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
}

body.dark-mode #likes_header {
  color: #f8fafc;
}

body.dark-mode #likes_section {
  border-top-color: rgba(51, 65, 85, 0.8);
}

body.dark-mode #like_button {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: #334155;
  color: #cbd5e1;
}

body.dark-mode #like_button:hover {
  border-color: #ef4444;
}

body.dark-mode #like_button.liked {
  background: linear-gradient(135deg, #3f1f1f 0%, #2d1414 100%);
  border-color: #ef4444;
  color: #fca5a5;
}

body.dark-mode .like_user img {
  border-color: #1e293b;
}

body.dark-mode .like_user .tooltip {
  background: #f8fafc;
  color: #0f172a;
}

body.dark-mode .like_user .tooltip::after {
  border-top-color: #f8fafc;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  #content_article {
    flex-direction: column;
    gap: 24px;
  }

  #nav_art {
    width: 100%;
    position: static;
    max-height: none;
  }

  #article_content_text {
    max-width: 100%;
    padding: 32px;
  }
}

@media (max-width: 768px) {
  #article_content_text {
    padding: 24px;
  }

  #show_article_text {
    font-size: 16px;
  }

  #show_article_text h2 {
    font-size: 28px;
    margin-top: 40px;
    margin-bottom: 20px;
  }

  #show_article_text h3 {
    font-size: 22px;
    margin-top: 32px;
    margin-bottom: 16px;
  }

  #show_article_text h4 {
    font-size: 19px;
    margin-top: 24px;
    margin-bottom: 12px;
  }

  #show_article_text p,
  #show_article_text li {
    font-size: 16px;
  }

  #article_content_text img {
    max-width: 95%;
    margin: 24px auto;
  }

  #likes_container {
    flex-direction: column;
    align-items: flex-start;
  }

  .like_user img {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 640px) {
  .expandable-header {
    padding: 10px 14px;
    gap: 8px;
  }

  .expandable-title {
    font-size: 13px;
    gap: 6px;
  }

  .ai-icon {
    width: 16px;
    height: 16px;
  }

  .ai-badge {
    font-size: 7px;
    padding: 3px 6px;
  }

  .expandable-arrow {
    font-size: 12px;
    margin-left: 6px;
  }
}

@media (max-width: 480px) {
  #article_content_text {
    padding: 20px;
    border-radius: 16px;
  }

  #show_article_text h2 {
    font-size: 24px;
  }

  #show_article_text h3 {
    font-size: 20px;
  }

  #show_article_text h4 {
    font-size: 18px;
  }

  #like_button {
    padding: 12px 20px;
    font-size: 15px;
  }

  .like_user img {
    width: 36px;
    height: 36px;
    margin-right: -10px;
  }
}

/* ========================================
   MOBILE PERFORMANCE - ARTICLE CONTENT
   ======================================== */

@media (max-width: 900px) {
  /* Відключити backdrop-filter */
  .image-zoom-close {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* Спростити backgrounds */
  #article_content_text {
    background: #ffffff !important;
  }

  body.dark-mode #article_content_text {
    background: #1e293b !important;
  }

  body.dark-mode #nav_art {
    background: #1e293b !important;
  }

  /* Спростити тіні */
  #article_content_text {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08) !important;
  }

  body.dark-mode #article_content_text {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  }

  #article_content_text img {
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08) !important;
  }

  .table-wrapper {
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08) !important;
  }

  .like_user img {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
  }

  .like_user img:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
  }

  .image-zoom-content img {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3) !important;
  }

  /* Прибрати ::after на h2 */
  #show_article_text h2::after {
    display: none !important;
  }

  /* Спростити gradient texts */
  #content_overview_text {
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: unset !important;
    background-clip: unset !important;
    color: #10b981 !important;
  }

  body.dark-mode #content_overview_text {
    color: #22c55e !important;
  }

  /* Спростити navigation hover */
  #navigation_list li a {
    transition-duration: 0.15s !important;
  }

  #navigation_list li a::before {
    transition-duration: 0.15s !important;
  }

  #navigation_list li a:hover {
    background: rgba(59, 130, 246, 0.1) !important;
    transform: none !important;
  }

  body.dark-mode #navigation_list li a:hover {
    background: rgba(59, 130, 246, 0.15) !important;
  }

  #navigation_list li.active a {
    background: rgba(59, 130, 246, 0.15) !important;
  }

  body.dark-mode #navigation_list li.active a {
    background: rgba(59, 130, 246, 0.2) !important;
  }

  /* Відключити hover на зображеннях */
  #article_content_text img:hover {
    transform: none !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08) !important;
  }

  /* Спростити expandable blocks */
  .pathogenesis-explanation,
  .clinical-case {
    background: #eff6ff !important;
  }

  body.dark-mode .pathogenesis-explanation,
  body.dark-mode .clinical-case {
    background: #1e293b !important;
  }

  .pathogenesis-explanation:hover,
  .clinical-case:hover {
    box-shadow: none !important;
  }

  .expandable-header {
    background: #3b82f6 !important;
    transition-duration: 0.15s !important;
  }

  .expandable-header:hover {
    background: #2563eb !important;
  }

  .expandable-content {
    transition-duration: 0.3s !important;
  }

  .expandable-content {
    background: #ffffff !important;
  }

  body.dark-mode .expandable-content {
    background: #0f172a !important;
  }

  /* Спростити AI badge */
  .ai-badge {
    background: #8b5cf6 !important;
    animation: none !important;
    box-shadow: none !important;
  }

  body.dark-mode .ai-badge {
    background: #a78bfa !important;
  }

  /* Спростити expandable arrow */
  .expandable-arrow {
    transition-duration: 0.2s !important;
  }

  /* Спростити blockquote */
  #show_article_text blockquote {
    background: rgba(59, 130, 246, 0.08) !important;
  }

  body.dark-mode #show_article_text blockquote {
    background: rgba(59, 130, 246, 0.1) !important;
  }

  /* Спростити code */
  #show_article_text code {
    background: #f1f5f9 !important;
  }

  body.dark-mode #show_article_text code {
    background: #334155 !important;
  }

  /* Спростити tables */
  .article-table thead {
    background: #3b82f6 !important;
  }

  body.dark-mode .article-table {
    background: #0f172a !important;
  }

  /* Спростити likes button */
  #like_button {
    background: #ffffff !important;
    transition-duration: 0.15s !important;
  }

  #like_button:hover {
    transform: none !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15) !important;
  }

  #like_button.liked {
    background: #fee2e2 !important;
  }

  body.dark-mode #like_button {
    background: #1e293b !important;
  }

  body.dark-mode #like_button.liked {
    background: #3f1f1f !important;
  }

  /* Спростити likes icon animation */
  #likes_header .likes-icon {
    animation: none !important;
  }

  #like_button .heart-icon {
    transition-duration: 0.2s !important;
  }

  #like_button.liked .heart-icon {
    animation: none !important;
  }

  #likes_count.pulse {
    animation: none !important;
  }

  /* Спростити like users */
  .like_user {
    transition-duration: 0.15s !important;
  }

  .like_user:hover {
    transform: none !important;
  }

  .like_user img {
    transition-duration: 0.15s !important;
  }

  /* Спростити tooltip */
  .like_user .tooltip {
    transition-duration: 0.15s !important;
  }

  .like_user:hover .tooltip {
    transform: translateX(-50%) translateY(-8px) !important;
  }

  /* Спростити image zoom modal */
  .image-zoom-modal {
    transition-duration: 0.2s !important;
  }

  .image-zoom-close {
    background: rgba(255, 255, 255, 0.25) !important;
    transition-duration: 0.15s !important;
  }

  .image-zoom-close:hover {
    background: rgba(255, 255, 255, 0.35) !important;
    transform: none !important;
  }

  /* Відключити всі основні анімації */
  #content_article,
  #article_content_text,
  .image-zoom-content {
    animation: none !important;
  }

  /* Спростити scrollbar */
  #nav_art::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.4) !important;
  }

  #nav_art::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.6) !important;
  }
}

/* Для дуже слабких пристроїв */
@media (max-width: 480px) and (max-height: 800px) {
  /* Мінімальні тіні */
  #article_content_text {
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06) !important;
  }

  body.dark-mode #article_content_text {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
  }

  /* Відключити всі анімації */
  * {
    animation: none !important;
  }

  /* Спростити backgrounds */
  #article_content_text {
    background: #ffffff !important;
  }

  body.dark-mode #article_content_text {
    background: #1e293b !important;
  }

  .expandable-header {
    background: #3b82f6 !important;
  }

  .expandable-header:hover {
    background: #2563eb !important;
  }

  /* Спростити tables */
  .article-table thead {
    background: #3b82f6 !important;
  }

  /* Відключити всі transitions */
  #navigation_list li a,
  #navigation_list li a::before,
  .expandable-arrow,
  .expandable-content,
  #like_button,
  .like_user,
  .like_user img,
  .like_user .tooltip {
    transition: none !important;
  }

  /* Зменшити padding для економії місця */
  #article_content_text {
    padding: 16px !important;
  }

  .pathogenesis-explanation.open .expandable-content,
  .clinical-case.open .expandable-content {
    padding: 16px !important;
  }

  /* Спростити навігацію */
  #navigation_list li a {
    padding: 8px 12px !important;
  }

  /* Спростити likes */
  #like_button {
    padding: 10px 16px !important;
  }

  .like_user img {
    width: 32px !important;
    height: 32px !important;
  }

  /* Зменшити розміри зображень */
  #article_content_text img {
    max-width: 100% !important;
    margin: 16px auto !important;
  }
}

/* Для landscape орієнтації на малих екранах */
@media (max-width: 900px) and (max-height: 500px) {
  #article_content_text {
    padding: 20px !important;
  }

  #show_article_text h2 {
    margin-top: 32px !important;
    margin-bottom: 16px !important;
  }

  #show_article_text h3 {
    margin-top: 24px !important;
    margin-bottom: 12px !important;
  }

  #likes_section {
    margin-top: 32px !important;
    padding-top: 24px !important;
  }
}






/* =====================================================
   PROGRESSIVE LOADING OVERLAY - BLUR + PROGRESS BAR
   ===================================================== */

/* Блокування body під час завантаження */
body.article-is-loading {
  overflow: hidden !important;
  height: 100vh !important;
  position: fixed !important;
  width: 100% !important;
}

/* Overlay поверх всього */
.article-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
  padding: 20px;
  cursor: wait;
}

body.dark-mode .article-loading-overlay {
  background: rgba(0, 0, 0, 0.9);
}

/* Контент під overlay блюриться */
#content_article.article-loading {
  filter: blur(12px);
  pointer-events: none;
  user-select: none;
  transition: filter 0.5s ease-out;
  opacity: 0.6;
}

/* Блюримо header і footer */
body.article-is-loading .container > *:not(#main_part) {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
  opacity: 0.5;
}

/* Блюримо весь контент КРІМ overlay */
body.article-is-loading #main_part {
  filter: blur(10px);
  pointer-events: none;
  user-select: none;
}

/* Overlay НЕ блюриться */
body.article-is-loading #article-loading-overlay {
  filter: none !important;
}

/* ===== МОДАЛЬНЕ ВІКНО З ПРОГРЕСОМ ===== */
.loading-modal {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 24px;
  padding: 48px 56px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4),
              0 0 0 1px rgba(255, 255, 255, 0.1);
  max-width: 500px;
  width: 100%;
  text-align: center;
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 100000;
}

body.dark-mode .loading-modal {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6),
              0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* ===== СПІННЕР ===== */
.spinner-large {
  width: 80px;
  height: 80px;
  border: 6px solid #e5e7eb;
  border-top: 6px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 28px;
}

body.dark-mode .spinner-large {
  border-color: #334155;
  border-top-color: #60a5fa;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===== ТЕКСТ МОДАЛЬНОГО ВІКНА ===== */
.loading-modal h3 {
  font-family: 'Inter', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 16px 0;
  letter-spacing: -0.02em;
}

body.dark-mode .loading-modal h3 {
  color: #f8fafc;
}

/* ===== СТАТУС ЗАВАНТАЖЕННЯ ===== */
.loading-status {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: #475569;
  margin: 0 0 24px 0;
}

body.dark-mode .loading-status {
  color: #cbd5e1;
}

#loaded-parts-count {
  color: #3b82f6;
  font-weight: 800;
  font-size: 20px;
}

body.dark-mode #loaded-parts-count {
  color: #60a5fa;
}

/* ===== PROGRESS BAR ===== */
.progress-bar-container {
  width: 100%;
  height: 12px;
  background: #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
  margin-bottom: 20px;
}

body.dark-mode .progress-bar-container {
  background: #1e293b;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Progress Bar Fill */
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
  border-radius: 6px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Анімований градієнт shimmer */
.progress-bar-fill::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(255, 255, 255, 0.3) 50%, 
    transparent 100%);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 200%; }
}

/* ===== ПІДКАЗКА ===== */
.loading-hint {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #94a3b8;
  margin: 0;
  font-style: italic;
}

body.dark-mode .loading-hint {
  color: #64748b;
}

/* ===== RESPONSIVE - LOADING MODAL ===== */
@media (max-width: 768px) {
  .loading-modal {
    padding: 36px 32px;
    max-width: 90%;
  }

  .spinner-large {
    width: 64px;
    height: 64px;
    border-width: 5px;
    margin-bottom: 24px;
  }

  .loading-modal h3 {
    font-size: 20px;
    margin-bottom: 12px;
  }

  .loading-status {
    font-size: 15px;
    margin-bottom: 20px;
  }

  #loaded-parts-count {
    font-size: 18px;
  }

  .progress-bar-container {
    height: 10px;
    margin-bottom: 16px;
  }

  .loading-hint {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .article-loading-overlay {
    padding: 16px;
  }

  .loading-modal {
    padding: 28px 24px;
    border-radius: 20px;
  }

  .spinner-large {
    width: 56px;
    height: 56px;
    border-width: 4px;
    margin-bottom: 20px;
  }

  .loading-modal h3 {
    font-size: 18px;
    margin-bottom: 10px;
  }

  .loading-status {
    font-size: 14px;
    margin-bottom: 16px;
  }

  #loaded-parts-count {
    font-size: 16px;
  }

  .progress-bar-container {
    height: 8px;
    margin-bottom: 14px;
  }

  .loading-hint {
    font-size: 12px;
  }
}

/* ===== PERFORMANCE ДЛЯ МОБІЛЬНИХ ===== */
@media (max-width: 900px) {
  #content_article.article-loading {
    filter: blur(6px);
  }

  body.article-is-loading #main_part {
    filter: blur(5px);
  }

  body.article-is-loading .container > *:not(#main_part) {
    filter: blur(4px);
  }

  .article-loading-overlay {
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    background: rgba(15, 23, 42, 0.9);
  }

  /* Відключити shimmer анімацію на мобільних */
  .progress-bar-fill::before {
    animation: none;
  }
}

@media (max-width: 480px) and (max-height: 800px) {
  #content_article.article-loading {
    filter: blur(4px);
  }

  body.article-is-loading #main_part {
    filter: blur(3px);
  }

  .article-loading-overlay {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(15, 23, 42, 0.95);
  }

  body.dark-mode .article-loading-overlay {
    background: rgba(0, 0, 0, 0.95);
  }

  .loading-modal {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}

.paragraph-edit-btn {
  position: absolute;
  left: -35px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: 2px solid white;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
  z-index: 10;
}

.paragraph-edit-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

.paragraph-edit-btn svg {
  width: 14px;
  height: 14px;
  stroke: white;
  stroke-width: 2;
}

#show_article_text p {
  position: relative;
}

#show_article_text p:hover .paragraph-edit-btn {
  opacity: 1;
}

/* Edit mode styles */
.paragraph-editing {
  background: #f0f9ff;
  border: 2px solid #3b82f6;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
}

.paragraph-edit-textarea {
  width: 100%;
  min-height: 150px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  resize: vertical;
  margin-bottom: 12px;
}

.paragraph-edit-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.paragraph-edit-save,
.paragraph-edit-cancel {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.paragraph-edit-save {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.paragraph-edit-save:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.paragraph-edit-cancel {
  background: #f1f5f9;
  color: #475569;
}

.paragraph-edit-cancel:hover {
  background: #e2e8f0;
}

.paragraph-edit-loading {
  opacity: 0.6;
  pointer-events: none;
}


/* HTML Mode Toggle */
.paragraph-edit-mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 8px;
  width: fit-content;
}

.paragraph-edit-mode-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  color: #64748b;
}

.paragraph-edit-mode-btn:hover {
  color: #334155;
}

.paragraph-edit-mode-btn.active {
  background: white;
  color: #3b82f6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.paragraph-edit-mode-btn i {
  margin-right: 6px;
}

/* HTML mode textarea styling */
.paragraph-edit-textarea.html-mode {
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 14px;
  background: #1e293b;
  color: #e2e8f0;
  border-color: #475569;
}

.paragraph-edit-textarea.html-mode::selection {
  background: #3b82f6;
  color: white;
}

/* Dark mode */
body.dark-mode .paragraph-edit-mode-toggle {
  background: #1e293b;
}

body.dark-mode .paragraph-edit-mode-btn.active {
  background: #334155;
  color: #60a5fa;
}

body.dark-mode .paragraph-edit-textarea.html-mode {
  background: #0f172a;
  border-color: #334155;
}




/* =====================================================================
   PARAGRAPH IMAGE ADD BUTTON - FOR VAINTEM ONLY
   ===================================================================== */

/* Кнопка додавання зображення */
.paragraph-add-image-btn {
  position: absolute;
  left: -70px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  z-index: 100;
}

.paragraph-add-image-btn svg {
  width: 16px;
  height: 16px;
  stroke: white;
  stroke-width: 2;
  fill: none;
}

.paragraph-add-image-btn:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* Show button on paragraph hover */
#show_article_text [data-part-number] p:hover .paragraph-add-image-btn {
  opacity: 1;
}

/* Dark mode */
body.dark-mode .paragraph-add-image-btn {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.4);
}

body.dark-mode .paragraph-add-image-btn:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
}

/* =====================================================================
   IMAGE UPLOAD MODAL
   ===================================================================== */

.image-upload-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-upload-modal.active {
  opacity: 1;
}

.image-upload-content {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.image-upload-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.image-upload-header h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
}

.image-upload-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6b7280;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.image-upload-close:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.image-upload-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.image-upload-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-upload-field label {
  font-weight: 600;
  font-size: 14px;
  color: #374151;
}

.image-upload-file-input {
  padding: 12px;
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  background: #f9fafb;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.image-upload-file-input:hover {
  border-color: #10b981;
  background: #ecfdf5;
}

.image-upload-field input[type="text"],
.image-upload-field textarea {
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
}

.image-upload-field input[type="text"]:focus,
.image-upload-field textarea:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.image-upload-field textarea {
  resize: vertical;
  min-height: 80px;
}

.image-preview {
  max-width: 100%;
  max-height: 300px;
  border-radius: 12px;
  margin-top: 12px;
  display: none;
}

.image-preview.show {
  display: block;
}

.image-upload-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.image-upload-btn {
  flex: 1;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.image-upload-btn-cancel {
  background: #f3f4f6;
  color: #374151;
}

.image-upload-btn-cancel:hover {
  background: #e5e7eb;
}

.image-upload-btn-submit {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.image-upload-btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.image-upload-btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Dark mode */
body.dark-mode .image-upload-content {
  background: #1f2937;
}

body.dark-mode .image-upload-header h3 {
  color: #f9fafb;
}

body.dark-mode .image-upload-close:hover {
  background: #374151;
  color: #f9fafb;
}

body.dark-mode .image-upload-field label {
  color: #e5e7eb;
}

body.dark-mode .image-upload-file-input {
  background: #374151;
  border-color: #4b5563;
  color: #e5e7eb;
}

body.dark-mode .image-upload-file-input:hover {
  border-color: #10b981;
  background: #065f46;
}

body.dark-mode .image-upload-field input[type="text"],
body.dark-mode .image-upload-field textarea {
  background: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}

body.dark-mode .image-upload-btn-cancel {
  background: #374151;
  color: #e5e7eb;
}

body.dark-mode .image-upload-btn-cancel:hover {
  background: #4b5563;
}



.article_illustration {
  margin: 32px 0;
  padding: 0;
  background: transparent;
  border-radius: 16px;
  overflow: hidden;
  transform: translateY(20px);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.article_illustration.fade-in {
  animation: fadeInUp 0.6s ease forwards;
}

.article_illustration.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.article_illustration .img_art {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  cursor: zoom-in;
}

.article_illustration .img_art:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.article_illustration .subscription_image {
  margin: 16px 0 0 0;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  color: #6b7280;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border-radius: 8px;
  font-style: italic;
  border-left: 3px solid #10b981;
}

/* Dark mode */
body.dark-mode .article_illustration .img_art {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body.dark-mode .article_illustration .img_art:hover {
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

body.dark-mode .article_illustration .subscription_image {
  color: #d1d5db;
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  border-left-color: #10b981;
}

/* =====================================================================
   SUCCESS TOAST NOTIFICATION
   ===================================================================== */

.success-toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
  z-index: 100000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.success-toast.show {
  bottom: 32px;
}

.success-toast i {
  font-size: 20px;
}

/* Dark mode */
body.dark-mode .success-toast {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.4);
}

/* =====================================================================
   IMAGE ZOOM MODAL - IMPROVED
   ===================================================================== */

.image-zoom-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-zoom-modal.active {
  opacity: 1;
}

.image-zoom-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  cursor: zoom-out;
}

.image-zoom-content {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  z-index: 1;
}

.image-zoom-content img {
  max-width: 100%;
  max-height: 95vh;
  display: block;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.image-zoom-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.2s ease;
}

.image-zoom-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .article_illustration {
    margin: 24px 0;
  }
  
  .article_illustration .subscription_image {
    font-size: 13px;
    padding: 10px 12px;
  }
  
  .success-toast {
    bottom: 16px;
    left: 16px;
    right: 16px;
    transform: none;
  }
}
/* =====================================================================
   IMAGE EDIT CONTROLS - FOR VAINTEM ONLY
   ===================================================================== */

.image-edit-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.article_illustration {
  position: relative;
}

.article_illustration:hover .image-edit-controls {
  opacity: 1;
}

.image-edit-btn,
.image-delete-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.image-edit-btn {
  background: rgba(59, 130, 246, 0.9);
  color: white;
}

.image-edit-btn:hover {
  background: rgba(37, 99, 235, 1);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.image-delete-btn {
  background: rgba(239, 68, 68, 0.9);
  color: white;
}

.image-delete-btn:hover {
  background: rgba(220, 38, 38, 1);
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Dark mode */
body.dark-mode .image-edit-btn {
  background: rgba(59, 130, 246, 0.8);
}

body.dark-mode .image-delete-btn {
  background: rgba(239, 68, 68, 0.8);
}

/* =====================================================================
   IMAGE EDIT MODAL
   ===================================================================== */

.image-edit-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-edit-modal.active {
  opacity: 1;
}

.image-edit-content {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.image-edit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.image-edit-header h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
}

.image-edit-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6b7280;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.image-edit-close:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.image-edit-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.image-edit-preview {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-edit-preview img {
  width: 100%;
  height: auto;
  display: block;
}

.image-edit-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-edit-field label {
  font-weight: 600;
  font-size: 14px;
  color: #374151;
}

.image-edit-field input[type="text"],
.image-edit-field textarea {
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
}

.image-edit-field input[type="text"]:focus,
.image-edit-field textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.image-edit-field textarea {
  resize: vertical;
  min-height: 80px;
}

.image-edit-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.image-edit-btn {
  flex: 1;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.image-edit-btn-cancel {
  background: #f3f4f6;
  color: #374151;
}

.image-edit-btn-cancel:hover {
  background: #e5e7eb;
}

.image-edit-btn-submit {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.image-edit-btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.image-edit-btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Dark mode */
body.dark-mode .image-edit-content {
  background: #1f2937;
}

body.dark-mode .image-edit-header h3 {
  color: #f9fafb;
}

body.dark-mode .image-edit-close:hover {
  background: #374151;
  color: #f9fafb;
}

body.dark-mode .image-edit-field label {
  color: #e5e7eb;
}

body.dark-mode .image-edit-field input[type="text"],
body.dark-mode .image-edit-field textarea {
  background: #374151;
  border-color: #4b5563;
  color: #f9fafb;
}

body.dark-mode .image-edit-btn-cancel {
  background: #374151;
  color: #e5e7eb;
}

body.dark-mode .image-edit-btn-cancel:hover {
  background: #4b5563;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .image-edit-controls {
    opacity: 1;
  }
  
  .image-edit-btn,
  .image-delete-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

/* Кнопка редагування блоку на заголовку */
.header-block-edit-btn {
  position: absolute;
  right: -120px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  border: 2px solid white;
  border-radius: 10px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
  z-index: 10;
  font-size: 12px;
  font-weight: 700;
  color: white;
  font-family: 'Inter', sans-serif;
}

.header-block-edit-btn:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.5);
}

.header-block-edit-btn svg {
  width: 16px;
  height: 16px;
  stroke: white;
  stroke-width: 2;
  fill: none;
}

#show_article_text h2,
#show_article_text h3,
#show_article_text h4 {
  position: relative;
}

#show_article_text h2:hover .header-block-edit-btn,
#show_article_text h3:hover .header-block-edit-btn,
#show_article_text h4:hover .header-block-edit-btn {
  opacity: 1;
}

/* Block editing container */
.header-block-editing {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 3px solid #3b82f6;
  border-radius: 12px;
  padding: 24px;
  margin: 24px 0;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
}

.block-edit-header {
  margin-bottom: 16px;
}

.block-edit-header h4 {
  margin: 0 0 8px 0;
  color: #1e293b;
  font-size: 18px;
  font-weight: 700;
}

.block-edit-hint {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  font-style: italic;
}

.block-edit-textarea {
  width: 100%;
  min-height: 400px;
  padding: 16px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  margin-bottom: 16px;
  background: #1e293b;
  color: #e2e8f0;
  tab-size: 2;
}

.block-edit-textarea::selection {
  background: #3b82f6;
  color: white;
}

.block-edit-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.block-edit-save,
.block-edit-cancel {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.block-edit-save {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.block-edit-save:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.block-edit-cancel {
  background: #f1f5f9;
  color: #475569;
}

.block-edit-cancel:hover {
  background: #e2e8f0;
}

.header-block-editing.block-edit-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Dark mode */
body.dark-mode .header-block-editing {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: #3b82f6;
}

body.dark-mode .block-edit-header h4 {
  color: #f8fafc;
}

body.dark-mode .block-edit-hint {
  color: #cbd5e1;
}

body.dark-mode .block-edit-textarea {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}

body.dark-mode .block-edit-cancel {
  background: #334155;
  color: #e2e8f0;
}

body.dark-mode .block-edit-cancel:hover {
  background: #475569;
}

/* Mobile */
@media (max-width: 768px) {
  .header-block-edit-btn {
    right: -100px;
    font-size: 11px;
    padding: 6px 10px;
  }
  
  .header-block-edit-btn svg {
    width: 14px;
    height: 14px;
  }
  
  .header-block-editing {
    padding: 16px;
  }
  
  .block-edit-textarea {
    font-size: 12px;
  }
}

.paragraph-edit-warning {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-left: 4px solid #f59e0b;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #92400e;
  font-family: 'Inter', sans-serif;
}

.paragraph-edit-warning i {
  font-size: 20px;
  color: #f59e0b;
}

/* =====================================================================
   COMPACT / MINIMALIST READING OVERRIDES (2026 redesign)
   Додано в КІНЕЦЬ файлу навмисно: перекриває попередні правила
   (та сама специфічність → пізніше у файлі = виграє).
   Мета: компактний, мінімалістичний, зручний для читання текст —
   особливо на телефоні; менші відступи у списках; знешкодження
   легасі-inline font-size, через які старі статті виглядають велетенськими.
   ===================================================================== */

/* ----- база / десктоп: спокійніше й компактніше ----- */
#article_content_text {
  padding: 36px 40px;
  border-radius: 16px;
  box-shadow: 0 2px 16px rgba(15, 23, 42, 0.06);
}

#show_article_text {
  font-size: 16.5px;
  line-height: 1.65;
  letter-spacing: 0;
}

#show_article_text p {
  font-size: 16.5px;
  line-height: 1.65;
  margin-bottom: 16px;
}

/* заголовки — менші, без важкого градієнт-бруса */
#show_article_text h2 {
  font-size: 25px;
  font-weight: 800;
  margin-top: 36px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  letter-spacing: -0.02em;
}
#show_article_text h2::after { width: 44px; height: 3px; }

#show_article_text h3 {
  font-size: 20px;
  font-weight: 700;
  margin-top: 26px;
  margin-bottom: 10px;
}
#show_article_text h4 {
  font-size: 17px;
  font-weight: 700;
  margin-top: 20px;
  margin-bottom: 8px;
}

/* ----- списки: компактні відступи ----- */
#show_article_text ul,
#show_article_text ol {
  margin: 14px 0;
  padding-left: 22px;
}
#show_article_text ul li,
#show_article_text ol li {
  font-size: 16.5px;
  line-height: 1.55;
  margin-bottom: 6px;
  padding-left: 6px;
}
#show_article_text ul ul,
#show_article_text ol ol,
#show_article_text ul ol,
#show_article_text ol ul {
  margin: 6px 0;
  padding-left: 18px;
}
#show_article_text li > p { margin-bottom: 6px; }
#show_article_text ul li::marker { font-size: 1em; }

/* ----- планшет / телефон ----- */
@media (max-width: 768px) {
  #article_content_text { padding: 18px 16px; border-radius: 14px; }

  #show_article_text,
  #show_article_text p,
  #show_article_text ul li,
  #show_article_text ol li {
    font-size: 15px;
    line-height: 1.55;
  }
  #show_article_text p { margin-bottom: 13px; }

  #show_article_text ul,
  #show_article_text ol { margin: 12px 0; padding-left: 20px; }
  #show_article_text ul li,
  #show_article_text ol li { margin-bottom: 5px; padding-left: 5px; }

  #show_article_text h2 { font-size: 21px; margin-top: 28px; margin-bottom: 12px; padding-bottom: 8px; }
  #show_article_text h3 { font-size: 18px; margin-top: 22px; margin-bottom: 9px; }
  #show_article_text h4 { font-size: 16px; margin-top: 18px; margin-bottom: 7px; }

  /* Легасі-контент: знешкодити зашиті inline font-size / <font size>, щоб не
     роздувало текст. Чіпаємо лише носії тексту (НЕ заголовки — ними керують
     правила вище). */
  #show_article_text p[style*="font-size"],
  #show_article_text li[style*="font-size"],
  #show_article_text span[style*="font-size"],
  #show_article_text div[style*="font-size"],
  #show_article_text font[size] {
    font-size: 15px !important;
    line-height: 1.55 !important;
  }
}

@media (max-width: 480px) {
  #article_content_text { padding: 14px 13px; }

  #show_article_text,
  #show_article_text p,
  #show_article_text ul li,
  #show_article_text ol li { font-size: 14.5px; }

  #show_article_text h2 { font-size: 20px; }
  #show_article_text h3 { font-size: 17px; }
  #show_article_text h4 { font-size: 15.5px; }

  #show_article_text p[style*="font-size"],
  #show_article_text li[style*="font-size"],
  #show_article_text span[style*="font-size"],
  #show_article_text div[style*="font-size"],
  #show_article_text font[size] {
    font-size: 14.5px !important;
  }
}


