/* ============================================================
   CDF Campeonatos — core.css
   Design tokens + ALL shared components.
   Loaded by every shortcode type.
   ============================================================ */

/* ── Design Tokens ────────────────────────────────────────── */
:root {
    --cdf-bg:           #0d0d0d;
    --cdf-surface:      #161616;
    --cdf-surface-2:    #1e1e1e;
    --cdf-surface-3:    #272727;
    --cdf-border:       rgba(255, 255, 255, .07);
    --cdf-border-hover: rgba(255, 255, 255, .14);

    --cdf-text:         #f0f0f0;
    --cdf-text-muted:   #888;
    --cdf-text-dim:     #555;

    --cdf-red:          #e02020;
    --cdf-red-dark:     #b51818;
    --cdf-red-glow:     rgba(224, 32, 32, .22);

    --cdf-gold:         #f5c518;
    --cdf-silver:       #c0c0c0;
    --cdf-bronze:       #cd7f32;

    /* Zone accent colours — shared by league and tournament */
    --cdf-zone-libertadores:   #1e6e35;
    --cdf-zone-sulamericana:   #1a4f72;
    --cdf-zone-relegation:     #7a1a1a;
    --cdf-zone-classification: #1e6e35;
    --cdf-zone-playoff:        #b07a10;
    --cdf-zone-eliminated:     #7a1a1a;
    --cdf-zone-semifinal:      #1e6e35;

    --cdf-radius:    12px;
    --cdf-radius-sm:  8px;
    --cdf-radius-xs:  4px;
    --cdf-transition: .18s ease;

    --cdf-font-head: 'Barlow Condensed', 'Arial Narrow', sans-serif;
    --cdf-font-body: 'Barlow', Arial, sans-serif;
}

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

/* ── Widget shell ──────────────────────────────────────────── */
.cdf {
    background: var(--cdf-bg);
    color: var(--cdf-text);
    font-family: var(--cdf-font-body);
    font-size: 14px;
    line-height: 1.4;
    border-radius: var(--cdf-radius);
    overflow: hidden;
    width: 100%;
    max-width: 960px;
    margin-inline: auto;
    border: 1px solid var(--cdf-border);
    box-shadow: 0 8px 40px rgba(0, 0, 0, .6);
}

/* ── Header ────────────────────────────────────────────────── */
.cdf__header {
    background: linear-gradient(135deg, #1a0000 0%, #0d0d0d 70%);
    padding: 20px 20px 18px;
    border-bottom: 2px solid var(--cdf-red);
    position: relative;
    overflow: hidden;
}

.cdf__header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 80% at 95% 50%, var(--cdf-red-glow) 0%, transparent 70%);
    pointer-events: none;
}

.cdf__header-eyebrow {
    display: block;
    font-family: var(--cdf-font-head);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .15em;
    color: var(--cdf-red);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.cdf__header-title {
    font-family: var(--cdf-font-head);
    font-size: clamp(22px, 5vw, 32px);
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.1;
}

/* ── Main tabs ─────────────────────────────────────────────── */
.cdf__tabs {
    display: flex;
    background: var(--cdf-surface);
    border-bottom: 1px solid var(--cdf-border);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.cdf__tabs::-webkit-scrollbar { display: none; }

.cdf__tab {
    flex: 1;
    min-width: 80px;
    padding: 14px 12px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--cdf-text-muted);
    font-family: var(--cdf-font-head);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: color var(--cdf-transition), border-color var(--cdf-transition);
    white-space: nowrap;
}
.cdf__tab:hover      { color: var(--cdf-text); }
.cdf__tab--active    { color: #fff; border-bottom-color: var(--cdf-red); }

/* ── Panels ────────────────────────────────────────────────── */
.cdf__panel         { display: none; }
.cdf__panel--active { display: block; animation: cdf-fade-in .22s ease; }

/* ── Table shared ──────────────────────────────────────────── */
.cdf-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cdf-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 320px;
}

.cdf-table__head { background: var(--cdf-surface-2); }

.cdf-th {
    padding: 10px 8px;
    font-family: var(--cdf-font-head);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--cdf-text-muted);
    text-align: center;
    white-space: nowrap;
    user-select: none;
}
.cdf-th--club  { text-align: left; padding-left: 12px; }
.cdf-th--pos   { width: 50px; }
.cdf-th--form  { min-width: 70px; }
.cdf-th--pts   { min-width: 44px; }

.cdf-table__row {
    border-bottom: 1px solid var(--cdf-border);
    transition: background var(--cdf-transition);
    border-left: 3px solid transparent;
}
.cdf-table__row:hover { background: var(--cdf-surface-2); }

/* Zone row accents */
.cdf-row--zone-libertadores   { border-left-color: var(--cdf-zone-libertadores); }
.cdf-row--zone-sulamericana   { border-left-color: var(--cdf-zone-sulamericana); }
.cdf-row--zone-relegation     { border-left-color: var(--cdf-zone-relegation); }
.cdf-row--zone-classification { border-left-color: var(--cdf-zone-classification); }
.cdf-row--zone-playoff        { border-left-color: var(--cdf-zone-playoff); }
.cdf-row--zone-eliminated     { border-left-color: var(--cdf-zone-eliminated); }
.cdf-row--zone-semifinal      { border-left-color: var(--cdf-zone-semifinal); }

/* Highlight row */
.cdf-row--highlight {
    background: rgba(224, 32, 32, .06);
    border-left-color: var(--cdf-red) !important;
}
.cdf-row--highlight:hover { background: rgba(224, 32, 32, .12); }

.cdf-td {
    padding: 11px 8px;
    text-align: center;
    font-size: 14px;
}
.cdf-td--club { text-align: left; padding-left: 12px; }

/* Position cell */
.cdf-td--pos {
    display: flex;
    align-items: center;
    gap: 5px;
    padding-left: 10px;
    width: 50px;
}
.cdf-pos-num {
    font-family: var(--cdf-font-head);
    font-size: 15px;
    font-weight: 700;
    color: var(--cdf-text-muted);
}
.cdf-row--highlight .cdf-pos-num { color: var(--cdf-red); }

/* Zone dot */
.cdf-zone-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cdf-zone-dot--libertadores   { background: var(--cdf-zone-libertadores); }
.cdf-zone-dot--sulamericana   { background: var(--cdf-zone-sulamericana); }
.cdf-zone-dot--relegation     { background: var(--cdf-zone-relegation); }
.cdf-zone-dot--classification { background: var(--cdf-zone-classification); }
.cdf-zone-dot--playoff        { background: var(--cdf-zone-playoff); }
.cdf-zone-dot--eliminated     { background: var(--cdf-zone-eliminated); }
.cdf-zone-dot--semifinal      { background: var(--cdf-zone-semifinal); }

/* Club cell */
.cdf-club {
    display: flex;
    align-items: center;
    gap: 10px;
}
.cdf-club__shield {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}
.cdf-club__shield-ph {
    width: 28px;
    height: 28px;
    background: var(--cdf-surface-3);
    border-radius: 50%;
    flex-shrink: 0;
}
.cdf-club__name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.cdf-row--highlight .cdf-club__name { font-weight: 700; color: #fff; }
.cdf-club__star { font-size: 10px; color: var(--cdf-red); margin-left: 2px; }

/* Stat numbers */
.cdf-num--pos { color: #4cde80; }
.cdf-num--neg { color: #f86060; }

/* Points */
.cdf-pts {
    font-family: var(--cdf-font-head);
    font-size: 18px;
    font-weight: 900;
    color: #fff;
}
.cdf-pts--red { color: var(--cdf-red); font-size: 20px; }

/* Form dots */
.cdf-form {
    display: flex;
    align-items: center;
    gap: 3px;
    justify-content: center;
}
.cdf-form__dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}
.cdf-form__dot--win  { background: #4cde80; }
.cdf-form__dot--draw { background: #f5c518; }
.cdf-form__dot--loss { background: #f86060; }

/* Mobile: hide optional columns */
@media (max-width: 600px) {
    .cdf-hide-mobile { display: none !important; }
    .cdf-club__name  { max-width: 120px; }
}

/* ── Zone Legend ───────────────────────────────────────────── */
.cdf-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    padding: 12px 16px;
    border-top: 1px solid var(--cdf-border);
    background: var(--cdf-surface);
}
.cdf-legend__item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.cdf-legend__label {
    font-size: 11px;
    font-family: var(--cdf-font-head);
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--cdf-text-muted);
}

/* ── Round nav (shared by league matches + tournament group matches) */
.cdf-round-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 14px 16px 0;
    -webkit-overflow-scrolling: touch;
}
.cdf-round-nav::-webkit-scrollbar { display: none; }

.cdf-round-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--cdf-border);
    background: var(--cdf-surface-2);
    color: var(--cdf-text-muted);
    font-family: var(--cdf-font-head);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--cdf-transition);
    white-space: nowrap;
}
.cdf-round-btn:hover         { color: var(--cdf-text); border-color: var(--cdf-border-hover); }
.cdf-round-btn--active       { background: var(--cdf-red); border-color: var(--cdf-red); color: #fff; }

.cdf-round-panel             { display: none; }
.cdf-round-panel--active     { display: block; animation: cdf-fade-in .18s ease; }

/* ── Match card ────────────────────────────────────────────── */
.cdf-matches, .cdf-group-matches { padding: 14px 16px 16px; }

.cdf-match-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.cdf-match-card {
    background: var(--cdf-surface-2);
    border-radius: var(--cdf-radius-sm);
    border: 1px solid var(--cdf-border);
    overflow: hidden;
    transition: transform var(--cdf-transition), box-shadow var(--cdf-transition);
}
.cdf-match-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
}
.cdf-match-card--highlight {
    border-color: rgba(224, 32, 32, .35);
    box-shadow: inset 0 0 0 1px rgba(224, 32, 32, .18);
}

.cdf-match-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: var(--cdf-surface-3);
    font-family: var(--cdf-font-head);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--cdf-text-muted);
}
.cdf-match-card--highlight .cdf-match-card__meta { color: var(--cdf-red); }

.cdf-match-card__time-badge {
    background: var(--cdf-red);
    color: #fff;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
}

.cdf-match-card__body {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 14px;
}

.cdf-match-card__team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.cdf-match-card__team--home { align-items: flex-end;   }
.cdf-match-card__team--away { align-items: flex-start; }

.cdf-match-card__shield {
    width: 42px;
    height: 42px;
    object-fit: contain;
}
.cdf-match-card__shield-ph {
    width: 42px;
    height: 42px;
    background: var(--cdf-surface-3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--cdf-font-head);
    font-size: 10px;
    font-weight: 700;
    color: var(--cdf-text-muted);
}

.cdf-match-card__team-name {
    font-family: var(--cdf-font-head);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.cdf-match-card__center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 72px;
}

.cdf-match-card__score {
    font-family: var(--cdf-font-head);
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    letter-spacing: .04em;
}
.cdf-match-card__kickoff {
    font-family: var(--cdf-font-head);
    font-size: 20px;
    font-weight: 900;
    color: var(--cdf-red);
}
.cdf-match-card__vs {
    font-family: var(--cdf-font-head);
    font-size: 10px;
    font-weight: 700;
    color: var(--cdf-text-dim);
    letter-spacing: .12em;
}
.cdf-match-card__date-played {
    font-size: 10px;
    color: var(--cdf-text-dim);
}

.cdf-match-card__stadium {
    padding: 6px 14px 10px;
    font-size: 11px;
    color: var(--cdf-text-dim);
    text-align: center;
    font-style: italic;
}

/* ── Scorers ───────────────────────────────────────────────── */
.cdf-scorers { padding: 16px; }

.cdf-scorers__list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cdf-scorer {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--cdf-surface-2);
    border-radius: var(--cdf-radius-sm);
    padding: 12px 14px;
    border: 1px solid var(--cdf-border);
    transition: background var(--cdf-transition);
}
.cdf-scorer:hover           { background: var(--cdf-surface-3); }
.cdf-scorer--highlight      { border-color: rgba(224, 32, 32, .3); background: rgba(224, 32, 32, .05); }

.cdf-scorer__rank { min-width: 28px; display: flex; justify-content: center; }

.cdf-scorer__medal {
    font-family: var(--cdf-font-head);
    font-size: 14px;
    font-weight: 900;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cdf-scorer__medal--1 { background: var(--cdf-gold);   color: #000; }
.cdf-scorer__medal--2 { background: var(--cdf-silver); color: #000; }
.cdf-scorer__medal--3 { background: var(--cdf-bronze); color: #000; }

.cdf-scorer__pos {
    font-family: var(--cdf-font-head);
    font-size: 15px;
    font-weight: 700;
    color: var(--cdf-text-muted);
}

.cdf-scorer__shield { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.cdf-scorer__shield-ph {
    width: 36px;
    height: 36px;
    background: var(--cdf-surface-3);
    border-radius: 50%;
    display: block;
    flex-shrink: 0;
}

.cdf-scorer__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.cdf-scorer__name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cdf-scorer__team {
    font-size: 11px;
    color: var(--cdf-text-muted);
    font-family: var(--cdf-font-head);
    letter-spacing: .04em;
    text-transform: uppercase;
}

.cdf-scorer__goals { display: flex; flex-direction: column; align-items: flex-end; }
.cdf-scorer__goals-num {
    font-family: var(--cdf-font-head);
    font-size: 28px;
    font-weight: 900;
    color: #fff;
    line-height: 1;
}
.cdf-scorer__goals-num--red { color: var(--cdf-red); }
.cdf-scorer__goals-label {
    font-size: 10px;
    color: var(--cdf-text-dim);
    text-transform: uppercase;
    letter-spacing: .08em;
}

/* ── Utilities ─────────────────────────────────────────────── */
.cdf-empty { padding: 20px 16px; color: var(--cdf-text-muted); font-size: 14px; text-align: center; }
.cdf-error { padding: 16px; color: var(--cdf-red); font-size: 13px; }

/* ── Animations ────────────────────────────────────────────── */
@keyframes cdf-fade-in {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
    .cdf__header       { padding: 14px 14px 12px; }
    .cdf__tab          { padding: 12px 8px; font-size: 12px; }
    .cdf-td, .cdf-th   { padding: 9px 5px; }
    .cdf-club__shield  { width: 22px; height: 22px; }
    .cdf-pts           { font-size: 16px; }
    .cdf-pts--red      { font-size: 18px; }
    .cdf-match-card__shield  { width: 32px; height: 32px; }
    .cdf-match-card__score   { font-size: 18px; }
    .cdf-match-card__kickoff { font-size: 17px; }
    .cdf-match-card__body    { padding: 10px; }
}
