/* ============================================================
   ИСПРАВЛЕННЫЙ style-animations.css
   Версия 2.1 - Очищена от дублирования стилей
============================================================ */

/* =========================
   1. АНИМАЦИЯ ПОЯВЛЕНИЯ СЕКЦИЙ
========================= */

.fade-in-section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-section.visible {
  opacity: 1;
  transform: translateY(0);
}


/* =========================
   2. MICRO-INTERACTIONS - Анимированное подчёркивание ссылок
========================= */

.animated-link {
  position: relative;
  display: inline-block;
  text-decoration: none;
  transition: color 0.3s ease;
}

/* Подчёркивание снизу */
.animated-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-color, #005baa);
  transition: width 0.3s ease;
}

.animated-link:hover::after {
  width: 100%;
}


/* =========================
   3. УЛУЧШЕННЫЙ POPUP - СВЕТЛЫЙ ФОН
========================= */

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Светлый полупрозрачный фон */
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px); /* размытие фона */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, backdrop-filter 0.3s ease;
}

.popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

.popup-content {
  background: white;
  padding: 2.5rem;
  border-radius: 16px;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: translateY(-50px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  opacity: 0;
}

.popup-overlay.active .popup-content {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Кнопка закрытия */
.popup-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  font-size: 2rem;
  color: #333;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.popup-close:hover {
  transform: scale(1.1) rotate(90deg);
  background: #f44336;
  color: white;
}

/* Loader внутри popup */
.popup-loader {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  font-size: 1.1rem;
  color: var(--primary-color);
}

.popup-loader::after {
  content: '';
  width: 40px;
  height: 40px;
  margin-left: 15px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Улучшенное изображение в popup */
.popup-image-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.popup-image-container img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}


/* =========================
   4. СКЕЛЕТОН ДЛЯ LAZY-LOADING ИЗОБРАЖЕНИЙ
========================= */

.lazy-loading {
  position: relative;
  background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
  animation: pulse 1.5s ease-in-out infinite;
  min-height: 200px;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.lazy-loading.loaded {
  animation: none;
  background: none;
}


/* =========================
   5. УЛУЧШЕННЫЕ HOVER ЭФФЕКТЫ
========================= */

button, .btn {
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

button:hover, .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

button:active, .btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.doc-thumb {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.doc-thumb:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
}

.doc-thumb:active {
  transform: translateY(-4px) scale(1);
}

img {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

img:hover {
  opacity: 0.95;
}


/* =========================
   6. ПЛАВНЫЙ СКРОЛЛ
========================= */

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* =========================
   7. FOCUS STYLES
========================= */

*:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 2px;
  border-radius: 4px;
}

*:focus:not(:focus-visible) {
  outline: none;
}


/* =========================
   8. FAQ АККОРДЕОН - ИСПРАВЛЕНО
========================= */

.faq-item {
  border-bottom: 1px solid #e0e0e0;
  transition: background-color 0.3s ease;
}

.faq-item:hover {
  background-color: #f9f9f9;
}

.faq-question {
  cursor: pointer;
  padding: 1.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: color 0.3s ease;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-size: 1.05rem;
  font-weight: 500;
}

.faq-question:hover {
  color: var(--accent-color);
}

/* ИСПРАВЛЕНО: Стрелка через ::after (не конфликтует с HTML) */
.faq-question::after {
  content: '▼';
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  color: var(--accent-color);
  flex-shrink: 0;
  margin-left: 1rem;
}

.faq-item.active .faq-question::after {
  transform: rotate(180deg);
}

/* Скрыть <span class="arrow"> из HTML если он есть */
.faq-question .arrow {
  display: none;
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, padding 0.4s ease, opacity 0.3s ease;
  padding: 0 1rem;  /* Одинаковый padding сверху и снизу */
}

.faq-item.active .faq-answer {
  max-height: 1000px !important;
  opacity: 1 !important;
  padding: 1rem 1rem !important;  /* Одинаковые отступы сверху и снизу */
}


/* =========================
   9. HEADER ФОН - УБРАН КОНФЛИКТ
========================= */

/* УДАЛЕНО: background для header - чтобы не конфликтовать с основным CSS */
/* Если нужен градиент - раскомментируйте и удалите из style.css */
/*
header {
  background: linear-gradient(135deg, var(--primary-color) 0%, #004080 100%);
}
*/


/* =========================
   10. TOOLTIP
========================= */

[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: 0.85rem;
  white-space: nowrap;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
}

[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
}

[data-tooltip]:hover::after {
  transform: translateX(-50%) translateY(-12px);
}


/* =========================
   11. CTA BUTTON
========================= */

.cta-sticky {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  animation: fadeInUp 0.5s ease 0.5s both;
}

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

.cta-button {
  background: linear-gradient(135deg, #005baa 0%, #0066cc 100%);
  color: white;
  padding: 14px 28px;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0 4px 20px rgba(0, 91, 170, 0.4);
  display: inline-block;
  transition: all 0.3s ease;
  will-change: transform, box-shadow;
  backface-visibility: hidden;
}

.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 30px rgba(0, 91, 170, 0.6);
}

.cta-button:active {
  transform: translateY(-1px);
}


/* =========================
   12. PRINT STYLES
========================= */

@media print {
  .popup-overlay,
  .cta-sticky,
  header nav,
  .social-links {
    display: none !important;
  }
  
  .about-collapsible {
    max-height: none !important;
    opacity: 1 !important;
  }
  
  * {
    color: #000 !important;
    background: #fff !important;
  }
  
  a {
    text-decoration: underline;
  }
}


/* =========================
   13. DARK MODE
========================= */

@media (prefers-color-scheme: dark) {
  :root {
    --bg-light: #1a1a1a;
    --text-main: #e0e0e0;
    --primary-color: #004080;
  }
  
  body {
    background: var(--bg-light);
    color: var(--text-main);
  }
  
  .popup-overlay {
    background: rgba(0, 0, 0, 0.8);
  }
  
  .popup-content {
    background: #2a2a2a;
    color: #e0e0e0;
  }
  
  .popup-close {
    background: rgba(50, 50, 50, 0.9);
    color: #e0e0e0;
  }
  
  .faq-item:hover {
    background-color: #333;
  }
}


/* =========================
   14. RESPONSIVE
========================= */

@media (max-width: 992px) {
  .fade-in-section {
    transform: translateY(20px);
  }
  
  .doc-thumb:hover {
    transform: translateY(-4px) scale(1.01);
  }
  
  .popup-content {
    padding: 2rem;
    max-width: 90%;
  }
}

@media (max-width: 576px) {
  .fade-in-section {
    opacity: 1;
    transform: none;
  }
  
  .doc-thumb:hover {
    transform: none;
  }
  
  .cta-sticky {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }
  
  .cta-button {
    width: 100%;
    text-align: center;
  }
  
  .popup-content {
    padding: 1.5rem;
    max-width: 95%;
    max-height: 95vh;
  }
  
  .popup-close {
    width: 35px;
    height: 35px;
    font-size: 1.5rem;
  }
}


/* =========================
   15. PERFORMANCE
========================= */

.popup-overlay,
.popup-content,
.animated-link::after,
.doc-thumb,
.fade-in-section {
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
}

.fade-in-section.visible {
  will-change: auto;
}


/* =========================
   16. ACCESSIBILITY
========================= */

@media (max-width: 768px) {
  button,
  a,
  .faq-question {
    min-height: 44px;
    min-width: 44px;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

@media (prefers-contrast: high) {
  * {
    border-width: 2px !important;
  }
  
  .animated-link::after {
    height: 3px;
  }
}


/* =========================
   17. THUMBNAIL CONTAINER (для документов)
========================= */

.thumbnail-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.doc-thumb {
  background: transparent;  /* Прозрачный фон */
  border: none;             /* Убрана рамка */
  border-radius: 8px;
  padding: 0;               /* Убран padding */
  cursor: pointer;
  transition: all 0.3s ease;
}

.doc-thumb img {
  width: 100%;
  height: auto;
  border-radius: 4px;
}

@media (max-width: 768px) {
  .thumbnail-container {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
  }
}


/* =========================
   КОНЕЦ
========================= */
