/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Общие стили */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  background: #f5f5f5;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  color: #2c3e50;
  margin-bottom: 30px;
}

/* Поиск */
.search-box {
  background: white;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.search-box form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.search-box select {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.search-box input[type="submit"],
.reset-btn {
  padding: 10px 20px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.search-box input[type="submit"]:hover {
  background: #2980b9;
}

.reset-btn {
  background: #95a5a6;
}

/* Облако тэгов */
.tags-cloud {
  background: white;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 30px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-tags-btn {
  display: inline-block;
  padding: 6px 12px;
  margin: 4px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-tags-btn:hover {
  background: #2980b9;
}



.tag {
  display: inline-block;
  padding: 6px 12px;
  margin: 4px;
  background: #ecf0f1;
  color: #34495e;
  text-decoration: none;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.2s;
}

.tag:hover,
.tag.active {
  background: #3498db;
  color: white;
}

/* Плитка материалов */
.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.material-card {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.material-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.material-image {
  width: 100%;
  height: 280px;
  overflow: hidden;
  background: #ecf0f1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.material-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.material-content {
  padding: 15px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.material-content h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: #2c3e50;
  line-height: 1.3;
  height: 46.8px; /* 18px * 1.3 * 2 строки = 46.8px */
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.description {
  color: #7f8c8d;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 10px;
  flex-grow: 1;
}

.tags {
  margin-top: auto;
  padding-top: 10px;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  background: #e8f4f8;
  color: #3498db;
  border-radius: 3px;
  font-size: 12px;
  margin: 2px;
  text-decoration: none;
}

.external-link {
  display: block;
  text-align: center;
  padding: 12px;
  background: #2ecc71;
  color: white;
  text-decoration: none;
  font-weight: bold;
  transition: background 0.2s;
  margin-top: auto;
  flex-shrink: 0;
}

.external-link:hover {
  background: #27ae60;
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Пагинация */
.pagination {
  text-align: center;
  margin: 30px 0;
}

.pagination a,
.pagination span {
  padding: 8px 12px;
  margin: 0 2px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
  color: #3498db;
}

.pagination .current {
  background: #3498db;
  color: white;
  border-color: #3498db;
}

/* Страница материала */
.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: #3498db;
  text-decoration: none;
}

.material-detail {
  background: white;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.material-image-large {
  width: 100%;
  max-width: 600px;
  margin: 0 auto 30px;
}

.material-image-large img {
  width: 100%;
  border-radius: 8px;
}

.material-info h1 {
  margin-bottom: 15px;
}

.btn-primary {
  display: inline-block;
  padding: 12px 24px;
  background: #2ecc71;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  font-weight: bold;
  margin-top: 20px;
}

.btn-primary:hover {
  background: #27ae60;
}
