@import url("https://fonts.googleapis.com/css?family=Open+Sans:400,600,700");
@import url("fontawesome-all.min.css");

/* RESET */

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend, table,
caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

article, aside, details, figcaption,
figure, footer, header, hgroup,
menu, nav, section, main {
    display: block;
}

ol, ul {
    list-style: none;
}

*, *:before, *:after {
    box-sizing: border-box;
}

/* VARIABLES */

:root {
    --bg: #0e0e0e;

    --surface: #191216;
    --surface-2: #32232d;

    --text: #f3f4f6;
    --text-soft: #b7bcc6;

    --accent: #f2a7d8;
    --accent-soft: rgba(242,167,216,0.12);

    --border: rgba(255,255,255,0.06);

    --shadow: 0 2px 6px rgba(0,0,0,0.18);

    --header-h: 82px;
}

/* BODY */

body {
    line-height: 1;
    -webkit-text-size-adjust: none;
    font-family: 'Open Sans', sans-serif;
    font-size: 11pt;
    font-weight: 400;
    line-height: 1.8em;
    color: var(--text);
    min-height: 100vh;
    background: var(--bg);
    overflow-x: hidden;
}

/* LINKS */

a {
    color: inherit;
    text-decoration: none;
}

/* TEXT */

h1, h2, h3, h4, h5, h6 {
    text-transform: none;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 0.8em;
}

h1 {
    font-size: 2em;
}

h2 {
    font-size: 1.35em;
}

h3 {
    font-size: 1.1em;
}

p {
    margin-bottom: 1.2em;
    color: var(--text-soft);
}

/* CONTAINER */

.container {
    margin: 0 auto;
    max-width: 1200px;
    width: calc(100% - 100px);
}

/* HEADER */

#header-wrapper {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 10000;
    padding-top: 1.1em;
    pointer-events: none;
}

#header {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9em 1.3em;
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    min-height: var(--header-h);
    transition: max-width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    max-width: 100%;
    overflow: hidden;
    width: 100%;
}

/* Свернутый хедер: ширина только для отступов и кнопки (около 80px на десктопе) */
#header.collapsed {
    max-width: 80px; 
}

/* Анимация исчезновения логотипа */
#header .logo {
    flex-shrink: 0;
    overflow: hidden;
    max-width: 200px; /* Стартовая максимальная ширина для анимации */
    transition: max-width 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease, margin 0.3s ease;
}

/* Когда свернут — схлопываем логотип */
#header.collapsed .logo {
    max-width: 0;
    opacity: 0;
    margin: 0;
    pointer-events: none;
}

/* LOGO */

#logos {
    height: 58px;
    width: auto;
    object-fit: contain;
}

#logos1 {
    max-width: 700px;
    max-height: 95px;
    width: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* NAV */

#nav {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
    transition: opacity 0.3s ease;
    opacity: 1;
}

/* Схлопываем навигацию */
#header.collapsed #nav {
    opacity: 0;
    pointer-events: none;
    max-width: 0; 
    flex: 0;
    margin: 0;
}

#nav::-webkit-scrollbar {
    display: none;
}

#nav ul {
    display: flex;
    align-items: center;
    gap: 0.6em;
    flex-wrap: nowrap;
    justify-content: flex-end;
    min-width: min-content;
}

#nav li a {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    color: var(--text-soft);
    text-transform: none;
    font-weight: 600;
    letter-spacing: 0;
    padding: 0.7em 1em;
    border-radius: 10px;
    transition: 0.15s ease;
}

#nav li a:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text);
}

#nav li.current_page_item a {
    background: var(--accent-soft);
    color: var(--accent);
}

/* --- КНОПКА СВОРАЧИВАНИЯ --- */
.nav-toggle {
    display: none; 
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-soft);
    cursor: pointer;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    transition: 0.2s ease, margin 0.3s ease;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

/* Убираем отступ у кнопки, когда хедер свернут, чтобы она стояла строго по центру */
#header.collapsed .nav-toggle {
    margin-left: 0;
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.nav-toggle.visible {
    display: flex; 
}

.nav-toggle .toggle-arrow {
    width: 24px;
    height: 24px;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

#header.collapsed .toggle-arrow {
    transform: rotate(180deg);
}

/* MAIN */

#main {
    padding-top: calc(var(--header-h) + 36px);
    padding-bottom: 0;
    margin-bottom: 0;
    position: relative;
    z-index: 2;
}

/* HERO */

#hero {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2em 1em 0.6em;
}

/* TABS */

.tab-panel {
    display: none;
    position: relative;
    z-index: 2;
}

.tab-panel.active {
    display: block;
}

/* CARD */

.card {
    border-radius: 18px;
    padding: 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

/* FULL-WIDTH INFO / GRAFANA */

#content.container {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
}

#content.container > .tab-panel:not(#tab-info):not(#tab-map) {
    max-width: 1200px;
    width: calc(100% - 100px);
    margin: 0 auto;
    padding: 0;
}

#tab-info {
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    overflow: hidden;
    position: relative;
}

#grafana-wrap {
    position: relative;
    width: 100vw;
    height: calc(100vh - var(--header-h) - 145px);
    min-height: 600px;
    margin-left: calc(-1 * ((100vw - 100%) / 2));
    overflow: hidden;
}

#grafana-main {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #0b0b0b;
}

#grafana-scroll-cap {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
}

/* MAP */

#tab-map {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: none;
}

#tab-map.active {
    display: block;
}

#tab-map .card {
    height: 100vh;
    width: 100vw;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.map-frame-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.map-frame-wrap iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* RULES */

#tab-rules .card {
    line-height: 1.75em;
}

#tab-rules h2 {
    margin: 2.2em 0 0.8em;
    padding-top: 0.4em;
    border-top: 1px solid var(--border);
}

#tab-rules h3 {
    margin: 1.4em 0 0.6em;
}

#tab-rules p {
    margin-bottom: 0.9em;
}

#tab-rules ul {
    margin: 0.6em 0 1.2em 1.2em;
    list-style: disc;
}

#tab-rules li {
    margin-bottom: 0.35em;
}

/* GUIDE SYSTEM */

.guide-shell {
    line-height: 1.8em;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.4rem;
}

.guide-tile {
    display: block;
    padding: 1.4rem;
    border-radius: 16px;
    background: var(--surface-2);
    border: 1px solid rgba(242,167,216,0.08);
    transition: 0.15s ease;
}

.guide-tile:hover {
    transform: translateY(-2px);
    background: #3d2b37;
    border-color: rgba(242,167,216,0.22);
}

.guide-tile h2 {
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.guide-tile p {
    margin: 0;
}

.guide-view {
    display: none;
}

.guide-view.active {
    display: block;
}

/* BACK BUTTON */

.guide-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1rem;
    margin-bottom: 1.4rem;
    border: 0;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s ease;
}

.guide-back:hover {
    background: #563d4e;
}

/* GUIDE SECTIONS */

.guide-section {
    margin-top: 2rem;
}

.guide-section h2 {
    margin-bottom: 0.8rem;
    padding-top: 0.3rem;
    border-top: 1px solid var(--border);
}

.guide-section h3 {
    margin-top: 1.2rem;
    margin-bottom: 0.5rem;
}

.guide-section ul {
    margin: 0.8rem 0 1.2rem 1.2rem;
    list-style: disc;
}

.guide-section li {
    margin-bottom: 0.35rem;
}

/* CODE */

code {
    padding: 0.18rem 0.45rem;
    border-radius: 6px;
    background: #442339;
    font-family: monospace;
    font-size: 0.95em;
    color: #ff97e0;
}

/* IMAGES */

.guide-image {
    display: block;
    max-width: 100%;
    margin: 1rem auto;
    border-radius: 14px;
    border: 1px solid var(--border);
}

/* MAP PLACEHOLDER */

.map-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 1rem;
    color: var(--text-soft);
    background: #4a2a44;
}

/* JOIN GUIDE */

.join-checklist {
  list-style: none;
  margin: 0 0 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.join-checklist li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1rem;
  color: var(--text-soft);
}

.join-checklist strong {
  color: var(--text);
}

.join-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(242,167,216,0.12);
  color: var(--accent);
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* SERVER ADDRESS */

.server-address-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.server-address-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.server-address-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.server-address-hint {
  font-size: 0.78rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #6b7280;
}

.server-address-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.server-address-code {
  flex: 1;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  background: #1e1118;
  border: 1px solid var(--border);
  font-family: monospace;
  font-size: 1rem;
  color: #ff97e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* COPY BUTTON */

.copy-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.copy-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  pointer-events: none;
}

.copy-btn:hover {
  background: #3d2b37;
  color: var(--text);
  border-color: rgba(242,167,216,0.2);
}

.copy-btn--ok {
  background: rgba(242,167,216,0.15) !important;
  color: var(--accent) !important;
  border-color: rgba(242,167,216,0.3) !important;
}

/* COPY TOAST */

.copy-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 1.5rem));
  background: var(--surface);
  border: 1px solid rgba(242,167,216,0.2);
  color: var(--text);
  padding: 0.65rem 1.2rem;
  border-radius: 10px;
  font-size: 0.9rem;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  z-index: 99999;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.25s ease;
  opacity: 0;
}

.copy-toast--show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* SCROLLBAR */

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #111315;
}

::-webkit-scrollbar-thumb {
    background: #2b3038;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #353b45;
}

/* MOBILE */

@media (max-width: 980px) {
    :root {
        --header-h: 82px;
    }

    .container {
        width: auto;
        max-width: calc(100% - 32px);
    }

    #header {
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
        padding: 0.9em 1em;
        gap: 0.75rem;
        overflow: hidden;
    }

    /* На планшетах и мобилках отступы чуть меньше, значит ширина свернутого блока тоже должна быть чуть меньше */
    #header.collapsed {
        max-width: 70px; 
    }

    #nav {
        flex: 1 1 0;
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    #nav::-webkit-scrollbar {
        display: none;
    }

    #nav ul {
        justify-content: flex-start;
        flex-wrap: nowrap;
        min-width: min-content;
    }

    #main {
        padding-top: calc(var(--header-h) + 60px);
    }

    #content.container > .tab-panel:not(#tab-info):not(#tab-map) {
        width: calc(100% - 32px);
    }

    #grafana-wrap {
        height: calc(100vh - var(--header-h) - 180px);
        min-height: 500px;
    }
}

@media (max-width: 736px) {
    body {
        font-size: 10pt;
    }

    .container {
        width: calc(100% - 24px);
        margin: 0 auto;
    }

    #header {
        border-radius: 12px;
        padding: 0.9em 1em;
    }

    #nav li a {
        font-size: 0.92em;
        padding: 0.55em 0.75em;
    }

    #hero {
        padding-top: 1.2em;
    }

    .card {
        padding: 1.25rem;
        border-top: 1px solid rgba(242,167,216,0.18);
    }

    .guide-grid {
        grid-template-columns: 1fr;
    }

    #content.container > .tab-panel:not(#tab-info):not(#tab-map) {
        width: 100%;
    }

    #grafana-wrap {
        height: calc(100vh - var(--header-h) - 200px);
        min-height: 450px;
    }
}