/* Файл: base.css — общий каркас: цвета, боковое меню/нижняя панель, 3 версии (десктоп/планшет/телефон) */
/* Участвует в: base.html (подключается на всех страницах) */

:root {
  --bg: #0f1420;
  --bg-panel: #161d2e;
  --bg-card: #1c2538;
  --border: #2a3450;
  --text: #e6ebf5;
  --text-muted: #8b96ab;
  --accent: #4f8cff;
  --accent-hover: #3f78e0;
  --ok: #3ddc84;
  --warn: #ffb648;
  --danger: #ff5c6c;
  --radius: 10px;
  --sidebar-width: 220px;
  --sidebar-width-tablet: 72px;
  --bottom-tabs-height: 64px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }

.app-shell { display: flex; min-height: 100vh; }

/* ---------- Боковое меню (десктоп) ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 8px;
  flex-shrink: 0;
}

.sidebar-brand {
  font-size: 18px;
  font-weight: 600;
  padding: 8px 12px 20px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: var(--radius);
  color: var(--text);
  margin-bottom: 4px;
}

.nav-item:hover { background: var(--bg-card); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item-logout { margin-top: auto; color: var(--danger); }

.icon { font-size: 18px; width: 22px; text-align: center; }

.app-content {
  flex: 1;
  padding: 24px;
  min-width: 0;
}

.bottom-tabs { display: none; }

/* ---------- Общие элементы интерфейса ---------- */
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius);
  padding: 10px 16px;
  min-height: 44px;
  font-size: 14px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

.btn:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); }
.btn-warn { background: var(--warn); color: #1a1a1a; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: 6px 10px; min-height: 36px; font-size: 13px; }

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

label { display: block; font-size: 13px; color: var(--text-muted); margin: 10px 0 4px; }

.form-row { margin-bottom: 8px; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-running { background: rgba(61,220,132,0.15); color: var(--ok); }
.badge-stopped { background: rgba(139,150,171,0.15); color: var(--text-muted); }
.badge-failed { background: rgba(255,92,108,0.15); color: var(--danger); }
.badge-unknown { background: rgba(255,182,72,0.15); color: var(--warn); }
.badge-overdue { background: rgba(255,92,108,0.25); color: var(--danger); }

.error-box {
  background: rgba(255,92,108,0.12);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; }

.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type=text] { width: auto; min-width: 220px; }

.mobile-card-list { display: none; }

/* ================= ПЛАНШЕТ (768–1024px): иконки вместо текста в меню ================= */
@media (max-width: 1024px) {
  .sidebar { width: var(--sidebar-width-tablet); align-items: center; }
  .sidebar .label { display: none; }
  .sidebar-brand .label { display: none; }
  .nav-item { justify-content: center; padding: 14px 0; width: 44px; height: 44px; }
  .app-content { padding: 16px; }
}

/* ================= ТЕЛЕФОН (<768px): нижняя панель вкладок, карточки вместо таблиц ================= */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .app-content { padding: 12px; padding-bottom: calc(var(--bottom-tabs-height) + 16px); }

  .bottom-tabs {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-tabs-height);
    background: var(--bg-panel);
    border-top: 1px solid var(--border);
    z-index: 100;
  }
  .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--text-muted);
    font-size: 11px;
    min-height: 44px;
  }
  .tab-item.active { color: var(--accent); }
  .tab-item .icon { font-size: 20px; }

  table.desktop-table { display: none; }
  .mobile-card-list { display: block; }

  .toolbar input[type=text] { width: 100%; min-width: 0; }
  .toolbar { flex-direction: column; align-items: stretch; }
}
