/* ================================================================
 * LS Match Details – External Stylesheet
 * โหลดผ่าน get_style_depends() → wp_register_style()
 * ค่าที่ปรับได้จาก Elementor จะ override ผ่าน CSS variables
 * ================================================================ */

/* ── CSS Variables (defaults) ─────────────────────────────────── */
.ls-details-wrapper {
    --ls-fade-duration : 0.3s;
    --ls-bar-speed     : 1s;
    --ls-stripe-color  : rgba(0,0,0,0.06);
}

/* ── Wrapper ─────────────────────────────────────────────────── */
.ls-details-wrapper {
    font-family : var(--ls-font-family, 'Inter', sans-serif);
    overflow    : hidden;
    background-color : #111111;
    color            : #eeeeee;
    border-radius    : 12px;
}

/* ── Header ──────────────────────────────────────────────────── */
.ls-main-header {
    border-bottom : 1px solid #222;
    padding       : 30px 15px;
}

.ls-score-flex {
    display         : flex;
    align-items     : center;
    justify-content : space-around;
    max-width       : 600px;
    margin          : 0 auto;
}

.ls-team-box {
    flex        : 1;
    text-align  : center;
}

.ls-team-box .ls-team-logo {
    width      : 55px;
    height     : 55px;
    object-fit : contain;
}

.ls-team-name {
    margin-top  : 10px;
    font-weight : 700;
}

.ls-score-box  { flex: 1; text-align: center; }

.ls-score-num {
    font-size      : 38px;
    font-weight    : 800;
    letter-spacing : -1px;
}

.ls-match-status {
    font-weight      : bold;
    font-size        : 12px;
    color            : #ff4d4d;
    background-color : #222;
    padding          : 2px 10px;
    border-radius    : 10px;
    margin-top       : 5px;
    display          : inline-block;
}

.ls-league-name {
    font-size  : 11px;
    color      : #666666;
    margin-top : 4px;
}

/* ── Tabs Navigation ─────────────────────────────────────────── */
.ls-tabs-nav {
    display          : flex;
    border-bottom    : 1px solid #222;
    background-color : #1a1a1a;
}

.ls-tab-btn {
    flex           : 1;
    background     : none;
    border         : none;
    color          : #777777;
    padding        : 15px 5px;
    cursor         : pointer;
    font-weight    : 600;
    font-size      : 13px;
    border-bottom  : 2px solid transparent;
    transition     : color 0.3s, border-bottom-color 0.3s;
    position       : relative;
}

.ls-tab-btn.active {
    color              : #ff6b00;
    border-bottom-color: #ff6b00;
}

/* ── Content Body ────────────────────────────────────────────── */
.ls-content-body { padding: 20px; }

/* ── Tab Fade Animation ──────────────────────────────────────── */
@keyframes lsFadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ls-tab-content        { display: none; }
.ls-tab-content.active {
    display   : block;
    animation : lsFadeIn var(--ls-fade-duration) ease-in-out;
}

/* ── Statistics ──────────────────────────────────────────────── */
.ls-stat-row { margin-bottom: 20px; }

.ls-stat-info {
    display         : flex;
    justify-content : space-between;
    font-size       : 13px;
    margin-bottom   : 8px;
    font-weight     : 500;
}

.ls-stat-title {
    text-transform : uppercase;
    color          : #888888;
}

.ls-stat-bar-bg {
    height        : 6px;
    border-radius : 10px;
    overflow      : hidden;
    display       : flex;
    background-color : #222222;
}

.ls-stat-bar-fill {
    height           : 100%;
    background-color : #ff6b00;
    transition       : width var(--ls-bar-speed) cubic-bezier(0.17,0.67,0.83,0.67);
}

/* ── Timeline (Events) ───────────────────────────────────────── */
.ls-timeline-container {
    position   : relative;
    max-width  : 500px;
    margin     : 0 auto;
    padding    : 10px 0;
}

.ls-timeline-line {
    position         : absolute;
    left             : 50%;
    top              : 0;
    bottom           : 0;
    width            : 1px;
    transform        : translateX(-50%);
    background-color : #333333;
}

.ls-timeline-item {
    display      : flex;
    align-items  : flex-start;
    margin-bottom: 20px;
    position     : relative;
}

.ls-event-time {
    font-size   : 10px;
    color       : #ffffff;
    text-align  : center;
    margin-bottom: 4px;
    font-weight : bold;
    white-space : nowrap;
}

.ls-timeline-icon {
    margin   : 0 15px;
    z-index  : 2;
    position : relative;
    width    : 22px;
    height   : 22px;
}

.ls-timeline-icon img {
    width   : 100%;
    height  : 100%;
    display : block;
    margin  : 0 auto;
}

.ls-player-name    { font-weight: 600; font-size: 14px; color: #ffffff; }
.ls-player-subtext { font-size: 11px; margin-top: 2px; color: #888888; }

.ls-sub-in  { font-weight: bold; color: #22C55E; }
.ls-sub-out { font-weight: bold; color: #EF4444; }
.ls-own-goal { color: #EF4444; }
.ls-penalty  { color: #f90; }

.ls-home-side { flex: 1; text-align: right; padding-right: 8px; }
.ls-away-side { flex: 1; text-align: left;  padding-left:  8px; }

/* ── Pitch ───────────────────────────────────────────────────── */
/*
 * background-color  → Elementor control: pitch_bg_color
 * background-image  → stripe pattern (ใช้ CSS var จาก pitch_stripe_color)
 * ทั้งสองแยกชั้นกัน ไม่ override กัน
 */
.ls-pitch-container {
    position         : relative;
    width            : 100%;
    height           : 360px;
    border-radius    : 8px;
    margin-bottom    : 20px;
    overflow         : hidden;
    background-color : #2d8a4e;
    background-image : repeating-linear-gradient(
        90deg,
        var(--ls-stripe-color) 0px,
        var(--ls-stripe-color) 35px,
        transparent 35px,
        transparent 70px
    );
}

/* เส้นกลางสนาม – background-color controlled by Elementor */
.ls-pitch-pattern {
    position         : absolute;
    left             : 50%;
    top              : 0;
    bottom           : 0;
    width            : 2px;
    transform        : translateX(-50%);
    background-color : rgba(255,255,255,0.2);
    pointer-events   : none;
}

/* วงกลมกลางสนาม – border-color controlled by Elementor */
.ls-pitch-circle {
    position      : absolute;
    left          : 50%;
    top           : 50%;
    transform     : translate(-50%, -50%);
    width         : 100px;
    height        : 100px;
    border-radius : 50%;
    border        : 2px solid rgba(255,255,255,0.2);
    pointer-events: none;
}

/* ── Player Marker (Pitch) ───────────────────────────────────── */
.ls-player-marker {
    position      : relative;
    display       : inline-block;
    width         : 34px;
    height        : 34px;
    border-radius : 50%;
    overflow      : hidden;
    border-width  : 2px;
    border-style  : solid;
}

/*
 * border-color → Elementor controls: home/away_marker_border_color
 * box-shadow   → Elementor controls: home/away_marker_shadow_color  ← เพิ่มใหม่
 */
.ls-home-marker {
    border-color : #28a745;
    box-shadow   : 0 0 6px var(--ls-home-shadow, rgba(40,167,69,0.55));
}
.ls-away-marker {
    border-color : #dc3545;
    box-shadow   : 0 0 6px var(--ls-away-shadow, rgba(220,53,69,0.55));
}

.ls-shirt-number {
    position        : absolute;
    bottom          : -2px;
    right           : -4px;
    font-size       : 8px;
    font-weight     : bold;
    background-color: #000000;
    color           : #ffffff;
    border-radius   : 50%;
    line-height     : 1;
    display         : flex;
    align-items     : center;
    justify-content : center;
    width           : 14px;
    height          : 14px;
}

.ls-player-name-pitch {
    font-size     : 9px;
    color         : #ffffff;
    margin-top    : 3px;
    white-space   : nowrap;
    overflow      : hidden;
    text-overflow : ellipsis;
    max-width     : 44px;
    text-shadow   : 0 1px 3px rgba(0,0,0,0.9);
    font-weight   : 600;
}

/* ── Lineups List ────────────────────────────────────────────── */
.ls-lineups-container {
    display : flex;
    gap     : 15px;
}

.ls-lineup-box {
    flex             : 1;
    padding          : 15px;
    border-radius    : 8px;
    background-color : #181818;
}

.ls-lineup-header {
    font-weight    : 800;
    margin-bottom  : 12px;
    padding-bottom : 10px;
    /* border-bottom → Elementor control: lineup_header_border_color ← เพิ่มใหม่ */
    border-bottom  : 1px solid var(--ls-lineup-header-border, #2a2a2a);
}

.ls-team-header {
    display         : flex;
    align-items     : center;
    justify-content : space-between;
}

.ls-team-info {
    display     : flex;
    align-items : center;
    gap         : 8px;
}

.ls-team-logo-small {
    width      : 24px;
    height     : 24px;
    object-fit : contain;
}

.ls-active-formation {
    font-size : 12px;
    color     : #ff6b00;
}

/* ── Substitutes ─────────────────────────────────────────────── */
.ls-subs-title {
    font-size      : 10px;
    text-transform : uppercase;
    color          : #888888;
    margin         : 12px 0 6px;
    padding-top    : 10px;
}

/* แถวสำรอง: เลข | รูป | ชื่อ | ตำแหน่ง — อยู่แถวเดียวกัน */
.ls-substitute-item {
    display        : flex;
    flex-direction : row;
    align-items    : center;
    gap            : 6px;
    margin-bottom  : 8px;
}

.ls-player-info {
    display        : flex;
    flex-direction : row;
    align-items    : center;
    gap            : 6px;
    flex           : 1;
    min-width      : 0;
}

.ls-player-number {
    font-size   : 11px;
    font-weight : bold;
    color       : #888888;
    min-width   : 20px;
    flex-shrink : 0;
    text-align  : right;
}

.ls-player-photo-list {
    border-radius : 50%;
    object-fit    : cover;
    width         : 24px;
    height        : 24px;
    flex-shrink   : 0;
}

.ls-lineup-player-name {
    font-size     : 12px;
    white-space   : nowrap;
    overflow      : hidden;
    text-overflow : ellipsis;
}

/* position badge ── Elementor control: player_position_color ← เพิ่มใหม่ */
.ls-player-position {
    font-size   : 10px;
    flex-shrink : 0;
    min-width   : 14px;
    text-align  : right;
    color       : #888888;
}

/* ── Coach ───────────────────────────────────────────────────── */
.ls-coach {
    margin-top   : 12px;
    padding-top  : 10px;
    /* border-top-color → Elementor control: coach_border_color ← เพิ่มใหม่ */
    border-top   : 1px solid var(--ls-coach-border, #333333);
    font-size    : 11px;
}

.ls-coach-icon { margin-right: 4px; color: #666666; }
.ls-coach-name { color: #666666; }

/* ── Form ────────────────────────────────────────────────────── */
.ls-form-container { display: flex; gap: 4px; }

.ls-form-dot {
    width           : 22px;
    height          : 22px;
    border-radius   : 4px;
    display         : flex;
    align-items     : center;
    justify-content : center;
    font-size       : 10px;
    font-weight     : bold;
    color           : #ffffff;
}

.ls-form-w { background-color: #28a745; }
.ls-form-d { background-color: #6c757d; }
.ls-form-l { background-color: #dc3545; }

/* ── H2H ─────────────────────────────────────────────────────── */
.ls-h2h-team      { width: 100%; display: flex; }
.ls-h2h-team-item { width: 50%; text-align: center; }
.last5            { display: flex; }
.form-5-last      { width: 50%; text-align: center; }
.last-5-detail    { justify-content: center; }

/* ── Error / No Data ─────────────────────────────────────────── */
.ls-error-message {
    text-align    : center;
    padding       : 40px;
    color         : #ff0000;
    background    : #111;
    border-radius : 12px;
}

.ls-no-data {
    text-align    : center;
    padding       : 40px;
    color         : #888888;
    background    : #111;
    border-radius : 12px;
    border        : 1px solid #222;
}