/* Подключаем шрифт Manrope */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap');

/* Основные стили */
body {
  margin: 0;
  padding: 0;
  font-family: 'Manrope', sans-serif;
  position: relative;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background-color: #121212;
}

/* Заголовок */
h1 {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  color: white;
  text-align: center;
  font-size: 3em;
  margin-bottom: 40px;
  margin-top: 20px;
  line-height: 1.2;
}

/* Общие стили для всех input и button */
.input-container input[type="number"],
button,
table input[type="number"] {
  font-family: 'Manrope', sans-serif;
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  transition: all 0.3s ease;
  text-align: center;
  outline: none;
}

/* Стиль для поля ввода количества вершин */
.input-container input[type="number"] {
  width: 100px;
  height: 50px;
  padding: 10px;
  font-size: 1.3em;
  margin: 10px auto;
  display: block;
}

/* Стиль для кнопок */
button {
  padding: 15px 30px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  margin: 5px 0;
  min-width: 120px;
}

/* Стиль для ячеек матрицы */
table input[type="number"] {
  width: 60px;
  height: 40px;
  padding: 5px;
  font-size: 1em;
  margin: 2px;
}

/* Эффекты при наведении и фокусе */
.input-container input[type="number"]:hover,
button:hover,
table input[type="number"]:hover {
  border-color: rgba(255, 255, 255, 0.7);
}

.input-container input[type="number"]:focus,
button:focus,
table input[type="number"]:focus {
  border-color: white;
  background-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Контейнеры */
.content {
  padding: 30px;
  position: relative;
  z-index: 1;
  max-width: 800px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.input-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 5px;
  width: 100%;
}

.button-container {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 5px 0;
}

/* Фон 
.background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('Purple.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -1;
  opacity: 0.7;
}*/

body {
    background: linear-gradient(to right, #325aa8, #534496, #824ca8);
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Таблица */
table {
  border-collapse: separate;
  border-spacing: 5px;
  margin: 10px 0;
}

td {
  padding: 0;
}

/* Заголовок "Количество вершин графа" */
.input-container label {
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  color: white;
  font-size: 1.8em;
  margin-bottom: 15px;
  text-align: center;
  display: block;
  width: 100%;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Для Firefox */
input[type="number"] {
    -moz-appearance: textfield;
}

/* Дополнительно центрируем текст */
input[type="number"] {
    text-align: center;
    padding: 10px;
}

.matrix-input {
    width: 50px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 1em;
    margin: 2px;
    transition: all 0.2s ease;
}

.matrix-input:focus {
    border-color: white;
    background-color: rgba(255, 255, 255, 0.2);
    outline: none;
}


/* Стиль для ячеек матрицы на главной диагонали */
table input[type="number"][disabled] {
    background-color: rgba(0, 0, 0, 0.3); /* Более темный фон */
    border-color: rgba(255, 255, 255, 0.2); /* Более тусклая рамка */
    color: rgba(255, 255, 255, 0.5); /* Полупрозрачный текст */
    cursor: not-allowed; /* Курсор "недоступно" */
}

/* Убираем эффекты hover/focus для disabled ячеек */
table input[type="number"][disabled]:hover,
table input[type="number"][disabled]:focus {
    border-color: rgba(255, 255, 255, 0.2);
    background-color: rgba(0, 0, 0, 0.3);
    box-shadow: none;
}

/* Стили для руководства */
.guide-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto 30px;
  color: white;
  font-family: 'Manrope', sans-serif;
}

.guide-header {
  /* предыдущие стили */
  display: flex;
  justify-content: center;
  align-items: center;
}

.guide-header::after {
  content: '▼';
  color: #aaccff;
  margin-left: 10px;
  transition: transform 0.3s ease;
  font-size: 0.8em;
}

.guide-header.active::after {
  transform: rotate(180deg);
}

.guide-header:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.guide-title {
  font-size: 1.4em;
  font-weight: 600;
  margin: 0;
  color: white;
  display: inline-block; /* Чтобы треугольник был в одной строке */
  padding-right: 20px; /* Место для треугольника */
}

.guide-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
  padding: 0 20px;
}

.guide-content.active {
  max-height: 500px; /* Достаточно большое значение для контента */
  padding: 10px 20px;
}

.guide-content h3 {
  font-size: 1.1em;
  line-height: 1.6;
  margin: 15px 0;
  color: white;
  font-family: 'Manrope', sans-serif;
}

.guide-content a {
  color: #aaccff;
  text-decoration: none;
  transition: color 0.3s ease;
}

.guide-content a:hover {
  color: #88bbff;
  text-decoration: underline;
}


/* Стили для контейнера кнопок матрицы */
.matrix-buttons-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
  width: 100%;
}

/* Стили для кнопок матрицы */
#submitMatrixButton1, 
#submitMatrixButton2 {
  padding: 12px 24px;
  font-size: 1em;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Адаптация для мобильных устройств */
@media (max-width: 600px) {
  .matrix-buttons-container {
    flex-direction: column;
    gap: 10px;
  }
  
  #submitMatrixButton1, 
  #submitMatrixButton2 {
    width: 100%;
  }
}

/* Стили для контейнера матрицы */
#matrixContainer {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

/* Стили для таблицы матрицы */
#matrixContainer table {
  border-collapse: separate;
  border-spacing: 5px;
  margin: 0 auto; /* Центрирование таблицы */
}

/* Дополнительные стили для лучшего отображения */
.rounded-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}


html {
  scroll-behavior: smooth;
}

#matrixContainer {
  scroll-margin-top: 20px; /* Отступ при скролле */
  transition: all 0.3s ease;
}

/* Стили для контейнера графа */
.graph-container {
  margin: 40px 0;
  padding: 20px 0;
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

/* Анимация подсветки */
@keyframes highlight-fade {
  0% { background-color: rgba(255, 255, 255, 0); }
  50% { background-color: rgba(255, 255, 255, 0.1); }
  100% { background-color: rgba(255, 255, 255, 0); }
}

.highlight {
  animation: highlight-fade 2s ease-out;
}

/* Улучшаем плавность скролла */
html {
  scroll-behavior: smooth;
}

/* Центрируем canvas */
#graphContainer canvas {
  display: block;
  margin: 0 auto;
}


/* Стиль для пустых ячеек */
.matrix-input:placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* Изменяем стиль для ячеек с нулями */
.matrix-input[value="0"] {
  color: rgba(255, 255, 255, 0.7);
}

/* Подсветка активной ячейки */
.matrix-input:focus {
  border-color: #4CAF50;
  box-shadow: 0 0 5px #4CAF50;
  background-color: rgba(76, 175, 80, 0.1);
}


.guide-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto 30px;
  color: white;
  font-family: 'Manrope', sans-serif;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.guide-header {
  cursor: pointer;
  padding: 15px 20px;
  background: rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.guide-header:hover {
  background: rgba(255, 255, 255, 0.15);
}

.guide-title {
  font-size: 1.4em;
  font-weight: 600;
  margin: 0;
  color: #aaccff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guide-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
  padding: 0 20px;
}

.guide-content.active {
  max-height: 1000px;
  padding: 20px;
}

.guide-section {
  margin-bottom: 20px;
}

.guide-subtitle {
  font-size: 1.2em;
  color: #88bbff;
  margin-bottom: 10px;
  font-weight: 500;
}

.guide-text {
  line-height: 1.6;
  margin: 0 0 15px 0;
}

.guide-steps {
  padding-left: 20px;
  margin: 15px 0;
}

.guide-step {
  margin-bottom: 15px;
  line-height: 1.5;
  padding-left: 10px;
}

.guide-tips {
  padding-left: 20px;
  list-style-type: circle;
}

.guide-tips li {
  margin-bottom: 8px;
  line-height: 1.4;
}

.tips-section {
  background: rgba(100, 150, 255, 0.08);
  padding: 15px;
  border-radius: 8px;
  border-left: 3px solid #4CAF50;
}

.guide-note {
  font-style: italic;
  opacity: 0.8;
  margin-top: 15px;
}

.wiki-link {
  color: #4CAF50;
  text-decoration: none;
  border-bottom: 1px dotted #4CAF50;
  transition: all 0.2s ease;
}

.wiki-link:hover {
  color: #8BC34A;
  border-bottom-style: solid;
}


.guide-content.active + .guide-header .guide-title::after {
  transform: rotate(180deg);
}

button:active {
  transform: scale(0.98);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.info-hover-container {
  position: relative;
  display: inline-block;
}

.info-hover-container:hover .info-hover-content {
  visibility: visible;
  opacity: 1;
  position: absolute;
  z-index: 100;
  width: 600px;
  background: rgba(40, 40, 60, 0.9);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  left: 50%;
  transform: translateX(-50%);
  backdrop-filter: blur(5px);
}

.info-hover-container:hover .info-hover-content {
  visibility: visible;
  opacity: 1;
}

.info-columns {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.left-column {
  text-align: right;
}

.right-column {
  text-align: left;
}

.logo-center {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
}

.hover-logo {
  max-width: 100px;
  max-height: 100px;
  object-fit: contain;
}

.info-item h3 {
  color: #4CAF50;
  margin-bottom: 8px;
  font-size: 1.1em;
}

.info-item p {
  color: #ddd;
  margin: 5px 0;
  font-size: 0.9em;
}

.footer-text {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  color: #aaa;
  font-size: 0.8em;
}

/* Стили для контейнера с информацией о пути */
.path-info-container {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  border-left: 4px solid #4CAF50;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.path-info-header h3 {
  color: #4CAF50;
  margin: 0 0 15px 0;
  font-size: 1.3em;
  text-align: center;
}

.path-info-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.path-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.path-info-label {
  font-weight: 600;
  color: #88bbff;
}

.path-info-value {
  font-weight: 500;
  color: white;
  text-align: right;
}

/* Анимация для выделенного пути */
@keyframes pulse {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

.highlight-path {
  animation: pulse 2s infinite;
}

/* Стили для контейнера с информацией о пути */
.path-info-container {
  width: calc(100% - 40px); /* Учитываем padding */
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  border-left: 4px solid #4CAF50;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.path-info-header h3 {
  color: #4CAF50;
  margin: 0 0 15px 0;
  font-size: 1.3em;
  text-align: center;
}

.path-info-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.path-info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.path-info-label {
  font-weight: 600;
  color: #88bbff;
}

.path-info-value {
  font-weight: 500;
  color: white;
  text-align: right;
}

/* Для мобильных устройств */
@media (max-width: 600px) {
  .path-info-container {
    width: calc(100% - 20px);
    padding: 15px 10px;
  }
  
  .path-info-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .path-info-value {
    text-align: left;
    width: 100%;
  }
}