/* Переменные и сброс */
:root {
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary-color: #64748b;
  --bg-light: #f8fafc;
  --bg-white: #ffffff;
  --text-dark: #0f172a;
  --text-muted: #475569;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --radius: 0.75rem;
  --transition: all 0.2s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-image: url('335a1bc.jpg');
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  z-index: -1;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

/* Шапка */
.site-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 1rem 0;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  white-space: nowrap;
}
.logo span {
  color: #fff;
}

.search-bar {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  max-width: 600px;
  align-items: center;
}

#searchInput {
  flex: 1;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 1rem;
  background: white;
  min-width: 200px;
}

#searchInput:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Кнопки */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  border: 1px solid var(--primary-color);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn-secondary {
  background: #6b7280;
  color: white;
  border: 1px solid #6b7280;
}
.btn-secondary:hover {
  background: #4b5563;
  border-color: #4b5563;
}

.btn-success {
  background: #10b981;
  color: white;
  border: 1px solid #10b981;
}
.btn-success:hover {
  background: #059669;
  border-color: #059669;
}

.btn-outline {
  background: transparent;
  border: 2px solid white;
  color: white;
}
.btn-outline:hover {
  background: white;
  color: var(--primary-color);
}

/* Горизонтальное меню */
.menu-list {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 2rem 0;
  padding: 0;
  flex-wrap: wrap;
}

.menu-item {
  position: relative;
}

.menu-item > a {
  display: block;
  padding: 0.5rem 1rem;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-dark);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}

.menu-item > a:hover {
  background: #eef2ff;
  border-color: var(--primary-color);
}

.menu-item.active > a {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-dark);
}

.menu-link.premium {
  position: relative;
}
.menu-link.premium::after {
  content: " 🔒";
  font-size: 0.8rem;
  opacity: 0.8;
}

.menu-link.no-arrow::after {
  display: none;
}

.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 0.5rem 0;
  margin-top: 0.25rem;
  display: none;
  z-index: 10;
}

.menu-item.open .dropdown {
  display: block;
}

.dropdown li {
  list-style: none;
}

.dropdown a {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--text-dark);
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
}

.dropdown a:hover {
  background: #eef2ff;
  color: var(--primary-dark);
}

.dropdown a.active {
  background: #dbeafe;
  color: var(--primary-dark);
  font-weight: 500;
}

.cat-count {
  background: var(--bg-light);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 8px;
}

/* Панель статей */
.content-section {
  background: var(--bg-white);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-header h2 {
  font-size: 1.5rem;
  color: var(--text-dark);
}

#articlesList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.article-card {
  padding: 1.25rem;
  background: var(--bg-light);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.article-card:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
  background: #f1f5f9;
}

.article-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.article-card p {
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
}

.article-level {
  background: #dbeafe;
  color: #1e40af;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 500;
}

.article-tag {
  background: var(--bg-white);
  color: var(--text-muted);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
}

.premium-lock {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 1.2rem;
}

/* Детальный просмотр */
#articleDetail {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-light);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

#articleDetail.hidden {
  display: none;
}

#articleDetail h2 {
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: var(--primary-dark);
}

.detail-section {
  margin: 1.5rem 0;
}

.detail-section h4 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.detail-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* Модальное окно */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  z-index: 1001;
  box-shadow: var(--shadow-md);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-close:hover {
  color: var(--text-dark);
}

/* Вкладки модального окна */
.modal-tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.tab-button {
  background: transparent;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border-radius: var(--radius) var(--radius) 0 0;
}

.tab-button.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
}

/* Содержимое вкладок */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* Формы */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: var(--text-dark);
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.message {
  padding: 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.message.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.message.error {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.premium-status {
  padding: 0.5rem;
  background: var(--bg-light);
  border-radius: var(--radius);
  text-align: center;
  margin: 1rem 0;
}

.premium-status.active {
  background: #d1fae5;
  color: #065f46;
}

/* Приветственный экран */
#welcomeScreen {
  text-align: center;
  padding: 3rem 1rem;
}

.welcome-hints {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.hint-chip {
  background: var(--bg-light);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  font-size: 0.9rem;
}

.hint-chip span {
  color: var(--primary-color);
  font-weight: 600;
}

/* Системная информация */
.system-info-wrap {
  margin-top: 3rem;
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
}

.system-info-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-muted);
}

#systemInfo {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.system-info-row {
  background: var(--bg-light);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.system-info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.system-info-value {
  font-weight: 600;
}

/* Состояния загрузки */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.error-message {
  background: #fee2e2;
  color: #b91c1c;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid #fecaca;
  margin: 1rem 0;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Адаптивность */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
  }
  .search-bar {
    max-width: 100%;
  }
  .menu-list {
    flex-direction: column;
    align-items: stretch;
  }
  .dropdown {
    position: static;
    box-shadow: none;
    margin-top: 0.5rem;
    border: none;
    background: #f8fafc;
  }
}
/* Кнопка "Купить премиум" */
.btn-premium {
  background: #f1c40f;
  color: #000;
  margin-left: 10px;
}
.btn-premium:hover {
  background: #d4ac0d;
}

/* QR‑код в модальном окне */
.qr-code {
  text-align: center;
  margin: 15px 0;
}
.qr-code img {
  max-width: 200px;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}