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

body {
  font-family: Arial, sans-serif;
  background: #f4f4f4;
  color: #222;
  line-height: 1.6;
}

a {
  color: #29b6f6;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* HEADER НАВЫЛЕТ */
.header {
  width: 100%;
  background: #222;
  color: #fff;
}

/* Внутренний контейнер — центрирует контент */
.header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.header__logo {
  font-size: 22px;
  font-weight: bold;
  white-space: nowrap;
}

.header__nav {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.header__nav a {
  color: #ddd;
  font-size: 15px;
  white-space: nowrap;
}

.header__nav a:hover {
  color: #4fc3f7;
  text-decoration: none;
}

/* ---------- ОБЁРТКА main + aside ---------- */
.wrapper {
  max-width: 1200px;
  margin: 10px auto;
  padding: 0 10px;
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

.main {
  flex: 1;          /* занимает всё свободное место */
  min-width: 0;     /* чтобы не ломался flex при длинных словах */
}

/* ---------- СТАТЬИ ---------- */
.main h1 {
  margin-bottom: 10px;
  font-size: 26px;
}

.post {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);

  /* Картинка справа от текста */
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

/* Картинка справа */
.post__thumb {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  order: 2;              /* ← сдвигаем картинку в конец */
}

/* Текстовый блок слева */
.post__body {
  flex: 1;
  min-width: 0;
  order: 1;
}

.post h2 {
  font-size: 20px;
  margin-bottom: 6px;
}

.post h2 a {
  color: #222;
}

.post h2 a:hover {
  color: #29b6f6;
  text-decoration: none;
}

.post__meta {
  font-size: 13px;
  color: #888;
  margin-bottom: 10px;
}

.post__more {
  display: inline-block;
  margin-top: 10px;
  font-size: 14px;
}

/* ---------- ASIDE ---------- */
.aside {
  width: 260px;
  flex-shrink: 0;
  background: #fff;
  padding: 20px;
  margin-top: 50px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.aside h3 {
  font-size: 16px;
  margin-bottom: 10px;
  margin-top: 15px;
}

.aside h3:first-child {
  margin-top: 0;
}

.aside ul {
  list-style: none;
}

.aside ul li {
  padding: 5px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.aside ul li:last-child {
  border-bottom: none;
}

.aside ul li a {
  color: #444;
}

.footer {
  background: #222;
  color: #aaa;
  margin-top: 40px;
}

.footer__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
  font-size: 14px;
}

/* ---------- АДМИНКА ---------- */
.admin {
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.table th, .table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
.table th {
    background: #fafafa;
    font-size: 14px;
    color: #555;
}
.table td a {
    margin-right: 10px;
}

.form {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    max-width: 700px;
}
.form label {
    display: block;
    margin-bottom: 15px;
    font-size: 14px;
    color: #444;
}
.form input,
.form textarea,
.form select {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
}
.form button {
    padding: 10px 22px;
    background: #29b6f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
}
.form button:hover {
    background: #0288d1;
}
.form a {
    margin-left: 15px;
}

.login-box {
    max-width: 360px;
    margin: 80px auto;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.login-box h1 { margin-bottom: 20px; }
.login-box input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
}
.login-box button {
    width: 100%;
    padding: 11px;
    background: #29b6f6;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
}

.error {
    color: #c62828;
    margin-bottom: 12px;
}
.success {
    color: #2e7d32;
    margin-bottom: 15px;
    background: #e8f5e9;
    padding: 10px 15px;
    border-radius: 6px;
}

/*Адаптив под узкие экраны*/
/* Планшет / узкий десктоп */
@media (max-width: 800px) {
  .wrapper {
    flex-direction: column;
  }
  .aside {
    width: 100%;
  }
}

/* Мобильные */
@media (max-width: 600px) {
  .header__inner {
    justify-content: center;
    text-align: center;
  }
  .header__nav {
    gap: 16px;
    justify-content: center;
  }

  /* Статья: картинка сверху, текст снизу */
  .post {
    flex-direction: column;
  }
  .post__thumb {
    width: 100%;
    height: auto;
    max-height: 220px;
    order: 0;          /* сбрасываем order, чтобы картинка была первой */
    margin-bottom: 12px; /* отступ от картинки до текста */
  }
}