/* ===== Базовые настройки ===== */
#instruction-content * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

#instruction-content body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f4f6f8;
  color: #333;
  line-height: 1.6;
  padding: 2rem;
  min-height: 100vh;
  font-size: 16px !important;
}

#instruction-content .container {
  max-width: 100%;
  margin: 0 auto;
}

#instruction-content .page-header {
  margin-bottom: 2rem;
}

#instruction-content .page-header h1 {
  font-size: 2rem !important;
  color: #222 !important;
}

#instruction-content .page-header span {
  display: block;
  font-size: 1rem !important;
  color: #666 !important;
  margin-top: 0.5rem !important;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ===== ГЛАВНЫЙ КОНТЕЙНЕР ===== */
#instruction-content .main-section {
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  margin-bottom: 2rem;
}

#instruction-content .main-section > summary {
  background: #1ABC9C;
  color: #fff;
  padding: 1.5rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.4rem !important;
  font-weight: 600;
  transition: background 0.2s;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#instruction-content .main-section > summary::-webkit-details-marker {
  display: none;
}

#instruction-content .main-section > summary:hover {
  background: #1abc8b;
}

#instruction-content .main-section > summary::after {
  content: '▼';
  font-size: 0.8rem;
  opacity: 0.7;
}

#instruction-content .main-section[open] > summary::after {
  content: '▲';
}

#instruction-content .main-section-content {
  padding: 2rem;
  background: #f9fafb;
}

/* ===== ВНУТРЕННИЕ КАРТОЧКИ ===== */
#instruction-content .instruction-card {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 2rem;
}

#instruction-content .instruction-card > summary {
  background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  padding: 1rem 1.5rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  font-weight: 500;
  font-size: 1.1rem !important;
  transition: opacity 0.2s, box-shadow 0.2s;
  position: sticky;
  top: 80px;
  z-index: 900;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#instruction-content .instruction-card > summary::-webkit-details-marker {
  display: none;
}

#instruction-content .instruction-card > summary:hover {
  opacity: 0.95;
}

#instruction-content .instruction-card > summary::after {
  content: '+';
  font-size: 1.5rem;
  margin-left: auto;
  font-weight: 300;
}

#instruction-content .instruction-card[open] > summary::after {
  content: '−';
}

/* ===== ШАГИ ===== */
#instruction-content .steps-list {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

#instruction-content .step-item {
  display: flex;
  gap: 1rem;
  position: relative;
  scroll-margin-top: 120px;
}

#instruction-content .step-item::before {
  content: '';
  position: absolute;
  left: 1.25rem;
  top: 2.5rem;
  bottom: -2rem;
  width: 2px;
  background: #e5e7eb;
  z-index: 0;
}

#instruction-content .step-item:last-child::before {
  display: none;
}

#instruction-content .step-number {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  background: #fff;
  border: 2px solid #3b82f6;
  color: #3b82f6;
  font-weight: bold;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  position: sticky;
}

#instruction-content .step-content {
  flex: 1;
}

#instruction-content .step-content h3 {
  font-size: 1.1rem !important;
  color: #1f2937 !important;
  margin-bottom: 0.5rem !important;
}

#instruction-content .step-content p,
#instruction-content .step-content li {
  font-size: 1rem !important;
  color: #4b5563 !important;
  margin-bottom: 0.5rem !important;
}

#instruction-content .step-content ul,
#instruction-content .step-content ol {
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
}

/* Изображения */
#instruction-content .step-image {
  margin: 1rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #ccd0d6;
  background: #fff;
  cursor: zoom-in;
}

#instruction-content .step-image img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 600px;
  object-fit: contain;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#instruction-content .step-image:hover img {
  transform: scale(1.1);
}

/* Подсказки */
#instruction-content .tip {
  display: inline-block;
  background: #eff6ff;
  border-left: 4px solid #3b82f6;
  color: #1e40af;
  padding: 0.75rem 1rem;
  font-size: 1rem !important;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  border-radius: 0 4px 4px 0;
}

#instruction-content .link {
  color:#2563eb; 
  font-weight:600;
  text-decoration:none;
  border-bottom:2px solid #3b82f660;
}

#instruction-content .link_button {
  display:inline-block; 
  margin:8px 0; 
  padding:6px 18px; 
  background:#fff; 
  border:2px solid #9fc0a8; 
  border-radius:30px; 
  color:#2b7a48; 
  text-decoration:none; 
  font-weight:500;
}

#instruction-content table {
  border-collapse: collapse;
  border: 1px solid #4b5563;
  color: #4b5563 !important;
}

#instruction-content td {
  border: 1px solid #4b5563;
  padding: 8px;
}

/* ===== ДЕРЕВО НАВИГАЦИИ (вне #instruction-content) ===== */
#instruction-tree {
  position: fixed;
  right: 2%;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 14px 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 80vh;
  overflow-y: auto;
  z-index: 999;
  width: 15%;
  backdrop-filter: blur(4px);
  font-size: 0.9rem;
}

#instruction-tree .tree-title {
  font-weight: 700;
  font-size: 1rem !important;
  color: #1f2937;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e5e7eb;
  text-align: center;
}

#instruction-tree ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#instruction-tree .tree-group {
  margin-bottom: 10px;
}

#instruction-tree .tree-group-title {
  font-weight: 600;
  font-size: 0.8rem !important;
  color: #2563eb;
  padding: 3px 0 3px 6px;
  border-left: 2px solid #3b82f6;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

#instruction-tree .tree-steps {
  padding-left: 6px;
}

#instruction-tree .tree-step {
  margin: 3px 0;
}

#instruction-tree .tree-step a {
  display: block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.8rem !important;
  color: #4b5563;
  text-decoration: none;
  transition: all 0.15s;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#instruction-tree .tree-step a:hover {
  background: #eff6ff;
  color: #1e40af;
}

#instruction-tree .tree-step a.active {
  background: #1ABC9C;
  color: #fff;
}

/* ===== МОДАЛЬНОЕ ОКНО (глобальное) ===== */
.image-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  animation: fadeIn 0.2s ease;
}

.image-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.image-modal-content img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.image-modal-close {
  position: absolute;
  top: -40px;
  right: -40px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 50%;
  font-size: 28px;
  line-height: 40px;
  text-align: center;
  color: #333;
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  font-weight: 300;
}

.image-modal-close:hover {
  background: #fff;
  transform: scale(1.1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (max-width: 600px) {
  .image-modal-close {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    font-size: 24px;
    line-height: 36px;
  }
}

/* Адаптив для дерева */
@media (max-width: 768px) {
  #instruction-tree {
    right: 10px;
    width: 160px;
    padding: 10px 8px;
    top: auto;
    bottom: 20px;
    transform: none;
    max-height: 40vh;
  }
  #instruction-tree .tree-step a {
    font-size: 0.7rem !important;
    padding: 2px 6px;
  }
  .step-item {
    scroll-margin-top: 160px;
  }
}

@media (max-width: 600px) {
  .step-item {
    flex-direction: column;
    gap: 0.5rem;
  }
  .step-item::before {
    display: none;
  }
  .instruction-card > summary {
    top: 60px;
  }
  #instruction-tree {
    right: 6px;
    width: 120px;
    padding: 8px 4px;
    bottom: 10px;
    max-height: 30vh;
  }
  #instruction-tree .tree-step a {
    font-size: 0.65rem !important;
    padding: 2px 4px;
  }
  #instruction-tree .tree-group-title {
    font-size: 0.65rem !important;
  }
}

#instruction-content,
#instruction-content * {
    font-size: 16px !important;
}

/* Отдельно для дерева (чуть мельче) */
#instruction-tree,
#instruction-tree * {
    font-size: 14px !important;
}

/* Но заголовки и подписи можно сделать крупнее */
#instruction-content .step-content h3 {
    font-size: 18px !important;
}
#instruction-content .main-section > summary {
    font-size: 20px !important;
}
#instruction-content .instruction-card > summary {
    font-size: 17px !important;
}
#instruction-content .page-header h1 {
    font-size: 32px !important;
}
#instruction-tree .tree-title {
    font-size: 16px !important;
}
#instruction-tree .tree-group-title {
    font-size: 13px !important;
}
#instruction-tree .tree-step a {
    font-size: 13px !important;
}

#instruction-content p,
#instruction-content li,
#instruction-content .step-content p,
#instruction-content .step-content li,
#instruction-content .tip,
#instruction-content .step-content div:not(.step-image):not(.step-number) {
    font-size: 16px !important;
    font-weight: 400 !important;
    color: #333 !important;
    line-height: 1.6 !important;
}

/* Все заголовки делаем жирными */
#instruction-content h1,
#instruction-content h2,
#instruction-content h3,
#instruction-content h4,
#instruction-content h5,
#instruction-content h6 {
    font-weight: 600 !important;
}

/* Отдельно для h3 внутри шагов – жирнее и чуть крупнее */
#instruction-content .step-content h3 {
    font-weight: 700 !important;
    font-size: 18px !important;
    color: #1f2937 !important;
}

/* Заголовки карточек тоже жирнее */
#instruction-content .instruction-card > summary .card-header {
    font-weight: 600 !important;
}

#instruction-content .instruction-card > summary {
    font-size: 18px !important;
    padding: 14px 24px !important;
}

#instruction-content .instruction-card > summary .card-header {
    font-size: 18px !important;
    font-weight: 600 !important;
}

/* Полоска между карточками – делаем толще и виднее */
#instruction-content .step-item::before {
    width: 3px !important;
    background: #b0c4de !important;
}

/* Если есть какие-то мелкие span вне карточек */
#instruction-content span:not(.step-number):not(.card-header):not(.tree-group-title) {
    font-size: 16px !important;
}
