/**
 * YallaScore — Public Frontend Stylesheet
 *
 * Uses the same CSS variables defined by the YallaScore theme (style.css).
 * Falls back gracefully when used without the theme.
 *
 * Table of contents:
 *  1. CSS Variables / Reset
 *  2. Layout Wrappers
 *  3. Match Header
 *  4. Scoreboards (live + final)
 *  5. Match Cards (archive / taxonomy lists)
 *  6. Date Navigation
 *  7. Form Tables
 *  8. H2H Table
 *  9. Lineups Grid
 * 10. Stats Bars
 * 11. Events Timeline
 * 12. FAQ Accordion
 * 13. Stream Section
 * 14. Taxonomy Pages (league / team)
 * 15. Utilities / Badges
 * 16. Animations
 *
 * @package YallaScore
 * @since   2.0.0
 */

/* =========================================================
 * 1. CSS Variables / Reset
 * ========================================================= */
:root {
    --ys-primary:     #00d166;
    --ys-primary-dim: #00a34d;
    --ys-bg:          #0a0e17;
    --ys-bg-card:     #111827;
    --ys-bg-card2:    #1a2235;
    --ys-text:        #f0f4f8;
    --ys-text-muted:  #8898aa;
    --ys-border:      rgba(255,255,255,0.08);
    --ys-live:        #ff3b3b;
    --ys-win:         #00d166;
    --ys-loss:        #ff3b3b;
    --ys-draw:        #f5a623;
    --ys-radius:      8px;
    --ys-radius-sm:   4px;
    --ys-gap:         16px;
    --ys-font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.ys-main *,
.ys-main *::before,
.ys-main *::after {
    box-sizing: border-box;
}

.ys-main {
    font-family: var(--ys-font);
    color: var(--ys-text);
    background: var(--ys-bg);
    min-height: 60vh;
}

/* =========================================================
 * 2. Layout Wrappers
 * ========================================================= */
.ys-match-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 var(--ys-gap) 48px;
}

.ys-section {
    margin-bottom: 32px;
    background: var(--ys-bg-card);
    border: 1px solid var(--ys-border);
    border-radius: var(--ys-radius);
    padding: 20px;
}

.ys-section-title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ys-primary);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--ys-border);
}

/* =========================================================
 * 3. Match Header
 * ========================================================= */
.ys-match-header {
    background: var(--ys-bg-card);
    border: 1px solid var(--ys-border);
    border-radius: var(--ys-radius);
    padding: 20px 16px;
    margin-bottom: 24px;
    text-align: center;
}

.ys-header-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ys-league-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .8rem;
    color: var(--ys-text-muted);
}

.ys-league-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.ys-header-date {
    font-size: .8rem;
    color: var(--ys-text-muted);
}

.ys-header-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ys-gap);
}

.ys-team-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.ys-team-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.ys-team-logo-placeholder {
    display: block;
    width: 60px;
    height: 60px;
    background: var(--ys-bg-card2);
    border-radius: 50%;
}

.ys-team-name {
    font-size: .9rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
}

/* Header score / kickoff time */
.ys-header-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 80px;
}

.ys-score-main {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: .02em;
    color: var(--ys-text);
}

.ys-kickoff-time {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ys-primary);
}

/* =========================================================
 * 4. Scoreboards
 * ========================================================= */
.ys-scoreboard {
    background: var(--ys-bg-card2);
    border-radius: var(--ys-radius);
    padding: 20px;
    text-align: center;
    margin-bottom: 24px;
    border: 1px solid var(--ys-border);
}

.ys-scoreboard--live {
    border-color: var(--ys-live);
    box-shadow: 0 0 12px rgba(255,59,59,.2);
}

.ys-scoreboard-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.ys-score-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ys-score-num {
    font-size: 3rem;
    font-weight: 900;
    min-width: 1.5ch;
    text-align: center;
}

.ys-score-sep {
    font-size: 2rem;
    color: var(--ys-text-muted);
}

.ys-score-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.ys-status-label {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--ys-primary);
    background: rgba(0,209,102,.12);
    padding: 3px 10px;
    border-radius: 20px;
}

.ys-elapsed {
    font-size: .85rem;
    color: var(--ys-text-muted);
}

.ys-ht-score {
    font-size: .8rem;
    color: var(--ys-text-muted);
}

/* =========================================================
 * 5. Match Cards (archive / taxonomy)
 * ========================================================= */
.ys-match-cards {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ys-match-card {
    display: flex;
    align-items: center;
    background: var(--ys-bg-card);
    border: 1px solid var(--ys-border);
    border-radius: var(--ys-radius-sm);
    padding: 10px 14px;
    text-decoration: none;
    color: var(--ys-text);
    transition: background .15s, border-color .15s;
    gap: var(--ys-gap);
}

.ys-match-card:hover {
    background: var(--ys-bg-card2);
    border-color: var(--ys-primary);
    color: var(--ys-text);
    text-decoration: none;
}

.ys-match-card--live {
    border-left: 3px solid var(--ys-live);
}

.ys-card-team {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.ys-card-home { justify-content: flex-end; }
.ys-card-away { justify-content: flex-start; }

.ys-card-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.ys-card-name {
    font-size: .875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ys-card-middle {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
    gap: 3px;
    flex-shrink: 0;
    text-align: center;
}

.ys-card-score {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
}

.ys-card-league {
    font-size: .7rem;
    color: var(--ys-text-muted);
}

/* =========================================================
 * 6. Date Navigation
 * ========================================================= */
.ys-archive-header {
    padding: 20px var(--ys-gap) 0;
    max-width: 900px;
    margin: 0 auto;
}

.ys-archive-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.ys-date-nav ul {
    display: flex;
    gap: 4px;
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
}

.ys-date-nav ul::-webkit-scrollbar { display: none; }

.ys-date-nav li a {
    display: block;
    padding: 6px 14px;
    background: var(--ys-bg-card);
    border: 1px solid var(--ys-border);
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--ys-text-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: all .15s;
}

.ys-date-nav li a:hover,
.ys-date-active a,
.ys-date-nav li.ys-date-active a {
    background: var(--ys-primary);
    border-color: var(--ys-primary);
    color: #000;
}

/* =========================================================
 * 7. Form Tables
 * ========================================================= */
.ys-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--ys-gap);
}

@media (max-width: 600px) {
    .ys-form-grid { grid-template-columns: 1fr; }
}

.ys-form-team-title {
    font-size: .85rem;
    font-weight: 700;
    color: var(--ys-text-muted);
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* =========================================================
 * 8. H2H Table
 * ========================================================= */
.ys-h2h-summary {
    font-size: .85rem;
    color: var(--ys-text-muted);
    margin-bottom: 12px;
    text-align: center;
}

.ys-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* =========================================================
 * Shared table styles (form + h2h)
 * ========================================================= */
.ys-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

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

.ys-table th {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ys-text-muted);
}

.ys-table tr:last-child td { border-bottom: none; }

.ys-table tr:hover td { background: rgba(255,255,255,.03); }

/* H2H winner highlights */
.ys-h2h-home-win td:nth-child(2) { color: var(--ys-primary); font-weight: 700; }
.ys-h2h-away-win td:nth-child(4) { color: var(--ys-primary); font-weight: 700; }
.ys-h2h-draw td:nth-child(3)     { color: var(--ys-draw); }

.ys-h2h-score, .ys-form-score { text-align: center; font-weight: 700; }

/* =========================================================
 * 9. Lineups Grid
 * ========================================================= */
.ys-lineups-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--ys-gap);
}

@media (max-width: 600px) {
    .ys-lineups-grid { grid-template-columns: 1fr; }
}

.ys-lineup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ys-border);
}

.ys-lineup-team {
    font-weight: 700;
    font-size: .9rem;
}

.ys-lineup-formation {
    font-size: .8rem;
    color: var(--ys-primary);
    font-weight: 700;
    background: rgba(0,209,102,.12);
    padding: 2px 8px;
    border-radius: 10px;
}

.ys-lineup-sublabel {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ys-text-muted);
    margin: 12px 0 6px;
}

.ys-player-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ys-player-list li {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: var(--ys-radius-sm);
    font-size: .82rem;
    transition: background .1s;
}

.ys-player-list li:hover { background: rgba(255,255,255,.04); }

.ys-player-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: var(--ys-bg-card2);
    border-radius: 50%;
    font-size: .72rem;
    font-weight: 700;
    flex-shrink: 0;
    color: var(--ys-text-muted);
}

.ys-player-name { flex: 1; }

.ys-player-pos {
    font-size: .7rem;
    color: var(--ys-text-muted);
    background: var(--ys-bg-card2);
    padding: 1px 6px;
    border-radius: 10px;
}

.ys-lineup-coach {
    font-size: .75rem;
    color: var(--ys-text-muted);
    margin-top: 8px;
}

/* =========================================================
 * 10. Stats Bars
 * ========================================================= */
.ys-stats-bars {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ys-stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ys-stat-val {
    width: 48px;
    font-size: .85rem;
    font-weight: 700;
    text-align: center;
    flex-shrink: 0;
}

.ys-stat-home { color: var(--ys-primary); }
.ys-stat-away { color: #7b9fff; }

.ys-stat-label-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ys-stat-label {
    font-size: .75rem;
    color: var(--ys-text-muted);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.ys-stat-bar {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--ys-bg-card2);
}

.ys-stat-bar-home {
    background: var(--ys-primary);
    border-radius: 3px 0 0 3px;
    transition: width .4s ease;
}

.ys-stat-bar-away {
    background: #7b9fff;
    border-radius: 0 3px 3px 0;
    transition: width .4s ease;
}

/* =========================================================
 * 11. Events Timeline
 * ========================================================= */
.ys-events-timeline {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ys-event-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: var(--ys-radius-sm);
    font-size: .84rem;
    background: transparent;
    transition: background .1s;
}

.ys-event-row:hover { background: rgba(255,255,255,.04); }

/* Home events left-aligned; away events right-aligned */
.ys-event-home {
    flex-direction: row;
}

.ys-event-away {
    flex-direction: row-reverse;
    text-align: right;
}

.ys-event-min {
    min-width: 40px;
    font-size: .75rem;
    font-weight: 700;
    color: var(--ys-primary);
    text-align: center;
    flex-shrink: 0;
}

.ys-event-icon {
    font-size: 1rem;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.ys-event-player {
    flex: 1;
    font-weight: 600;
}

.ys-event-assist {
    font-weight: 400;
    color: var(--ys-text-muted);
    font-size: .78rem;
}

/* =========================================================
 * 12. FAQ Accordion
 * ========================================================= */
.ys-faq-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ys-faq-item {
    border: 1px solid var(--ys-border);
    border-radius: var(--ys-radius-sm);
    overflow: hidden;
}

.ys-faq-question {
    width: 100%;
    background: var(--ys-bg-card2);
    border: none;
    padding: 14px 16px;
    text-align: left;
    font-size: .9rem;
    font-weight: 600;
    color: var(--ys-text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    transition: background .15s;
    line-height: 1.4;
}

.ys-faq-question:hover { background: rgba(255,255,255,.05); }

.ys-faq-question::after {
    content: '+';
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--ys-primary);
    flex-shrink: 0;
    transition: transform .2s;
}

.ys-faq-question[aria-expanded="true"]::after {
    content: '−';
}

.ys-faq-answer {
    padding: 14px 16px;
    font-size: .875rem;
    line-height: 1.7;
    color: var(--ys-text-muted);
    background: var(--ys-bg-card);
    border-top: 1px solid var(--ys-border);
}

.ys-faq-answer[hidden] { display: none; }

/* =========================================================
 * 13. Stream Section
 * ========================================================= */
.ys-stream-wrap {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: var(--ys-radius-sm);
    background: #000;
}

.ys-stream-iframe,
.ys-stream-wrap iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* =========================================================
 * 14. Taxonomy Pages
 * ========================================================= */
.ys-taxonomy-page {
    padding: 0 var(--ys-gap) 48px;
    max-width: 900px;
    margin: 0 auto;
}

.ys-taxonomy-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px 0 20px;
    border-bottom: 1px solid var(--ys-border);
    margin-bottom: 24px;
}

.ys-taxonomy-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    flex-shrink: 0;
}

.ys-taxonomy-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 4px;
}

.ys-taxonomy-desc {
    font-size: .85rem;
    color: var(--ys-text-muted);
    margin: 0;
}

.ys-date-group { margin-bottom: 28px; }

.ys-date-heading {
    font-size: .85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--ys-text-muted);
    margin-bottom: 8px;
    padding: 6px 10px;
    background: var(--ys-bg-card2);
    border-radius: var(--ys-radius-sm);
}

.ys-league-group { margin-bottom: 16px; }

.ys-league-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--ys-bg-card);
    border: 1px solid var(--ys-border);
    border-radius: var(--ys-radius-sm) var(--ys-radius-sm) 0 0;
    border-bottom: none;
}

.ys-league-group-logo {
    width: 20px; height: 20px;
    object-fit: contain;
}

.ys-league-group-name {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ys-text-muted);
}

.ys-league-group .ys-match-cards .ys-match-card {
    border-radius: 0;
    border-top: none;
}

.ys-league-group .ys-match-cards .ys-match-card:last-child {
    border-radius: 0 0 var(--ys-radius-sm) var(--ys-radius-sm);
}

/* Team form inline */
.ys-team-form-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.ys-form-label {
    font-size: .8rem;
    color: var(--ys-text-muted);
    margin-right: 4px;
}

/* =========================================================
 * 15. Utilities / Badges
 * ========================================================= */

/* Form W/D/L badges */
.ys-form-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: .72rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.ys-form-w { background: var(--ys-win); color: #000; }
.ys-form-l { background: var(--ys-loss); }
.ys-form-d { background: var(--ys-draw); color: #000; }

/* Card badges (LIVE / FT / etc.) */
.ys-card-badge {
    display: inline-block;
    font-size: .65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 2px 7px;
    border-radius: 10px;
}

.ys-card-live {
    background: var(--ys-live);
    color: #fff;
}

.ys-card-ft {
    background: var(--ys-bg-card2);
    color: var(--ys-text-muted);
}

/* Match header live badge */
.ys-live-badge {
    display: inline-block;
    background: var(--ys-live);
    color: #fff;
    font-size: .65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 4px;
}

/* No-matches notice */
.ys-no-matches {
    text-align: center;
    color: var(--ys-text-muted);
    padding: 40px 20px;
}

/* Preview paragraph */
.ys-preview-paragraph {
    background: var(--ys-bg-card);
    border: 1px solid var(--ys-border);
    border-left: 3px solid var(--ys-primary);
    border-radius: var(--ys-radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    font-size: .9rem;
    line-height: 1.8;
    color: var(--ys-text);
}

.ys-preview-paragraph p { margin: 0; }

/* Editor content (manual post content from WordPress editor) */
.ys-editor-content {
    background: var(--ys-bg-card);
    border: 1px solid var(--ys-border);
    border-radius: var(--ys-radius);
    padding: 20px;
    margin-top: 24px;
    font-size: .9rem;
    line-height: 1.8;
}

/* =========================================================
 * 16. Animations
 * ========================================================= */
@keyframes ys-pulse {
    0%   { opacity: 1; }
    50%  { opacity: .5; }
    100% { opacity: 1; }
}

.ys-live-pulse {
    animation: ys-pulse 1.8s ease-in-out infinite;
}

@keyframes ys-score-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.3); color: var(--ys-primary); }
    100% { transform: scale(1); }
}

.ys-score-updated {
    animation: ys-score-pop .5s ease-out forwards;
}

/* =========================================================
 * Responsive
 * ========================================================= */
@media (max-width: 480px) {
    .ys-team-logo { width: 40px; height: 40px; }
    .ys-score-num { font-size: 2.2rem; }
    .ys-match-card { padding: 8px 10px; }
    .ys-card-name  { font-size: .78rem; }
    .ys-section    { padding: 14px; }
    .ys-match-content { padding: 0 10px 32px; }
    .ys-header-teams { gap: 8px; }
}
