/* ================= YallaMatch UI Polish - Clean Safe Version ================= */

/* لا نغير ألوان أزرار البطولات المهمة */
html body a.ym-hot-link {
    font-weight: inherit;
}

/* Hide old duplicated YouTube watch button if it exists */
html body .ym-primary-btn[href*="youtube.com/watch"],
html body .ym-primary-btn[href*="youtu.be/"] {
    display: none !important;
}

/* تحسين شكل السكورل الأفقي في الجوال */
@media (max-width: 768px) {
    .ym-scrollable-hint {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        scrollbar-width: thin;
        box-shadow:
            inset 18px 0 18px -22px rgba(0,0,0,.55),
            inset -18px 0 18px -22px rgba(0,0,0,.55);
        position: relative;
    }

    .ym-scrollable-hint::after {
        content: "↔ اسحب";
        position: sticky;
        right: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 4px 9px;
        margin-inline-start: 8px;
        border-radius: 999px;
        background: rgba(0,0,0,.50);
        color: #fff;
        font-size: 11px;
        font-weight: 900;
        z-index: 5;
        pointer-events: none;
    }

    .ym-scrollable-hint.ym-scrolled::after {
        opacity: .35;
    }
}

/*
|--------------------------------------------------------------------------
| Match detail safe mobile cleanup
| لا نجبر الكرت على grid أو flex حتى لا يتلخبط.
| فقط نمنع التضخم والتداخل.
|--------------------------------------------------------------------------
*/
@media (max-width: 768px) {
    html body .ym-score-card {
        max-width: 210px !important;
        width: auto !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding: 14px 10px !important;
        border-radius: 20px !important;
    }

    html body .ym-score {
        font-size: 30px !important;
        line-height: 1.1 !important;
        white-space: nowrap !important;
    }

    html body .ym-team-logo {
        max-width: 72px !important;
        max-height: 72px !important;
        object-fit: contain !important;
    }

    html body .ym-score-card .status,
    html body .ym-score-card span.status {
        font-size: 12px !important;
        padding: 6px 12px !important;
    }
}

/* Match detail board mobile: team | score | team */
@media (max-width: 768px) {
    html body .ym-match-board {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 92px minmax(0, 1fr) !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 12px 8px !important;
    }

    html body .ym-match-board .ym-team-card {
        min-width: 0 !important;
        width: auto !important;
        padding: 8px 4px !important;
        text-align: center !important;
    }

    html body .ym-match-board .ym-team-logo-wrap {
        width: 58px !important;
        height: 58px !important;
        margin: 0 auto 6px !important;
        border-radius: 16px !important;
    }

    html body .ym-match-board .ym-team-logo {
        width: 52px !important;
        height: 52px !important;
        object-fit: contain !important;
    }

    html body .ym-match-board .ym-team-card strong {
        display: block !important;
        font-size: 13px !important;
        line-height: 1.35 !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }

    html body .ym-match-board .ym-score-card {
        width: 92px !important;
        min-width: 92px !important;
        max-width: 92px !important;
        padding: 10px 5px !important;
        margin: 0 auto !important;
        border-radius: 18px !important;
    }

    html body .ym-match-board .ym-score-card .status {
        font-size: 10px !important;
        padding: 5px 7px !important;
        margin-bottom: 6px !important;
    }

    html body .ym-match-board .ym-score {
        font-size: 25px !important;
        line-height: 1.05 !important;
        white-space: nowrap !important;
    }

    html body .ym-match-board .ym-vs {
        font-size: 11px !important;
        margin: 4px 0 !important;
    }

    html body .ym-match-board .ym-match-date {
        font-size: 10px !important;
        line-height: 1.35 !important;
    }
}

@media (max-width: 380px) {
    html body .ym-match-board {
        grid-template-columns: minmax(0, 1fr) 82px minmax(0, 1fr) !important;
        gap: 6px !important;
    }

    html body .ym-match-board .ym-score-card {
        width: 82px !important;
        min-width: 82px !important;
        max-width: 82px !important;
    }

    html body .ym-match-board .ym-score {
        font-size: 22px !important;
    }

    html body .ym-match-board .ym-team-logo-wrap {
        width: 50px !important;
        height: 50px !important;
    }

    html body .ym-match-board .ym-team-logo {
        width: 46px !important;
        height: 46px !important;
    }

    html body .ym-match-board .ym-team-card strong {
        font-size: 12px !important;
    }
}

/* Stable mobile match detail hero */
@media (max-width: 768px) {
    body {
        overflow-x: hidden !important;
    }

    .ym-match-hero,
    .ym-detail-hero,
    .match-hero,
    .match-box {
        padding-top: 32px !important;
        margin-top: 0 !important;
        overflow: hidden !important;
    }

    .ym-match-hero h1,
    .ym-detail-hero h1,
    .match-hero h1,
    .match-box h1 {
        display: block !important;
        margin-top: 0 !important;
        padding-top: 8px !important;
        font-size: 26px !important;
        line-height: 1.45 !important;
        white-space: normal !important;
        word-break: normal !important;
    }

    .ym-score-card {
        max-width: 150px !important;
        min-width: 120px !important;
        padding: 14px 8px !important;
        border-radius: 20px !important;
        align-self: center !important;
    }

    .ym-score {
        font-size: 30px !important;
        line-height: 1.1 !important;
        white-space: nowrap !important;
    }

    .ym-team-logo {
        width: 66px !important;
        height: 66px !important;
        object-fit: contain !important;
    }

    .ym-score-card .status,
    .ym-score-card span.status {
        font-size: 12px !important;
        padding: 6px 12px !important;
        margin-bottom: 8px !important;
    }

    /* منع قص أول جزء من الهيرو بسبب الهيدر */
    main,
    .container,
    .ym-container,
    .ym-wrap {
        overflow: visible !important;
    }
}

/* ================= Match Detail Stadium Style ================= */

/* خلفية ملعب داكنة بدون صورة خارجية */
.ym-match-board {
    position: relative !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(120px, 170px) minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 18px !important;
    padding: 34px 28px !important;
    border-radius: 28px !important;
    overflow: hidden !important;
    background:
        linear-gradient(rgba(0,0,0,.58), rgba(0,0,0,.72)),
        radial-gradient(circle at 50% 0%, rgba(255,255,255,.18), transparent 24%),
        linear-gradient(180deg, #2f3b2c 0%, #0d2917 45%, #082014 100%) !important;
    border: 1px solid rgba(255,255,255,.22) !important;
    box-shadow: inset 0 0 80px rgba(0,0,0,.42), 0 18px 45px rgba(0,0,0,.20) !important;
}

/* تأثير إضاءة ملعب بسيط */
.ym-match-board::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, transparent 0 12%, rgba(255,255,255,.06) 12% 13%, transparent 13% 24%, rgba(255,255,255,.04) 24% 25%, transparent 25% 100%),
        radial-gradient(circle at 50% 110%, rgba(54, 180, 98, .30), transparent 38%);
    pointer-events: none;
    opacity: .75;
}

/* نخلي العناصر فوق الخلفية */
.ym-match-board > * {
    position: relative !important;
    z-index: 2 !important;
}

/* كروت الفرق */
.ym-match-board .ym-team-card {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    text-align: center !important;
    min-width: 0 !important;
}

.ym-match-board .ym-team-logo-wrap {
    width: 96px !important;
    height: 96px !important;
    margin: 0 auto 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background: rgba(255,255,255,.92) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.28) !important;
}

.ym-match-board .ym-team-logo {
    width: 74px !important;
    height: 74px !important;
    object-fit: contain !important;
}

.ym-match-board .ym-team-card strong {
    color: #fff !important;
    font-size: 22px !important;
    font-weight: 900 !important;
    text-shadow: 0 2px 8px rgba(0,0,0,.55) !important;
    display: block !important;
}

/* كرت النتيجة في الوسط */
.ym-match-board .ym-score-card {
    background: rgba(255,255,255,.96) !important;
    color: #0f172a !important;
    border-radius: 24px !important;
    padding: 18px 12px !important;
    min-width: 130px !important;
    max-width: 170px !important;
    margin: 0 auto !important;
    text-align: center !important;
    box-shadow: 0 14px 35px rgba(0,0,0,.28) !important;
}

.ym-match-board .ym-score {
    font-size: 38px !important;
    font-weight: 900 !important;
    line-height: 1.1 !important;
    color: #064e3b !important;
    white-space: nowrap !important;
}

.ym-match-board .ym-vs {
    color: #64748b !important;
    font-weight: 800 !important;
    margin-top: 4px !important;
}

.ym-match-board .ym-match-date {
    color: #475569 !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    margin-top: 6px !important;
}

/* الجوال: نفس فكرة الرئيسية، فريق - نتيجة - فريق */
@media (max-width: 768px) {
    .ym-match-board {
        grid-template-columns: minmax(0, 1fr) 112px minmax(0, 1fr) !important;
        gap: 8px !important;
        padding: 22px 10px !important;
        border-radius: 22px !important;
    }

    .ym-match-board .ym-team-logo-wrap {
        width: 68px !important;
        height: 68px !important;
        margin-bottom: 8px !important;
    }

    .ym-match-board .ym-team-logo {
        width: 52px !important;
        height: 52px !important;
    }

    .ym-match-board .ym-team-card strong {
        font-size: 15px !important;
        line-height: 1.35 !important;
        white-space: normal !important;
        word-break: normal !important;
    }

    .ym-match-board .ym-score-card {
        min-width: 104px !important;
        max-width: 112px !important;
        padding: 12px 6px !important;
        border-radius: 18px !important;
    }

    .ym-match-board .ym-score {
        font-size: 28px !important;
    }

    .ym-match-board .ym-score-card .status {
        font-size: 11px !important;
        padding: 5px 9px !important;
        margin-bottom: 7px !important;
    }

    .ym-match-board .ym-match-date {
        font-size: 11px !important;
        line-height: 1.45 !important;
    }
}

/* Mobile clean match detail card - override stadium style on phones */
@media (max-width: 768px) {
    .ym-match-board {
        display: grid !important;
        grid-template-columns: 1fr 96px 1fr !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 16px 8px !important;
        border-radius: 22px !important;
        background: #ffffff !important;
        border: 1px solid #e5e7eb !important;
        box-shadow: 0 8px 24px rgba(15,23,42,.08) !important;
        overflow: visible !important;
    }

    .ym-match-board::before {
        display: none !important;
    }

    .ym-match-board .ym-team-card {
        background: transparent !important;
        border: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
        min-width: 0 !important;
        text-align: center !important;
    }

    .ym-match-board .ym-team-logo-wrap {
        width: 58px !important;
        height: 58px !important;
        margin: 0 auto 7px !important;
        border-radius: 16px !important;
        background: #ffffff !important;
        box-shadow: 0 6px 18px rgba(15,23,42,.10) !important;
    }

    .ym-match-board .ym-team-logo {
        width: 46px !important;
        height: 46px !important;
        object-fit: contain !important;
    }

    .ym-match-board .ym-team-card strong {
        color: #0f172a !important;
        font-size: 13px !important;
        line-height: 1.35 !important;
        font-weight: 900 !important;
        text-shadow: none !important;
        display: block !important;
        white-space: normal !important;
    }

    .ym-match-board .ym-score-card {
        min-width: 92px !important;
        max-width: 96px !important;
        padding: 10px 5px !important;
        border-radius: 18px !important;
        background: #f8fafc !important;
        color: #0f172a !important;
        box-shadow: 0 8px 20px rgba(15,23,42,.10) !important;
    }

    .ym-match-board .ym-score {
        font-size: 25px !important;
        line-height: 1.05 !important;
        color: #064e3b !important;
        white-space: nowrap !important;
    }

    .ym-match-board .ym-vs {
        font-size: 11px !important;
        margin: 2px 0 !important;
        color: #64748b !important;
    }

    .ym-match-board .ym-match-date {
        font-size: 10px !important;
        line-height: 1.35 !important;
        color: #475569 !important;
    }

    .ym-match-board .status {
        font-size: 10px !important;
        padding: 4px 8px !important;
        margin-bottom: 5px !important;
    }
}

/* =========================================================
   FINAL: Match detail board - stadium background + centered score
   Applies after all previous overrides
========================================================= */

/* خلفية ملعب داكنة بدون صورة */
html body .ym-match-board {
    position: relative !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(120px, 170px) minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 18px !important;
    padding: 34px 28px !important;
    border-radius: 28px !important;
    overflow: hidden !important;
    background:
        linear-gradient(rgba(0,0,0,.56), rgba(0,0,0,.74)),
        radial-gradient(circle at 50% 0%, rgba(255,255,255,.18), transparent 26%),
        linear-gradient(180deg, #293628 0%, #0d2a18 46%, #071b12 100%) !important;
    border: 1px solid rgba(255,255,255,.22) !important;
    box-shadow: inset 0 0 80px rgba(0,0,0,.42), 0 18px 45px rgba(0,0,0,.20) !important;
}

/* لمعة ملعب خفيفة */
html body .ym-match-board::before {
    content: "" !important;
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    pointer-events: none !important;
    opacity: .8 !important;
    background:
        radial-gradient(circle at 50% 105%, rgba(48,180,95,.28), transparent 38%),
        linear-gradient(90deg, transparent 0 15%, rgba(255,255,255,.055) 15% 16%, transparent 16% 31%, rgba(255,255,255,.04) 31% 32%, transparent 32% 100%) !important;
}

html body .ym-match-board > * {
    position: relative !important;
    z-index: 2 !important;
}

/* الترتيب الأساسي: فريق | نتيجة | فريق */
html body .ym-match-board > .ym-team-card:first-child {
    grid-column: 1 !important;
    grid-row: 1 !important;
}

html body .ym-match-board > .ym-score-card {
    grid-column: 2 !important;
    grid-row: 1 !important;
}

html body .ym-match-board > .ym-team-card:last-child {
    grid-column: 3 !important;
    grid-row: 1 !important;
}

/* كروت الفرق */
html body .ym-match-board .ym-team-card {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    text-align: center !important;
    min-width: 0 !important;
    padding: 0 !important;
}

html body .ym-match-board .ym-team-logo-wrap {
    width: 96px !important;
    height: 96px !important;
    margin: 0 auto 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background: rgba(255,255,255,.94) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,.28) !important;
}

html body .ym-match-board .ym-team-logo {
    width: 74px !important;
    height: 74px !important;
    object-fit: contain !important;
}

html body .ym-match-board .ym-team-card strong {
    color: #ffffff !important;
    font-size: 22px !important;
    font-weight: 900 !important;
    line-height: 1.35 !important;
    text-shadow: 0 2px 8px rgba(0,0,0,.55) !important;
    display: block !important;
}

/* كرت النتيجة في المنتصف */
html body .ym-match-board .ym-score-card {
    background: rgba(255,255,255,.97) !important;
    color: #0f172a !important;
    border-radius: 24px !important;
    padding: 18px 12px !important;
    min-width: 130px !important;
    max-width: 170px !important;
    margin: 0 auto !important;
    text-align: center !important;
    box-shadow: 0 14px 35px rgba(0,0,0,.28) !important;
}

html body .ym-match-board .ym-score {
    font-size: 38px !important;
    font-weight: 900 !important;
    line-height: 1.1 !important;
    color: #064e3b !important;
    white-space: nowrap !important;
}

html body .ym-match-board .ym-vs {
    color: #64748b !important;
    font-weight: 800 !important;
    margin-top: 4px !important;
}

html body .ym-match-board .ym-match-date {
    color: #475569 !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    margin-top: 6px !important;
}

/* الجوال: فريق | نتيجة | فريق في نفس الصف مع خلفية ملعب */
@media (max-width: 768px) {
    html body .ym-match-board {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 104px minmax(0, 1fr) !important;
        grid-template-areas: "home score away" !important;
        align-items: center !important;
        gap: 7px !important;
        padding: 18px 8px !important;
        border-radius: 22px !important;
        overflow: hidden !important;
        background:
            linear-gradient(rgba(0,0,0,.58), rgba(0,0,0,.78)),
            radial-gradient(circle at 50% 0%, rgba(255,255,255,.16), transparent 30%),
            linear-gradient(180deg, #2b3829 0%, #0d2a18 48%, #071b12 100%) !important;
        border: 1px solid rgba(255,255,255,.18) !important;
        box-shadow: inset 0 0 55px rgba(0,0,0,.38), 0 10px 26px rgba(0,0,0,.16) !important;
    }

    html body .ym-match-board > .ym-team-card:first-child {
        grid-area: home !important;
        grid-column: 1 !important;
        grid-row: 1 !important;
    }

    html body .ym-match-board > .ym-score-card {
        grid-area: score !important;
        grid-column: 2 !important;
        grid-row: 1 !important;
        order: 0 !important;
    }

    html body .ym-match-board > .ym-team-card:last-child {
        grid-area: away !important;
        grid-column: 3 !important;
        grid-row: 1 !important;
    }

    html body .ym-match-board .ym-team-logo-wrap {
        width: 58px !important;
        height: 58px !important;
        margin: 0 auto 7px !important;
        border-radius: 50% !important;
        background: rgba(255,255,255,.94) !important;
        box-shadow: 0 6px 16px rgba(0,0,0,.28) !important;
    }

    html body .ym-match-board .ym-team-logo {
        width: 44px !important;
        height: 44px !important;
        object-fit: contain !important;
    }

    html body .ym-match-board .ym-team-card strong {
        color: #ffffff !important;
        font-size: 13px !important;
        line-height: 1.35 !important;
        font-weight: 900 !important;
        text-shadow: 0 2px 6px rgba(0,0,0,.58) !important;
        white-space: normal !important;
        word-break: normal !important;
    }

    html body .ym-match-board .ym-score-card {
        min-width: 100px !important;
        max-width: 104px !important;
        width: 104px !important;
        padding: 10px 5px !important;
        border-radius: 18px !important;
        background: rgba(255,255,255,.97) !important;
        box-shadow: 0 8px 20px rgba(0,0,0,.26) !important;
        margin: 0 auto !important;
    }

    html body .ym-match-board .ym-score {
        font-size: 25px !important;
        line-height: 1.05 !important;
        white-space: nowrap !important;
    }

    html body .ym-match-board .ym-vs {
        font-size: 11px !important;
        margin: 2px 0 !important;
    }

    html body .ym-match-board .ym-match-date {
        font-size: 10px !important;
        line-height: 1.35 !important;
    }

    html body .ym-match-board .status {
        font-size: 10px !important;
        padding: 4px 8px !important;
        margin-bottom: 5px !important;
        white-space: nowrap !important;
    }
}

/* ================= Mobile horizontal menu scroll hint ================= */
@media (max-width: 768px) {

    /* استهداف قوائم الروابط الأفقية في الجوال */
    .ym-nav,
    .ym-tabs,
    .ym-filter-tabs,
    .ym-league-tabs,
    .ym-hub-links,
    .ym-seo-hub-links,
    .top-links,
    .day-tabs,
    nav {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .ym-nav::-webkit-scrollbar,
    .ym-tabs::-webkit-scrollbar,
    .ym-filter-tabs::-webkit-scrollbar,
    .ym-league-tabs::-webkit-scrollbar,
    .ym-hub-links::-webkit-scrollbar,
    .ym-seo-hub-links::-webkit-scrollbar,
    .top-links::-webkit-scrollbar,
    .day-tabs::-webkit-scrollbar,
    nav::-webkit-scrollbar {
        display: none;
    }

    /* حاوية عامة للقوائم القابلة للسحب */
    .ym-mobile-scroll-hint {
        position: relative !important;
    }

    .ym-mobile-scroll-hint::before,
    .ym-mobile-scroll-hint::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 34px;
        z-index: 5;
        pointer-events: none;
    }

    .ym-mobile-scroll-hint::before {
        right: 0;
        background: linear-gradient(to left, rgba(255,255,255,.98), rgba(255,255,255,0));
    }

    .ym-mobile-scroll-hint::after {
        left: 0;
        background: linear-gradient(to right, rgba(255,255,255,.98), rgba(255,255,255,0));
    }

    /* سهم صغير يدل على السحب */
    .ym-mobile-scroll-hint .ym-scroll-arrow {
        position: absolute;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 8;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background: rgba(6, 78, 59, .92);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        font-weight: 900;
        pointer-events: none;
        box-shadow: 0 6px 18px rgba(15,23,42,.22);
        animation: ymScrollHintMove 1.25s ease-in-out infinite;
    }

    @keyframes ymScrollHintMove {
        0%, 100% {
            transform: translateY(-50%) translateX(0);
            opacity: .75;
        }
        50% {
            transform: translateY(-50%) translateX(-6px);
            opacity: 1;
        }
    }

    /* بعد أول تفاعل نخفي السهم */
    body.ym-user-scrolled-menu .ym-mobile-scroll-hint .ym-scroll-arrow {
        display: none !important;
    }
}
