/* ============================================
   БАЗОВЫЕ СТИЛИ
   ============================================ */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 16px 0;
}

/* ============================================
   ОСНОВНАЯ СТРУКТУРА
   ============================================ */
.app {
  max-width: 1800px;
  margin: auto;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 18px;
}

h1 {
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 12px 0;
  text-shadow: 0 2px 10px rgba(0,0,0,0.1);
  grid-column: 1 / -1;
}

h3 {
  color: #2d3748;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}

/* ============================================
   ЧЕК-ЛИСТ
   ============================================ */
section {
  background: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: transform 0.2s, box-shadow 0.2s;
}

section:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

label {
  display: flex;
  align-items: center;
  margin: 3px 0;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 6px;
  transition: background 0.2s;
  font-size: 15px;
  line-height: 1.45;
  color: #2d3748;
}

label:hover {
  background: #f7fafc;
}

label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  cursor: pointer;
  accent-color: #667eea;
  flex-shrink: 0;
}

.critical {
  color: #e53e3e;
  font-size: 12px;
  margin-left: 8px;
  padding: 2px 8px;
  background: #fed7d7;
  border-radius: 12px;
  font-weight: 600;
}

.risk {
  color: #d69e2e;
  font-size: 12px;
  margin-left: 8px;
  padding: 2px 8px;
  background: #fefcbf;
  border-radius: 12px;
  font-weight: 600;
}

/* ============================================
   ПАНЕЛЬ ПРОГРЕССА
   ============================================ */
.result-zone {
  background: #fff;
  padding: 18px;
  border-radius: 16px;
  position: sticky;
  top: 12px;
  align-self: start;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.result-zone strong {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 12px;
}

#percent {
  font-size: 34px;
  font-weight: 700;
  color: #667eea;
  margin: 8px 0;
  text-align: center;
  transition: color 0.3s ease;
}

.bar {
  height: 16px;
  background: #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  margin: 16px 0;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
  position: relative;
}

.bar span {
  display: block;
  height: 100%;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.bar span::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, 
    rgba(255,255,255,0.3) 0%, 
    rgba(255,255,255,0) 50%, 
    rgba(255,255,255,0.3) 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.bar.progress-low span {
  background: linear-gradient(90deg, #fc8181 0%, #f56565 100%);
}

.bar.progress-medium span {
  background: linear-gradient(90deg, #f6ad55 0%, #ed8936 100%);
}

.bar.progress-high span {
  background: linear-gradient(90deg, #68d391 0%, #48bb78 100%);
}

.bar.progress-complete span {
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

#resultText {
  white-space: pre-line;
  line-height: 1.6;
  margin-top: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
  border-radius: 12px;
  font-size: 14px;
  color: #4a5568;
  border-left: 4px solid #667eea;
}

/* Прогресс по этапам */
#stagesProgress {
  margin-top: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.stage-progress-item {
  margin-bottom: 8px;
  padding: 8px;
  background: #f7fafc;
  border-radius: 6px;
  border-left: 3px solid #e2e8f0;
}

.stage-progress-item.complete {
  border-left-color: #48bb78;
}

.stage-progress-item.partial {
  border-left-color: #ed8936;
}

.stage-progress-item h4 {
  font-size: 12px;
  font-weight: 600;
  color: #2d3748;
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.stage-progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.stage-progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #48bb78 0%, #38a169 100%);
  transition: width 0.3s;
}

/* Скроллбар */
.result-zone::-webkit-scrollbar {
  width: 8px;
}

.result-zone::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.result-zone::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 10px;
}

.result-zone::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* ============================================
   КНОПКИ
   ============================================ */
button {
  margin-top: 0;
  padding: 11px 14px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.2s;
  width: 100%;
}

.tech-menu button {
  margin-top: 0;
}

#finishBtn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#finishBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

#myProjectsBtn {
  background: #edf2f7;
  color: #2d3748;
}

#myProjectsBtn:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.modern-open-btn {
  background: linear-gradient(90deg, #1976d2 0%, #1e90ff 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(.4,0,.2,1), box-shadow 0.18s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 2px 8px rgba(30,94,204,0.2);
  outline: none;
}

.modern-open-btn:hover, .modern-open-btn:focus {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(30,94,204,0.3);
  background: linear-gradient(90deg, #1e90ff 0%, #1976d2 100%);
}

/* ============================================
   КАТЕГОРИИ И ВКЛАДКИ
   ============================================ */
.category-container {
  margin-bottom: 16px;
}

.category-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  justify-content: flex-start;
}

.category-btn {
  width: auto;
  padding: 9px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: #4a5568;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.category-btn:hover {
  border-color: #cbd5e0;
  background: #f7fafc;
}

.category-btn.active {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: #fff;
  border-color: #48bb78;
  box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

.tabs-container {
  margin-bottom: 20px;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.tab-btn {
  width: auto;
  min-width: 0;
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  color: #4a5568;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-btn:hover {
  border-color: #cbd5e0;
  background: #f7fafc;
}

.tab-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Выбор типа чек-листа */
.checklist-type-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.type-btn {
  width: auto;
  flex: 1;
  padding: 12px 20px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #4a5568;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.type-btn:hover {
  border-color: #cbd5e0;
  background: #f7fafc;
}

.type-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* ============================================
   СЕТЕВЫЕ РАЗДЕЛЫ (NETWORK/HEALTH LAYOUT)
   ============================================ */
.tabs.network-layout {
  display: block;
}

.tabs.network-layout .section-group {
  width: 100%;
}

.tabs.network-layout .periods-container {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  }
  
.section-group {
  transition: all 0.3s ease;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.section-group:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.section-group.active {
  background: rgba(102,126,234,0.12);
  border-color: rgba(102,126,234,0.45);
  box-shadow: 0 8px 18px rgba(102,126,234,0.2);
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
  color: #f7fafc;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.section-badge svg {
  width: 14px;
  height: 14px;
}

.section-btn {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 14px;
  background: #fff;
  color: #1f2937;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  transition: all 0.2s ease !important;
  cursor: pointer !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  max-width: 260px;
  width: fit-content;
}

.section-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: #fff !important;
  border-color: #667eea !important;
  box-shadow: 0 4px 14px rgba(102,126,234,0.35);
}

.section-btn:hover:not(.active) {
  transform: translateY(-1px);
  background: #f7fafc !important;
  border-color: #cbd5e0 !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}

.section-btn:active {
  transform: translateY(0);
}

.periods-container {
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
}

.periods-label {
  font-size: 12px;
  color: #e2e8f0;
  font-weight: 600;
  letter-spacing: 0.2px;
  margin-top: 4px;
}

.periods-container .tab-btn {
  width: auto;
  padding: 9px 10px;
  font-size: 12.5px;
  color: #1f2937;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: all 0.2s ease;
}

.periods-container .tab-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.periods-container .tab-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: #fff !important;
  border-color: #667eea !important;
  box-shadow: 0 2px 8px rgba(102,126,234,0.3);
}

/* ============================================
   ПРОЕКТЫ
   ============================================ */
#projectsList {
  margin-top: 16px;
}

#projectsList > div {
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f7fafc;
  transition: all 0.2s;
}

#projectsList > div:hover {
  border-color: #cbd5e0;
  background: #edf2f7;
}

/* ============================================
   ХЛЕБНЫЕ КРОШКИ И SEO
   ============================================ */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: #cbd5e0;
  margin: 4px 0 14px;
}

.breadcrumbs a {
  color: #e2e8f0;
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
}

.breadcrumbs a:hover {
  background: rgba(255,255,255,0.08);
}

.breadcrumbs .crumb-sep {
  color: #718096;
}

.breadcrumbs .current {
  color: #fff;
  font-weight: 600;
}

.seo-block {
  grid-column: 1/-1;
  margin-bottom: 24px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid rgba(255,255,255,0.06);
}

.seo-block h2 {
  margin: 0 0 6px 0;
  font-size: 18px;
  color: #fff;
}

.seo-block h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: #e2e8f0;
}

.seo-block p {
  margin: 0;
}

/* ============================================
   ФУТЕР
   ============================================ */
footer.site-footer {
  margin-top: 32px;
  padding: 16px 0;
  color: #cbd5e0;
  font-size: 13px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.footer-container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 18px;
}

footer.site-footer a {
  color: #e2e8f0;
  text-decoration: none;
}

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

footer.site-footer .footer-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  align-items: flex-start;
}

.footer-block-title {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 6px;
}

.footer-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.footer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
  font-size: 13px;
}

.chip:hover {
  background: rgba(255,255,255,0.12);
  text-decoration: none;
}

.muted {
  color: #a0aec0;
}

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */
@media (max-width: 1100px) {
  .periods-container {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }
}

@media (max-width: 900px) {
  body {
    padding: 12px 0;
  }
  
  .app {
    grid-template-columns: 1fr;
    padding: 12px 14px;
    gap: 12px;
  }
  
  h1 {
    font-size: 28px;
    line-height: 1.2;
    margin-bottom: 12px;
  }
  
  .result-zone {
    position: static;
    top: auto;
    max-height: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  }
  
  .tabs {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  
  .category-tabs {
    gap: 6px;
  }
  
  .category-btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .tab-btn {
    padding: 9px 10px;
    font-size: 12.5px;
  }
  
  section {
    padding: 12px 12px;
  }
  
  label {
    font-size: 14px;
  }
}

@media (min-width: 1400px) {
  .app {
    grid-template-columns: 3.5fr 1fr;
  }
  
  .result-zone {
    top: 10px;
    padding: 16px;
  }
}

/* ============================================
   ПЕЧАТЬ (PDF)
   ============================================ */
@media print {
  body {
    background: #fff;
  }
  
  .app {
    max-width: 100%;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }
  
  .result-zone {
    position: static;
    max-height: none;
    page-break-inside: avoid;
  }
  
  button, .tabs-container, .checklist-type-selector {
    display: none;
  }
  
  section {
    page-break-inside: avoid;
    margin-bottom: 16px;
  }
  
  h1 {
    color: #000;
    text-shadow: none;
  }
}
