* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: all 0.3s ease;
}

:root {
  --primary-color: #e63946;
  --secondary-color: #1d3557;
  --light-color: #f1faee;
  --accent-color: #a8dadc;
  --dark-color: #293241;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: #f8f9fa;
  color: #333;
  line-height: 1.6;
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  color: var(--secondary-color);
  text-decoration: none;
}

/* Шапка */
.site-header {
  background: linear-gradient(to right, #f8f9fa, #e9ecef);
  border-bottom: 3px solid var(--primary-color);
  padding: 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: static;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo img {
  height: 60px;
  width: auto;
  border-radius: 50%;
  border: 2px solid var(--primary-color);
  padding: 5px;
  background-color: white;
  transition: transform 0.3s ease;
}

.logo img:hover {
  transform: scale(1.05);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo h1 {
  font-size: 2rem;
  color: var(--primary-color);
  font-weight: bold;
  letter-spacing: 1px;
  margin: 0;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--secondary-color);
  font-style: italic;
}

.mobile-menu-toggle {
  display: none;
}

/* Меню */
.main-nav {
  margin-top: 1rem;
}

.main-nav ul {
  display: flex;
  list-style: none;
  padding-left: 0;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.main-nav li a {
  padding: 0.6rem 1rem;
  background-color: var(--primary-color);
  color: white;
  border-radius: 4px;
  display: block;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.main-nav li a:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Основной блок */
.main-content {
  display: flex;
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
  gap: 2rem;
  min-height: 70vh;
}

/* Статьи */
.articles {
  flex: 3;
}

.post {
  background-color: white;
  border: none;
  padding: 1.5rem;
  margin-bottom: 2rem;
  border-radius: 8px;
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
}

.post::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background-color: var(--primary-color);
}

.post:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.post h2 {
  font-size: 1.5rem;
  color: var(--secondary-color);
  margin-bottom: 0.8rem;
}

.post h2 a:hover {
  color: var(--primary-color);
}

.post-meta {
  font-size: 0.85rem;
  color: #777;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.post-meta::before {
  content: '📅';
  font-size: 1rem;
}

.post img {
  width: 100%;
  height: 400px; /* Фиксированная высота */
  object-fit: contain; /* Растягивает изображение без сохранения пропорций */
  margin-bottom: 1rem;
  border-radius: 5px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.excerpt {
  font-size: 1rem;
  line-height: 1.7;
  color: #444;
}

.read-more {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.4rem 1rem;
  background-color: var(--light-color);
  color: var(--primary-color);
  border-radius: 20px;
  font-weight: 500;
  font-size: 0.9rem;
}

.read-more:hover {
  background-color: var(--primary-color);
  color: white;
}

/* Боковая панель */
.sidebar {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.sidebar-widget {
  background-color: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
}

.sidebar-widget h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--secondary-color);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-color);
}

/* Форма входа */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group label {
  font-size: 0.9rem;
  color: #555;
  font-weight: 500;
}

.form-group input {
  padding: 0.7rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.95rem;
}

.form-group input:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(230, 57, 70, 0.2);
}

.login-button {
  padding: 0.7rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.5rem;
}

.login-button:hover {
  background-color: var(--secondary-color);
}

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.8rem;
  font-size: 0.85rem;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Языки */
.language-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.language-list li a {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.8rem;
  background-color: var(--light-color);
  border-radius: 20px;
  color: var(--secondary-color);
  font-size: 0.9rem;
  font-weight: 500;
}

.language-list li a:hover {
  background-color: var(--accent-color);
}

.language-list li a::before {
  content: '🌐';
  margin-right: 0.4rem;
}

/* Поиск */
.search-form {
  display: flex;
  margin-bottom: 1rem;
}

.search-input {
  flex: 1;
  padding: 0.7rem;
  border: 1px solid #ddd;
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
  font-size: 0.95rem;
}

.search-button {
  padding: 0 1rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  cursor: pointer;
}

/* Подвал */
.site-footer {
  background-color: var(--secondary-color);
  color: white;
  padding: 2rem 1rem;
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  text-align: left;
}

.footer-section h4 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--accent-color);
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section ul li a {
  color: var(--light-color);
}

.footer-section ul li a:hover {
  color: var(--accent-color);
}

.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 50%;
  font-size: 1.2rem;
}

.social-links a:hover {
  background-color: var(--primary-color);
  transform: translateY(-3px);
}

.copyright {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
}

/* Медиа запросы для адаптивности */
@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
  }

  .site-header {
    padding: 0.8rem;
  }

  .logo h1 {
    font-size: 1.5rem;
  }

  .main-nav ul {
    justify-content: center;
  }

  .main-nav li a {
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
  }
}

/* Дополнительные стили для интерактивных элементов */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-3px);
  background-color: var(--secondary-color);
}

/* Стили для уведомлений */
.notification {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 1rem;
  background-color: #4caf50;
  color: white;
  border-radius: 4px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  display: none;
  z-index: 2000;
}

/* Loading indicator for buttons */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  border: 3px solid transparent;
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Стили для модального окна */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: white;
  padding: 2rem;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.3);
  position: relative;
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: #888;
}

.close-modal:hover {
  color: var(--primary-color);
}

.page-title {
  font-size: 2rem;
  color: var(--secondary-color);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-color);
}

/* Активная ссылка в меню */
.main-nav li a.active {
  background-color: var(--secondary-color);
}

/* Кнопки категорий для библиотеки */
.library-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.category-btn {
  padding: 0.5rem 1rem;
  background-color: var(--light-color);
  color: var(--secondary-color);
  border-radius: 20px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.category-btn:hover, .category-btn.active {
  background-color: var(--primary-color);
  color: white;
}

.quote {
  font-style: italic;
  line-height: 1.2;
  color: #333; /* Твой старый цвет, если сломался */
}

/* Мобильная адаптивность шапки */
@media (max-width: 768px) {
  .site-header {
    padding: 0.45rem 0.8rem;
  }
  .header-container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
  }
  .logo {
    gap: 0.5rem;
  }
  .logo img {
    height: 32px;
    padding: 1px;
  }
  .logo-text h1 {
    font-size: clamp(0.92rem, 3.8vw, 1.15rem);
    margin: 0;
    line-height: 1.2;
    white-space: nowrap;
  }
  .subtitle {
    display: none;
  }
  .mobile-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--primary-color, #c0392b);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s ease;
  }
  .mobile-menu-toggle:hover,
  .mobile-menu-toggle:focus {
    background: #a93226;
    outline: none;
  }
  .main-nav {
    display: none;
    width: 100%;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }
  .main-nav.nav-open {
    display: block;
    animation: navFadeIn 0.2s ease-out;
  }
  .main-nav ul {
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
  }
  .main-nav li {
    width: 100%;
  }
  .main-nav li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 4px;
    width: 100%;
  }
}

@keyframes navFadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}