/* ── Сброс и базовые стили ────────────────────────────────────────────────── */

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

body {
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #222;
  background: #fff;
}

a {
  color: #106E9A;
  text-decoration: underline;
}
a:hover {
  text-decoration: none;
}

img {
  border: none;
  max-width: 100%;
}

p {
  margin: 10px 0;
}

/* ── Обёртка ─────────────────────────────────────────────────────────────── */

#sitewrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 10px;
}

/* ── Шапка ───────────────────────────────────────────────────────────────── */

#header {
  padding: 14px 0 12px;
  border-bottom: 2px solid #106E9A;
  margin-bottom: 20px;
}

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

#logo {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

#logo img {
  height: 48px;
  width: auto;
}

/* Бургер */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-burger span {
  display: block;
  width: 100%;
  height: 3px;
  background: #106E9A;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ── Основной layout ──────────────────────────────────────────────────────── */

#main {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

#sidebar {
  flex: 0 0 220px;
  min-width: 0;
}

.sb-block {
  margin-bottom: 24px;
}

.sb-title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 8px;
  color: #333;
}

#tools-list,
#info-list {
  list-style: none;
}

#tools-list li,
#info-list li {
  line-height: 30px;
  border-bottom: 1px solid #f0f0f0;
}

.nav-icon {
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
  color: #106E9A;
}

#tools-list a,
#info-list a {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  color: #106E9A;
  text-decoration: none;
  border-radius: 3px;
  transition: background 0.15s, color 0.15s;
}

#tools-list a:hover,
#info-list a:hover {
  background: #f0f7fb;
  text-decoration: none;
}

#tools-list .nav-active a,
#info-list .nav-active a {
  background: #106E9A;
  color: #fff;
  font-weight: bold;
}

#tools-list .nav-active .nav-icon,
#info-list .nav-active .nav-icon {
  color: #fff;
}

/* ── Подменю в навигации ─────────────────────────────────────────────────── */

.nav-group-toggle {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  color: #106E9A;
  cursor: pointer;
  border-radius: 3px;
  user-select: none;
  transition: background 0.15s;
}

.nav-group-toggle:hover {
  background: #f0f7fb;
}

.nav-arrow {
  width: 10px;
  height: 6px;
  margin-left: auto;
  color: #106E9A;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.nav-group-open > .nav-group-toggle .nav-arrow {
  transform: rotate(180deg);
}

.nav-sub {
  list-style: none;
  display: none;
  padding-left: 22px;
}

.nav-group-open > .nav-sub {
  display: block;
}

.nav-sub li {
  line-height: 28px;
  border-bottom: none;
}

.nav-sub a {
  display: block;
  padding: 2px 6px;
  color: #106E9A;
  text-decoration: none;
  border-radius: 3px;
  transition: background 0.15s;
}

.nav-sub a:hover {
  background: #f0f7fb;
}

.nav-sub .nav-active a {
  background: #106E9A;
  color: #fff;
  font-weight: bold;
}

/* ── Контент ─────────────────────────────────────────────────────────────── */

#content {
  flex: 1 1 0;
  min-width: 0;
}

#content h1 {
  font-size: 20px;
  line-height: 1.3;
  margin-bottom: 12px;
}

#content h2 {
  font-size: 16px;
  margin-top: 18px;
  margin-bottom: 10px;
}

#content h3 {
  font-size: 14px;
  font-weight: bold;
  margin-top: 10px;
}

#content ol,
#content ul {
  margin-left: 24px;
}

#content li {
  padding-bottom: 4px;
}

/* ── Формы инструментов ───────────────────────────────────────────────────── */

.tool-form {
  background: #FDFDED;
  border: 1px solid #ccc;
  padding: 12px 18px;
  margin: 16px 0;
}

.tool-form label {
  display: block;
  margin-bottom: 4px;
  font-weight: bold;
}

.tool-input {
  height: 32px;
  line-height: 32px;
  border: 1px solid #ccc;
  padding: 0 8px;
  font-size: 14px;
  width: 400px;
  max-width: 100%;
}

.tool-btn {
  height: 32px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  background: #106E9A;
  color: #fff;
  border: none;
  border-radius: 3px;
  transition: background 0.15s, opacity 0.15s;
}

.tool-btn:hover {
  background: #0d5a80;
}

.tool-btn:focus {
  outline: 2px solid #106E9A;
  outline-offset: 2px;
}

.tool-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.tool-input:focus {
  outline: 2px solid #106E9A;
  outline-offset: 0;
  border-color: #106E9A;
}

/* ── Информационный блок инструментов ────────────────────────────────────── */

.tool-info {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
  color: #444;
}

.tool-info h2 {
  font-size: 15px;
  margin-bottom: 8px;
  color: #333;
}

.tool-info p {
  margin: 6px 0;
}

.tool-info ul {
  margin: 6px 0 6px 20px;
}

.tool-info li {
  padding-bottom: 2px;
}

.tool-info code {
  font-family: monospace;
  background: #f4f4f4;
  padding: 1px 4px;
  border-radius: 2px;
}

.tool-info kbd {
  font-family: monospace;
  font-size: 12px;
  background: #f4f4f4;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 1px 5px;
}

/* ── Spinner ──────────────────────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid #d0e8f3;
  border-top-color: #106E9A;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-msg {
  color: #888;
  display: flex;
  align-items: center;
  padding: 10px 0;
}

/* ── pre / code ───────────────────────────────────────────────────────────── */

.whois-raw {
  background: #f6f8fa;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  padding: 12px;
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 10px;
  max-height: 400px;
  overflow-y: auto;
}

code {
  font-family: monospace;
  font-size: 13px;
  background: #f0f7fb;
  padding: 1px 5px;
  border-radius: 2px;
  color: #106E9A;
}

/* ── Результаты whois ────────────────────────────────────────────────────── */

.domain-free    { color: #138C2A; font-weight: bold; }
.domain-taken   { color: #B42020; font-weight: bold; }
.domain-unknown { color: #888; }

.result-table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
}

.result-table th,
.result-table td {
  border: 1px solid #ccc;
  padding: 6px 10px;
  text-align: left;
}

.result-table tr.head {
  background: #FDFDED;
  font-weight: bold;
}

.result-table tr.row-even { background: #fff; }
.result-table tr.row-odd  { background: #F4F5FF; }

/* ── Список статей ───────────────────────────────────────────────────────── */

.article-list {
  list-style: none;
}

.article-item {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  line-height: 1.5;
}

.article-date {
  color: #7A8387;
  font-size: 12px;
  margin-right: 8px;
}

/* ── Список статей ───────────────────────────────────────────────────────── */

.article-announce {
  margin: 2px 0 0;
  font-size: 12px;
  color: #555;
  line-height: 1.4;
}

.article-title {
  font-weight: bold;
}

.article-digest {
  margin: 3px 0 0;
  font-size: 12px;
  color: #555;
  line-height: 1.4;
}

/* ── Пагинация ───────────────────────────────────────────────────────────── */

.pagination {
  margin: 20px 0;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.pagination a,
.pagination span {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid #ccc;
  text-decoration: none;
  color: #106E9A;
  font-size: 13px;
}

.pagination span.current {
  background: #106E9A;
  color: #fff;
  border-color: #106E9A;
}

.pagination .pag-gap {
  border: none;
  padding: 3px 4px;
  color: #aaa;
}

.pager-total {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}

/* ── Подвал ──────────────────────────────────────────────────────────────── */

#footer {
  border-top: 1px solid #ccc;
  margin-top: 30px;
  padding: 16px 0;
  font-size: 11px;
  color: #666;
}

#footer-desc {
  margin-bottom: 8px;
}

#footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

#footer-links a {
  color: #106E9A;
  font-size: 11px;
}

/* ── Массовый whois ──────────────────────────────────────────────────────── */

.mass-form-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.mass-names {
  flex: 0 0 260px;
}

.mass-textarea {
  width: 100%;
  height: 130px;
  border: 1px solid #ccc;
  padding: 6px 8px;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

.mass-zones {
  flex: 1 1 0;
  min-width: 0;
}

.zone-group {
  margin-bottom: 10px;
}

.zone-group-title {
  font-weight: bold;
  margin-bottom: 6px;
  font-size: 13px;
}

.zone-toggle-btn, .zone-action-btn {
  font-size: 11px;
  padding: 1px 6px;
  cursor: pointer;
  background: #f5f5f5;
  border: 1px solid #ccc;
  margin-left: 8px;
}

.zone-group-actions {
  margin-bottom: 6px;
}

.zone-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 13px;
  max-height: 200px;
  overflow-y: auto;
}

.zone-subgroup {
  margin-bottom: 8px;
}

.zone-subgroup strong {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
  margin-top: 6px;
}

.zone-cb {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  white-space: nowrap;
}

.zone-loading {
  color: #888;
  font-size: 13px;
}

.mass-form-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.mass-count {
  font-size: 12px;
  color: #888;
}

/* Результаты массовой проверки */

.mass-results { margin-top: 16px; }

.mass-name-block { margin-bottom: 20px; }

.mass-name-title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 6px;
}

/* ── Ответ сервера ────────────────────────────────────────────────────────── */

.response-summary {
  font-size: 16px;
  margin: 12px 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.response-code {
  font-size: 24px;
  font-weight: bold;
}

.response-url {
  font-size: 13px;
  color: #555;
  word-break: break-all;
}

.redirect-chain {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 13px;
}

.chain-title {
  font-weight: bold;
  margin-bottom: 6px;
}

.chain-step {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 0;
}

.chain-final {
  font-weight: bold;
  border-top: 1px solid #ddd;
  margin-top: 4px;
  padding-top: 6px;
}

.chain-arrow { color: #aaa; }

.chain-url {
  word-break: break-all;
  color: #333;
}

.headers-block {
  margin-top: 10px;
  font-size: 13px;
}

.headers-block summary {
  cursor: pointer;
  padding: 4px 0;
  color: #106E9A;
}

/* ── Адаптивность ─────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  /* Бургер виден */
  .nav-burger {
    display: flex;
  }

  /* Sidebar — скрытый drawer слева */
  #sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 240px;
    height: 100%;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    z-index: 100;
    padding: 16px 12px;
    overflow-y: auto;
    transition: left 0.25s ease;
    box-shadow: none;
  }

  #sidebar.sidebar-open {
    left: 0;
    box-shadow: 4px 0 16px rgba(0,0,0,0.12);
  }

  /* Контент занимает всю ширину */
  #main {
    display: block;
  }

  #content {
    width: 100%;
  }

  /* Формы */
  .tool-input {
    width: 100%;
    max-width: 100%;
  }

  .tool-form-row {
    flex-direction: column;
    gap: 8px;
  }

  .tool-btn {
    width: 100%;
  }

  /* Массовый whois */
  .mass-form-row {
    flex-direction: column;
  }

  .mass-names {
    flex: unset;
    width: 100%;
  }

  .mass-textarea {
    width: 100%;
  }
}
