/* Сброс */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: #1a1e30;
  color: #c3c6cb;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* Content */
.content { padding: 40px; }

/* Hero */
.hero { text-align: center; }
.hero h1 {
  font-size: 28px;
  margin-bottom: 20px;
  margin-top: 40px;
}

.search-form {
  display: flex;
  gap: 10px;
  max-width: 600px;
  margin: 0 auto;
}
.search-form input {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #22263d;
  color: #c3c6cb;
}
.search-form input::placeholder { color: #727c95; }
.search-form input:focus {
  outline: none;
  background: #2a2f4a;
  box-shadow: 0 0 8px rgba(21,62,255,0.6);
}

.btn-primary {
  padding: 12px 20px;
  background: linear-gradient(135deg, #153eff, #2a4fff);
  border: none;
  border-radius: 20px;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s, background 0.3s, box-shadow 0.3s;
}
.btn-primary:hover {
  background: #1c46ff;
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(21,62,255,0.7);
}
.btn-primary:active { transform: scale(0.95); }

/* Categories */
.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 24px;
  margin-bottom: 28px;
}
.btn-category {
  padding: 10px 18px;
  border-radius: 20px;
  background: #22263d;
  color: #c3c6cb;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.25s, transform 0.2s, box-shadow 0.25s;
}
.btn-category:hover {
  background: #2a2f4a;
  transform: translateY(-2px);
  box-shadow: 0 0 8px rgba(21,62,255,0.45);
}
.btn-category.active {
  background: linear-gradient(135deg, #153eff, #2a4fff);
  color: #fff;
  box-shadow: 0 0 10px rgba(21,62,255,0.55);
}

/* Кнопка + */
.upload-toggle {
  background: #153eff;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}
.upload-toggle:hover {
  background: #1c46ff;
  transform: scale(1.1);
}

/* Фото-аватар */
.author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;       /* круг */
  object-fit: cover;        /* обрезаем лишнее */
  border: 2px solid #2a4fff;
  box-shadow: 0 0 6px rgba(21,62,255,0.4);
  display: block;           /* убираем лишние отступы */
}

/* Фоллбэк (инициал) */
.author-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3498db;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
  border: 2px solid #2a4fff;
  box-shadow: 0 0 6px rgba(21,62,255,0.4);
}

/* Cards grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}

/* Card */
.card {
  background: #1f2338;
  padding: 18px;
  border-radius: 14px;
  box-shadow: 0 6px 22px rgba(12, 20, 40, 0.35);
  transition: background 0.25s, transform 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  position: relative;
}
.card:hover { background: #252a45; transform: translateY(-2px); }

/* Автор внутри карточки */
.card-author {
  display: flex;              /* аватар + ник в одну строку */
  align-items: center;        /* выравнивание по вертикали */
  gap: 10px;                  /* расстояние между аватаром и ником */
}

/* Ник автора */
.author-link {
  color: #ffffff;             /* белый цвет по умолчанию */
  font-weight: 600;
  text-decoration: none;      /* убираем подчёркивание */
  transition: color 0.25s, text-decoration 0.25s;
}

.author-link:hover {
  color: #1c46ff;             /* синий при наведении */
  text-decoration: underline; /* подчёркивание при наведении */
}

/* Верх карточки: название + теги */
.card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.card-title {
  color: #e3e6eb;
  font-weight: 600;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-tags {
  display: flex;
  gap: 4px;
}
.card-tags .tag {
  background: #2a2f4a;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 11px;
  color: #7ff0ff;
}

/* Бейдж Бесплатно */
.free-label {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 12px;
  background: #153eff;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Описание */
.card-description {
  color: #c9ccd3;
  font-size: 13.5px;
  line-height: 1.55;
  margin-top: 8px;
  margin-bottom: 8px;
  max-height: 4.6em;
  overflow: hidden;
}

/* Мета */
.card-meta {
  color: #8a93b0;
  font-size: 13px;
  margin-top: auto;
}

/* Низ карточки: стрелка скачать */
.card-bottom {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.card-footer {
  display: flex;
  justify-content: space-between; /* автор слева, стрелка справа */
  align-items: center;            /* выравнивание по вертикали */
  margin-top: 12px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #153eff, #2a4fff);
  color: #fff;
  cursor: pointer;
  transition: background 0.25s, transform 0.18s, box-shadow 0.25s;
}
.download-btn:hover {
  background: #1c46ff;
  transform: scale(1.06);
  box-shadow: 0 0 12px rgba(21,62,255,0.55);
}

/* Модальное окно */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
}
.modal.active { display: flex; }

.modal-content {
  background: #22263d;
  padding: 24px;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  position: relative;
  animation: fadeIn 0.4s ease;
}
.modal-content h2 {
  margin-bottom: 16px;
  color: #fff;
}
.modal-content .close {
  position: absolute;
  top: 12px; right: 18px;
  font-size: 26px;
  color: #fff;
  cursor: pointer;
}

/* Upload form inside modal */
.modal-content form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-content label {
  font-size: 14px;
  color: #c3c6cb;
}
.modal-content input,
.modal-content select,
.modal-content textarea {
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: #2a2f4a;
  color: #c3c6cb;
}
.modal-content textarea { min-height: 96px; }
.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus {
  outline: none;
  background: #33395a;
  box-shadow: 0 0 8px rgba(21,62,255,0.6);
}

/* Стили для чекбоксов тегов */
.tag-option {
  display: inline-block;
  margin: 4px 6px;
  background: #2a2f4a;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: #7ff0ff;
  cursor: pointer;
}
.tag-option input {
  margin-right: 6px;
}

/* Кастомная кнопка выбора файла */
.file-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #2a2f4a;
  padding: 

/* 🔧 Адаптация под телефон */
@media (max-width: 768px) {
  .layout {
    grid-template-columns: 1fr; /* сайдбар уходит наверх */
  }

  .content {
    padding: 20px;
  }

  /* Поиск */
  .search-form {
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 100%;
  }
  .search-form input {
    width: 100%;
  }
  .btn-primary {
    width: 100%;
    text-align: center;
  }

  /* Категории */
  .categories {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .btn-category {
    width: 100%;
    text-align: center;
  }
  .upload-toggle {
    align-self: center;
  }

  /* Сетка карточек */
  .card-grid {
    grid-template-columns: 1fr; /* одна колонка */
    gap: 16px;
  }

  /* Карточка */
  .card {
    min-height: auto;
    padding: 16px;
  }
  .card-title {
    font-size: 15px;
    white-space: normal; /* переносим длинные названия */
  }
  .card-description {
    font-size: 13px;
    max-height: none; /* убираем ограничение высоты */
  }
  .card-meta {
    font-size: 12px;
  }

  /* Автор */
  .card-author {
    flex-direction: row;
    justify-content: flex-start;
    margin-top: 12px;
  }
  .author-link {
    font-size: 14px;
  }

  /* Аватар */
  .author-avatar,
  .author-avatar-fallback {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  /* Кнопка скачать */
  .download-btn {
    width: 34px;
    height: 34px;
  }
}
