/* ============================================
   NL SCORE — Modern UI v2.0
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
    /* Палитра */
    --bg-deep: #07090f;
    --bg-base: #0b0e17;
    --bg-card: rgba(21, 26, 40, 0.65);
    --bg-card-solid: #141927;
    --bg-elevated: #1a2032;
    --bg-input: #0d1120;

    --border: rgba(148, 163, 184, 0.1);
    --border-strong: rgba(148, 163, 184, 0.22);

    --text: #e7ecf5;
    --text-dim: #8b94a8;
    --text-faint: #5b6478;

    /* Акцент — спортивный лайм */
    --accent: #a3e635;
    --accent-hover: #bef264;
    --accent-dark: #65a30d;
    --accent-glow: rgba(163, 230, 53, 0.15);

    /* Семантические */
    --green: #34d399;
    --green-bg: rgba(52, 211, 153, 0.1);
    --red: #f87171;
    --red-bg: rgba(248, 113, 113, 0.1);
    --amber: #fbbf24;
    --amber-bg: rgba(251, 191, 36, 0.1);
    --blue: #60a5fa;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    background:
        radial-gradient(ellipse 800px 500px at 15% -10%, rgba(163, 230, 53, 0.06), transparent 60%),
        radial-gradient(ellipse 700px 500px at 90% 0%, rgba(96, 165, 250, 0.05), transparent 60%),
        var(--bg-base);
    background-attachment: fixed;
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #0b0e17; }

/* --- Кастомный скроллбар --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a3247; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #3b455f; }

/* ============================================
   AUTH
   ============================================ */
.auth-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse 600px 400px at 50% 0%, rgba(163, 230, 53, 0.08), transparent 60%),
        var(--bg-deep);
}
.auth-box {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 40px 32px;
    border-radius: 24px;
    width: 380px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.auth-box h1 {
    text-align: center; margin-bottom: 28px;
    font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
    background: linear-gradient(120deg, #fff 30%, var(--accent));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.tabs {
    display: flex; margin-bottom: 20px;
    border-radius: 12px; overflow: hidden;
    background: var(--bg-input); border: 1px solid var(--border);
    padding: 4px; gap: 4px;
}
.tab-btn {
    flex: 1; padding: 10px; background: none; border: none;
    color: var(--text-dim); cursor: pointer; font-weight: 600; font-size: 14px;
    font-family: inherit; border-radius: 8px; transition: var(--transition);
}
.tab-btn.active { background: var(--accent); color: #0b0e17; }
.tab { display: none; flex-direction: column; gap: 12px; }
.tab.active { display: flex; }
.auth-box input {
    padding: 13px 16px; border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: var(--bg-input); color: var(--text);
    font-family: inherit; font-size: 14px;
    transition: var(--transition);
}
.auth-box input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.error {
    background: var(--red-bg); color: var(--red);
    padding: 12px; border-radius: 12px; margin-bottom: 14px;
    text-align: center; font-size: 13px; font-weight: 500;
    border: 1px solid rgba(248, 113, 113, 0.25);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    background: linear-gradient(135deg, var(--accent), #84cc16);
    color: #0b0e17; border: none;
    padding: 12px 20px; border-radius: 12px;
    cursor: pointer; text-decoration: none; display: inline-block;
    font-size: 14px; font-weight: 700; font-family: inherit;
    letter-spacing: 0.1px;
    transition: var(--transition);
    box-shadow: 0 2px 12px rgba(163, 230, 53, 0.2);
}
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(163, 230, 53, 0.35);
    filter: brightness(1.08);
}
.btn:active { transform: translateY(0); }
.btn.small { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn.ghost {
    background: rgba(148, 163, 184, 0.06);
    border: 1px solid var(--border-strong);
    color: var(--text); box-shadow: none;
}
.btn.ghost:hover {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.35);
    filter: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

#sync-matches-btn {
    background: var(--green-bg) !important;
    border: 1px solid rgba(52, 211, 153, 0.3) !important;
    color: var(--green) !important;
    box-shadow: none;
}
#sync-matches-btn:hover {
    background: rgba(52, 211, 153, 0.18) !important;
    box-shadow: 0 0 16px rgba(52, 211, 153, 0.15);
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 28px;
    background: rgba(11, 14, 23, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.logo {
    font-size: 20px; font-weight: 800; letter-spacing: -0.5px;
    background: linear-gradient(120deg, #fff 20%, var(--accent) 80%);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.nav { display: flex; gap: 10px; align-items: center; }
.nav span { color: var(--text-dim); font-size: 13px; font-weight: 500; margin-right: 6px; }

/* ============================================
   LAYOUT
   ============================================ */
.container { max-width: 1240px; margin: 28px auto; padding: 0 20px; }
.container.narrow { max-width: 480px; }

h2 { margin-bottom: 18px; font-weight: 800; font-size: 24px; letter-spacing: -0.5px; color: #fff; }
h3 { margin: 28px 0 14px; font-weight: 700; font-size: 17px; color: #fff; }
.muted { color: var(--text-dim); }
a { color: var(--accent); transition: var(--transition); }
a:hover { color: var(--accent-hover); }

.stat-bar {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    padding: 16px 22px; border-radius: var(--radius);
    margin-bottom: 22px;
    border: 1px solid var(--border);
    font-size: 14px; color: var(--text-dim);
}
.stat-bar b { color: var(--accent); font-size: 16px; }

.dashboard-layout { display: flex; gap: 24px; align-items: flex-start; }
.main-content { flex: 1; min-width: 0; }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: 290px; flex-shrink: 0;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    padding: 18px; border-radius: var(--radius);
    border: 1px solid var(--border);
    position: sticky; top: 84px;
}
.sidebar h3 {
    margin: 0 0 14px; font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--text-faint);
}
.league-filter {
    list-style: none; padding: 0; margin: 0;
    max-height: calc(100vh - 200px); overflow-y: auto;
    padding-right: 4px;
}
.league-filter li { margin-bottom: 3px; }
.league-filter a {
    display: block; padding: 9px 12px;
    color: var(--text-dim); text-decoration: none;
    border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500;
    transition: var(--transition);
    border: 1px solid transparent;
}
.league-filter a:hover {
    background: rgba(148, 163, 184, 0.07);
    color: var(--text);
    transform: translateX(3px);
}
.league-filter a.active {
    background: var(--accent-glow);
    border-color: rgba(163, 230, 53, 0.3);
    color: var(--accent);
    font-weight: 700;
}
.league-filter img { box-shadow: 0 1px 4px rgba(0,0,0,0.4); }

/* ============================================
   MATCH CARD
   ============================================ */
.match-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px; margin-bottom: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.match-card::before {
    content: '';
    position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: transparent;
    transition: var(--transition);
}
.match-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.match-card:hover::before { background: var(--accent); }

.match-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.teams { font-size: 17px; font-weight: 700; color: #fff; letter-spacing: -0.2px; }
.vs {
    color: var(--text-faint); font-weight: 600; font-size: 11px;
    margin: 0 7px; text-transform: uppercase; letter-spacing: 1px;
    background: rgba(148, 163, 184, 0.08);
    padding: 3px 7px; border-radius: 6px;
    vertical-align: middle;
}
.meta { color: var(--text-dim); font-size: 13px; margin-top: 6px; }
.meta b { color: #c8d0de !important; }

/* Статусы */
.status {
    font-size: 12px; font-weight: 700; white-space: nowrap;
    padding: 6px 14px; border-radius: 30px;
    background: rgba(148, 163, 184, 0.08);
    color: var(--text-dim);
    border: 1px solid var(--border);
    letter-spacing: 0.3px;
}
.status.finished {
    background: var(--green-bg); color: var(--green);
    border-color: rgba(52, 211, 153, 0.25);
    font-family: 'JetBrains Mono', monospace;
}

/* --- LIVE --- */
.match-card.is-live { border-color: rgba(248, 113, 113, 0.35); }
.match-card.is-live::before { background: var(--red); }
.status.live {
    background: var(--red-bg); color: var(--red);
    border-color: rgba(248, 113, 113, 0.3);
    animation: pulse-live 2s infinite;
}
@keyframes pulse-live {
    0%   { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.35); }
    70%  { box-shadow: 0 0 0 10px rgba(248, 113, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0); }
}

/* ============================================
   PREDICTION AREA
   ============================================ */
.pred-area { margin-top: 16px; }

.analyze-btn {
    width: 100%;
    background: rgba(163, 230, 53, 0.06);
    border: 1px dashed rgba(163, 230, 53, 0.35);
    color: var(--accent);
    font-weight: 600;
    box-shadow: none;
}
.analyze-btn:hover {
    background: var(--accent-glow);
    border-style: solid;
    box-shadow: 0 0 20px rgba(163, 230, 53, 0.1);
    transform: none;
    filter: none;
}

.loading {
    color: var(--accent); padding: 14px 0; font-size: 14px; font-weight: 500;
    display: flex; align-items: center; gap: 10px;
}
.loading::before {
    content: '';
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid var(--accent-glow);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
    display: inline-block; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.prediction {
    background: linear-gradient(160deg, rgba(163, 230, 53, 0.05), rgba(11, 14, 23, 0.4));
    padding: 16px; border-radius: 14px;
    border: 1px solid rgba(163, 230, 53, 0.14);
}
.pred-badge {
    display: inline-block; padding: 7px 14px; border-radius: 30px;
    font-size: 13.5px; font-weight: 500;
    background: rgba(163, 230, 53, 0.1);
    color: var(--text);
    border: 1px solid rgba(163, 230, 53, 0.25);
}
.pred-badge b { color: var(--accent); font-family: 'JetBrains Mono', monospace; }

.pred-badge.conf-высокая { background: var(--green-bg); border-color: rgba(52,211,153,0.3); }
.pred-badge.conf-высокая b { color: var(--green); }
.pred-badge.conf-средняя { background: var(--amber-bg); border-color: rgba(251,191,36,0.3); }
.pred-badge.conf-средняя b { color: var(--amber); }
.pred-badge.conf-низкая { background: var(--red-bg); border-color: rgba(248,113,113,0.3); }
.pred-badge.conf-низкая b { color: var(--red); }

.reasoning {
    margin-top: 12px; color: var(--text-dim);
    font-size: 13.5px; line-height: 1.65;
}
.link-small {
    display: inline-block; margin-top: 12px;
    font-size: 12.5px; font-weight: 600;
    color: var(--text-faint); text-decoration: none;
    border-bottom: 1px dashed var(--text-faint);
    transition: var(--transition);
}
.link-small:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* --- Badges --- */
.badge {
    padding: 4px 11px; border-radius: 30px;
    font-size: 12px; font-weight: 700; margin-left: 8px;
    letter-spacing: 0.2px;
}
.badge.ok   { background: var(--green-bg); color: var(--green); border: 1px solid rgba(52,211,153,0.3); }
.badge.fail { background: var(--red-bg);   color: var(--red);   border: 1px solid rgba(248,113,113,0.3); }
.badge.wait { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(251,191,36,0.25); }

/* ============================================
   FORMS
   ============================================ */
.form-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    padding: 26px; border-radius: var(--radius);
    display: flex; flex-direction: column; gap: 6px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.form-card label {
    font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-faint); margin-top: 12px;
}
.form-card input {
    padding: 12px 15px; border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: var(--bg-input); color: var(--text);
    font-family: inherit; font-size: 14px;
    transition: var(--transition);
    color-scheme: dark;
}
.form-card input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-card .btn { margin-top: 20px; }

/* ============================================
   STATS
   ============================================ */
.stats-grid {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 14px; margin-bottom: 14px;
}
.stat-box {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 18px; text-align: center;
    transition: var(--transition);
    position: relative; overflow: hidden;
}
.stat-box::after {
    content: '';
    position: absolute; top: 0; left: 20%; right: 20%; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0; transition: var(--transition);
}
.stat-box:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.stat-box:hover::after { opacity: 1; }
.stat-num {
    font-size: 32px; font-weight: 800; letter-spacing: -1px;
    font-family: 'JetBrains Mono', monospace;
    background: linear-gradient(120deg, var(--accent), #4ade80);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.stat-label {
    color: var(--text-faint); font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.8px; margin-top: 6px;
}

/* --- Tables --- */
.tbl {
    width: 100%; border-collapse: collapse;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border);
}
.tbl th, .tbl td {
    padding: 13px 16px; text-align: left;
    border-bottom: 1px solid var(--border);
    color: var(--text); font-size: 13.5px;
}
.tbl th {
    background: rgba(7, 9, 15, 0.5);
    color: var(--text-faint);
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: var(--transition); }
.tbl tbody tr:hover { background: rgba(163, 230, 53, 0.04); }

/* ============================================
   FLASH / TOAST
   ============================================ */
.flash {
    padding: 14px 18px; border-radius: var(--radius-sm);
    margin-bottom: 18px; font-size: 14px; font-weight: 500;
    border: 1px solid transparent;
    animation: slide-in 0.3s ease;
}
@keyframes slide-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.flash.success {
    background: var(--green-bg); color: var(--green);
    border-color: rgba(52, 211, 153, 0.25);
}
.flash.error, .flash.danger {
    background: var(--red-bg); color: var(--red);
    border-color: rgba(248, 113, 113, 0.25);
}
.flash.warning {
    background: var(--amber-bg); color: var(--amber);
    border-color: rgba(251, 191, 36, 0.25);
}

/* ============================================
   SELECT
   ============================================ */
select {
    padding: 12px 15px; border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: var(--bg-input); color: var(--text);
    font-family: inherit; font-size: 14px;
    cursor: pointer; transition: var(--transition);
    color-scheme: dark;
}
select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination { display: flex; gap: 8px; justify-content: center; margin: 24px 0; }
.pagination a, .pagination span {
    padding: 8px 14px; border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    color: var(--text-dim); text-decoration: none;
    font-size: 13.5px; font-weight: 600;
    transition: var(--transition);
}
.pagination a:hover {
    border-color: var(--accent); color: var(--accent);
    background: var(--accent-glow);
}
.pagination .current {
    background: var(--accent); color: #0b0e17;
    border-color: var(--accent);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--text-faint);
    background: var(--bg-card);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .dashboard-layout { flex-direction: column-reverse; }
    .sidebar {
        width: 100%; position: static;
        max-height: 320px; overflow-y: auto;
    }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    body { font-size: 14px; }
    .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
    .nav { flex-wrap: wrap; }
    .nav span { display: none; }
    .container { margin: 16px auto; padding: 0 12px; }
    h2 { font-size: 20px; }
    .match-card { padding: 16px; }
    .match-head { flex-direction: column; }
    .teams { font-size: 16px; }
    .status { align-self: flex-start; }
    .stats-grid { grid-template-columns: 1fr; }
    .stat-num { font-size: 26px; }
    .auth-box { width: 92vw; padding: 30px 22px; }
    .tbl { display: block; overflow-x: auto; }
    .btn { padding: 11px 16px; }
}

/* ============================================
   MICRO-ANIMATIONS
   ============================================ */
.match-card, .stat-box, .form-card {
    animation: fade-up 0.4s ease both;
}
@keyframes fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.match-card:nth-child(1) { animation-delay: 0.03s; }
.match-card:nth-child(2) { animation-delay: 0.07s; }
.match-card:nth-child(3) { animation-delay: 0.11s; }
.match-card:nth-child(4) { animation-delay: 0.15s; }
.match-card:nth-child(5) { animation-delay: 0.19s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

.day-header {
    margin: 30px 0 15px 0;
    padding: 10px 15px;
    background: linear-gradient(90deg, #1e293b, transparent);
    border-left: 4px solid #fbbf24;
    color: #fbbf24;
    font-size: 16px;
    border-radius: 4px;
}
.day-header:first-of-type { margin-top: 10px; }