/* ============================================
   TREBLESTATS.CO.UK - MAIN STYLESHEET
   ============================================ */

/* ============ FONTS & TOKENS ============ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --accent:       #7c6fff;
    --accent-2:     #a78bfa;
    --accent-dim:   rgba(124, 111, 255, 0.12);
    --accent-glow:  rgba(124, 111, 255, 0.22);
    --bg:           #0c0c12;
    --surface:      #13131e;
    --surface-2:    #1a1a28;
    --surface-3:    #20202f;
    --border:       rgba(255, 255, 255, 0.07);
    --border-accent:rgba(124, 111, 255, 0.35);
    --text:         #eeeef2;
    --text-muted:   #7878a0;
    --text-dim:     #5a5a7a;
    --green:        #22c55e;
    --amber:        #f59e0b;
    --red:          #ef4444;
    --radius:       12px;
    --radius-sm:    8px;
}

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

body {
    font-family: "Inter", system-ui, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 8px; }
h2 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 6px; }
h3 { font-size: 1rem; font-weight: 500; margin: 0 0 4px; }

.content {
    padding: 24px 20px;
    max-width: 1100px;
    margin: auto;
}

.icon {
    display: inline-block;
    width: 28px; height: 28px;
    vertical-align: middle;
    margin-right: 6px;
}

/* ============ LINKS ============ */
a { color: var(--accent-2); text-decoration: none; transition: color 0.2s; }
a:hover { color: #fff; }
a:visited { color: var(--accent-2); }

/* ============ HEADER ============ */
.site-header {
    background: rgba(13, 13, 20, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 999;
    height: 60px;
    display: flex;
    align-items: center;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1100px;
    margin: auto;
}

.logo img { height: 44px; }

.desktop-nav { display: flex; align-items: center; gap: 4px; }

.desktop-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 13.5px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
}

.desktop-nav a:hover {
    color: var(--text);
    background: var(--accent-dim);
}

/* Mobile Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
    padding: 4px;
}

.hamburger span {
    width: 24px; height: 2px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: background 0.2s;
}

.hamburger:hover span { background: var(--text); }

.mobile-nav {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 998;
    background: var(--bg);
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    padding: 0 32px;
    opacity: 0;
    transition: opacity 0.22s ease;
}

.mobile-nav.show {
    display: flex;
    opacity: 1;
}

.mobile-nav a {
    color: var(--text);
    padding: 18px 0;
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-align: center;
    border-bottom: 1px solid var(--border);
    transition: color 0.15s;
}

.mobile-nav a:first-child { border-top: 1px solid var(--border); }
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a:hover,
.mobile-nav a:active { color: var(--accent-2); }

/* Hamburger → ✕ animation */
.hamburger span { transition: background 0.2s, transform 0.25s, opacity 0.2s; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 760px) {
    .desktop-nav { display: none; }
    .hamburger { display: flex; }
    .site-header { position: relative; z-index: 999; height: auto; padding: 14px 20px; }
}

/* ============ FOOTER ============ */
.site-footer {
    background: var(--surface);
    text-align: center;
    padding: 32px 20px;
    margin-top: 60px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.8;
}

.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text); }
.site-footer .small { opacity: 0.6; font-size: 12px; }
.footer-nav { margin-top: 12px; }
.footer-nav a { font-size: 13px; }

/* ============ HOMEPAGE LEAGUE CARDS ============ */
.leagues-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin: 36px 0;
}

@media (min-width: 640px) {
    .leagues-section { grid-template-columns: repeat(2, 1fr); }
}

.league-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: border-color 0.25s, box-shadow 0.25s, transform 0.2s;
    position: relative;
    overflow: hidden;
}

.league-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-dim) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.league-card:hover {
    border-color: var(--border-accent);
    box-shadow: 0 0 0 1px var(--border-accent), 0 8px 32px var(--accent-glow);
    transform: translateY(-3px);
}

.league-card:hover::before { opacity: 1; }

.league-card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}

.league-card-subtitle {
    font-size: 13.5px;
    color: var(--text-muted);
    margin: 0 0 24px;
    line-height: 1.5;
}

.league-card-button {
    display: inline-block;
    padding: 11px 20px;
    background: var(--accent-dim);
    color: var(--accent-2);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none !important;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.league-card-button:hover {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px var(--accent-glow);
    border-color: var(--accent);
}

/* ============ QUICK LINKS ============ */
.quick-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 20px 0 32px;
}

.quick-link-button {
    display: inline-block;
    padding: 9px 16px;
    background: var(--surface-2);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none !important;
    transition: all 0.2s;
}

.quick-link-button:hover {
    background: var(--accent-dim);
    color: var(--text);
    border-color: var(--border-accent);
}

/* ============ LOADING STATE ============ */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.loading-state p { margin-top: 16px; color: var(--text-muted); font-size: 14px; }

.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--accent-dim);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============ EMPTY STATE ============ */
.empty-state-card {
    margin: 40px auto;
    padding: 32px 24px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    text-align: center;
    color: var(--text);
}

.empty-state-card .empty-icon {
    width: 56px; height: 56px;
    margin-bottom: 16px;
    opacity: 0.7;
    animation: float 2.5s ease-in-out infinite;
}

.empty-state-card h2, .empty-state-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.empty-state-card p { font-size: 0.95rem; color: var(--text-muted); margin: 0; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* ============ MATCH CARDS ============ */
.match-card {
    background: var(--surface);
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.match-card:hover { border-color: rgba(255,255,255,0.12); }

.team-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}

.team-left { display: flex; align-items: center; }

.team-logo { width: 24px; height: 24px; object-fit: contain; margin-right: 8px; }

.team-name { font-size: 14px; font-weight: 500; }

.score {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.match-meta { margin-top: 6px; font-size: 12px; color: var(--text-muted); }

.minute { font-weight: 600; color: var(--accent-2); }

.league-divider {
    margin: 24px 0 10px;
    padding-bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ============ UPCOMING FIXTURES ============ */
.day-block {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 16px;
    border-radius: var(--radius);
}

.day-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-2);
    margin: 0 0 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.upcoming-match-card {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.upcoming-match-card:last-child { margin-bottom: 0; }

.upcoming-match-card .score {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.league-block {
    margin-bottom: 16px;
    padding-left: 12px;
    border-left: 2px solid var(--accent-dim);
}

.league-title { margin: 6px 0 12px; font-size: 0.9em; font-weight: 500; color: var(--text-muted); }

.upcoming-list { list-style: none; padding: 0; margin: 0; font-size: 0.9rem; }
.upcoming-list li { padding: 6px 0; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.upcoming-list li:last-child { border-bottom: none; }

/* ============ SECTION HEADINGS ============ */
#top5-section, #top6-section, #bottom3-section,
#bottom4-section, #bottom2-section, #fixtures-section,
#form-guide-section { margin-bottom: 44px; }

.table-h2-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding-bottom: 10px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

/* ============ STATS TABLES ============ */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.stats-table th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.stats-table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 14px;
}

.stats-table tr:last-child td { border-bottom: none; }
.stats-table tr:hover td { background: var(--surface-2); }

.stats-table td:first-child {
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 500;
    width: 32px;
}

.table-team-logo {
    width: 22px; height: 22px;
    object-fit: contain;
    margin-right: 8px;
    vertical-align: middle;
}

/* Position highlights */
.promotion-row td { background: rgba(34,197,94,0.05); }
.promotion-row td:first-child { border-left: 3px solid var(--green); padding-left: 11px; }
.playoff-row td { background: rgba(245,158,11,0.05); }
.playoff-row td:first-child { border-left: 3px solid var(--amber); padding-left: 11px; }
.promotion-divider td { border-bottom: 1px dashed rgba(255,255,255,0.1) !important; }

/* ============ DISCIPLINE TABLES ============ */
.discipline-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.discipline-table th, .discipline-table td {
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    text-align: left;
}

.discipline-table th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.discipline-table td { background: var(--surface); color: var(--text); font-size: 14px; }
.discipline-table tr:last-child td { border-bottom: none; }
.discipline-table tr:hover td { background: var(--surface-2); }

.yellow-header { background-color: #78540a !important; color: #fef3c7 !important; }
.red-header    { background-color: #7f1d1d !important; color: #fee2e2 !important; }
.yellow-cell, .red-cell { width: 44px; }

/* ============ AI SUMMARIES ============ */
.ai-summary {
    background: var(--surface);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 18px 22px;
    margin: 28px 0;
    font-size: 15px;
    line-height: 1.7;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
}

.ai-summary p { margin: 0; color: var(--text-muted); }

#team-summary-section, #player-summary-section { margin: 20px 0; }

@media (max-width: 768px) {
    .ai-summary { padding: 14px 16px; font-size: 14px; }
}

/* ============ FORM GUIDE ============ */
.form-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 5px;
    font-weight: 700;
    font-size: 12px;
}

.form-win  { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.form-draw { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.25); }
.form-loss { background: rgba(239,68,68,0.15);  color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.form-empty{ background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border); }

/* ============ PLAYER & LEADERBOARD ============ */
.player-img {
    width: 30px; height: 30px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid var(--border);
}

.player-row { display: flex; align-items: center; margin-bottom: 8px; }

.leaderboard-section { margin-bottom: 50px; }

.leaderboard-chart {
    width: 100%; max-width: 800px;
    margin: 20px auto 50px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
}

/* ============ UTILITY ============ */
.small { font-size: 0.875rem; color: var(--text-muted); line-height: 1.6; }

/* ============ MATCH EVENTS ============ */
.match-events {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding: 0 4px;
    gap: 16px;
}

.team-events { flex: 1; font-size: 12px; }
.team-events-away { text-align: right; }

.scorer-inline, .red-card-inline { padding: 3px; line-height: 1.5; float: left; }
.scorer-inline  { color: #4ade80; }
.red-card-inline{ color: #f87171; }

/* ============ RESPONSIVE ============ */
@media screen and (max-width: 768px) {
    .content { padding: 16px; }
    h1 { font-size: 1.3rem; }
    .upcoming-match-card .team-name { font-size: 13px; }
    .stats-table { font-size: 13px; }
    .stats-table th, .stats-table td { padding: 9px 8px; }
    .form-box { width: 24px; height: 24px; font-size: 11px; }
}

@media (max-width: 480px) {
    .stats-table { font-size: 12px; }
    .stats-table th, .stats-table td { padding: 7px 5px; }
    .form-box { width: 22px; height: 22px; font-size: 10px; }
    .team-name { font-size: 12px; }
    .table-h2-title { font-size: 10px; }
}

@media (max-width: 360px) {
    .stats-table { font-size: 11px; }
    .stats-table th, .stats-table td { padding: 6px 4px; }
    .form-box { width: 20px; height: 20px; font-size: 9px; }
}
/* ============ EXPANDABLE TEXT (read more) ============ */
.expandable-wrap { margin-top: 10px; margin-bottom: 16px; }

.expandable-content { font-size: 0.875rem; color: var(--text-muted); line-height: 1.6; margin: 0; }

/* Clamped state — mobile only applies this */
.expandable-content.is-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more-btn {
    display: none; /* hidden on desktop */
    background: none;
    border: none;
    padding: 6px 0 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-2);
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.read-more-btn:hover { color: #fff; }

@media (max-width: 768px) {
    .read-more-btn { display: inline-block; }
}
