:root {
  --bg-color: #0f111a;
  --text-color: #c5c8c6;
  --accent-color: #50fa7b;
  --accent-red-color: #c00707;
  --disabled-color: gray;
  --carts-bg: #191b24;
  --btn-bg: #282a36;
  --btn-hover: #44475a;
  --input-bg: #1a1c25;
  --border-color: #333;
  --text-muted: #888;
}

html, body {
  height: 100%;
  margin: 0;
}

[data-theme="light"] {
  --bg-color: #f5f5f5;
  --text-color: #1c1c1c;
  --accent-color: #005f73;
  --accent-red-color: #c00707;
  --disabled-color: gray;
  --carts-bg: #eeeeee;
  --btn-bg: #e0e0e0;
  --btn-hover: #c0c0c0;
  --input-bg: #ffffff;
  --border-color: #ccc;
  --text-muted: #666;
}

body {
  font-family: 'Aldrich', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  padding: 0;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem 2rem 2rem 2rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.menu-sticky {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-color);
  border-bottom: 1px solid #333;
  border-top: 1px solid #333;
}

.menu-nav {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 2rem;
  /*
  padding: 0 0 2rem 0;
  */
}

.nav-list {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-list a {
  text-decoration: none;
  color: var(--accent-color);
  font-weight: 500;
}

/* бургер по умолчанию скрыт на десктопе */
.burger {
  display: none;
  background: none;
  border: none;
  font-weight: 500;
}

.menu{
  padding: 10px 2rem;
}

.theme-toggle {
  cursor: pointer;
  font-size: 1.5rem;
  border: 1px solid var(--accent-color);
  border-radius: 4px;
  background: none;
  color: var(--accent-color);
  transition: 0.2s;
  min-width: 60px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.theme-toggle:focus {
  outline: none;
}

.theme-toggle:active {
  transform: scale(0.97);
}

.theme-toggle:hover {
  background-color: var(--accent-color);
  color: var(--bg-color);
}

.hero {
  text-align: left;
  margin: 2rem 0;
  line-height: 1.5;
}

.hero h1 {
  font-size: 2.5rem;
  color: var(--accent-color);
  margin-bottom: 1rem;
}

.hero h2 {
  font-size: 1.5rem;
  color: var(--text-color);
  margin-bottom: 1rem;
  font-weight: normal;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-color);
  margin-bottom: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.5rem;
  font-family: 'Aldrich', monospace;
  font-size: 1rem;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s;
}

/* Disabled наследует .btn + свои цвета */
.btn.btn-disabled {
  color: var(--disabled-color);
  background-color: var(--btn-bg);
  border: 2px solid var(--border-color);
}

/* Primary наследует .btn + свои цвета */
.btn.btn-primary {
  color: var(--accent-color);
  background-color: var(--btn-bg);
  border: 2px solid var(--accent-color);
}

.btn.btn-primary:hover {
  background-color: var(--btn-hover);
  color: #fff;
}

/* Secondary наследует .btn + свои цвета */
.btn.btn-secondary {
  color: var(--text-color);
  background-color: var(--btn-bg);
  border: none;
  font-weight: 100;
}

.btn.btn-secondary:hover {
  background-color: var(--btn-hover);
  color: #fff;
}

/* Danger наследует .btn + свои цвета */
.btn.btn-danger {
  background-color: #dc3545;
  color: #fff;
  border: none;
}

.btn.btn-danger:hover {
  background-color: #c82333;
}

/* Small наследует .btn + свои цвета */
.btn.btn-small {
  color: var(--accent-color);
  background-color: var(--btn-bg);
  border: none;
  font-weight: 100;
  padding: 0.4rem 1.2rem;
}

.btn.btn-small-red {
  color: var(--accent-red-color);
  background-color: var(--btn-bg);
  border: none;
  font-weight: 100;
  padding: 0.4rem 1.2rem;
}

.btn.btn-small:hover {
  background-color: var(--btn-hover);
  color: #fff;
}

footer {
  text-align: center;
  padding: 1rem 0;
  font-size: 0.9rem;
  border-top: 1px solid #333;
  color: var(--text-color);
}

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

footer a:hover {
  text-decoration: underline;
}

/* CHECKS TABLE */
.checks-table {
  width: 100%;            /* растягиваем на всю ширину контейнера */
  table-layout: fixed;
  border-collapse: separate; /* чтобы работал spacing */
  border-spacing: 0 8px;  /* расстояние между строками, можно менять */
}

.checks-table th,
.checks-table td {
  padding: 10px 15px;     /* внутренние отступы для читаемости */
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #ccc; /* тонкая линия между строками */
}

.checks-table th {
  font-weight: 600;
}

.checks-table td a {
  /* margin-right: 8px;       расстояние между ссылками Edit/Delete */
  text-decoration: none;
  color: #007bff;
}

/* health table */
.col-h-metric { width: 200px; }
.col-h-status { width: 100px; }
.col-h-info   { width: auto; }

/* checks table */
.col-target   { width: auto; }
.col-type     { width: 40px; }
.col-ssl      { width: 30px; }
.col-interval { width: 60px; }
.col-status   { width: 50px; }
.col-last     { width: 100px; }
.col-actions  { width: 170px; }

.col-actions,
.col-last {
  white-space: nowrap;
}

.col-actions td {
  display: flex;
  gap: 6px;
}

.target {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0; /* КРИТИЧНО для ellipsis */
}

.target-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.target-url {
  font-size: 0.85rem;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tr-inactive td:not(.btn):not(.actions) {
  color: #888;
  opacity: 0.7;
}


/* STATUS IN TABLE */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-up::before {
  background-color: #50fa7b;
}

.status-down::before {
  background-color: #ff5555;
}

/* FORM LAYOUT */
.check-form {
  max-width: 720px;
}

.form-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: center;
}

.form-row label {
  text-align: right;
  color: var(--text-color);
  font-weight: 500;
}

/* INPUTS */
.form-field input,
.form-field select {
  width: 100%;
  padding: 8px 0px;
  background-color: var(--input-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

/* CHECKBOX */
.form-field input[type="checkbox"] {
  width: auto;
  margin-top: 6px;
}

/* FOCUS */
.form-field input:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--accent-color);
}

/* HELP & ERRORS */
.help-text {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.field-error {
  color: #dc3545;
  font-size: 0.85rem;
  margin-top: 4px;
}

/* ACTIONS */
.form-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
}

/* TOGGLE */
.toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background-color: #555;
  border-radius: 24px;
  cursor: pointer;
  transition: 0.2s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.toggle input:checked + .toggle-slider {
  background-color: var(--accent-color);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

/* INTERVAL */
.interval-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.interval-btn {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  background: var(--btn-bg);
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
  cursor: pointer;
  font-size: 18px;
}

.interval-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.interval-value {
  min-width: 24px;
  text-align: center;
  font-weight: 600;
}

.interval-unit {
  display: inline-block;
  width: 60px;           /* фиксируем под "minutes" */
  text-align: left;      /* или center */
  opacity: 0.7;
  font-size: 14px;
}

/* AUTH */
.auth-field input,
.auth-field select {
  width: 25%;
  min-width: 250px;
  padding: 8px 10px;
  background-color: var(--input-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.last-updated {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

.inline-code {
  font-family: monospace;
  font-size: 1rem;
  background: var(--btn-bg);
  padding: 2px 4px;
  border-radius: 3px;
}

.login-actions {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  /*
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
  */
}

.qr {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qr-hint {
  font-size: 0.85rem;
  color: #777;
  margin-bottom: 0.4rem;
}

.subtitle {
  margin: 0.5rem 0 1.2rem;
  color: #888;
  font-size: 0.95rem;
}

.steps {
  margin-bottom: 1.5rem;
}

.steps ol {
  padding-left: 1.2rem;
  margin: 0.5rem 0 0;
}


/* MESSAGES and ALERTS*/
.messages {
    margin-bottom: 1rem;
    font-size: 1.3rem;
    align-items: center;
    justify-content: center;
}

.message {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    font-weight: 500;
    animation: shake 0.3s ease-in-out; /* небольшой акцент при появлении */
}

.message-error {
    color: var(--accent-red-color);
}

.message.success {
    color: var(--accent-color);
}

/* Легкая анимация “тряски” для привлечения внимания */
@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

/* metrics on health page */
.metrics {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 160px;
}

.metric {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}

.metric span:first-child {
  color: var(--text-muted);
}

.muted {
  color: var(--text-muted);
  font-style: italic;
}

.form-alert {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    font-weight: 500;
    animation: shake 0.3s ease-in-out;
    color: var(--accent-red-color);
}

@media (max-width: 768px) {
  .container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem 1rem;
  }

  /* бургер меню, возможно
  .nav-list {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    padding: 10px 0;
  }
  .burger {
    display: block;
    color: var(--accent-color);
  }
  .menu-nav {
    justify-content: center;
  }
  .menu-nav.active .nav-list {
    display: flex; /* раскрытие меню при клике на бургер
  }
  */

  .auth-field {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .auth-field input,
  .auth-field select,
  .auth-field button {
    width: 100%;
    padding: 8px 0px;
    min-width: 0;
  }

  .login-actions {
    justify-content: center;
  }

  .checks-table thead {
    display: none;
  }

  .checks-table,
  .checks-table tbody,
  .checks-table tr,
  .checks-table td {
    display: block;
  }

  .checks-table tr {
    background: var(--carts-bg);
    margin-bottom: 12px;
    border-radius: 6px;
    padding: 10px;
  }

  .checks-table td {
    border: none;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
  }

  /* главный контент карточки */
  .card-main {
    margin-bottom: 8px;
    border-bottom: 1px solid var(--accent-color);
    padding-bottom: 8px;
  }

  .checks-table td.card-main {
    display: block;
    position: relative;
    padding-bottom: 12px;
    margin-bottom: 8px;
  }

  .checks-table td.card-main::before {
    display: none;
  }

  .checks-table td.card-main::after {
    content: "";
    display: block;
    height: 1px;
    background-color: var(--border-color);
    margin-top: 8px;
    opacity: 0.6;
  }

  .checks-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-right: 10px;
  }

  .form-row {
    grid-template-columns: minmax(120px, 1fr) 2fr;
    gap: 8px;
  }

  .form-row label {
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* health page cards*/
  /* ---- карточка сервиса ---- */
  .checks-table .health-card td {
    display: block;
    justify-content: flex-start;
    padding: 4px 0;
  }

  /* верхняя строка: Service + Status */
  .health-card td:nth-child(1),
  .health-card td:nth-child(2) {
    display: inline-flex;
    width: 48%;
    align-items: center;
  }

  .health-card td:nth-child(1) {
    justify-content: flex-start;
    font-weight: 600;
  }

  .health-card td:nth-child(2) {
    justify-content: flex-end;
  }

  /* Info — отдельной строкой */
  .health-card td:nth-child(3) {
    display: block;
    margin-top: 6px;
    font-size: 0.9rem;
    color: var(--text-muted);
  }

  /* убираем data-label для Service и Status */
  .health-card td:nth-child(1)::before,
  .health-card td:nth-child(2)::before,
  .health-card td:nth-child(3)::before {
    display: none;
  }

  .metrics {
    max-width: 100%;
  }

}
