/* ============= RESET & BASE ============= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #202040;
  --text: #e0e0e0;
  --text-muted: #8888aa;
  --accent: #4fc3f7;
  --accent-hover: #29b6f6;
  --accent-gradient: linear-gradient(135deg, #4fc3f7, #81d4fa);
  --danger: #ef5350;
  --success: #66bb6a;
  --border: #2a2a4a;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

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

/* ============= HEADER ============= */
.header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
.header__logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}
.header__logo-img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
}
.header__logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header__nav { display: flex; align-items: center; gap: 0.5rem; }
.header__link {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.header__link:hover, .header__link:focus {
  color: var(--text);
  background: rgba(255,255,255,0.05);
  text-decoration: none;
}
.header__link--admin {
  background: var(--accent);
  color: #000 !important;
  font-weight: 600;
}
.header__link--admin:hover { background: var(--accent-hover); }
.header__link--logout { color: var(--danger); }

/* ============= MAIN ============= */
.main { flex: 1; padding: 2rem 0; }

/* ============= CATALOG ============= */
.catalog__title {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
}

.catalog__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.filter-btn {
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.filter-btn--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 600;
}

.catalog__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.catalog__empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

/* ============= PRODUCT CARD ============= */
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.product-card__link {
  text-decoration: none;
  color: var(--text);
  display: block;
}
.product-card__link:hover { text-decoration: none; }

.product-card__image-wrapper {
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.product-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.product-card:hover .product-card__image { transform: scale(1.05); }
.product-card__no-image {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.product-card__info { padding: 1rem; }
.product-card__name {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  min-height: 2.8em;
}
.product-card__price {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.product-card__current-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}
.product-card__old-price {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: line-through;
}
.product-card__stock { font-size: 0.8rem; }
.in-stock { color: var(--success); }
.out-of-stock { color: var(--danger); }
.product-card__ozon-note {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  line-height: 1.3;
}

/* ============= PRODUCT DETAIL ============= */
.breadcrumbs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent); }

.product-detail__layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
@media (max-width: 768px) {
  .product-detail__layout { grid-template-columns: 1fr; }
}

.product-detail__gallery {}
.product-detail__main-image {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--bg-card);
  margin-bottom: 0.75rem;
}
.product-detail__thumbs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
}
.product-detail__thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
}
.product-detail__thumb:hover { border-color: var(--accent); }

.product-detail__name {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}
.product-detail__price { margin-bottom: 1rem; }
.product-detail__current-price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}
.product-detail__old-price {
  font-size: 1.2rem;
  color: var(--text-muted);
  text-decoration: line-through;
  margin-left: 0.75rem;
}
.product-detail__stock {
  font-size: 1rem;
  margin-bottom: 1.5rem;
}
.product-detail__meta {
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.product-detail__meta p { margin-bottom: 0.25rem; }
.product-detail__actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.product-detail__ozon-note {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.product-detail__description { margin-top: 2rem; }
.product-detail__description h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}
.product-detail__desc-text {
  color: var(--text-muted);
  line-height: 1.7;
}

/* ============= BUTTONS ============= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn:hover { text-decoration: none; }
.btn--primary {
  background: var(--accent);
  color: #000;
}
.btn--primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.btn--outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
}
.btn--outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.btn--lg { padding: 0.8rem 2rem; font-size: 1.1rem; }

/* ============= ORDER FORM ============= */
.order-page__title {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}

.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.form-section__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.form-field {
  display: block;
  margin-bottom: 1rem;
}
.form-field__label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.form-field__input, .form-field__textarea {
  width: 100%;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
.form-field__input:focus, .form-field__textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.form-field__textarea { resize: vertical; font-family: inherit; }

.order-form__items {}
.order-form__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.order-form__item:last-child { border-bottom: none; }
.order-form__item-info { flex: 1; display: flex; align-items: center; gap: 0.75rem; }
.order-form__item-img { width: 50px; height: 50px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.order-form__item-name { font-size: 0.9rem; flex: 1; }
.order-form__item-price { color: var(--accent); font-weight: 600; white-space: nowrap; }
.order-form__item-qty {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}
.qty-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.qty-btn:hover { border-color: var(--accent); color: var(--accent); }
.qty-input {
  width: 50px;
  padding: 0.35rem;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
}

.order-form__total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.1rem;
}
.order-form__total strong { font-size: 1.3rem; color: var(--accent); }

/* ============= ALERTS ============= */
.alert {
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
.alert--success {
  background: rgba(102, 187, 106, 0.15);
  border: 1px solid var(--success);
  color: var(--success);
}
.alert--error {
  background: rgba(239, 83, 80, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
}

/* ============= ADMIN LOGIN ============= */
.admin-login {
  max-width: 400px;
  margin: 3rem auto;
}
.admin-login__title {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}
.admin-login__form .btn { width: 100%; margin-top: 0.5rem; }

/* ============= FOOTER ============= */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: 3rem;
}
.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.footer p { color: var(--text-muted); font-size: 0.85rem; }
.footer__small { font-size: 0.75rem !important; }

/* ============= SCROLLBAR ============= */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a5a; }

/* ============= ARTICLES ============= */
.articles__title {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
}
.articles__empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}
.articles__list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.article-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s;
}
.article-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
  text-decoration: none;
}
.article-card__icon {
  font-size: 2rem;
  flex-shrink: 0;
  width: 48px;
  text-align: center;
}
.article-card__info { flex: 1; }
.article-card__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.article-card__description {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  line-height: 1.5;
}
.article-card__date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============= ARTICLE PAGE ============= */
.article-page__content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}
.article-page__title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.article-page__meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.markdown-body {
  line-height: 1.8;
  color: var(--text);
  font-size: 0.95rem;
}
.markdown-body h1 { font-size: 1.6rem; margin: 1.5rem 0 0.75rem; font-weight: 700; }
.markdown-body h2 { font-size: 1.35rem; margin: 1.5rem 0 0.75rem; font-weight: 700; color: var(--accent); }
.markdown-body h3 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; font-weight: 600; }
.markdown-body h4 { font-size: 1rem; margin: 1rem 0 0.5rem; font-weight: 600; }
.markdown-body p { margin-bottom: 1rem; }
.markdown-body ul, .markdown-body ol { margin-bottom: 1rem; padding-left: 1.5rem; }
.markdown-body li { margin-bottom: 0.35rem; }
.markdown-body code {
  background: var(--bg);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: 'Consolas', 'Courier New', monospace;
}
.markdown-body pre {
  background: var(--bg);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  background: rgba(79, 195, 247, 0.05);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
}
.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 1rem 0;
  border: 1px solid var(--border);
}
.markdown-body a { color: var(--accent); }
.markdown-body a:hover { text-decoration: underline; }
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.markdown-body th, .markdown-body td {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  text-align: left;
}
.markdown-body th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
}
.markdown-body td { color: var(--text); }
.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}
.markdown-body strong { color: var(--text); font-weight: 700; }

/* ============= RESPONSIVE ============= */
@media (max-width: 640px) {
  .catalog__grid { grid-template-columns: 1fr; }
  .header__inner { padding: 0.5rem 1rem; }
  .header__logo-text { display: none; }
}
