/* ═══════════════════════════════════════════════════════════════════
   Zula Спорт — единая таблица стилей
   ═══════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ──────────────────────────────────────────── */
:root {
    --bg-body: #0f0f0f;
    --bg-card: #1a1a1a;
    --bg-card-hover: #1e1e1e;
    --bg-elevated: #1a1a1a;
    --border-subtle: #2a2a2a;
    --border-card: #2a2a2a;
    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --text-muted: #666;
    --text-heading: #fff;
    --accent: #00e676;
    --accent-10: rgba(0,230,118,0.1);
    --accent-20: rgba(0,230,118,0.2);
    --accent-30: rgba(0,230,118,0.3);
    --live-red: #e53935;
    --tv-orange: #ff9800;
    --gold: #ffd700;
    --stats-away: #00bcd4;
}

/* ─── Typography tokens ────────────────────────────────────────── */
:root {
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --text-xs: 0.75rem;    /* 12px */
    --text-sm: 0.8125rem;  /* 13px */
    --text-base: 0.9375rem; /* 15px */
    --text-md: 1rem;       /* 16px */
    --text-lg: 1.125rem;   /* 18px */
    --text-xl: 1.25rem;    /* 20px */
    --text-2xl: 1.5rem;    /* 24px */
    --leading-tight: 1.3;
    --leading-normal: 1.6;
    --leading-relaxed: 1.75;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

/* ─── Focus & Keyboard ────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ─── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
.container { max-width: 1440px; margin: 0 auto; padding: 16px; }

/* ─── Header & Nav ─────────────────────────────────────────────── */
.header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 0 16px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 24px;
}
.header h1 { font-size: var(--text-2xl); font-weight: 700; color: var(--accent); display: flex; align-items: center; gap: 8px; }
.header h1 span { color: var(--text-primary); font-weight: 400; }
.header .site-logo { height: 36px; width: auto; }
.header .update { font-size: var(--text-sm); color: var(--text-secondary); white-space: nowrap; }

.nav { display: flex; gap: 16px; padding: 12px 0; flex-wrap: wrap; position: sticky; top: 0; z-index: 20; background: var(--bg-body); }
.nav a {
    color: var(--text-secondary); font-size: var(--text-sm); padding: 8px 0;
    border-bottom: 2px solid transparent; transition: 0.2s;
    min-height: 44px; display: inline-flex; align-items: center;
    letter-spacing: 0.3px;
}
.nav a:hover, .nav a.active { color: var(--accent); border-color: var(--accent); }

/* ─── News ──────────────────────────────────────────────────────── */
.news-card {
    display: block; margin-bottom: 12px;
    background: var(--bg-card); border-radius: 10px;
    border: 1px solid var(--border-card); transition: 0.2s;
    animation: cardIn 0.35s ease-out both;
}
.news-card:hover {
    border-color: var(--accent); background: var(--bg-card-hover);
    transform: translateY(-1px);
}

/* Stagger news cards */
.news-card:nth-child(2) { animation-delay: 0.04s; }
.news-card:nth-child(3) { animation-delay: 0.08s; }
.news-card:nth-child(4) { animation-delay: 0.12s; }
.news-card:nth-child(5) { animation-delay: 0.16s; }

.news-row {
    display: flex; gap: 14px; padding: 14px;
}
.news-img {
    flex-shrink: 0; width: 120px; height: 80px;
    border-radius: 8px; overflow: hidden;
}
.news-row.no-img .news-img { display: none; }
.news-row.no-img { gap: 0; }
.news-img img { width: 100%; height: 100%; object-fit: cover; }

.news-body { flex: 1; min-width: 0; }
.news-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.news-source { color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; font-size: var(--text-xs); }
.news-time { color: var(--text-muted); }
.news-title { font-size: var(--text-md); font-weight: 600; margin-bottom: 4px; color: var(--text-heading); }
.news-desc {
    font-size: var(--text-sm); color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── Section titles & subs ────────────────────────────────────── */
.section-title {
    font-size: var(--text-lg); font-weight: 700; margin: 24px 0 12px;
    padding-bottom: 8px; border-bottom: 1px solid var(--border-subtle);
    letter-spacing: -0.2px;
}
.section-sub {
    position: sticky; top: 0; z-index: 10;
    background: var(--bg-body); padding: 6px 0;
    font-size: var(--text-sm); font-weight: 600; margin: 16px 0 8px; color: var(--text-secondary);
    display: flex; align-items: center; gap: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.league-logo { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; }

/* ─── Tables ────────────────────────────────────────────────────── */
.compact-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.compact-table tr { border-bottom: 1px solid #1e1e1e; }
.compact-table td { padding: 8px 6px; }
.compact-table td.time { color: #888; white-space: nowrap; width: 60px; }
.compact-table td.ch { color: #00e676; white-space: nowrap; width: 100px; font-size: 12px; }

/* ─── Match cards (unified) ────────────────────────────────────── */
.up-card {
    margin-bottom: 10px; border-radius: 12px; padding: 10px 14px;
    animation: cardIn 0.35s ease-out both;
}

/* Staggered card entrance */
.card-grid .up-card:nth-child(2) { animation-delay: 0.05s; }
.card-grid .up-card:nth-child(3) { animation-delay: 0.10s; }
.card-grid .up-card:nth-child(4) { animation-delay: 0.15s; }
.card-grid .up-card:nth-child(5) { animation-delay: 0.20s; }
.card-grid .up-card:nth-child(6) { animation-delay: 0.25s; }
.card-grid .up-card:nth-child(7) { animation-delay: 0.30s; }
.card-grid .up-card:nth-child(8) { animation-delay: 0.35s; }
.card-grid .up-card:nth-child(n+9) { animation-delay: 0.40s; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.up-card-v1 {
    background: linear-gradient(135deg, #1a2a3a, var(--bg-card));
    border: 1px solid #2a3a4a;
}
/* Live */
.up-card.up-card-v1.up-v1-live-card {
    background: linear-gradient(135deg, #1a2a3a, #3a1515);
}
/* Finished */
.up-card-v1.finished-card {
    background: linear-gradient(135deg, #1a2a3a, #153a15);
}

.up-v1-grid { display: flex; gap: 14px; justify-content: space-between; }
.up-v1-left { min-width: 0; flex: 1; }

.up-v1-right {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 6px; flex-shrink: 0;
}
.up-v1-row { padding: 4px 0; }
.up-v1-row-away { margin-top: 2px; padding-top: 6px; }
.up-v1-team-row { display: flex; align-items: center; gap: 6px; }
.up-v1-name { font-size: var(--text-sm); font-weight: 600; color: var(--text-heading); }

/* Time */
.up-v1-time {
    font-size: 22px; font-weight: 800; color: #888;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

/* Predict button */
.up-v1-predict-btn {
    font-size: var(--text-xs); font-weight: 700; color: var(--accent);
    background: var(--accent-10);
    border: 1px solid var(--accent-30);
    border-radius: 6px; padding: 8px 14px;
    min-height: 44px; min-width: 44px;
    cursor: pointer; transition: 0.2s;
    text-transform: uppercase; letter-spacing: 1px;
}
.up-v1-predict-btn:hover {
    background: var(--accent-20);
    border-color: var(--accent);
    transform: scale(1.04);
}
.up-v1-predict-btn:active {
    transform: scale(0.97);
}
.up-v1-predict-off {
    color: #555 !important;
    background: rgba(255,255,255,0.05) !important;
    border-color: #333 !important;
    cursor: default !important;
    pointer-events: none;
}

.up-v1-tv { margin-top: 6px; font-size: 12px; color: var(--tv-orange); padding-top: 6px; border-top: 1px solid #2a3a4a; }

/* ─── Flex finished card ────────────────────────────────────────── */
.f-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 0;
}
.f-row + .f-row {
    margin-top: 2px;
    padding-top: 5px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.f-team {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}
.f-team .up-v1-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.f-score {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* Live badge */
.up-v1-live-badge {
    font-size: 10px; font-weight: 700; color: #fff;
    background: var(--live-red); border-radius: 4px; padding: 2px 6px;
    text-transform: uppercase; letter-spacing: 1px;
    animation: live-pulse 1.5s infinite;
    text-align: center;
}
@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Score in right column */
.up-v1-score {
    font-size: 22px; font-weight: 800; color: #fff;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.up-v1-score.finished { color: #00e676; }

.up-v1-score-home {
    font-size: 22px; font-weight: 800; color: #00e676;
    font-variant-numeric: tabular-nums;
    text-align: center;
}
.up-v1-score-away {
    font-size: 22px; font-weight: 800; color: #00e676;
    font-variant-numeric: tabular-nums;
    text-align: center;
    margin-top: -2px;
}

/* ─── Logos ─────────────────────────────────────────────────────── */
.rl-logo { width: 20px; height: 20px; object-fit: contain; flex-shrink: 0; }

/* ─── Result cards (legacy fallback) ───────────────────────────── */
/* ─── Card grid (desktop 2-col) ────────────────────────────────── */
.card-grid { display: block; }
@media (min-width: 640px) {
    .card-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 10px;
    }
    .card-grid .section-sub { grid-column: 1 / -1; margin-bottom: 4px; }
    .card-grid .up-card { margin-bottom: 0; }
}

/* ─── Predictions grid (variant E) ─────────────────────────────── */
.pw-grid { display: block; }
@media (min-width: 640px) {
    .pw-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .pw-grid .section-sub { grid-column: 1 / -1; margin-bottom: 4px; }
    .pw-grid .up-card { margin-bottom: 0; }
}

.pw-e .up-v1-left { flex: initial; }
.pw-e-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
}
.pw-e-odds {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}
.pw-e-pick {
    display: flex;
    gap: 4px;
    justify-content: center;
}

/* ═══ Общие элементы прогнозов ═══ */
.pw-odd {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 3px 8px;
    min-width: 44px;
}
.pw-odd-label {
    font-size: 9px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.pw-odd-val {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.pw-pick-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: #00e676;
    background: rgba(0,230,118,0.1);
    border: 1px solid rgba(0,230,118,0.3);
    border-radius: 4px;
    padding: 2px 7px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ─── TV guide ──────────────────────────────────────────────────── */
.source-note { font-size: 11px; color: #555; margin-top: 8px; text-align: right; }

/* ─── Footer ────────────────────────────────────────────────────── */
.footer {
    margin-top: 32px; padding: 20px 0; border-top: 1px solid var(--border-subtle);
    text-align: center; font-size: 13px; color: var(--text-muted);
}
.footer a { color: var(--accent); }
.footer .bot-link {
    display: inline-block; margin-top: 8px;
    padding: 8px 20px; background: #00e676; color: #000;
    border-radius: 20px; font-weight: 600; font-size: 14px;
}

.more-btn {
    display: block; width: 100%; padding: 12px; margin: 16px 0;
    background: var(--bg-card); border: 1px solid #333; border-radius: 10px;
    color: var(--accent); font-size: 15px; font-weight: 600;
    cursor: pointer; transition: 0.2s;
}
.more-btn:hover {
    background: #222; border-color: var(--accent);
    transform: translateY(-1px);
}
.more-btn:active {
    transform: translateY(0);
}

/* ─── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0f0f0f; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* ─── Article modal ─────────────────────────────────────────────── */
.modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(4px);
    justify-content: center; align-items: flex-start; overflow-y: auto;
    padding: 40px 16px;
    transition: opacity 0.25s ease;
}
.modal-overlay.active {
    display: flex;
    animation: overlayIn 0.25s ease;
}

.modal-card {
    background: #1a1a1a; border-radius: 14px; max-width: 720px; width: 100%;
    border: 1px solid #2a2a2a; overflow: hidden;
    animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #2a2a2a;
    position: sticky; top: 0; background: #1a1a1a; z-index: 1;
}
.modal-header-left { display: flex; flex-direction: column; gap: 4px; }
.modal-close {
    width: 32px; height: 32px; border-radius: 50%; border: none;
    background: #333; color: #ccc; font-size: 18px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: 0.2s; flex-shrink: 0;
}
.modal-close:hover { background: #555; color: #fff; }

.modal-body {
    padding: 20px; line-height: 1.75; font-size: 15px;
    color: #ccc; overflow-y: auto; max-height: 65vh;
}
.modal-body p { margin-bottom: 14px; }
.modal-body h2, .modal-body h3, .modal-body h4 { color: #fff; margin: 20px 0 10px; }
.modal-body img { max-width: 100%; height: auto; border-radius: 8px; margin: 14px 0; }
.modal-body a { color: #00e676; text-decoration: underline; }
.modal-body ul, .modal-body ol { margin: 10px 0; padding-left: 24px; }
.modal-body li { margin-bottom: 6px; }
.modal-body blockquote {
    border-left: 3px solid #00e676; padding: 8px 14px; margin: 14px 0;
    background: rgba(0,230,118,0.05); border-radius: 0 8px 8px 0;
    color: #aaa;
}
.modal-body .news-desc {
    font-size: 13px; color: #888; margin-bottom: 16px;
    padding-bottom: 16px; border-bottom: 1px solid #2a2a2a;
}

.modal-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px; border-top: 1px solid #2a2a2a;
}
.modal-footer a {
    color: var(--accent); font-size: 13px; font-weight: 600;
    transition: 0.2s; padding: 6px 12px; border-radius: 6px;
}
.modal-footer a:hover { background: var(--accent-10); }

/* ─── Prediction modal ──────────────────────────────────────────── */
.stats-live {
    font-size: 10px; font-weight: 800; color: var(--live-red);
    text-align: center; text-transform: uppercase; letter-spacing: 1px;
    animation: live-pulse 1.5s ease-in-out infinite; margin-bottom: 4px;
}
.stats-header {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding-bottom: 14px; border-bottom: 1px solid #2a3a4a; margin-bottom: 14px;
}
.stats-team { flex: 1; font-size: 15px; font-weight: 700; color: var(--text-heading); text-align: center; }
.stats-score {
    font-size: 26px; font-weight: 800; color: var(--text-heading);
    font-variant-numeric: tabular-nums;
    text-align: center; flex-shrink: 0; min-width: 50px;
}
.stats-table { width: 100%; border-collapse: collapse; }
.stats-table td { padding: 6px 6px; font-size: 13px; }
.stats-table .stat-home { text-align: right; font-weight: 700; color: var(--text-heading); width: 20%; }
.stats-table .stat-name { text-align: center; color: var(--text-secondary); width: 60%; font-size: 12px; }
.stats-table .stat-away { text-align: left; font-weight: 700; color: var(--text-heading); width: 20%; }
.stats-table tr:nth-child(even) { background: rgba(255,255,255,0.03); }

.percent-row td { padding: 8px 6px 2px !important; }
.percent-label { font-size: 11px; color: #888; text-align: center; margin-bottom: 4px; }
.percent-bars { display: flex; align-items: center; gap: 8px; justify-content: center; }
.percent-val { font-size: 12px; font-weight: 700; color: var(--text-heading); min-width: 32px; text-align: center; }
.percent-track { flex: 1; height: 6px; background: #2a3a4a; border-radius: 3px; overflow: hidden; display: flex; max-width: 180px; }
.percent-home { height: 100%; background: var(--accent); }
.percent-away { height: 100%; background: #00bcd4; }

/* ─── Predictions page widgets ──────────────────────────────────── */
.pred-card { position: relative; }
.pred-card .p-txt {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    z-index: 10;
    margin: 0 !important;
    border-radius: 10px;
}
.pred-mid {
    display: flex; align-items: center;
    font-size: 16px; font-weight: 800; color: #fff;
    white-space: nowrap; flex-shrink: 0; padding: 0 10px;
}
.p-btn {
    display: block; width: 100%;
    margin: 4px 0 2px;
    padding: 8px;
    background: rgba(0,230,118,0.1);
    border: 1px solid rgba(0,230,118,0.3);
    border-radius: 6px;
    color: #00e676;
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1px;
    cursor: pointer;
}
.p-btn:hover { background: rgba(0,230,118,0.2); }

.p-txt {
    margin-bottom: 14px; padding: 12px;
    background: #0f1a2a; border: 1px solid #2a3a4a;
    border-radius: 8px; font-size: 13px;
    line-height: 1.7; color: var(--text-secondary);
}

/* ─── Mobile responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
    .container { padding: 10px; }

    .header { flex-direction: row; align-items: center; gap: 6px; padding: 14px 0 12px; }
    .header h1 { font-size: 20px; }
    .header .update { font-size: 11px; }

    .nav { gap: 8px; padding: 8px 0; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .nav::-webkit-scrollbar { display: none; }
    .nav a { font-size: 13px; padding: 10px 6px; white-space: nowrap; }

    .section-title { font-size: 16px; margin: 18px 0 10px; }
    .section-sub { font-size: 13px; margin: 12px 0 6px; }

    .up-card { padding: 8px 10px; }
    .up-v1-grid { gap: 8px; }
    .up-v1-time { font-size: 16px; }
    .up-v1-score { font-size: 16px; }
    .up-v1-score-home { font-size: 16px; }
    .up-v1-score-away { font-size: 16px; }
    .up-v1-predict-btn { font-size: 10px; }
    .up-v1-tv { font-size: 11px; }
    .rl-logo { width: 16px; height: 16px; }

    .news-row { flex-direction: column; padding: 10px; gap: 8px; }
    .news-img { width: 100%; height: 140px; }
    .news-title { font-size: 15px; }
    .news-desc { font-size: 13px; }
    .news-body { padding: 0; }

    .compact-table { font-size: 12px; }
    .compact-table td { padding: 6px 4px; }
    .compact-table td.ch { font-size: 10px; width: 70px; }

    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal-card { border-radius: 14px 14px 0 0; max-width: 100%; }
    .modal-card { animation-name: modalInMobile; }
    @keyframes modalInMobile {
        from { opacity: 0; transform: translateY(100%); }
        to { opacity: 1; transform: translateY(0); }
    }
    .modal-body { padding: 14px; font-size: 14px; max-height: 70vh; }
    .modal-header { padding: 12px 14px; }
    .modal-footer { padding: 10px 14px; }

    .footer { font-size: 12px; padding: 14px 0; }
}
