/**
 * Современный дизайн для doctor.ru
 * Медицинский портал - адаптивный дизайн
 */

/* ============================================
   CSS ПЕРЕМЕННЫЕ (Дизайн-система)
   ============================================ */
:root {
  /* Цвета */
  --primary-color: #2563eb;
  --primary-dark: #1e40af;
  --primary-light: #3b82f6;
  --secondary-color: #10b981;
  --accent-color: #f59e0b;

  /* Текст */
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;

  /* Фон */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;

  /* Границы */
  --border-color: #e5e7eb;
  --border-color-dark: #d1d5db;

  /* Тени */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Скругления */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Переходы */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Размеры */
  --max-width: 1280px;
  --content-width: 800px;
  --header-height: 72px;
}

/* ============================================
   RESET & БАЗОВЫЕ СТИЛИ
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
               'Ubuntu', 'Cantarell', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  font-size: 16px;
  overflow-x: hidden;
}

/* Типографика */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: 1em;
  line-height: 1.7;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--primary-dark);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

/* ============================================
   ХЕДЕР (Header)
   ============================================ */
.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base);
}

.header.scrolled {
  box-shadow: var(--shadow-md);
}

.header-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  gap: 20px;
}

/* Логотип */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
  transition: transform var(--transition-base);
}

.logo:hover {
  color: var(--primary-color);
  transform: translateY(-1px);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* Поиск */
.search-bar {
  flex: 1;
  max-width: 500px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 12px 48px 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 15px;
  background: var(--bg-secondary);
  transition: all var(--transition-base);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-input::placeholder {
  color: var(--text-light);
}

.search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-btn:hover {
  color: var(--primary-color);
}

/* Навигация */
.nav {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-base);
  white-space: nowrap;
  position: relative;
}

.nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary-color);
  transition: width var(--transition-base);
}

.nav a:hover::after,
.nav a.active::after {
  width: 100%;
}

.nav a:hover,
.nav a.active {
  color: var(--primary-color);
}

/* Мобильное меню */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--text-primary);
  transition: color var(--transition-base);
}

.mobile-menu-btn:hover {
  color: var(--primary-color);
}

.mobile-nav {
  display: none;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 16px 0;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mobile-nav.active {
  display: block;
}

.mobile-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-nav li {
  border-bottom: 1px solid var(--bg-tertiary);
}

.mobile-nav li:last-child {
  border-bottom: none;
}

.mobile-nav a {
  display: block;
  padding: 12px 20px;
  font-size: 16px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.mobile-nav a:hover {
  background: var(--bg-secondary);
  color: var(--primary-color);
  padding-left: 24px;
}

/* ============================================
   КОНТЕЙНЕРЫ
   ============================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.content-wrapper {
  padding: 32px 0;
}

.page-content {
  max-width: var(--content-width);
  margin: 0 auto;
}

/* ============================================
   HERO СЕКЦИЯ
   ============================================ */
.hero {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 48px 0;
  margin-bottom: 48px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="2" fill="white" opacity="0.1"/></svg>');
  opacity: 0.3;
}

.hero-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.2;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-subtitle {
  font-size: 18px;
  opacity: 0.95;
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
  animation: fadeInUp 0.6s ease backwards;
}

.stat-item:nth-child(1) { animation-delay: 0.1s; }
.stat-item:nth-child(2) { animation-delay: 0.2s; }
.stat-item:nth-child(3) { animation-delay: 0.3s; }

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

.stat-number {
  font-size: 32px;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  opacity: 0.9;
}

.stat-new {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

/* ============================================
   СЕКЦИИ
   ============================================ */
.section {
  margin-bottom: 64px;
}

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

.section-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  position: relative;
  padding-left: 16px;
}

.section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 28px;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
}

.section-link {
  font-size: 15px;
  font-weight: 500;
  color: var(--primary-color);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap var(--transition-base);
}

.section-link:hover {
  gap: 8px;
}

/* ============================================
   КАРТОЧКИ СТАТЕЙ
   ============================================ */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.article-card {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-slow);
  border: 1px solid var(--border-color);
  position: relative;
}

.article-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  transform: scaleX(0);
  transition: transform var(--transition-base);
}

.article-card:hover::before {
  transform: scaleX(1);
}

.article-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  border-color: var(--primary-light);
}

.article-content {
  padding: 24px;
}

.article-author {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.author-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--border-color);
  transition: border-color var(--transition-base);
}

.article-card:hover .author-avatar {
  border-color: var(--primary-color);
}

.author-avatar img,
.author-avatar svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-avatar svg {
  color: var(--text-light);
}

.author-info {
  flex: 1;
  min-width: 0;
}

.author-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.author-role {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.article-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--transition-base);
}

.article-card:hover .article-title {
  color: var(--primary-color);
}

.article-date-small {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 8px;
}

/* ============================================
   ВОПРОСЫ
   ============================================ */
.questions-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.question-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all var(--transition-base);
  display: block;
  position: relative;
  overflow: hidden;
}

.question-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary-color);
  transform: scaleY(0);
  transition: transform var(--transition-base);
}

.question-card:hover::before {
  transform: scaleY(1);
}

.question-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
  transform: translateX(4px);
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.question-category {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-tertiary);
  color: var(--primary-color);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  transition: all var(--transition-base);
}

.question-card:hover .question-category {
  background: var(--primary-color);
  color: white;
}

.question-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.question-doctor {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.doctor-icon {
  width: 24px;
  height: 24px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  transition: all var(--transition-base);
}

.question-card:hover .doctor-icon {
  background: var(--primary-color);
  color: white;
}

/* ============================================
   КАТЕГОРИИ
   ============================================ */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.category-tag {
  display: block;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  text-align: center;
  transition: all var(--transition-base);
  font-weight: 500;
}

.category-tag:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ============================================
   СТРАНИЦА ВОПРОСА
   ============================================ */
.breadcrumb {
  padding: 16px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-base);
}

.breadcrumb a:hover {
  color: var(--primary-color);
}

.breadcrumb-separator {
  margin: 0 8px;
  color: var(--text-light);
}

.question-page {
  max-width: var(--content-width);
  margin: 0 auto;
}

.question-header {
  margin-bottom: 32px;
}

.question-category-badge {
  display: inline-block;
  padding: 6px 16px;
  background: var(--bg-tertiary);
  color: var(--primary-color);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  transition: all var(--transition-base);
}

.question-category-badge:hover {
  background: var(--primary-color);
  color: white;
}

.question-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 24px;
}

.doctor-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 24px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 32px;
  transition: all var(--transition-base);
}

.doctor-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.doctor-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  border: 3px solid var(--border-color);
  transition: border-color var(--transition-base);
}

.doctor-card:hover .doctor-avatar {
  border-color: var(--primary-color);
}

.doctor-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doctor-info {
  flex: 1;
}

.doctor-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.doctor-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.doctor-name a {
  color: var(--text-primary);
  text-decoration: none;
}

.doctor-name a:hover {
  color: var(--primary-color);
}

.doctor-position {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.answer-content {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px;
  margin-bottom: 32px;
  line-height: 1.8;
  font-size: 17px;
  color: var(--text-primary);
}

.answer-content p {
  margin-bottom: 16px;
}

.answer-content a {
  color: var(--primary-color);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.answer-content a:hover {
  text-decoration: none;
  color: var(--primary-dark);
}

.answer-content ul,
.answer-content ol {
  margin: 16px 0;
  padding-left: 24px;
}

.answer-content li {
  margin-bottom: 8px;
}

.answer-content strong {
  font-weight: 600;
  color: var(--text-primary);
}

.answer-content em,
.answer-content i {
  font-style: italic;
}

/* Похожие вопросы */
.related-questions {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 32px;
  border: 1px solid var(--border-color);
}

.related-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.related-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.related-list li:last-child {
  border-bottom: none;
}

.related-list a {
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: color var(--transition-base);
}

.related-list a:hover {
  color: var(--primary-color);
}

.related-icon {
  flex-shrink: 0;
  color: var(--primary-color);
  margin-top: 2px;
}

/* Теги */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.tag {
  padding: 6px 14px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-size: 13px;
  text-decoration: none;
  transition: all var(--transition-base);
  border: 1px solid transparent;
}

.tag:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

/* Навигация между вопросами */
.navigation-buttons {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.nav-button {
  flex: 1;
  min-width: 200px;
  padding: 14px 24px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.nav-button:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.nav-button-primary {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.nav-button-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background: var(--text-primary);
  color: rgba(255, 255, 255, 0.8);
  margin-top: 80px;
}

.footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 20px 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 48px 32px;
  margin-bottom: 48px;
}

.footer-section h3 {
  color: white;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 12px;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  transition: color var(--transition-base);
}

.footer-links a:hover {
  color: white;
}

.footer-description {
  line-height: 1.6;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 16px;
}

.footer-social {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.footer-social a {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all var(--transition-base);
}

.footer-social a:hover {
  background: var(--primary-color);
  transform: translateY(-2px);
}

.footer-bottom {
  padding-top: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 14px;
}

.footer-copyright {
  color: rgba(255, 255, 255, 0.6);
}

.footer-age {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.popular-questions {
  margin-top: 16px;
}

.popular-questions li {
  margin-bottom: 8px;
  padding-left: 16px;
  position: relative;
}

.popular-questions li:before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--secondary-color);
}

/* ============================================
   УТИЛИТЫ
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden { display: none; }
.visible { display: block; }

/* Скелетон-загрузчик */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */
@media (max-width: 968px) {
  .nav {
    display: none;
  }

  .mobile-menu-btn {
    display: block;
  }

  .search-bar {
    max-width: none;
    order: 3;
    flex-basis: 100%;
  }

  .header-top {
    flex-wrap: wrap;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero-subtitle {
    font-size: 16px;
  }

  .stat-number {
    font-size: 24px;
  }

  .hero-stats {
    gap: 24px;
  }

  .section-title {
    font-size: 24px;
  }

  .articles-grid {
    grid-template-columns: 1fr;
  }

  .categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .navigation-buttons {
    flex-direction: column;
  }

  .nav-button {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer-content {
    padding: 32px 20px 24px;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  .question-title {
    font-size: 24px;
  }

  .doctor-card {
    flex-direction: column;
    text-align: center;
  }

  .doctor-avatar {
    margin: 0 auto;
  }

  .answer-content {
    padding: 20px;
    font-size: 16px;
  }
}

@media (max-width: 640px) {
  .header-top {
    padding: 12px 0;
  }

  .logo {
    font-size: 20px;
  }

  .logo-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .search-input {
    font-size: 14px;
    padding: 10px 44px 10px 14px;
  }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.5rem; }
}

/* ============================================
   ДОПОЛНИТЕЛЬНЫЕ КОМПОНЕНТЫ
   ============================================ */

/* Заголовок страницы */
.page-header {
  margin-bottom: 40px;
  text-align: center;
}

.page-title {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.2;
}

.page-description {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Список врачей (компактный) */
.doctors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.doctor-card-compact {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-base);
}

.doctor-card-compact:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--primary-color);
}

.doctor-card-link {
  display: flex;
  gap: 16px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
}

.doctor-avatar-compact {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
}

.doctor-avatar-compact img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doctor-card-content {
  flex: 1;
  min-width: 0;
}

.doctor-name-compact {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doctor-about {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doctor-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-light);
}

.doctor-stats svg {
  flex-shrink: 0;
}

.doctor-social {
  margin-top: 8px;
  color: var(--primary-color);
}

/* Список статей */
.articles-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.article-list-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all var(--transition-base);
}

.article-list-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
}

.article-list-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.article-list-meta {
  margin-bottom: 12px;
}

.article-date {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.article-list-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.4;
  transition: color var(--transition-base);
}

.article-list-link:hover .article-list-title {
  color: var(--primary-color);
}

.article-list-excerpt {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.article-list-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--primary-color);
  transition: gap var(--transition-base);
}

.article-list-link:hover .read-more {
  gap: 10px;
}

.article-list-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.article-list-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.article-list-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-list-author-name {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Кнопки */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-secondary);
  border-color: var(--border-color-dark);
}

.btn-large {
  padding: 16px 32px;
  font-size: 16px;
}

/* Пагинация */
.pagination-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 48px;
}

/* Профиль врача */
.doctor-profile {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 48px;
}

.doctor-profile-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.doctor-profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
}

.doctor-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.doctor-profile-info {
  flex: 1;
}

.doctor-profile-name {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.2;
}

.doctor-profile-name a {
  color: var(--text-primary);
  text-decoration: none;
}

.doctor-profile-name a:hover {
  color: var(--primary-color);
}

.doctor-profile-position {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.doctor-profile-position strong {
  color: var(--text-primary);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.doctor-profile-social {
  margin-top: 16px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  transition: all var(--transition-base);
}

.social-link:hover {
  background: var(--primary-color);
  color: white;
}

/* Разделитель дат */
.date-separator {
  padding: 16px 0 8px;
  margin: 24px 0 16px;
  border-top: 2px solid var(--border-color);
}

.date-separator time {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Просмотр статьи */
.article-view {
  max-width: 800px;
  margin: 0 auto;
}

.article-view-header {
  margin-bottom: 32px;
}

.article-view-title {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.article-category-link {
  display: inline-block;
  padding: 6px 16px;
  background: var(--bg-tertiary);
  color: var(--primary-color);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 16px;
  transition: all var(--transition-base);
}

.article-category-link:hover {
  background: var(--primary-color);
  color: white;
}

.article-author-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 32px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.article-author-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
}

.article-author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-author-info {
  flex: 1;
}

.article-author-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  margin-bottom: 4px;
  display: block;
}

.article-author-name:hover {
  color: var(--primary-color);
}

.article-author-about {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.article-author-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  transition: all var(--transition-base);
}

.article-author-social:hover {
  background: var(--primary-color);
  color: white;
}

.article-video {
  width: 100%;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.article-video-label {
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.video-responsive {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-tertiary);
}

.video-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.article-view-content {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px;
  margin-bottom: 32px;
  line-height: 1.8;
  font-size: 17px;
  color: var(--text-primary);
}

.article-view-content p {
  margin-bottom: 16px;
}

.article-view-content a {
  color: var(--primary-color);
  text-decoration: underline;
}

.article-view-content a:hover {
  text-decoration: none;
}

.article-view-content ul,
.article-view-content ol {
  margin: 16px 0;
  padding-left: 24px;
}

.article-view-content li {
  margin-bottom: 8px;
}

.article-view-content strong {
  font-weight: 600;
}

.article-view-content em,
.article-view-content i {
  font-style: italic;
}

.article-view-content h2,
.article-view-content h3 {
  margin-top: 32px;
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* Результаты поиска */
.search-results {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px;
  min-height: 400px;
}

/* ============================================
   АДАПТИВНОСТЬ ДЛЯ НОВЫХ КОМПОНЕНТОВ
   ============================================ */
@media (max-width: 768px) {
  .page-title {
    font-size: 28px;
  }

  .page-description {
    font-size: 16px;
  }

  .doctors-grid {
    grid-template-columns: 1fr;
  }

  .doctor-card-link {
    flex-direction: column;
    text-align: center;
  }

  .doctor-avatar-compact {
    margin: 0 auto;
  }

  .doctor-profile {
    padding: 20px;
  }

  .doctor-profile-header {
    flex-direction: column;
    text-align: center;
  }

  .doctor-profile-avatar {
    margin: 0 auto;
  }

  .doctor-profile-name {
    font-size: 24px;
  }

  .article-view-title {
    font-size: 28px;
  }

  .article-author-card {
    flex-direction: column;
    text-align: center;
  }

  .article-author-avatar {
    margin: 0 auto;
  }

  .article-view-content {
    padding: 20px;
    font-size: 16px;
  }

  .search-results {
    padding: 20px;
  }
}

/* ============================================
   PRINT СТИЛИ
   ============================================ */
@media print {
  .header,
  .footer,
  .navigation-buttons,
  .mobile-menu-btn,
  .search-bar,
  .btn-primary,
  .btn-secondary {
    display: none;
  }

  body {
    background: white;
  }

  .article-card,
  .question-card,
  .doctor-card-compact {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
}
