/* ============================================================================
   Putrakop Liga — Match Detail CSS (Awam)
   Tema: Premium Sports Dashboard | Navy Blue #06265C + Gold #FFD700
   Font: Inter | Icons: Font Awesome 6
   Mobile-first responsive
   ============================================================================ */

/* ----------------------------------------------------------------------------
   1. MATCH DETAIL HEADER — page header with back button
   ---------------------------------------------------------------------------- */
.match-detail-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.match-detail-back {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-white);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.match-detail-back:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    transform: translateX(-3px);
}

.match-detail-back i {
    font-size: 13px;
    transition: var(--transition);
}

.match-detail-title {
    font-size: clamp(20px, 4vw, 28px);
    font-weight: 800;
    color: var(--primary);
    line-height: 1.25;
}

.match-detail-title i {
    color: var(--accent);
    margin-right: 8px;
    font-size: 0.85em;
}

.match-detail-subtitle {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

/* ----------------------------------------------------------------------------
   2. MATCH SCORE CARD — large score display container
   ---------------------------------------------------------------------------- */
.match-score-card {
    position: relative;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, var(--primary-dark) 100%);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    margin-bottom: 24px;
    text-align: center;
}

/* Decorative glow circles */
.match-score-card::before,
.match-score-card::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.match-score-card::before {
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.05);
    top: -150px;
    right: -80px;
}

.match-score-card::after {
    width: 200px;
    height: 200px;
    background: rgba(255, 215, 0, 0.06);
    bottom: -100px;
    left: -60px;
}

/* Center divider stripe */
.match-score-divider {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1px;
    height: 70px;
    background: rgba(255, 255, 255, 0.15);
    z-index: 0;
}

/* ----------------------------------------------------------------------------
   3. TEAM SIDE — flexbox layout for home / away sides
   ---------------------------------------------------------------------------- */
.match-score-main {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.team-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.team-side.home { text-align: center; }
.team-side.away { text-align: center; }

.team-logo {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fff;
    object-fit: contain;
    padding: 4px;
    box-shadow: 0 0 0 3px var(--team-color, var(--accent)), var(--shadow-md);
    transition: var(--transition);
}

.team-logo-fallback {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: 0 0 0 3px var(--team-color, var(--accent));
}

.team-name {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    max-width: 110px;
    overflow-wrap: break-word;
}

.team-side .team-tag {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

/* Winner highlight */
.team-side.winner .team-name::after {
    content: '\f091'; /* fa-trophy */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--accent);
    margin-left: 6px;
    font-size: 11px;
}

/* ----------------------------------------------------------------------------
   4. SCORE DISPLAY — large score numbers
   ---------------------------------------------------------------------------- */
.score-display {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 8px;
}

.score-number {
    font-size: clamp(36px, 9vw, 56px);
    font-weight: 900;
    color: #fff;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    min-width: 1.2em;
}

.score-separator {
    font-size: clamp(20px, 5vw, 30px);
    font-weight: 800;
    color: var(--accent);
    opacity: 0.85;
}

/* ----------------------------------------------------------------------------
   5. MATCH META — date, time, venue, group info
   ---------------------------------------------------------------------------- */
.match-meta {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 18px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.match-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
}

.match-meta-item i {
    color: var(--accent);
    font-size: 11px;
}

/* ----------------------------------------------------------------------------
   6. MATCH STATUS BADGE — status pill
   ---------------------------------------------------------------------------- */
.match-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
    margin-bottom: 16px;
}

.match-status-scheduled {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.match-status-completed {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.match-status-postponed {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.match-status-cancelled {
    background: rgba(156, 163, 175, 0.15);
    color: #d1d5db;
    border: 1px solid rgba(156, 163, 175, 0.4);
}

.match-status-live {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.5);
}

/* ----------------------------------------------------------------------------
   7. MATCH STATUS LIVE — pulsing red dot animation
   ---------------------------------------------------------------------------- */
.match-status-live .live-pulse-dot {
    position: relative;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    display: inline-block;
}

.match-status-live .live-pulse-dot::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #ef4444;
    animation: livePulseRing 1.5s ease-out infinite;
}

@keyframes livePulseRing {
    0%   { transform: scale(1);   opacity: 0.8; }
    100% { transform: scale(2.8); opacity: 0; }
}

@keyframes liveDotBlink {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}

.match-status-live .live-pulse-dot {
    animation: liveDotBlink 1.5s ease-in-out infinite;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    .match-status-live .live-pulse-dot,
    .match-status-live .live-pulse-dot::before {
        animation: none;
    }
}

/* ----------------------------------------------------------------------------
   SECTION WRAPPERS (shared card look)
   ---------------------------------------------------------------------------- */
.events-section,
.stats-section {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--bg);
}

.section-heading i {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: var(--accent);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.section-count {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    background: var(--bg);
    padding: 4px 12px;
    border-radius: 50px;
}

/* ----------------------------------------------------------------------------
   8-9. EVENTS TIMELINE — vertical timeline layout
   ---------------------------------------------------------------------------- */
.events-timeline {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Vertical guide line through the icon column */
.events-timeline::before {
    content: '';
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 51px;
    width: 2px;
    background: linear-gradient(to bottom, var(--border), var(--primary) 20%, var(--primary) 80%, var(--border));
    opacity: 0.25;
    border-radius: 2px;
}

/* ----------------------------------------------------------------------------
   10. EVENT ITEM — single event row (minute | icon | details)
   ---------------------------------------------------------------------------- */
.event-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    z-index: 1;
}

.event-item .event-minute {
    order: 1;
    flex-shrink: 0;
}

.event-icon {
    order: 2;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: var(--bg);
    color: var(--text-light);
    border: 2px solid var(--border);
    box-shadow: 0 0 0 4px var(--bg-white); /* masks timeline behind icon */
    transition: var(--transition);
}

.event-details {
    order: 3;
    flex: 1;
    min-width: 0;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    transition: var(--transition);
}

.event-player {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
}

.event-type-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Away-team events mirrored to the right side */
.event-item.away .event-minute { order: 3; margin-left: auto; }
.event-item.away .event-icon   { order: 2; }
.event-item.away .event-details {
    order: 1;
    text-align: left;
    margin-right: auto;
}

/* Hover feedback */
.event-item:hover .event-details {
    background: #eef2f7;
    transform: translateX(2px);
}

.event-item.away:hover .event-details {
    transform: translateX(-2px);
}

/* ----------------------------------------------------------------------------
   11. EVENT ITEM GOAL — green accent
   ---------------------------------------------------------------------------- */
.event-item.goal .event-icon {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
    box-shadow: 0 0 0 4px var(--bg-white), 0 0 12px rgba(34, 197, 94, 0.45);
}

.event-item.goal .event-type-label { color: var(--success); }

.event-item.goal .event-minute {
    background: rgba(34, 197, 94, 0.12);
    border-color: var(--success);
    color: #15803d;
}

/* Own goal variant (if used) */
.event-item.own-goal .event-type-label { color: var(--warning); }

/* ----------------------------------------------------------------------------
   12. EVENT ITEM YELLOW CARD — yellow accent
   ---------------------------------------------------------------------------- */
.event-item.yellow-card .event-icon {
    background: var(--warning);
    border-color: var(--warning);
    color: #fff;
    box-shadow: 0 0 0 4px var(--bg-white), 0 0 10px rgba(245, 158, 11, 0.4);
}

.event-item.yellow-card .event-type-label { color: #b45309; }

.event-item.yellow-card .event-minute {
    background: rgba(245, 158, 11, 0.12);
    border-color: var(--warning);
    color: #b45309;
}

/* ----------------------------------------------------------------------------
   13. EVENT ITEM RED CARD — red accent
   ---------------------------------------------------------------------------- */
.event-item.red-card .event-icon {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
    box-shadow: 0 0 0 4px var(--bg-white), 0 0 10px rgba(239, 68, 68, 0.4);
}

.event-item.red-card .event-type-label { color: var(--danger); }

.event-item.red-card .event-minute {
    background: rgba(239, 68, 68, 0.12);
    border-color: var(--danger);
    color: #b91c1c;
}

/* Substitution variant (neutral/info accent) */
.event-item.substitution .event-icon {
    background: var(--info);
    border-color: var(--info);
    color: #fff;
    box-shadow: 0 0 0 4px var(--bg-white);
}

.event-item.substitution .event-type-label { color: var(--info); }

/* ----------------------------------------------------------------------------
   14. EVENT MINUTE — minute number circle badge
   ---------------------------------------------------------------------------- */
.event-minute {
    width: 44px;
    height: 30px;
    border-radius: 50px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    color: var(--text-light);
    font-size: 12px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 4px var(--bg-white);
}

/* ----------------------------------------------------------------------------
   15-16. STATS SECTION — stat comparison rows (home | label | away)
   ---------------------------------------------------------------------------- */
.stats-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.stat-row {
    display: grid;
    grid-template-columns: 48px 1fr 48px;
    align-items: center;
    gap: 10px;
}

.stat-value-home,
.stat-value-away {
    font-size: 15px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-align: center;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
}

.stat-value-home { color: var(--primary); background: rgba(6, 38, 92, 0.07); }
.stat-value-away { color: var(--text); background: var(--bg); }

.stat-value-home.leading { background: var(--primary); color: #fff; }
.stat-value-away.leading { background: var(--text); color: #fff; }

.stat-label {
    grid-column: 1 / -1;
    order: 4;
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-top: -4px;
}

/* ----------------------------------------------------------------------------
   17-18. STAT BAR — visual comparison bar (possession etc.)
   ---------------------------------------------------------------------------- */
.stat-bar-container {
    grid-column: 1 / -1;
    order: 5;
    display: flex;
    height: 10px;
    border-radius: 50px;
    overflow: hidden;
    background: var(--bg);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.stat-bar-home,
.stat-bar-away {
    height: 100%;
    min-width: 6px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.stat-bar-home {
    background: linear-gradient(90deg, var(--primary-dark), var(--primary-light));
    border-radius: 50px 0 0 50px;
}

.stat-bar-away {
    background: linear-gradient(90deg, #cbd5e1, #94a3b8);
    border-radius: 0 50px 50px 0;
    margin-left: auto;
}

/* Gold accent option when team colors are injected via --team-color */
.stat-row.has-team-colors .stat-bar-home { background: var(--home-color, var(--primary)); }
.stat-row.has-team-colors .stat-bar-away { background: var(--away-color, #94a3b8); }

/* ----------------------------------------------------------------------------
   19. EMPTY STATES — empty events / empty stats
   ---------------------------------------------------------------------------- */
.empty-events,
.empty-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-events i,
.empty-stats i {
    font-size: 36px;
    color: var(--border);
    background: var(--bg);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-events p,
.empty-stats p {
    font-size: 14px;
    font-weight: 500;
    max-width: 280px;
    line-height: 1.5;
}

/* ============================================================================
   RESPONSIVE — tablet & up (mobile-first enhancements)
   ============================================================================ */
@media (min-width: 640px) {

    /* Header row: back button beside title block */
    .match-detail-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 12px;
    }

    /* Score card breathing room */
    .match-score-card {
        padding: 36px 40px 28px;
    }

    .team-logo,
    .team-logo-fallback {
        width: 72px;
        height: 72px;
    }

    .team-logo-fallback { font-size: 28px; }

    .team-name {
        font-size: 15px;
        max-width: 160px;
    }

    .score-number {
        font-size: 64px;
    }

    .match-meta-item {
        font-size: 13px;
    }

    /* Section cards get more padding */
    .events-section,
    .stats-section {
        padding: 28px 32px;
    }

    /* Timeline: roomier rows */
    .events-timeline::before {
        left: 63px;
    }

    .event-item {
        gap: 16px;
        padding: 12px 0;
    }

    .event-icon {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }

    .event-minute {
        width: 52px;
        height: 32px;
        font-size: 13px;
    }

    .event-details {
        padding: 12px 18px;
    }

    .event-player { font-size: 15px; }

    /* Stats: label sits between values again on wide screens */
    .stat-row {
        grid-template-columns: 64px 1fr 64px;
        grid-template-areas:
            "home label away"
            "bar  bar  bar";
        gap: 8px 14px;
    }

    .stat-value-home { grid-area: home; }
    .stat-value-away { grid-area: away; }
    .stat-label      { grid-area: label; order: 0; margin-top: 0; }
    .stat-bar-container { grid-area: bar; height: 12px; }
}

@media (min-width: 992px) {

    .match-score-card {
        padding: 44px 60px 32px;
    }

    .team-logo,
    .team-logo-fallback {
        width: 84px;
        height: 84px;
    }

    .team-logo-fallback { font-size: 32px; }

    .team-name { font-size: 17px; }

    .score-number { font-size: 76px; }

    .match-status-badge {
        font-size: 13px;
        padding: 7px 20px;
    }

    .section-heading { font-size: 19px; }
}
