/**
 * Path: assets/css/templates/match/partials/header-box.css
 * Scoreboard Header Styling for NPL Sports Pro.
 * REDESIGNED: Exact replica of the custom high-contrast rounded-pill layout.
 * FIXED: Features fluid, rubber-like scaling using safe clamp() constraints.
 * FIXED: Added explicit flex-direction controls to prevent vertical pill stacking.
 * FIXED: 100% sanitized with zero Cricket (nplsc_ / NPLSC_) dependencies.
 * 
 * @package NPLSportsPro
 */

/* ==========================================================================
   PURE FLUID LOGO SIZING (Rule 9)
   Scales smoothly from 48px on tiny mobiles up to 160px on desktop
   ========================================================================== */
body .nplsp-match-engine-layout .engine-logo-col img,
body .nplsp-match-engine-layout div.nplsp-matches-list a.nplsp-match-card-link div.nplsp-match-card-item div.nplsp-match-teams-row div.team div.nplsp-logo-inner img,
body .nplsp-match-engine-layout img,
body .nplsp-match-engine-layout .team img,
body .nplsp-match-engine-layout .nplsp-logo-inner img {
    width: clamp(48px, 12vw, 160px) !important; /* Continuous elastic width */
    height: auto !important;
    max-width: clamp(48px, 12vw, 160px) !important;
    min-width: 48px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Constrain the container of the logo dynamically */
body .nplsp-match-engine-layout .nplsp-logo-inner {
    width: clamp(48px, 12vw, 160px) !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    overflow: hidden !important;
}

/* --- THE ENGINE CONTAINER --- */

body .nplsp-match-engine-layout {
    position: relative !important;
    width: 100% !important;
    min-height: clamp(250px, 35vw, 400px) !important; /* Elastic container height */
    background-size: cover !important;
    background-position: center !important;
    border-radius: 20px !important;
    overflow: hidden !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: 'Arial', sans-serif !important;
    padding: clamp(15px, 3vw, 35px) clamp(10px, 2vw, 25px) !important;
    box-sizing: border-box !important;
}

body .nplsp-match-engine-layout .engine-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.45) !important;
    z-index: 1 !important;
}

body .nplsp-match-engine-layout .engine-content {
    position: relative !important;
    z-index: 2 !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: clamp(12px, 3.5vw, 30px) !important; /* Unified vertical spacing */
}

/* ==========================================
   ROW 1: LOGOS & META ROW (FLUID SCALING)
   ========================================== */
body .nplsp-match-engine-layout .engine-top-row-flex {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    margin-bottom: clamp(10px, 3vw, 20px) !important;
    padding: 0 clamp(5px, 2vw, 15px) !important;
    box-sizing: border-box !important;
}

body .nplsp-match-engine-layout .engine-logo-col {
    flex: 0 0 25% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
}

body .nplsp-match-engine-layout .engine-meta-center {
    flex: 1 !important;
    text-align: center !important;
}

/* League Title Override (Forces clean white) */
body .nplsp-match-engine-layout .engine-meta-stack .meta-league,
body .nplsp-match-engine-layout .engine-meta-center .meta-league {
    font-size: clamp(9px, 2vw, 18px) !important;
    font-weight: 500 !important;
    margin: 0 !important;
    text-transform: uppercase !important;
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6) !important;
    line-height: 1.0 !important;
    display: block !important;
}

/* Round Subtitle Override (Forces clean white) */
body .nplsp-match-engine-layout .engine-meta-stack .meta-round,
body .nplsp-match-engine-layout .engine-meta-center .meta-round {
    font-size: clamp(9px, 2vw, 18px) !important;
    font-weight: 500 !important;
    margin: 5px 0 !important;
    color: #ffffff !important;
    text-transform: uppercase !important;
    line-height: 1.2 !important;
    display: block !important;
}

/* Elastic Date & Time */
body .nplsp-match-engine-layout .engine-meta-center .engine-date-time,
body .nplsp-match-engine-layout .engine-meta-stack .engine-date-time {
    font-size: clamp(9px, 2vw, 18px) !important;
    font-weight: 500 !important;
    margin: 5px 0 !important;
    color: #ffffff !important;
    text-transform: uppercase !important;
    line-height: 1.2 !important;
    display: block !important;
}

/* Elastic Stadium/Venue Override */
body .nplsp-match-engine-layout .engine-meta-center .meta-venue,
body .nplsp-match-engine-layout .engine-meta-stack .meta-venue {
    font-size: clamp(9px, 2vw, 18px) !important;
    font-weight: 500 !important;
    margin: 5px 0 !important;
    color: #ffffff !important;
    text-transform: uppercase !important;
    line-height: 1.2 !important;
    display: block !important;
}

/* Elastic Season Badge */
body .nplsp-match-engine-layout .engine-meta-center .engine-season-text,
body .nplsp-match-engine-layout .engine-meta-stack .engine-season-text {
    font-size: clamp(9px, 2vw, 15px) !important;
    color: #cccccc !important;
    margin-bottom: 5px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
}

/* ==========================================
   ROW 2: STATUS ROW
   ========================================== */
body .nplsp-match-engine-layout .engine-status-row {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    margin-bottom: clamp(10px, 3vw, 20px) !important;
}

body .nplsp-match-engine-layout .engine-status-row .engine-status-pill {
    background: rgba(255,255,255,0.2) !important;
    padding: clamp(2px, 0.8vw, 5px) clamp(6px, 2vw, 15px) !important;
    font-size: clamp(8px, 2vw, 14px) !important;
    border-radius: 5px !important;
    display: inline-block !important;
}

body .nplsp-match-engine-layout .engine-status-row .engine-status-pill.live-pill {
    background: #ff0000 !important;
    color: #fff !important;
    animation: blink 1s infinite !important;
}

/* ==========================================
   ROW 3: NAMES & SCORES (ELASTIC CLAMP INTEGRATION)
   ========================================== */
body .nplsp-match-engine-layout .engine-action-pills-row {
    display: flex !important;
    flex-direction: row !important; /* FIXED: Strictly forces horizontal alignment on all devices */
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    gap: clamp(5px, 2vw, 15px) !important;
}

/* Elastic Team Names */
body .nplsp-match-engine-layout .engine-score-row .engine-team-name {
    flex: 0 0 33% !important;
    font-size: clamp(11px, 2.5vw, 16px) !important;
    text-transform: uppercase !important;
    font-weight: 800 !important;
    word-wrap: break-word !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    color: #ffffff !important;
}

body .nplsp-match-engine-layout .engine-score-row .engine-team-name.left-align {
    text-align: right !important;
    padding-right: clamp(4px, 1.5vw, 20px) !important;
}

body .nplsp-match-engine-layout .engine-score-row .engine-team-name.right-align {
    text-align: left !important;
    padding-left: clamp(4px, 1.5vw, 20px) !important;
}

/* Central Score Pill Container */
body .nplsp-match-engine-layout .engine-action-pills-row .engine-score-pill-container {
    flex: 0 0 24% !important;
    display: flex !important;
    flex-direction: column !important; /* Stacks Score Pill and Penalties vertically */
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
}

/* Rounded Blue Central Score Pill Container */
body .nplsp-match-engine-layout .engine-action-pills-row .engine-score-pill-container .engine-score-pill {
    width: 100% !important;
    background-color: #0010a0 !important; /* Unified Blue */
    color: #ffffff !important;
    border-radius: 50px !important;
    padding: clamp(6px, 1.5vw, 15px) clamp(8px, 2vw, 20px) !important;
    font-size: clamp(11px, 2.5vw, 28px) !important;
    font-weight: 800 !important;
    text-align: center !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
    white-space: nowrap !important;
}

/* Elastic Penalty Shootout Text styling */
body .nplsp-match-engine-layout .engine-action-pills-row .engine-score-pill-container .engine-penalty-score {
    font-size: clamp(8px, 1.8vw, 14px) !important;
    font-weight: 800 !important;
    color: #ffc107 !important; /* Premium Gold/Yellow for visibility */
    text-transform: uppercase !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6) !important;
    display: block !important;
    line-height: 1 !important;
}

/* Beautiful Rounded Blue Team Name Pill Container */
body .nplsp-match-engine-layout .engine-action-pills-row .engine-team-pill {
    flex: 0 0 36% !important;
    background-color: #0010a0 !important; /* Unified Blue */
    color: #ffffff !important;
    border-radius: 50px !important;
    padding: clamp(6px, 1.5vw, 15px) clamp(10px, 2.5vw, 25px) !important;
    font-size: clamp(10px, 2.2vw, 24px) !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    text-align: center !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
    white-space: nowrap !important;
}

/* ==========================================
   ROW 4: FOOTER COUNTDOWN BAR
   ========================================== */
body .nplsp-match-engine-layout .engine-footer-pill-row {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
}

/* FIXED: Changed to inline-flex with auto-width to prevent horizontal text squishing */
body .nplsp-match-engine-layout .engine-footer-pill-row .engine-status-footer-pill {
    width: auto !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    background-color: #0010a0 !important; /* Unified Blue */
    color: #ffffff !important;
    border-radius: 50px !important;
    padding: clamp(8px, 1.2vw, 15px) clamp(30px, 5vw, 80px) !important;
    font-size: clamp(12px, 2vw, 24px) !important;
    font-weight: 800 !important;
    text-align: center !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
    text-transform: uppercase !important;
    line-height: 1.2 !important;
    margin: 0 auto !important;
    max-width: 90% !important;
    white-space: nowrap !important;
}

/* Timer constraints inside the Blue Pill */
body .nplsp-match-engine-layout .engine-footer-pill-row .engine-timer-box-inline {
    color: #ffffff !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 5px !important;
}

body .nplsp-match-engine-layout .engine-footer-pill-row .engine-timer-box-inline .t-val {
    color: #ffffff !important;
    font-size: clamp(11px, 2.5vw, 26px) !important;
    font-weight: 900 !important;
}

body .nplsp-match-engine-layout .engine-footer-pill-row .engine-timer-box-inline .t-lbl {
    color: #cccccc !important;
    font-size: clamp(8px, 1.8vw, 15px) !important;
    margin-left: 2px !important;
    margin-right: clamp(2px, 1vw, 8px) !important;
}

@keyframes blink {
    50% { opacity: 0.5; }
}