/* =========================================================
   BASE — reset, layout, header, sidebar, footer, tabbar
   Извлечено из reference.html (раздел 10/11).
   ========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    transition: background .25s ease, color .25s ease;
}

/* Общая палитра полей ввода для всех динамических страниц.
   !important нужен, потому что отдельные вьюхи добавляют свои CSS-стили позже. */
#view input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
#view textarea {
    background-color: var(--input-bg) !important;
    border-color: var(--input-border) !important;
    color: var(--input-text) !important;
}

#view input::placeholder,
#view textarea::placeholder {
    color: var(--input-placeholder) !important;
    opacity: 1;
}

#view input[type="checkbox"],
#view input[type="radio"] {
    accent-color: var(--accent-fill);
    color-scheme: inherit;
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
    background: none;
}

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

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.service-error {
    width: min(100% - 32px, 620px);
    margin: clamp(32px, 8vh, 88px) auto;
    padding: clamp(28px, 6vw, 52px);
    border: 1px solid var(--border);
    border-radius: 18px;
    background:
        radial-gradient(ellipse at 50% 0, var(--accent-soft), transparent 52%),
        var(--surface);
    box-shadow: var(--shadow);
    text-align: center;
}

.service-error-mark {
    display: grid;
    width: 64px;
    height: 64px;
    margin: 0 auto 22px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
    border-radius: 20px;
    background: var(--accent-soft);
    color: var(--accent);
}

.service-error-mark svg {
    width: 34px;
    height: 34px;
}

.service-error-eyebrow {
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .14em;
}

.service-error h1 {
    color: var(--text);
    font-size: clamp(22px, 5vw, 30px);
    line-height: 1.2;
}

.service-error-copy {
    max-width: 440px;
    margin: 14px auto 22px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

.service-error-code {
    display: flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 auto 22px;
    color: var(--text-muted);
    font-size: 12px;
}

.service-error-code code {
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--text-secondary);
    font: 600 12px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.service-error-id {
    opacity: .75;
    font: 11px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.service-error-retry {
    min-height: 44px;
    padding: 0 20px;
    border-radius: 9px;
    background: var(--accent-fill);
    color: #fff;
    font-weight: 700;
    transition: background .18s ease, transform .18s ease;
}

.service-error-retry:hover {
    background: var(--accent-fill-hov);
    transform: translateY(-1px);
}

.service-error-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 18px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
}

.service-error-links a {
    color: var(--text-secondary);
    font-weight: 600;
}

.service-error-links a:hover {
    color: var(--accent);
}

/* элементы, показываемые только на мобильном (11.8) */
.mobile-only {
    display: none;
}


/* =========================
   HEADER
   ========================= */

.header {
    position: sticky;
    top: 0;
    z-index: 100;

    height: var(--header-height);

    display: flex;
    align-items: center;

    background: color-mix(in srgb, var(--header-bg) 94%, transparent);
    border-bottom: 1px solid var(--border);

    backdrop-filter: blur(14px);
}

.header-inner {
    width: 100%;
    max-width: 1520px;
    height: 100%;

    margin: 0 auto;
    padding: 0 28px;

    display: flex;
    align-items: center;
    gap: 32px;
}

/* LOGO */

.logo {
    display: flex;
    align-items: center;
    gap: 11px;

    min-width: 210px;
}

.logo-mark {
    width: 56px;
    height: 56px;
    flex-shrink: 0;

    display: grid;
    place-items: center;
}
.logo-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.logo-text {
    font-family: "Rajdhani", sans-serif;
    font-size: 23px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .2px;
    text-transform: uppercase;
    margin: 0;
}

.logo-text span {
    display: block;
    color: #D81C19;
}

/* NAV */

.top-nav {
    display: flex;
    align-items: center;
    align-self: stretch;
    gap: 5px;
}

.top-nav a {
    position: relative;

    box-sizing: border-box;
    height: 100%;
    display: flex;
    align-items: center;

    padding: 9px 12px;

    color: var(--text-secondary);

    font-size: 13px;
    font-weight: 600;

    transition: color .18s ease;
}

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

.top-nav a.admin-center-link {
    align-self: center;
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--accent-fill, #A5201C);
    border-radius: 7px;
    color: var(--accent);
}

.top-nav a.admin-center-link:hover {
    background: var(--accent-soft, rgba(214, 51, 46, .12));
    color: var(--text);
}

.top-nav a.admin-center-link.active::after {
    display: none;
}

.admin-center-link[hidden] {
    display: none !important;
}

.top-nav a.active {
    color: var(--text);
}

/* Активная линия — вдоль нижней границы хедера (ссылка тянется на всю
   высоту header, поэтому bottom:0 = низ хедера), а не подчёркивание текста. */
.top-nav a.active::after {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 0;
    height: 2px;
    background: var(--accent);
}

/* HEADER RIGHT */

.header-actions {
    margin-left: auto;

    display: flex;
    align-items: center;
    gap: 10px;
}

.search {
    width: 205px;
    height: 38px;

    display: flex;
    align-items: center;
    gap: 9px;

    padding: 0 12px;

    border: 1px solid var(--border);
    border-radius: var(--radius-small);

    background: var(--card);

    color: var(--text-muted);

    transition: border-color .18s ease;
}

.search:focus-within {
    border-color: var(--accent);
}

.search svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.search input {
    width: 100%;

    border: 0;
    outline: 0;

    background: transparent;

    color: var(--text);
    font-size: 12px;
}

.search input::placeholder {
    color: var(--text-muted);
}

.theme-toggle,
.menu-toggle,
.profile-toggle {
    width: 38px;
    height: 38px;
    flex-shrink: 0;

    display: grid;
    place-items: center;

    border: 1px solid var(--border);
    border-radius: var(--radius-small);

    background: var(--card);
    color: var(--text-secondary);

    transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.theme-toggle:hover,
.menu-toggle:hover,
.profile-toggle:hover {
    background: var(--card-hover);
    border-color: var(--border-light);
    color: var(--text);
}

.theme-toggle svg,
.menu-toggle svg,
.profile-toggle svg {
    width: 17px;
    height: 17px;
}

.login-btn {
    height: 38px;

    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;

    border-radius: var(--radius-small);

    background: var(--accent-fill);
    color: #fff;

    font-size: 12px;
    font-weight: 700;

    transition: background .18s ease, transform .18s ease;
}

.login-btn svg {
    width: 15px;
    height: 15px;
}

.login-btn:hover {
    background: var(--accent-fill-hov);
    transform: translateY(-1px);
}

.login-btn.is-authed {
    background: var(--card);
    color: var(--text-secondary, #C6C7CB);
    border: 1px solid var(--border, #222328);
    padding: 5px 10px;
}

.login-btn.is-authed:hover {
    border-color: var(--accent, #D6332E);
    color: #fff;
    transform: none;
}

.menu-toggle,
.profile-toggle {
    display: none;
}

.auth-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 auto;
    background: var(--accent-soft, rgba(214, 51, 46, .12));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 11px;
    color: #fff;
}

.auth-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-name {
    font-weight: 600;
    font-size: 13px;
}


/* =========================
   LAYOUT
   ========================= */

.layout {
    width: 100%;
    max-width: 1520px;

    min-height: calc(100vh - var(--header-height));

    margin: 0 auto;

    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}


/* =========================
   SIDEBAR
   ========================= */

.sidebar {
    padding: 12px 12px 30px;
    display: flex;
    flex-direction: column;
    gap: 0;

    border-right: 1px solid var(--border);
}

/* 11.3 п.4: блоки «Навигация» и «Сообщество» — единая панель стык в стык:
   одна заливка, без границы/зазора между ними, скруглены только внешние
   углы панели; общая рамка — по внешним краям, внутренний шов без границы. */
.sidebar-section {
    padding: 10px 8px;
    border: 0;
    border-radius: 0;
    /* неактивная панель — светлее, как фон .forum-card (--card) */
    background: var(--card);
}
/* активная панель (в ней выбран пункт) — темнее */
.sidebar-section.is-current {
    background: var(--surface);
}
.sidebar-section:first-of-type {
    border: 1px solid var(--border-light);
    border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    padding-top: 14px;
}
.sidebar-section:nth-of-type(2) {
    border: 1px solid var(--border-light);
    border-top: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    padding-bottom: 14px;
}
/* отступ панели навигации от блока сервера */
.sidebar > .server-card { margin-top: 10px; }

.sidebar-title {
    margin: 0 3px 7px;

    color: var(--accent);

    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.1px;
    text-transform: uppercase;
}

.sidebar-link {
    position: relative;

    min-height: 37px;

    display: flex;
    align-items: center;
    gap: 10px;

    padding: 0 9px;

    border-radius: 8px;

    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 600;

    transition: background .18s ease, color .18s ease;
}

.sidebar-link:hover {
    background: var(--card-hover);
    color: var(--text);
}

.sidebar-link.active {
    background: var(--nav-active-bg);
    color: var(--text);
}

/* Активная линия — с обеих сторон. 8px-зона, внутри красной оставляем
   только 2px-границу (border-left/right), поэтому border-radius:8px реально
   формирует дугу в углах — линия повторяет скругление самой кнопки, без
   прямых торцов. */
.sidebar-link.active::before,
.sidebar-link.active::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 8px;
    box-sizing: border-box;
    pointer-events: none;
}
.sidebar-link.active::before {
    left: 0;
    border-left: 2px solid var(--accent);
    border-radius: 8px 0 0 8px;
}
.sidebar-link.active::after {
    right: 0;
    border-right: 2px solid var(--accent);
    border-radius: 0 8px 8px 0;
}

.sidebar-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;

    display: grid;
    place-items: center;

    color: currentColor;
}

.sidebar-icon svg {
    width: 17px;
    height: 17px;
}

/* BADGE */

.badge {
    margin-left: auto;

    padding: 2px 7px;

    border-radius: 10px;

    background: var(--accent-fill);
    color: white;

    font-size: 9px;
    font-weight: 700;
}


/* SERVER CARD */

.server-card {
    padding: 15px;

    border: 1px solid var(--border-light);
    border-radius: var(--radius);

    background: var(--card-server);

    box-shadow: var(--shadow-small);
}

.server-card[hidden] { display: none; }

/* Заголовок «Сервер: CS 1.6» и статус — ОДНОЙ строкой: игра слева, статус
   справа (2026-10-03). Раньше статус стоял вторым блоком и «онлайн» уезжал на
   целую строку вниз, из-за чего верх карточки выглядел как обрывок. */
.server-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

    margin-bottom: 11px;
}

.server-label {
    color: var(--accent);

    font-size: 10px;
    font-weight: 700;
    letter-spacing: .7px;
    text-transform: uppercase;
    white-space: nowrap;
}

.online {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;

    color: var(--success);

    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.online-dot {
    width: 6px;
    height: 6px;
    flex-shrink: 0;

    border-radius: 50%;

    background: var(--success);
}

.server-name {
    margin-bottom: 10px;

    font-size: 13px;
    font-weight: 700;
}

/* 11.3 п.7: единый вертикальный список, а не строка+ряд */
.server-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;

    padding-top: 10px;
    margin-top: 2px;

    border-top: 1px solid var(--border);
}

.server-stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    color: var(--text-secondary);

    font-size: 11px;
}

.server-stats-row strong {
    color: var(--text);
    font-weight: 700;
}

/* CONNECT BUTTON */

.connect-btn {
    margin-top: 14px;
    width: 100%;

    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    border-radius: var(--radius-small);

    background: var(--accent-fill);
    color: white;

    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;

    transition: background .18s ease, transform .18s ease;
}

.connect-btn svg {
    width: 15px;
    height: 15px;
}

.connect-btn:hover {
    background: var(--accent-fill-hov);
    transform: translateY(-1px);
}


/* =========================
   MAIN
   ========================= */

.main {
    min-width: 0;
    padding: 12px 12px 40px;
}


/* =========================
   FOOTER
   ========================= */

.footer-links {
    display: flex;
    gap: 18px;
}

.footer-links a {
    transition: color .18s ease;
}

.footer-links a:hover {
    color: var(--text);
}


/* =========================
   BOTTOM TAB BAR (mobile, 10.5)
   ========================= */

.tabbar {
    display: none;
}

.sidebar-backdrop {
    display: none;
}
