/* ===== CSS Variables ===== */
:root {
  --bg-body: #f0f4f8;
  --bg-card: #ffffff;
  --bg-header: #ffffff;
  --bg-footer: #f8f9fa;
  --text-primary: #1a2332;
  --text-secondary: #4a5b6e;
  --border-color: #dce3ed;
  --shadow: 0 4px 12px rgba(0, 20, 40, 0.08);
  --shadow-hover: 0 6px 20px rgba(0, 40, 80, 0.12);
  --radius: 12px;
  --color-brand: #2a7de1;
  --color-brand-light: #e8f0fe;
  --color-success: #28a745;
  --color-danger: #dc3545;
  --color-warning: #0fb404;
}

.dark-theme {
  --bg-body: #1a1f2b;
  --bg-card: #252d3a;
  --bg-header: #1e2633;
  --bg-footer: #1a1f2b;
  --text-primary: #eaeef5;
  --text-secondary: #b0c0d4;
  --border-color: #3a4555;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.6);
  --color-brand-light: #2a3a55;
}

/* ===== Global ===== */
* {
  margin: 0; 
  padding: 0;
  box-sizing: border-box;
}
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}
body {
  background: var(--bg-body);
  color: var(--text-primary);
  font-family: 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  transition: background 0.3s, color 0.3s;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}
a {
  color: var(--color-brand);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

/* ===== Layout ===== */
.wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.content {
  flex: 1;
  padding: 10px 15px;
}
.container-custom {
  max-width: 1200px;
  margin: 0 auto;
}
.news-date {
  font-weight: 500; 
}
/* ===== Header (без картинок) ===== */
.header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.header-inner {
 /* display: flex;*/
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-brand);
  text-decoration: none;
  border-bottom: 2px solid var(--color-brand);
}
.logo-text:hover {
  text-decoration: none;
  color: #1a5fb0;
}
.logo {
 margin-bottom: 10px; 
}
/*.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
*/
  
/* Десктопная версия – все в одну строку */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap; /* запрещаем перенос */
    gap: 6px 10px; /* уменьшаем отступы */
    width: 100%;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
    flex-wrap: nowrap; /* элементы внутри групп тоже не переносятся */
    gap: 6px;
}

/* Кнопки не сжимаются и не переносят текст */
.header-actions .btn,
.header-actions .btn-dark-toggle {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.85rem; /* чуть уменьшаем шрифт для экономии места */
    padding: 6px 12px;
}

/* Центральная группа занимает оставшееся место */
.header-center {
    flex: 1;
    justify-content: center;
}

/* Мобильная версия – переносим по необходимости */
@media (max-width: 768px) {
    .header-actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    .header-left,
    .header-center,
    .header-right {
        flex-wrap: wrap;
        justify-content: center;
    }
    .header-actions .btn,
    .header-actions .btn-dark-toggle {
        font-size: 0.8rem;
        padding: 4px 10px;
    }
}

.header-actions .btn {
  font-size: 0.9rem;
  padding: 6px 14px;
  border-radius: 30px;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-outline-light {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.btn-outline-light:hover {
  background: var(--color-brand-light);
  border-color: var(--color-brand);
  color: var(--color-brand);
}
.btn-dark-toggle {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 30px;
  padding: 6px 14px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: 0.2s;
}
.btn-dark-toggle:hover {
  background: var(--color-brand-light);
}

/* ===== Footer (без картинок) ===== */
.footer {
  background: var(--bg-footer);
  border-top: 1px solid var(--border-color);
  padding: 20px 0;
  text-align: center;
  color: var(--text-secondary);
}
.footer-inner p {
  margin: 0;
}

/* ===== Cards ===== */
.panel_con {
  display: none;
}
.card-modern {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.card-modern:hover {
  box-shadow: var(--shadow-hover);
}
.card-modern h2,
.card-modern h3 {
  margin-top: 0;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.4rem;
  border-bottom: 2px solid var(--color-brand);
  padding-bottom: 8px;
  margin-bottom: 18px;
}
.card-modern hr {
  border-color: var(--border-color);
  margin: 16px 0;
}

/* ===== Forms ===== */
input[type="text"],
input[type="password"],
input[type="number"],
select {
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text-primary);
  width: 100%;
  max-width: 300px;
  transition: 0.2s;
  margin-bottom: 10px;
}
input:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(42,125,225,0.2);
}
.btn {
  border-radius: 30px;
  padding: 8px 22px;
  font-weight: 500;
  border: none;
  transition: 0.2s;
  cursor: pointer;
}
.btn-primary {
  background: var(--color-brand);
  color: #fff;
}
.btn-primary:hover {
  background: #1a5fb0;
  color: #fff;
}
.btn-success {
  background: var(--color-success);
  color: #fff;
}
.btn-success:hover {
  background: #1e8e3a;
}
.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover {
  background: #bd2130;
}
.btn-info {
  background: #17a2b8;
  color: #fff;
}
.btn-info:hover {
  background: #138496;
}
.btn-warning {
  background: var(--color-warning);
  color: #1a2332;
}
.btn-outline-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.btn-outline-secondary:hover {
  background: var(--color-brand-light);
  border-color: var(--color-brand);
  color: var(--color-brand);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .header-actions {
    justify-content: center;
    flex-wrap: wrap;
  }
  .header-actions .btn {
    font-size: 0.8rem;
    padding: 4px 12px;
  }
  .card-modern {
    padding: 16px;
  }
  input[type="text"],
  input[type="password"],
  input[type="number"] {
    max-width: 100%;
  }
}

/* ===== Misc ===== */
.text-info { color: var(--color-brand); }
.text-error { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-success { color: var(--color-success); }
.dn { display: none; }
.hide { display: none; }
.clr { clear: both; }

/* Индикатор загрузки */
.load-img {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
}
.load-img div {
  position: fixed;
  top: 30%; left: 35%;
}

/* Кнопка «наверх» без картинки */
.to-top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: none;
  z-index: 999;
  background: var(--color-brand);
  color: #fff;
  padding: 10px 16px;
  border-radius: 30px;
  text-decoration: none;
  font-weight: 500;
  box-shadow: var(--shadow);
  transition: 0.2s;
}
.to-top-btn:hover {
  background: #1a5fb0;
  color: #fff;
  text-decoration: none;
}

/* Telegram button – можно оставить, но если хотите убрать и его – удалите */
.telegram-button {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 9999;
}
.telegram-button img {
  height: auto;
  width: 130px;
}
.accordion-header {
    cursor: pointer;
    padding: 12px 16px;
    background: var(--color-brand-light);
    border-radius: 8px;
    margin-bottom: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
}
.accordion-header:hover {
    background: #b7d2fc;
}
.accordion-icon {
    display: inline-block;
    width: 24px;
    font-weight: bold;
    color: var(--color-brand);
}
.accordion-content {
    padding: 10px 16px 16px 16px;
    border-left: 2px solid var(--color-brand);
    margin-left: 10px;
    margin-bottom: 10px;
}
.accordion-sub {
    margin-top: 8px;
}
.accordion-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}
/* ===== Адаптивные колонки для форм ===== */
.flex-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 10px;
}

.flex-item {
    flex: 1 1 calc(50% - 15px);
    min-width: 250px;
}

.flex-item-3 {
    flex: 1 1 calc(33.333% - 15px);
    min-width: 200px;
}
/* Центрирование столбцов с 4-го по 12-й (индексы с 1) */
.table-admin td:nth-child(n+4),
.table-admin th:nth-child(n+4) {
    text-align: center;
    vertical-align: middle;
}

/* Первые три столбца остаются по левому краю */
.table-admin td:nth-child(-n+3),
.table-admin th:nth-child(-n+3) {
    text-align: left;
    vertical-align: middle;
}
/* Мобильная версия — всё в столбец */
@media (max-width: 768px) {
    .flex-item,
    .flex-item-3 {
        flex: 1 1 100%;
        min-width: 0;
    }
}

/* Дополнительный отступ для групп полей */
.flex-item label,
.flex-item-3 label {
    display: block;
    margin-bottom: 4px;
}
textarea {
width: 100%;
}
/* Тёмная тема для textarea */
.dark-theme textarea {
    background: var(--bg-body);      /* тёмный фон (из переменной) */
    color: var(--text-primary);      /* светлый текст */
    border-color: var(--border-color);
}
.dark-theme .accordion-header:hover {
    background: #0255d0;
}
.dark-theme .accordion-icon {
    color: #ffffff;
}
/* ===== Формы ===== */
.form-group {
    margin-bottom: 18px;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-body);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-size: 1rem;
    box-sizing: border-box;
}
.form-control:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(42, 125, 225, 0.2);
}
.text-muted {
    color: var(--text-secondary);
}
.text-center {
    text-align: center;
}
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 20px;
}

/* Тёмная тема – корректировка */
.dark-theme .form-control {
    background: var(--bg-body);
    color: var(--text-primary);
}
.dark-theme .form-control:focus {
    border-color: #4a8cf7;
    box-shadow: 0 0 0 3px rgba(74, 140, 247, 0.3);
}
.dark-theme .text-muted {
    color: #a0b4c8;
}
/* Фиксация подвала внизу */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

.wrap {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* минимальная высота = высота экрана */
}

.content {
    flex: 1; /* занимает всё свободное пространство */
}

.footer {
    flex-shrink: 0; /* подвал не сжимается */
}
/* ===== Уведомления (toast) по центру экрана ===== */
.toast-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    z-index: 99999;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 500;
    text-align: center;
    max-width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none; /* чтобы не мешать кликам */
}

.toast-notification.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.toast-success {
    background: #d4edda; /* салатовый */
    color: #155724;
    border: 1px solid #c3e6cb;
}

.toast-error {
    background: #f8d7da; /* светло-красный */
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Мобильная адаптация */
@media (max-width: 576px) {
    .toast-notification {
        padding: 16px 24px;
        font-size: 1rem;
        width: 90%;
    }
}