/* Улучшенная система CSS переменных */
:root {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f1f1;
    --bg-nav: rgba(0, 0, 0, 0.95);
    --bg-editor: #000000;
    --text-primary: #383838;
    --text-secondary: #555555;
    --text-tertiary: #666666;
    --text-nav: #b8b8b8;
    --text-nav-hover: #ffffff;
    --text-nav-active: #dddddd;
    --text-editor: #ffffff;
    --border-color: #dddddd;
    --border-active: #909090;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --accent-color: #60a5fa;
    --hover-bg: rgba(0, 0, 0, 0.03);
    --tab-active-text: #555555;
    --tab-inactive-text: #aaaaaa;
    --highlight-color: #fffa35;
    --warning-color: #b60a0a;
}

/* Темная тема */
[data-theme="dark"] {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #333333;
    --bg-nav: rgba(0, 0, 0, 0.95);
    --bg-editor: #1a1a1a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #999999;
    --text-nav: #b8b8b8;
    --text-nav-hover: #ffffff;
    --text-nav-active: #ffffff;
    --text-editor: #ffffff;
    --border-color: #404040;
    --border-active: #60a5fa;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.6);
    --hover-bg: rgba(255, 255, 255, 0.05);
    --tab-active-text: #e0e0e0;
    --tab-inactive-text: #808080;
}

/* Автоматическая поддержка системной темы */
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        --bg-primary: #121212;
        --bg-secondary: #1e1e1e;
        --bg-tertiary: #333333;
        --bg-nav: rgba(0, 0, 0, 0.95);
        --bg-editor: #1a1a1a;
        --text-primary: #e0e0e0;
        --text-secondary: #b0b0b0;
        --text-tertiary: #999999;
        --text-nav: #b8b8b8;
        --text-nav-hover: #ffffff;
        --text-nav-active: #ffffff;
        --text-editor: #ffffff;
        --border-color: #404040;
        --border-active: #60a5fa;
        --shadow-light: rgba(0, 0, 0, 0.3);
        --shadow-medium: rgba(0, 0, 0, 0.6);
        --hover-bg: rgba(255, 255, 255, 0.05);
        --tab-active-text: #e0e0e0;
        --tab-inactive-text: #808080;
    }
}

/* Базовые стили */
*, *:before, *:after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1;
    color: var(--text-secondary);
    background: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

hr {
    height: 1px;
    border: none;
    background-color: var(--border-color);
}

a {
    outline: none;
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--text-primary);
}

a img { outline: none; }
img { border: 0; }
img.responsive { height: auto; }

p {
    padding-bottom: 0.3em;
}

pre {
    background: var(--bg-editor);
    border: 1px dotted var(--warning-color);
    border-left: 4px solid var(--warning-color);
    color: var(--text-editor);
    page-break-inside: avoid;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 0.6em;
    max-width: 100%;
    overflow: auto;
    padding: 0.5em 1.5em;
    display: block;
    word-wrap: break-word;
}

/* Фиксированное верхнее меню */
.top-nav {
    background: var(--bg-nav);
    box-shadow: 0 2px 6px 0 var(--shadow-medium);
    left: 0;
    opacity: 0.95;
    padding: 10px;
    position: fixed;
    right: 0;
    top: 0;
    z-index: 9999;
}

.nav-container {
    margin: 0 auto;
    max-width: 780px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand a {
    color: var(--text-nav-active);
    text-decoration: none;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
    padding-left: 10px;
    transition: color 0.3s ease;
}

.nav-brand a:hover {
    color: var(--text-nav-hover);
}

.nav-menu {
    margin-left: auto;
}

.nav-menu ul {
    margin: 0;
    overflow: hidden;
    display: flex;
    list-style: none;
}

.nav-menu li {
    float: left;
    list-style-type: none;
    margin: 0;
}

.nav-menu li a {
    color: var(--text-nav);
    display: block;
    padding: 0.05em 0.75em;
    text-decoration: none;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.nav-menu li a:hover {
    color: var(--text-nav-hover);
    text-shadow: none;
}

.nav-menu li a i {
    margin-right: 5px;
}

/* Переключатель тем с вертикальной полосой */
.theme-toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.theme-options {
    display: flex;
    align-items: center;
}

.theme-toggle {
    position: relative;
    display: inline-block;
    width: 3.5rem;
    height: 1.75rem;
}

.theme-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    border-radius: 34px;
    transition: 0.3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 1.25rem;
    width: 1.25rem;
    left: 0.25rem;
    bottom: 0.25rem;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(1.75rem);
}

.theme-icon {
    margin: 0 0.5rem;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s ease;
    width: 1.25rem;
    height: 1.25rem;
    fill: var(--text-nav);
    color: var(--text-nav);
}

.theme-icon.active {
    opacity: 1;
    transform: scale(1.1);
}

.theme-icon svg {
    width: 100%;
    height: 100%;
}

.auto-icon {
    margin-left: 0.75rem;
}

/* Мобильное меню */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    position: relative;
}

.mobile-menu-toggle span {
    width: 100%;
    height: 2px;
    background: var(--text-nav);
    border-radius: 1px;
    transition: all 0.3s ease;
    display: block;
    position: absolute;
    left: 0;
}

.mobile-menu-toggle span:nth-child(1) {
    top: 0;
}

.mobile-menu-toggle span:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.mobile-menu-toggle span:nth-child(3) {
    bottom: 0;
}

.mobile-menu-toggle.active span:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

/* Основной контейнер */
.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 75px 25px 10px 25px;
}

h1 {
    padding: 50px 0;
    font-weight: 400;
    text-align: center;
    color: var(--text-primary);
}

h1 img {
    filter: drop-shadow(0 4px 6px var(--shadow-light));
    transition: transform 0.3s ease;
}

h1 img:hover {
    transform: scale(1.05);
}

/* Подвал страницы */
.info {
    color: rgba(78, 78, 78, 0.8);
    width: 100%;
    margin: 40px auto;
    text-align: center;
    font-weight: 300;
}

/* Базовый контейнер табов */
.tabs {
    min-width: 320px;
    max-width: 800px;
    padding: 0px;
    margin: 0 auto;
}

/* Стили секций с содержанием */
.tabs > section {
    display: none;
    padding: 15px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.tabs > section > p {
    margin: 0 0 5px;
    line-height: 1.5;
    color: var(--text-primary);
    -webkit-animation-duration: 1s;
    animation-duration: 1s;
    -webkit-animation-fill-mode: both;
    animation-fill-mode: both;
    -webkit-animation-name: fadeIn;
    animation-name: fadeIn;
}

/* Анимации */
@-webkit-keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Прячем чекбоксы */
.tabs > input {
    display: none;
    position: absolute;
}

/* Стили переключателей вкладок (табов) */
.tabs > label {
    display: inline-block;
    margin: 0 0 -1px;
    padding: 15px 25px;
    font-weight: 600;
    text-align: center;
    color: var(--tab-inactive-text);
    border: 0px solid var(--border-color);
    border-width: 1px 1px 1px 1px;
    background: var(--bg-tertiary);
    border-radius: 3px 3px 0 0;
    cursor: pointer;
}

/* Шрифт-иконки от Font Awesome в формате Unicode */
.tabs > label:before {
    font-family: "Font Awesome 5 Free", "Font Awesome 5 Brands";
    font-weight: normal;
    margin-right: 10px;
}

.tabs > label[for*="1"]:before {
    content: "\f022";
}

.tabs > label[for*="2"]:before {
    content: "\f17a";
}

.tabs > label[for*="3"]:before {
    content: "\f179";
}

.tabs > label[for*="4"]:before {
    content: "\f17c";
}

.tabs > label[for*="5"]:before {
    content: "\f10b";
}

/* Изменения стиля переключателей вкладок при наведении */
.tabs > label:hover {
    color: #888;
    cursor: pointer;
}

/* Стили для активной вкладки */
.tabs > input:checked + label {
    color: var(--tab-active-text);
    border-top: 3px solid var(--border-active);
    border-bottom: 1px solid var(--bg-secondary);
    background: var(--bg-secondary);
}

/* Активация секций с помощью псевдокласса :checked */
#tab1:checked ~ #content-tab1,
#tab2:checked ~ #content-tab2,
#tab3:checked ~ #content-tab3,
#tab4:checked ~ #content-tab4,
#tab5:checked ~ #content-tab5 {
    display: block;
}

/* Копирование адреса */
.server-address {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 10px;
    margin: 10px 0;
    font-family: monospace;
}

.server-address code {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
    background: none;
    border: none;
    padding: 0;
}

.copy-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 3px;
    padding: 5px 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
}

.copy-btn:hover {
    background: var(--border-active);
}

.copy-btn.copied {
    background: #22c55e !important;
    transition: all 0.3s ease;
}

.copy-btn.copied:hover {
    background: #16a34a !important;
}

/* Остальные оригинальные стили */
.blackbox {
    position: relative;
    padding: 10px;
    background-color: #000;
    color: #fff;
    font-size: 12px;
    line-height: 16px;
    overflow: auto;
    height: 600px;
}

.topic_style {
    color: #ffab2b;
    font-weight: bold;
}

.highlight_style {
    color: #000;
    background-color: var(--highlight-color);
}

.update_button {
    -moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
    -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
    box-shadow:inset 0px 1px 0px 0px #ffffff;
    background-color:#ffffff;
    -moz-border-radius:3px;
    -webkit-border-radius:3px;
    border-radius:3px;
    border:1px solid #dcdcdc;
    display:inline-block;
    cursor:pointer;
    color:#666666;
    font-size:12px;
    padding:6px 24px;
    text-decoration:none;
}

.update_button:hover {
    background-color:#f6f6f6;
}

.update_button:active {
    position:relative;
    top:1px;
}

/* Очистка флоатов */
.clear {
    clear: both;
}

/* Убираем текст с переключателей и оставляем иконки на малых экранах */
@media screen and (max-width: 680px) {
    .tabs > label {
        font-size: 0;
    }
    .tabs > label:before {
        margin: 0;
        font-size: 18px;
    }

    img.responsive {
        max-width: 100%;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-nav);
        border-top: 1px solid var(--border-color);
        padding: 1rem;
    }

    .nav-menu.active {
        display: block;
    }

    .nav-menu ul {
        flex-direction: column;
        gap: 1rem;
    }

    .theme-toggle-container {
        order: -1;
        border-left: none;
        margin-left: 0;
        padding-left: 0;
    }

    .container {
        padding: 75px 15px 10px 15px;
    }
}

/* Изменяем внутренние отступы переключателей для малых экранов */
@media screen and (max-width: 400px) {
    .tabs > label {
        padding: 15px;
    }
}

/* Улучшенная доступность */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
