/* =========================================
   styles-audit.css - Sample / Audit pages
   ========================================= */


/* ══════════════════════════════════════════
   VARIABLES & RESET
══════════════════════════════════════════ */

html {
  height: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scroll-padding-top: 30px;
}

:root {
  --white: #ffffff;
  --gray: #f7f7f7;
  --light-blue: #1E88E5;
  --border: #E6ECEF;
  --btn-green: #23c55e;
  --text-muted: #444;
  --color-black: #000000;
}

body {
  display: flex;
  min-height: 100%;
  margin: 0;
  padding-left: 260px;
  overflow-x: hidden;
  font-family: Arial, sans-serif;
  color: var(--text-muted);
  background-color: #fafcfe;
  box-sizing: border-box;
}


/* ══════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════ */

#list {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: 260px;
  height: 100vh;
  padding: 20px 20px 0 28px;
  overflow-y: auto;
  font: 1.1em sans-serif;
  background: #ffffff;
  border-right: 1px solid #eee;
  box-sizing: border-box;
}

/* Навигационная часть занимает всё пространство и скроллится */
#list-nav {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 16px;
}

#list ul {
  padding-left: 0;
  list-style-type: none;
}

#list ul li {
  margin-bottom: 5px;
}

/* Sidebar links */
#list ul li a {
  display: block;
  padding: 5px 8px 5px 6px;
  font-weight: 400;
  text-decoration: none;
  color: #888;
  border-left: 3px solid transparent;
  border-radius: 0 6px 6px 0;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

#list ul li a.active {
  font-weight: 550;
  color: var(--light-blue);
  background: #f0f8ff;
  border-left-color: var(--light-blue);
}

#list ul li a:hover:not(.active) {
  color: var(--light-blue);
  background: #f8fbff;
  border-left-color: #c8dff7;
}

/* Back button - desktop sidebar */
.back-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text-muted);
  background: var(--gray);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.back-button:hover {
  background: #e8f3fd;
  color: var(--light-blue);
  border-color: var(--light-blue);
}

.back-button a {
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
}

/* CTA в sidebar - всегда видна, прилипает к низу */
.sidebar-cta {
  position: sticky;
  bottom: 0;
  padding: 16px 0 20px;
  background: #ffffff;
  border-top: 1px solid var(--border);
}

.sidebar-cta-text {
  font-size: 12px;
  line-height: 1.45;
  color: #999;
  margin: 0 0 10px;
}

.sidebar-cta-link {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: #fff;
  background: var(--btn-green);
  border-radius: 8px;
  transition: opacity 0.18s;
}

.sidebar-cta-link:hover {
  opacity: 0.88;
}


/* ══════════════════════════════════════════
   CONTENT AREA
══════════════════════════════════════════ */

.content {
  flex: 1;
  min-width: 0;
  max-width: 800px;
  margin: 20px auto;
  padding: 36px 40px 36px 60px;
  color: var(--text-muted);
  background: var(--white);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  isolation: isolate;
}


/* ══════════════════════════════════════════
   BASE ELEMENTS
══════════════════════════════════════════ */

p {
  margin: 6px auto;
}

li {
  margin: 5px auto;
}

section {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid #e2e2e2;
}

section:last-child {
  border-bottom: none;
}

.page-item {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid #e2e2e2;
}

.page-item:last-child {
  border-bottom: none;
}

h1 {
  color: #3161ab;
}

h2 {
  margin-top: 0;
  font-size: 1.5em;
  color: #3161ab;
}

h3 {
  font-size: 1.25em;
  color: #3161ab;
}

h4 {
  font-size: 1.1em;
  color: #3161ab;
}

pre,
code {
  display: block;
  max-width: 100%;
  margin: 8px 0;
  padding: 6px 10px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  background: #f4f5fa;
  border-radius: 5px;
  box-sizing: border-box;
}

table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
}

td,
th {
  padding: 6px 8px;
  border: 1px solid #bbb;
}

th {
  background: #e9eef5;
}

img {
  max-width: 100%;
  margin: 0 15px -5px 0;
}


/* ══════════════════════════════════════════
   MOBILE TOC - вынести из flex-потока body
══════════════════════════════════════════ */

section:has(.toc-mobile-btn) {
  position: fixed;
  width: 0;
  height: 0;
  padding: 0;
  margin: 0;
  overflow: visible;
  border: none;
}


/* ══════════════════════════════════════════
   MOBILE TOC - Button (скрыт на десктопе)
══════════════════════════════════════════ */

.toc-mobile-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 1001;
  transform: translateX(-50%);
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  color: white;
  background: var(--light-blue);
  border: none;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: opacity 0.2s ease;
}

body:has(.toc-mobile.active) .toc-mobile-btn {
  display: none;
}

@supports (top: env(safe-area-inset-top)) {
  .toc-mobile-btn {
    top: calc(12px + env(safe-area-inset-top, 0px));
  }
}

/* Скрыты на десктопе */
.toc-mobile {
  display: none;
}

#toc-mobile-list {
  display: none;
}


/* ══════════════════════════════════════════
   CTA
══════════════════════════════════════════ */

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 60px;
  padding: 70px 0;
}

.cta p {
  letter-spacing: 1px;
  line-height: 1.8;
  text-align: center;
}

.cta-bottom {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid #e6e7eb;
}

.cta-bottom-span {
  font-size: 36px;
  font-weight: 550;
  letter-spacing: 1px;
  color: var(--btn-green);
}

.container h2 {
  text-align: center;
}


/* ══════════════════════════════════════════
   FORM
══════════════════════════════════════════ */

.form-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  margin: 24px 0;
  box-sizing: border-box;
}

.email-input {
  flex: 1;
  min-width: 0;
  padding: 16px 20px;
  font-size: 16px;
  color: var(--text-muted);
  background: var(--white);
  border: 0.5px solid var(--border);
  border-radius: 4px 0 0 4px;
  outline: none;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}

.try-btn {
  flex-shrink: 0;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--white);
  background: var(--btn-green);
  border: 0.5px solid var(--border);
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}


/* ══════════════════════════════════════════
   HERO ITEMS ROW
══════════════════════════════════════════ */

.hero-items {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin: 0;
  font-size: 16px;
}

.screenshot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 130px;
  margin: 20px 0;
  padding: 28px 24px;
  background: #f5f7fa;
  border: 2px dashed #c8d3dc;
  border-radius: 8px;
  box-sizing: border-box;
  text-align: center;
}

.screenshot-placeholder .sp-icon {
  font-size: 30px;
  line-height: 1;
  opacity: 0.55;
}

.screenshot-placeholder .sp-label {
  font-size: 13px;
  font-weight: 600;
  font-style: normal;
  color: #4a6880;
  letter-spacing: 0.2px;
  max-width: 480px;
}

.screenshot-placeholder .sp-note {
  font-size: 11px;
  font-style: italic;
  color: #8faabb;
  margin-top: 1px;
  max-width: 400px;
}



/* ══════════════════════════════════════════
   RESPONSIVE (≤1024px)
══════════════════════════════════════════ */

@media (max-width: 1024px) {
  body {
    padding-left: 0;
  }

  .toc-nav,
  #list {
    display: none;
  }

  .toc-mobile-btn {
    display: block;
  }

  #toc-mobile-list {
    display: block;
  }

  .content {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 16px;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .cta {
    flex-direction: column;
    gap: 24px;
    padding: 40px 0;
  }

  .hero-items {
    flex-direction: column;
    gap: 12px;
  }

  .toc-mobile {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 75vh;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 0 0 calc(20px + env(safe-area-inset-bottom, 0px)) 0;
    font-size: 16px;
    background: white;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(110%);
    transition: transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
  }

  .toc-mobile.active {
    transform: translateY(0);
  }

  .toc-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 10px;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--border);
  }

  .toc-mobile-header strong {
    font-size: 15px;
    font-weight: 600;
    color: #444;
  }

  .toc-header-btn {
    display: inline-flex;
    align-items: center;
    padding: 9px 14px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
    color: var(--text-muted);
    background: var(--gray);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-sizing: border-box;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
  }

  #toc-mobile-list {
    list-style: none;
    padding: 10px 0 0;
    margin: 0;
  }

  #toc-mobile ul li {
    padding: 0;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
  }

  #toc-mobile ul li:last-child {
    border-bottom: none;
  }

  #toc-mobile ul li a {
    display: block;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.45;
    text-decoration: none;
    color: var(--text-muted);
    background: transparent;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  #toc-mobile ul li a.active {
    font-weight: 550;
    color: var(--light-blue);
    background: #f0f8ff;
  }

  .toc-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.5);
    transition: opacity 0.35s;
  }

  .toc-mobile-overlay.active {
    opacity: 1;
    pointer-events: all;
  }

  .table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table,
  .audit-table {
    width: 100%;
    min-width: 100%;
    table-layout: fixed;
    font-size: 13px;
    box-sizing: border-box;
  }

  td,
  th,
  .audit-table td,
  .audit-table th {
    padding: 5px 6px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    vertical-align: top;
  }

@media (hover: none) and (pointer: coarse) {
  #toc-mobile ul li a:hover,
  .toc-header-btn:hover,
  .back-button:hover {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
  }

  #toc-mobile ul li a.active:hover {
    color: var(--light-blue);
    background: #f0f8ff;
  }
}
}