/* ============================================================
   QCN — assets/css/main.css
   Глобальный лэйаут: navbar, баннер, двухколонная сетка,
   сайдбар, футер, таблица лиги, утилиты, анимации.
   ============================================================ */

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--navbar-height);
    background: var(--bg-overlay);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
}

.navbar__inner {
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--page-padding);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Логотип */
.navbar__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-right: 18px;
}

.navbar__logo img {
    height: 36px;
    width: auto;
}

.navbar__logo-text {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text);
}

.navbar__logo-text span {
    color: var(--accent);
}

/* Пункты меню */
.navbar__nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

.navbar__nav a {
    position: relative;
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: var(--radius);
    transition: color var(--transition);
    white-space: nowrap;
}

.navbar__nav a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 14px;
    right: 14px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    transform: scaleX(0);
    transition: transform var(--transition);
}

.navbar__nav a:hover {
    color: var(--text);
}

.navbar__nav a:hover::after,
.navbar__nav a.active::after {
    transform: scaleX(1);
}

.navbar__nav a.active {
    color: var(--text);
}

/* Джерси — выделенная кнопка */
.navbar__nav a.nav-jersey {
    color: var(--accent);
    border: 1px solid var(--border);
    padding: 5px 13px;
}

.navbar__nav a.nav-jersey:hover {
    background: var(--accent-dim);
    color: var(--text);
    border-color: var(--accent);
}

.navbar__nav a.nav-jersey::after {
    display: none; /* нет подчёркивания у outlined-кнопки */
}

/* Бургер */
.navbar__burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
    margin-left: auto;
    border-radius: var(--radius);
    transition: background var(--transition);
}

.navbar__burger:hover {
    background: var(--border-soft);
}

.navbar__burger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform var(--transition), opacity var(--transition);
}

/* ============================================================
   PAGE CONTAINER — центрирует всё до 1620px
   ============================================================ */
.page-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--page-padding);
    margin-top: 24px;
}

/* ============================================================
   PAGE WRAPPER
   ============================================================ */
.page-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px var(--page-padding) 60px;
}

/* ============================================================
   MAIN BANNER
   ============================================================ */
.main-banner {
    width: 100%;
    height: 326px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    margin-bottom: 24px;
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
}

.main-banner a {
    display: block;
    width: 100%;
    height: 100%;
}

.main-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.main-banner:hover img {
    transform: scale(1.02);
}

/* Фолбэк без баннера */
.main-banner__fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0e1220, #111827);
    text-align: center;
}

.main-banner__fallback-title {
    font-family: var(--font-heading);
    font-size: 52px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.1em;
}

.main-banner__fallback-sub {
    color: var(--text-muted);
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-top: 6px;
}

/* ============================================================
   ДВУХКОЛОННАЯ СЕТКА
   ============================================================ */
.layout-cols {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: var(--sidebar-gap);
    align-items: start;
}

.layout-main {
    min-width: 0;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: calc(var(--navbar-height) + 20px);
    align-self: start;
}

/* Info panel */
.info-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.info-panel__header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(27, 131, 194, 0.07);
}

.info-panel__header h3 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text);
}

.info-panel__header .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.info-panel__body {
    padding: 14px;
}

/* Партнёры */
.partners-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.partner-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    transition: border-color var(--transition), transform var(--transition);
}

.partner-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.partner-item img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 6px;
}

.partner-item span {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
}

/* Топ-3 команды */
.top3-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.top3-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    transition: border-color var(--transition);
}

.top3-item:hover {
    border-color: var(--border-mid);
}

.top3-rank {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    color: var(--text-muted);
}

.top3-rank.r1 { color: var(--gold); }
.top3-rank.r2 { color: var(--silver); }
.top3-rank.r3 { color: var(--bronze); }

.top3-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.top3-info {
    flex: 1;
    min-width: 0;
}

.top3-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

.top3-pts {
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
}

/* ============================================================
   PATCH — rpanel.php
   Добавить в конец блока SIDEBAR в main.css
   (после .top3-pts или в конце секции /* SIDEBAR 
   ============================================================ */

/* ── Список команд в панели ── */
.rp-teams-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.rp-team-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    transition: border-color var(--transition);
}

.rp-team-item:hover {
    border-color: var(--border-mid);
}

/* Номер места — просто белый */
.rp-team-rank {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    width: 26px;
    flex-shrink: 0;
    text-align: center;
}

/* Логотип */
.rp-team-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Название + pts */
.rp-team-info {
    flex: 1;
    min-width: 0;
}

.rp-team-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.rp-team-pts {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Пустое состояние */
.rp-empty {
    font-size: 12px;
    color: var(--text-dim);
    text-align: center;
    padding: 12px 0 8px;
}

/* Кнопка «Все команды» */
.rp-all-btn {
    margin-top: 4px;
    font-size: 13px;
}

/* ============================================================
   SECTION TITLE
   ============================================================ */
.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.section-title h2 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text);
    white-space: nowrap;
}

.section-title .line {
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--border), transparent);
}

.section-title .badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 20px;
    letter-spacing: 0.04em;
    white-space: nowrap;
    text-decoration: none;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs-wide {
    display: flex;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    margin-bottom: 22px;
    overflow: hidden;
    background: var(--bg-panel);
}

.tabs-wide .tab-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    white-space: nowrap;
}

.tabs-wide .tab-btn + .tab-btn {
    border-left: 1px solid var(--border-soft);
}

.tabs-wide .tab-btn.active {
    background: var(--accent-dim);
    color: var(--accent);
}

.tabs-wide .tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
}

.tabs-wide .tab-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform var(--transition);
}

.tabs-wide .tab-btn.active::after {
    transform: scaleX(1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Счётчик в табе */
.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    margin-left: 6px;
}

.tab-count.completed {
    background: rgba(100, 116, 139, 0.2);
    color: #64748b;
}

/* ============================================================
   LEAGUE TABLE
   ============================================================ */
.lt-wrap {
    background: var(--bg-panel);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.table-scroll {
    overflow-x: auto;
}

.league-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.league-table th {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 10px 12px;
    background: rgba(27, 131, 194, 0.06);
    border-bottom: 1px solid var(--border-soft);
    text-align: center;
    white-space: nowrap;
}

.league-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-soft);
    text-align: center;
    vertical-align: middle;
}

.league-table tr:last-child td {
    border-bottom: none;
}

.league-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.league-table .lt-rank {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-muted);
    width: 40px;
}

.league-table .lt-rank.r1 { color: var(--gold); }
.league-table .lt-rank.r2 { color: var(--silver); }
.league-table .lt-rank.r3 { color: var(--bronze); }

.lt-team {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.lt-team-info .lt-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.lt-team-info .lt-players {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.lt-stat {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-muted);
}

.lt-stat.win  { color: var(--green); }
.lt-stat.lose { color: var(--red); }
.lt-stat.tbd  { color: var(--text-dim); font-style: italic; }

.lt-row-tbd td { opacity: 0.4; }
.lt-row-tbd:hover td { opacity: 0.6; }

/* ============================================================
   STATUS BADGE
   ============================================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-upcoming {
    background: rgba(27, 131, 194, 0.15);
    color: var(--accent);
}
.status-upcoming::before { background: var(--accent); }

.status-ongoing {
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
}
.status-ongoing::before {
    background: var(--green);
    animation: pulse 1.5s infinite;
}

.status-completed {
    background: rgba(100, 116, 139, 0.15);
    color: #64748b;
}
.status-completed::before { background: #64748b; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 20px;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-dim);
}

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash {
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.flash-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--red);
}

.flash-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--green);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    background: var(--bg-panel);
    border-top: 1px solid var(--border-soft);
    padding: 36px var(--page-padding) 24px;
}

.footer__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 240px 1fr 1fr 1fr;
    gap: 32px;
}

.footer__brand {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer__logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer__logo img {
    height: 30px;
}

.footer__logo-text {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text);
}

.footer__logo-text span {
    color: var(--accent);
}

.footer__desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

.footer__socials {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.social-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition);
}

.social-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.footer__col h4 {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
    margin-bottom: 14px;
}

.footer__col ul {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer__col ul li a {
    font-size: 13px;
    color: var(--text-muted);
    transition: color var(--transition);
}

.footer__col ul li a:hover {
    color: var(--text);
}

.footer__bottom {
    max-width: var(--max-width);
    margin: 24px auto 0;
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-dim);
}

/* ============================================================
   SKELETON LOADER
   ============================================================ */
@keyframes shimmer {
    0%   { background-position: -700px 0; }
    100% { background-position:  700px 0; }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-panel) 25%,
        var(--bg-card) 50%,
        var(--bg-panel) 75%
    );
    background-size: 700px 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

/* ============================================================
   АНИМАЦИИ
   ============================================================ */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* 1280px */
@media (max-width: 1280px) {
    :root { --sidebar-width: 280px; }
    .footer__inner { grid-template-columns: 200px 1fr 1fr 1fr; }
}

/* 1024px — убираем сайдбар в поток */
@media (max-width: 1024px) {
    .layout-cols {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .info-panel {
        flex: 1 1 280px;
    }
    .footer__inner {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }
}

/* 768px — мобильный */
@media (max-width: 768px) {
    .navbar__nav {
        display: none;
        position: absolute;
        top: var(--navbar-height);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        background: var(--bg-overlay);
        border-bottom: 1px solid var(--border);
        padding: 8px 0;
        z-index: 999;
    }
    .navbar__nav.open {
        display: flex;
    }
    .navbar__nav a {
        padding: 12px var(--page-padding);
        border-radius: 0;
        font-size: 16px;
    }
    .navbar__nav a::after {
        display: none;
    }
    .navbar__nav a.nav-jersey {
        border: none;
        border-top: 1px solid var(--border-soft);
        margin-top: 4px;
        padding-top: 14px;
    }
    .navbar__burger {
        display: flex;
    }
    .main-banner {
        height: 200px;
    }
    .footer__inner {
        grid-template-columns: 1fr;
    }
    .footer__bottom {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

/* ============================================================
   УТИЛИТЫ
   ============================================================ */
.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-gold   { color: var(--gold); }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.d-flex       { display: flex; }
.align-center { align-items: center; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.w-full       { width: 100%; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ── Ссылка «Все турниры» в section-title ── */
.section-all-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    transition: color var(--transition);
    text-decoration: none;
}

.section-all-link:hover {
    color: #fff;
}