.almanac-container {
  padding: 120px 0 40px;
  min-height: 100vh;
  background-color: var(--bg-color);
  position: relative;
  overflow: hidden;
}

.almanac-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(217deg, rgba(204, 120, 50, 0.1), transparent 70%),
    linear-gradient(127deg, rgba(255, 198, 109, 0.1), transparent 70%),
    linear-gradient(336deg, rgba(88, 157, 246, 0.1), transparent 70%);
  z-index: 1;
}

.almanac-container::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(
      circle at 20% 30%,
      var(--accent-color) 1px,
      transparent 1px
    ),
    radial-gradient(
      circle at 70% 60%,
      var(--secondary-color) 1px,
      transparent 1px
    ),
    radial-gradient(circle at 40% 80%, var(--link-color) 1px, transparent 1px),
    radial-gradient(circle at 80% 20%, var(--accent-color) 1px, transparent 1px);
  background-size: 50px 50px;
  background-position: 0 0;
  opacity: 0.1;
  animation: backgroundMove 20s linear infinite;
  z-index: 1;
}

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

.almanac-container .container {
  position: relative;
  z-index: 2;
}

.almanac-container h1 {
  text-align: center;
  color: var(--secondary-color);
  font-size: 2.5rem;
  margin-bottom: 2rem;
}

.almanac-subtitle {
  font-size: 1.1rem;
  color: var(--text-color);
  opacity: 0.85;
  max-width: 800px;
  margin: -0.5rem auto 2rem;
  text-align: center;
  line-height: 1.6;
}

/* Облако тегов */
.tags-cloud {
  margin-bottom: 2rem;
  padding: 14px 20px;
  background: rgba(26, 26, 26, 0.86);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.tags-header {
  margin-bottom: 0;
}

.tags-cloud.expanded .tags-header {
  margin-bottom: 1rem;
}

.tags-cloud h2 {
  color: var(--secondary-color);
  font-size: 1.5rem;
  margin: 0;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: all 0.3s ease;
  padding: 4px 8px;
  border-radius: 8px;
  user-select: none;
}

.tags-cloud h2:hover {
  color: var(--accent-color);
  background: rgba(204, 120, 50, 0.1);
}

.tags-cloud h2 > span {
  display: inline-block;
}

.tag-title-arrow {
  color: var(--accent-color);
  font-size: 0.9rem;
  transition: transform 0.3s ease;
}

.tag-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100%, 420px);
  margin: 0 auto 18px;
  padding: 10px 14px;
  color: var(--text-color);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(204, 120, 50, 0.25);
  border-radius: 8px;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    opacity 0.3s ease;
}

.tags-cloud:not(.expanded) .tag-search {
  display: none;
}

.tag-search:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(204, 120, 50, 0.12);
}

.tag-search i {
  color: var(--accent-color);
  font-size: 0.9rem;
}

.tag-search-input {
  width: 100%;
  min-width: 0;
  color: var(--text-color);
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
}

.tag-search-input::placeholder {
  color: var(--text-color);
  opacity: 0.6;
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  overflow: hidden;
  transition: all 0.3s ease;
  max-height: 1000px;
  opacity: 1;
}

.tags-container.collapsed {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
}

.tags-cloud.expanded .tag-title-arrow {
  transform: rotate(180deg);
}

.tag-cloud-item {
  font-size: 0.9em;
  color: var(--text-color);
  background: rgba(204, 120, 50, 0.1);
  padding: 5px 15px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag-cloud-item[hidden] {
  display: none;
}

.tag-cloud-item:hover {
  background: rgba(204, 120, 50, 0.2);
  border-color: var(--accent-color);
  box-shadow: 0 0 0 1px rgba(204, 120, 50, 0.15);
}

.tag-cloud-item.active {
  background: var(--accent-color);
  color: var(--bg-color);
}

.tag-count {
  background: rgba(0, 0, 0, 0.2);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.8em;
}

/* Статистика */
.video-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stats-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--dark-bg);
  border-radius: 8px;
  color: var(--text-color);
}

.stats-item i {
  color: var(--accent-color);
  font-size: 1.2em;
}

/* Активные фильтры */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1rem;
  padding: 10px;
  min-height: 40px;
}

.active-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  background: var(--accent-color);
  color: var(--bg-color);
  border-radius: 15px;
  font-size: 0.9em;
}

.active-filter .remove-filter {
  cursor: pointer;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  transition: background 0.3s ease;
}

.active-filter .remove-filter:hover {
  background: rgba(0, 0, 0, 0.4);
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.video-card {
  background: var(--dark-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  cursor: pointer;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  height: 480px;
}

.video-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
  border-color: var(--accent-color);
}

.video-thumbnail {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.video-info {
  padding: 15px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 200px;
  position: relative;
}

.video-title {
  font-size: 1.1em;
  margin: 0 0 10px 0;
  color: var(--secondary-color);
}

.video-description {
  font-size: 0.9em;
  color: var(--text-color);
  line-height: 1.6;
  margin-bottom: 0;
  max-height: calc(1.6em * 3);
  overflow: hidden;
}

.video-description-block {
  position: relative;
}

.description-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: var(--description-more-left, 0);
  top: var(--description-more-top, 0);
  font: inherit;
  font-size: 0.78em;
  color: var(--secondary-color);
  background: rgba(204, 120, 50, 0.16);
  border: 1px solid rgba(204, 120, 50, 0.25);
  border-radius: 4px;
  width: 30px;
  height: 24px;
  padding: 0;
  cursor: pointer;
  line-height: 1;
}

.description-more[hidden] {
  display: none;
}

.description-more:hover,
.description-more[aria-expanded="true"] {
  background: rgba(204, 120, 50, 0.28);
}

.description-more i {
  pointer-events: none;
}

.video-description-full {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 6;
  max-height: 150px;
  overflow-y: auto;
  padding: 10px;
  color: var(--text-color);
  font-size: 0.9em;
  line-height: 1.5;
  background: var(--dark-bg);
  border: 1px solid rgba(204, 120, 50, 0.35);
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
  cursor: default;
}

.video-description-full[hidden] {
  display: none;
}

.video-tags {
  margin: auto 0 12px;
  position: relative;
}

.video-tags-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.tag {
  flex: 0 0 auto;
  max-width: 100%;
  font-size: 0.8em;
  color: var(--accent-color);
  background: rgba(204, 120, 50, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.3s ease;
}

.tag:hover {
  background: rgba(204, 120, 50, 0.2);
}

.tag-more {
  flex: 0 0 auto;
  font: inherit;
  font-size: 0.8em;
  color: var(--secondary-color);
  background: rgba(204, 120, 50, 0.16);
  border: 1px solid rgba(204, 120, 50, 0.25);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  line-height: 1.6;
}

.tag-more:hover,
.tag-more[aria-expanded="true"] {
  background: rgba(204, 120, 50, 0.28);
}

.video-tags-overflow {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 110px;
  overflow-y: auto;
  padding: 8px;
  background: var(--dark-bg);
  border: 1px solid rgba(204, 120, 50, 0.35);
  border-radius: 6px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.video-tags-overflow[hidden] {
  display: none;
}

.video-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.video-date {
  font-size: 0.85em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.video-date i {
  color: var(--accent-color);
}

.video-views {
  font-size: 0.9em;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 5px;
}

.video-views i {
  color: var(--accent-color);
}

@media (max-width: 768px) {
  .almanac-container {
    padding: 100px 0 30px;
  }

  .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
  }

  .almanac-container h1 {
    font-size: 2rem;
  }

  .video-stats {
    gap: 15px;
  }

  .stats-item {
    padding: 8px 15px;
    font-size: 0.9em;
  }

  .tags-cloud {
    padding: 15px;
  }

  .tags-cloud h2 {
    font-size: 1.2rem;
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .almanac-container {
    padding: 80px 0 20px;
  }

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

  .almanac-container h1 {
    font-size: 1.8rem;
  }

  .tags-cloud {
    padding: 15px;
  }

  .tags-cloud h2 {
    font-size: 1.1rem;
    gap: 8px;
  }

  .tag-title-arrow {
    font-size: 0.8rem;
  }

  .tag-cloud-item {
    font-size: 0.8em;
    padding: 4px 12px;
  }
}
