/* ==============================
   Общие стили
============================== */
html, body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: hidden; /* убираем горизонтальный скролл */
}

body {
  background: url("../images/blue.jpg") no-repeat center center/cover;
  background-size: cover;
  color: #004080; /* цвет текста светлой темы */
  transition: background 0.5s, color 0.5s;
  flex: 1;
}

body.dark {
  background: url("../images/dark.jpg") no-repeat center center;
  background-size: cover;
  color: #fff; /* цвет текста темной темы */
}

/* ==============================
   Header
============================== */
header {
  background: rgba(0,64,128,0.9);
  width: 100%;
  box-sizing: border-box;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 100;
}

header h1 {
  margin: 0;
  font-size: 20px;
  color: #fff; /* заголовок белый */
}

/* Контейнер кнопки темы и меню */
.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Кнопка темы */
.theme-btn {
  background: none;
  border: none;
  cursor: pointer;
}

.theme-btn img {
  width: 30px;
  height: 30px;
  transition: transform 0.3s;
}

.theme-btn:hover img {
  transform: rotate(20deg);
}

/* Бургер */
.menu-toggle {
  font-size: 28px;
  background: none;
  border: none;
  color: #fff; /* белый бургер */
  cursor: pointer;
}

/* Меню */
nav {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 60px;
  right: 10px;
  background: rgba(0,64,128,0.95);
  border-radius: 8px;
  padding: 10px;
  z-index: 1000;
}

nav a {
  color: #fff; /* меню белым */
  padding: 8px 12px;
  text-decoration: none;
  font-weight: bold;
  display: block;
}

nav a.active {
  color: #ffd700;
  text-decoration: underline;
}

nav a:hover {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

nav.show {
  display: flex;
}

/* ==============================
   Контейнер контента
============================== */
.container {
  max-width: 1100px;
  margin: 20px auto;
  padding: 20px;
  flex: 1;
}

/* ==============================
   Блоки на главной (три блока)
============================== */
.three-blocks {
  display: flex;
  justify-content: center; /* по центру */
  align-items: flex-start;
  max-width: 1100px;
  margin: 20px auto;
  gap: 20px;
  flex-wrap: wrap;
}

.block {
  padding: 20px;
  background: rgba(255,255,255,0.85);
  border-radius: 20px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  text-align: center;
  color: #004080;
  flex: 1 1 250px; /* гибкая ширина, минимум 250px */
  max-width: 350px;
}

body.dark .block {
  background: rgba(0,0,0,0.7);
  color: #fff; /* текст в темной теме белый */
}

.block img {
  width: 100%;
  height: auto;
  border-radius: 15px;
  margin-bottom: 10px;
}

/* Увеличиваем блок "Учитель года" */
.teacher-block {
  flex: 1 1 500px; /* увеличиваем размер блока */
  max-width: 600px;
  background: rgba(255, 255, 255, 0.9); /* светлый фон */
  color: #004080;
  text-align: center;
  margin: 20px auto;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
  padding: 30px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

body.dark .teacher-block {
  background: rgba(0, 0, 0, 0.7);
  color: #fff; /* цвет текста в темной теме */
}

/* Выравнивание изображения в блоке учителя */
.teacher-block img {
  border-radius: 50%;
  width: 100px;
  height: 100px;
  margin-bottom: 15px;
  object-fit: cover;
}

.teacher-block h3, .teacher-block p {
  margin: 10px 0;
  color: inherit;
}

/* ==============================
   Новости
============================== */
.news {
  display: flex;
  flex-wrap: wrap; /* Элементы могут переходить на новую строку */
  gap: 20px;
  justify-content: center;
  margin: 20px 0;
}

.card {
  border: 1px solid #ccc;
  padding: 15px;
  border-radius: 8px;
  background: rgba(255,255,255,0.9);
  color: #004080;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: transform 0.3s, background 0.5s, color 0.5s;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* верхнее выравнивание */
  width: 100%; /* по умолчанию карточка будет на 100% ширины */
  max-width: 350px; /* ограничиваем ширину */
  height: auto;
  margin: 0 auto;
}

body.dark .card {
  background: rgba(0,0,0,0.7);
  color: #fff; /* цвет текста в темной теме белый */
}

.card:hover {
  transform: translateY(-3px);
}

.card img {
  width: 100%; /* изображение будет на 100% ширины блока */
  height: auto;
  display: block;
  margin-bottom: 10px;
  border-radius: 8px;
}

.card h3 {
  margin-top: 10px;
}

.card p {
  margin: 10px 0 0 0;
  font-size: 14px;
  line-height: 1.4;
  color: inherit;
  flex-grow: 1;
}

.card .news-meta {
  font-size: 12px;
  margin-top: 10px;
  text-align: right;
  color: inherit;
  font-style: italic;
}







/* ==============================
   Кнопки Удалить и Редактировать
============================== */
.admin-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.delete-btn, .edit-btn {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  text-decoration: none;
  text-align: center;
  transition: opacity 0.3s;
  cursor: pointer;
}

.delete-btn {
  background-color: red;
  color: white;
}

.delete-btn:hover {
  opacity: 0.8;
}

.edit-btn {
  background-color: #004080;
  color: white;
}

.edit-btn:hover {
  opacity: 0.8;
}

/* ==============================
   Скрытие кнопок для не-админов
============================== */
.admin-buttons {
  display: none; /* Скрывать по умолчанию */
}

body.admin .admin-buttons {
  display: block; /* Показать только для админов */
}

/* ==============================
   Footer
============================== */
footer {
  background: rgba(0,64,128,0.95);
  color: #fff !important; /* текст всегда белый */
  text-align: center;
  padding: 15px;
  position: relative;
  z-index: 50;
}

/* Темная тема футера */
body.dark footer {
  background: rgba(0,0,50,0.95);
  color: #ffd700 !important;
}

/* ==============================
   Адаптив
============================== */

/* На больших экранах (от 992px и выше) */
@media (min-width: 992px) {
  .three-blocks {
    justify-content: space-between; /* Новости в два ряда */
  }

  .block {
    width: 45%; /* Каждая карточка занимает 45% ширины */
  }
}

/* Для экранов от 768px до 991px */
@media (max-width: 991px) and (min-width: 768px) {
  .block {
    width: 48%; /* Каждая карточка занимает 48% ширины */
  }
}

/* Для экранов меньше 768px */
@media (max-width: 767px) {
  .three-blocks {
    flex-direction: column; /* Все новости в одну колонку */
    align-items: center;
  }

  .block {
    width: 100%; /* Каждая карточка на всю ширину экрана */
  }
}

/* Для экрана с разрешением 720x1600px */
@media (max-width: 720px) and (min-height: 1600px) {
  /* Уменьшаем блоки на главной */
  .three-blocks {
    justify-content: center;
    gap: 15px;
  }

  .block {
    width: 100%; /* Блоки растягиваются на всю ширину */
    max-width: 320px;
    margin: 10px auto;
    padding: 15px;
  }

  .teacher-block {
    max-width: 500px;
    margin: 20px auto;
    padding: 20px;
  }

  .card {
    max-width: 320px; /* Ограничиваем ширину карточек */
  }

  .menu-toggle {
    font-size: 24px; /* Уменьшаем размер бургер-меню */
  }

  nav a {
    font-size: 16px; /* Уменьшаем размер шрифта в меню */
    padding: 8px 12px;
  }

  footer {
    padding: 12px;
    font-size: 14px;
  }
}
