@import url('fonts.css');

body {
    font-family: 'Montserrat', sans-serif;
    line-height: 1.6;
    color: #333;
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4f0fb 100%);
    display: flex; /* Используем Flexbox для расположения меню и контента */
    justify-content: center;
    align-items: flex-start;
}

#side-menu {
    width: 250px;
    background-color: #ffffff;
    padding: 15px;
    margin-right: 25px;
    height: 93vh;
    position: sticky;
    top: 20px;
    box-shadow: 0px 0 10px 0px rgba(0,0,0,0.1);
    overflow-y: auto;

    border-radius: 15px;
}

#side-menu h3 {
    margin-top: 0;
}

#side-menu ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#side-menu li a {
    display: block;
    color: #2c3e50;
    padding: 8px 12px; /* Уменьшаем отступы */
    text-decoration: none;
    border-radius: 4px;
    margin-bottom: 5px;
    transition: background-color 0.3s, color 0.3s;
    font-size: 0.9em; /* Уменьшаем шрифт */
}

#side-menu li a:hover, #side-menu li a.active {
    background-color: #3498db;
    color: #ffffff;
}

#main-content {
    padding: 20px;
    max-width: 760px;
    width: 100%;
}


h1, h2, h3, h4 {
    color: #2c3e50;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
}

summary {
    cursor: pointer;
    padding: 6px;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    background: linear-gradient(to right, #3498db, #2ecc71);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

h2 {
    margin-top: 30px;
    padding-bottom: 5px;
    /* border-bottom: 1px solid #eee; */
}

.note {
    background-color: #e3f2fd;
    border-left: 4px solid #2196F3;
    padding: 15px;
    margin: 20px 0;
    border-radius: 0 4px 4px 0;
}

.code-block {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    margin: 15px 0;
}
.code {
  background-color: #ffffff; /* Белый фон */
  border-radius: 4px; /* Слегка закругленные края */
  padding: 0.2em 0.4em; /* Небольшие внутренние отступы */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Небольшая тень */
  font-family: 'Courier New', Courier, monospace; /* Моноширинный шрифт */
  font-size: 0.9em; /* Немного уменьшенный размер шрифта */
  color: #333; /* Цвет текста */
  border: 1px solid #e1e1e1; /* Легкая граница */
}

code {
  font-size: 1.0em;
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0px;
}

.code-block-title {
  margin: 0; /* убирает отступы h4 */
  /* font-size: 1.1em; */
}

.code-block-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.code-block-control {
  cursor: pointer;
  display: flex;
  align-items: center;
}


/* Styles for code highlighting (using Highlight.js class names) */
.hljs-keyword { color: #0000ff; }
.hljs-built_in, .hljs-type { color: #2b91af; }
.hljs-string { color: #a31515; }
.hljs-comment { color: #008000; }
.hljs-variable { color: #001080; }
.hljs-function { color: #795e26; }
/* Add more classes as needed based on the chosen highlighting theme */

/* Hide comment highlighting when comments-off class is applied */
.comments-off .hljs-comment {
    color: inherit;
    font-style: normal;
    opacity: inherit;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 20px auto;
}

.gif-container img, .gif-container video { /* Applied to video too */
    max-width: 520px; /* Limit video/gif size */
    border: 1px solid #ddd; /* Optional: add border to video */
    border-radius: 4px;
}

.gif-container {
    text-align: center;
    margin: 25px 0;
}


.file-structure {
    background-color: #f0f0f0;
    padding: 15px;
    border-radius: 4px;
    font-family: monospace;
}

/* Стили для кнопки */
#scrollToTop {
    position: fixed;
    right: 30px;
    bottom: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    /* background: linear-gradient(to bottom, #3498db, #2ecc71); */
    background-color: #2980b9;
    color: white;
    border: none;
    cursor: pointer;
    display: none; /* Сначала скрыта */
    opacity: 0.7;
    transition: opacity 0.3s;
    font-size: 20px;
    z-index: 99;
}

#scrollToTop:hover {
    opacity: 1;
}

#scrollToTop::after {
    content: "↑";
}

pre code.hljs {
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  padding: 24px;
  /* background-color: #f8f9fa; */
  border: 1px solid #e1e1e1;
  margin-bottom: 40px;
}

h1, h2, h3, h4, h5 {
    color: #333;
    margin-top: 0;
}

/* Общие стили для гиперссылок */
a {
    color: #3498db; /* Немного голубоватый цвет */
    text-decoration: none; /* Убираем подчеркивание по умолчанию */
}

a:hover {
    text-decoration: underline; /* Добавляем подчеркивание при наведении */
}

.icon {
  width: 24px;
  height: 24px;
  margin: 0;
}

.back-link {
    text-decoration: none;
    color: #333 !important;
}

.back-link:visited {text-decoration: none;
    color: #333 !important;
}

.back-link:hover {text-decoration: none;
    color: #333 !important;
}

.back-link:active {text-decoration: none;
    color: #333 !important;
}

.back-link:focus {text-decoration: none;
    color: #333 !important;
}



/* new-style.css или <style> */
.interactive-code-container {
  margin-bottom: 30px;
  /* Стили из вашего предыдущего урока для .code-block-header, pre, code и т.д.
     должны применяться и здесь. */
}

.interactive-controls {
  margin-top: 15px;
  padding: 10px;
  background-color: #f0f0f0; /* Немного другой фон для контролов */
  border-radius: 0 0 8px 8px; /* Скругляем нижние углы, если pre имеет скругление */
  text-align: center;
}

.interactive-controls button {
  padding: 8px 15px;
  margin: 5px;
  cursor: pointer;
  background-color: #3498db; /* Цвет как у scrollToTop */
  color: white;
  border: none;
  border-radius: 4px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.9em;
  transition: background-color 0.2s;
}

.interactive-controls button:hover {
  background-color: #2980b9;
}

.interactive-controls button:disabled {
  background-color: #bdc3c7;
  cursor: not-allowed;
}

.next-section-btn {
    display: block;
    margin: 40px auto 20px; /* Отступы сверху и снизу */
    padding: 12px 25px;
    border: none;
    border-radius: 20px; /* Закругленные края */
    /* background-image: linear-gradient(45deg, #007bff, #28a745); Сине-зеленый градиент */
    background-color: #2980b9;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.next-section-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

/* Стили для анимации секций урока */
.lesson-section {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.5s ease-in-out; /* Убрана анимация для max-height */
    visibility: hidden;
}

.lesson-section.active {
    opacity: 1;
    max-height: none; /* Позволяет секции занять нужную высоту */
    visibility: visible;
    overflow: visible;
}

/* Убираем стили для кнопки "бургер" меню, так как она больше не нужна */
/* .menu-toggle { ... } */

/* Медиа-запросы для адаптивной верстки */

/* Планшеты и мобильные устройства */
@media (max-width: 1024px) {
    #side-menu {
        display: none; /* Полностью скрываем меню */
    }

    #main-content {
        margin-left: 0; /* Убираем отступ слева */
        padding: 20px; /* Устанавливаем стандартные отступы */
    }

    h1 {
        font-size: 2em;
    }

    img {
        max-width: 100%;
        height: auto;
    }
    
    pre {
        white-space: pre-wrap;       /* Перенос кода */
        word-wrap: break-word;      /* Перенос длинных слов */
    }
}

/* Старые стили для мобильных устройств ниже можно удалить или оставить, 
   но основная логика уже покрыта блоком max-width: 1024px */


/* Стили для таблиц (как на изображении) */
table {
    border-collapse: collapse;
    margin: 25px 0;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden; /* Essential for border-radius to work on child elements */
    background: #fff;
    font-size: 0.9em;
}

table th,
table td {
    padding: 12px 15px;
    border: 1px solid #e0e0e0; /* Thin, light gray border for all cells */
    text-align: center;
}

table th {
    font-weight: bold;
    background-color: #f9f9f9; /* A very subtle background for the header */
}

/* Comment switch styles */
.comment-switch-container {
    position: absolute;
    top: 10px;
    right: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
    font-size: 0.8em;
    /* background-color: rgba(255, 255, 255, 0.7); */
    padding: 3px 8px;
    border-radius: 12px;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    z-index: 10;
}

.comment-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.comment-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
    -webkit-transform: translateX(14px);
    -ms-transform: translateX(14px);
    transform: translateX(14px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 20px;
}

.slider.round:before {
    border-radius: 50%;
}

.newly-typed {
    background-color: rgba(4, 170, 109, 0.12); /* Muted teal background */
    border-radius: 4px;
    /* This property ensures that background and borders are applied to each line of a multi-line span */
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

pre .hljs {
    position: relative;
}

.copy-code-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
    z-index: 10;
}

.copy-code-button:hover {
    background-color: #f0f0f0;
    color: #333;
}

.copy-code-button.copied {
    color: #28a745; /* Green color for success */
}

.copy-code-button svg {
    width: 16px;
    height: 16px;
}