/* ========== GLOSSARY HERO ========== */
.glossary-hero {
  padding: var(--spacing-4xl) 0 var(--spacing-4xl);
  text-align: center;
  max-width: 1400px;
  margin: 0 auto;
}

.glossary-hero__title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: var(--spacing-xl);
  background: linear-gradient(135deg, #4a9fd8 0%, #4caf50 50%, #8b5dff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  text-shadow: 0 4px 20px rgba(74, 159, 216, 0.3);
}

.glossary-hero__description {
  font-size: clamp(1rem, 2vw, 1.25rem);
  line-height: 1.7;
  max-width: 1200px; /* Изменил с 800px на 1200px для соответствия */
  margin: 0 auto var(--spacing-4xl);
  color: var(--color-text-secondary);
  font-weight: 400;
  padding: 0 var(--spacing-lg); /* Добавлено для мобильных */
}


/* ========== PREMIUM SEARCH BAR ========== */
.glossary-search-wrapper {
  max-width: 1200px; /* Изменил с 900px на 1200px для соответствия */
  width: 100%;
  margin: 0 auto var(--spacing-4xl);
  padding: 0 var(--spacing-lg); /* Добавил горизонтальные отступы */
  position: relative;
}

.glossary-search {
  position: relative;
  display: flex;
  align-items: center;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 2px solid rgba(74, 159, 216, 0.2);
  border-radius: 24px;
  padding: 8px 12px;
  /* margin: 0 var(--spacing-lg); УБРАЛ - теперь отступы в wrapper */
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 0 rgba(74, 159, 216, 0);
  position: relative;
  overflow: hidden;
}


/* Animated gradient border effect */
.glossary-search::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, 
    #4a9fd8, 
    #4caf50, 
    #8b5dff, 
    #4a9fd8
  );
  background-size: 300% 300%;
  border-radius: 24px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
  animation: gradientShift 6s ease infinite;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.glossary-search:hover {
  border-color: rgba(74, 159, 216, 0.4);
  transform: translateY(-4px) scale(1.01);
  box-shadow: 
    0 20px 60px rgba(74, 159, 216, 0.25),
    0 8px 24px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 0 0 rgba(74, 159, 216, 0.4);
}

.glossary-search:focus-within {
  border-color: transparent;
  transform: translateY(-6px) scale(1.02);
  box-shadow: 
    0 24px 80px rgba(74, 159, 216, 0.35),
    0 12px 32px rgba(74, 159, 216, 0.2),
    inset 0 2px 4px rgba(255, 255, 255, 0.1),
    0 0 0 4px rgba(74, 159, 216, 0.15);
}

.glossary-search:focus-within::before {
  opacity: 1;
}

/* Glowing light effect */
.glossary-search::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(74, 159, 216, 0.15) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.glossary-search:focus-within::after {
  opacity: 1;
}

.glossary-search__icon {
  color: var(--color-text-secondary);
  flex-shrink: 0;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.glossary-search__icon--left {
  margin-left: var(--spacing-md);
  margin-right: var(--spacing-md);
  width: 24px;
  height: 24px;
}

.glossary-search:hover .glossary-search__icon--left {
  color: var(--color-accent);
  transform: scale(1.15) rotate(90deg);
}

.glossary-search:focus-within .glossary-search__icon--left {
  color: #4caf50;
  transform: scale(1.2) rotate(360deg);
  filter: drop-shadow(0 0 8px rgba(76, 175, 80, 0.6));
}

.glossary-search__input {
  flex: 1;
  padding: var(--spacing-lg) var(--spacing-md);
  font-size: clamp(1rem, 2vw, 1.125rem);
  font-family: var(--font-main);
  font-weight: 500;
  color: var(--color-text-primary);
  background: transparent;
  border: none;
  outline: none;
  min-height: 56px;
  letter-spacing: 0.01em;
}

.glossary-search__input::placeholder {
  color: var(--color-text-secondary);
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.glossary-search:hover .glossary-search__input::placeholder {
  opacity: 0.8;
}

.glossary-search:focus-within .glossary-search__input::placeholder {
  opacity: 0.4;
}

.glossary-search__clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-right: var(--spacing-xs);
  padding: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  backdrop-filter: blur(10px);
}

.glossary-search__clear:hover {
  background: linear-gradient(135deg, rgba(255, 82, 82, 0.2), rgba(255, 82, 82, 0.1));
  border-color: rgba(255, 82, 82, 0.3);
  color: #ff5252;
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 4px 16px rgba(255, 82, 82, 0.3);
}

.glossary-search__clear:active {
  transform: rotate(90deg) scale(0.95);
}

.glossary-search__hint {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  justify-content: center;
  margin-top: var(--spacing-md);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.glossary-search-wrapper:hover .glossary-search__hint {
  opacity: 0.9;
}

.glossary-search__kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 var(--spacing-sm);
  font-size: 0.8125rem;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Courier New', monospace;
  font-weight: 700;
  color: var(--color-text-primary);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* ========== PREMIUM ALPHABET NAVIGATION ========== */
.glossary-alphabet-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2xl);
  margin-bottom: var(--spacing-4xl);
  padding: 0 var(--spacing-lg);
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}


.glossary-alphabet-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  align-items: center;
  position: relative;
}

/* Section divider line */
.glossary-alphabet-section::after {
  content: '';
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(74, 159, 216, 0.5), transparent);
  opacity: 0.3;
}

.glossary-alphabet-section:last-child::after {
  display: none;
}

.glossary-alphabet-label {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: var(--spacing-xs) var(--spacing-lg);
  background: linear-gradient(135deg, rgba(74, 159, 216, 0.1), rgba(76, 175, 80, 0.1));
  border-radius: 20px;
  border: 1px solid rgba(74, 159, 216, 0.2);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(74, 159, 216, 0.1);
}

.glossary-alphabet {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-sm);
  max-width: 1000px;
  padding: var(--spacing-lg);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.glossary-alphabet__btn {
  position: relative;
  min-width: 52px;
  height: 52px;
  padding: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Shimmer effect on hover */
.glossary-alphabet__btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.2), 
    transparent
  );
  transition: left 0.5s ease;
}

.glossary-alphabet__btn:hover::before {
  left: 100%;
}

/* Gradient background */
.glossary-alphabet__btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #4a9fd8, #4caf50);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
  border-radius: 14px;
}

.glossary-alphabet__btn:hover {
  color: #fff;
  border-color: rgba(74, 159, 216, 0.5);
  transform: translateY(-4px) scale(1.08);
  box-shadow: 
    0 12px 32px rgba(74, 159, 216, 0.35),
    0 4px 12px rgba(0, 0, 0, 0.15),
    inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.glossary-alphabet__btn:hover::after {
  opacity: 0.3;
}

.glossary-alphabet__btn.active {
  color: #fff;
  background: linear-gradient(135deg, #4a9fd8 0%, #4caf50 100%);
  border-color: transparent;
  box-shadow: 
    0 12px 40px rgba(74, 159, 216, 0.5),
    0 4px 16px rgba(76, 175, 80, 0.3),
    inset 0 1px 2px rgba(255, 255, 255, 0.3);
  transform: translateY(-2px) scale(1.05);
}

.glossary-alphabet__btn.active::after {
  opacity: 1;
}

/* Pulse animation for active button */
@keyframes pulse {
  0%, 100% {
    box-shadow: 
      0 12px 40px rgba(74, 159, 216, 0.5),
      0 4px 16px rgba(76, 175, 80, 0.3);
  }
  50% {
    box-shadow: 
      0 12px 50px rgba(74, 159, 216, 0.6),
      0 4px 20px rgba(76, 175, 80, 0.4);
  }
}

.glossary-alphabet__btn.active {
  animation: pulse 2s ease-in-out infinite;
}

.glossary-alphabet__btn:active {
  transform: translateY(0) scale(1);
  box-shadow: 
    0 4px 16px rgba(74, 159, 216, 0.3),
    inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.glossary-alphabet__btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

/* ========== GLOSSARY TERMS ========== */
.glossary {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

.glossary-terms {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-2xl);
}

.glossary-term {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: var(--spacing-2xl);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  scroll-margin-top: 100px;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.glossary-term:hover {
  border-color: rgba(74, 159, 216, 0.3);
  box-shadow: 
    0 12px 40px rgba(74, 159, 216, 0.15),
    0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-4px);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
}

.glossary-term__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
}

.glossary-term__title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.glossary-term__category {
  flex-shrink: 0;
}

.glossary-term__content {
  font-size: var(--font-size-base);
  line-height: 1.8;
  color: var(--color-text-primary);
}

.glossary-term__content p {
  margin-bottom: var(--spacing-md);
}

.glossary-term__content strong {
  color: var(--color-accent);
  font-weight: 600;
}

.glossary-term__list {
  margin: var(--spacing-md) 0;
  padding-left: var(--spacing-xl);
}

.glossary-term__list li {
  margin-bottom: var(--spacing-sm);
  color: var(--color-text-primary);
}

.glossary-term__list li strong {
  color: var(--color-accent);
}

.glossary-term__example {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-lg);
  background: linear-gradient(135deg, rgba(74, 159, 216, 0.08), rgba(76, 175, 80, 0.08));
  border-left: 4px solid var(--color-accent);
  border-radius: 12px;
  font-size: var(--font-size-sm);
  line-height: 1.7;
  box-shadow: 0 4px 16px rgba(74, 159, 216, 0.1);
}

.glossary-term__example strong {
  color: var(--color-accent);
}

.glossary-term__footer {
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.glossary-term__related {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.glossary-term__related a {
  color: var(--color-accent);
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 500;
}

.glossary-term__related a:hover {
  color: #4caf50;
  text-decoration: underline;
}

/* ========== BADGES ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(139, 93, 255, 0.2), rgba(139, 93, 255, 0.1));
  color: #8b5dff;
  border: 1px solid rgba(139, 93, 255, 0.3);
  box-shadow: 0 2px 8px rgba(139, 93, 255, 0.2);
}

.badge--seo {
  background: linear-gradient(135deg, rgba(74, 159, 216, 0.2), rgba(74, 159, 216, 0.1));
  color: var(--color-accent);
  border-color: rgba(74, 159, 216, 0.3);
  box-shadow: 0 2px 8px rgba(74, 159, 216, 0.2);
}

.badge--analytics {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(76, 175, 80, 0.1));
  color: #4caf50;
  border-color: rgba(76, 175, 80, 0.3);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.badge--ai {
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.2), rgba(255, 152, 0, 0.1));
  color: #ff9800;
  border-color: rgba(255, 152, 0, 0.3);
  box-shadow: 0 2px 8px rgba(255, 152, 0, 0.2);
}

/* ========== NO RESULTS MESSAGE ========== */
.glossary-no-results {
  text-align: center;
  padding: var(--spacing-4xl) var(--spacing-xl);
}

.glossary-no-results__icon {
  color: var(--color-text-secondary);
  opacity: 0.4;
  margin-bottom: var(--spacing-lg);
}

.glossary-no-results__title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--spacing-md);
  color: var(--color-text-primary);
}

.glossary-no-results__text {
  font-size: var(--font-size-base);
  max-width: 500px;
  margin: 0 auto;
  color: var(--color-text-secondary);
}

/* ========== GLOSSARY CTA ========== */
.glossary-cta {
  margin-top: var(--spacing-4xl);
  padding: var(--spacing-3xl);
  background: linear-gradient(135deg, rgba(74, 159, 216, 0.1) 0%, rgba(76, 175, 80, 0.1) 100%);
  border: 1px solid rgba(74, 159, 216, 0.2);
  border-radius: 24px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(74, 159, 216, 0.15);
}

.glossary-cta__title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin-bottom: var(--spacing-md);
  color: var(--color-text-primary);
}

.glossary-cta__description {
  font-size: var(--font-size-lg);
  max-width: 600px;
  margin: 0 auto var(--spacing-xl);
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.glossary-cta__buttons {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  flex-wrap: wrap;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
  .glossary-alphabet {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .glossary-hero {
    padding: var(--spacing-3xl) 0 var(--spacing-3xl);
  }

  .glossary-hero__title {
    font-size: 2rem;
  }

  .glossary-search-wrapper {
    padding: 0 var(--spacing-md);
  }

  .glossary-search {
    border-radius: 20px;
    padding: 6px 10px;
  }

  .glossary-search__input {
    font-size: 1rem;
    min-height: 48px;
    padding: var(--spacing-md) var(--spacing-sm);
  }

  .glossary-search__hint {
    font-size: 0.75rem;
  }

  .glossary-alphabet-wrapper {
    gap: var(--spacing-xl);
    padding: 0 var(--spacing-md);
  }

  .glossary-alphabet {
    gap: var(--spacing-xs);
    padding: var(--spacing-md);
    border-radius: 20px;
  }

  .glossary-alphabet__btn {
    min-width: 44px;
    height: 44px;
    font-size: 0.9375rem;
    border-radius: 12px;
  }

  .glossary-term {
    padding: var(--spacing-xl);
    border-radius: 16px;
  }

  .glossary-cta {
    padding: var(--spacing-2xl) var(--spacing-lg);
    border-radius: 20px;
  }

  .glossary-cta__buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .glossary-cta__buttons .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .glossary-search {
    border-radius: 16px;
  }

  .glossary-search__icon--left {
    margin-left: var(--spacing-sm);
    width: 20px;
    height: 20px;
  }

  .glossary-search__input {
    font-size: 0.9375rem;
  }

  .glossary-search__clear {
    width: 36px;
    height: 36px;
  }

  .glossary-alphabet__btn {
    min-width: 40px;
    height: 40px;
    font-size: 0.875rem;
    border-radius: 10px;
  }

  .glossary-alphabet-label {
    font-size: 0.6875rem;
    letter-spacing: 1px;
  }
}

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

.reveal-on-scroll {
  animation: fadeInUp 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========== DARK MODE ENHANCEMENTS ========== */
@media (prefers-color-scheme: dark) {
  .glossary-search {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .glossary-alphabet__btn.active {
    animation: none;
  }
  
  .glossary-search::before {
    animation: none;
  }
}

/* Focus visible for accessibility */
.glossary-search__input:focus-visible,
.glossary-alphabet__btn:focus-visible,
.glossary-search__clear:focus-visible {
  outline: 3px solid rgba(74, 159, 216, 0.5);
  outline-offset: 2px;
}
