/* =========================================================
   HOME MATCHES
   الصفحة الرئيسية — قسم المباريات
========================================================= */


/* =========================================================
   الحاوية الرئيسية
========================================================= */

.home-matches {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    direction: rtl;
}


/* =========================================================
   بطاقة المنافسة
========================================================= */

.home-matches-competition {
    width: 100%;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    overflow: visible;

}


/* =========================================================
   رأس المنافسة
========================================================= */

.home-matches-competition__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    min-height: 72px;
    padding: 14px 16px;

    background: #008f4c;
    border-bottom: 1px solid #eef0f2;
}


/* =========================================================
   هوية المنافسة
========================================================= */

.home-matches-competition__identity {
    display: flex;
    align-items: center;
    gap: 12px;

    min-width: 0;
    flex: 1;
}


.home-matches-competition__logo {
    flex: 0 0 auto;

    width: 42px;
    height: 42px;

    object-fit: contain;
}


.home-matches-competition__title {
    display: block;

    min-width: 0;

    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;

    text-decoration: none;
}


.home-matches-competition__title span {
    font-weight: 700;
}


.home-matches-competition__title:hover {
    color: #ffffff;
}


/* =========================================================
   فلتر المراحل
========================================================= */

.home-matches-phase-filter {
    position: relative;
    flex: 0 0 auto;
}


.home-matches-phase-filter__trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-width: 112px;
    min-height: 36px;
    padding: 7px 12px;

    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 9px;

    color: #374151;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;

    cursor: pointer;
}


.home-matches-phase-filter__trigger:hover {
    background: #f3f4f6;
}


.home-matches-phase-filter__trigger i {
    font-size: 10px;
    color: #6b7280;
}




/* =========================================================
   اسم المرحلة عندما توجد مرحلة واحدة
========================================================= */

.home-matches-phase-label {
    flex: 0 0 auto;

    padding: 7px 11px;

    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 9px;

    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
}


/* =========================================================
   قائمة المباريات
========================================================= */

.home-matches-list {
    display: flex;
    flex-direction: column;

    width: 100%;
}


/* =========================================================
   عنوان التاريخ
========================================================= */

.home-matches-date {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;

    padding: 10px 16px 7px;

    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}


/* =========================================================
   المباراة
========================================================= */

.home-match {
    position: relative;

    display: grid;

    grid-template-columns: minmax(0, 1fr) 84px minmax(0, 1fr);

    grid-template-areas:
        "date date date"
        "home center away"
        "changes changes changes";

    align-items: center;

    column-gap: 14px;
    row-gap: 0;

    width: 100%;

padding: 13px 16px 11px;

    color: inherit;
    text-decoration: none;

    background: #ffffff;

    transition:
        background-color 0.15s ease,
        box-shadow 0.15s ease;
}

.home-match__team--home {
    grid-area: home;
}

.home-match__center {
    grid-area: center;
}

.home-match__team--away {
    grid-area: away;
}



.home-match__changes {
    grid-area: changes;
}


.home-match + .home-match {
    border-top: 1px solid #f0f2f4;
}


.home-match:hover {
    background: #fafafa;
}


/* =========================================================
   الفريق
========================================================= */

.home-match__team {
    display: flex;
    align-items: center;
    gap: 9px;

    min-width: 0;
}


.home-match__team--home {
    justify-content: flex-start;
}


.home-match__team--away {
    justify-content: flex-end;
}


.home-match__team > span {
    min-width: 0;

    color: #1f2937;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.home-match__team--away > span {
    text-align: right;
}


.home-match__team--home > span {
    text-align: left;
}


/* =========================================================
   شعار الفريق
========================================================= */

.home-match__team img {
    flex: 0 0 auto;

    width: 34px;
    height: 34px;

    object-fit: contain;
}


/* =========================================================
   المنتصف
========================================================= */

.home-match__center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-width: 0;

    min-height: 40px;

    text-align: center;
}


/* =========================================================
   الوقت
========================================================= */

.home-match__time {
    display: block;

    color: #111827;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}


/* =========================================================
   النتيجة
========================================================= */

.home-match__score {
    display: block;

    color: #111827;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.2;
    direction: ltr;
}


.home-match__status {
    display: block;
    margin-top: 3px;

    color: #6b7280;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
}


/* =========================================================
   مباشر
========================================================= */

.home-match__status--live,
.home-match__live {
    color: #dc2626;
    font-weight: 700;
}


.home-match__live {
    display: block;

    font-size: 11px;
    line-height: 1.3;
}


/* =========================================================
   الحالات الخاصة
========================================================= */

.home-match--status .home-match__center {
    padding: 0 3px;
}


.home-match--status .home-match__status {
    font-size: 10px;
    font-weight: 600;
}


/* =========================================================
   الملعب
========================================================= */

.home-match__stadium {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    margin-top: 6px;

    color: #6b7280;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.3;
}

.home-match__meta {
    grid-area: date;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    margin-bottom: 10px;
    padding-top: 5px;

    direction: rtl;
}

.home-match__date {
    display: flex;
    align-items: center;
    gap: 6px;

    margin: 0;

    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
}

.home-match__stadium {
    display: flex;
    align-items: baseline;
    gap: 6px;

    margin: 0;

    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
}


.home-match__stadium i {
    flex: 0 0 auto;

    color: #9ca3af;
    font-size: 10px;
}


.home-match__stadium span {
    min-width: 0;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* =========================================================
   تنبيهات التغييرات
========================================================= */

.home-match__changes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px 12px;

    margin-top: 8px;
    padding-top: 8px;

    border-top: 1px dashed #eef0f2;
}


.home-match__changes > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;

    color: #d97706;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.3;
}


.home-match__change-dot {
    display: inline-block;

    width: 5px;
    height: 5px;

    border-radius: 50%;
    background: #d97706;
}


/* =========================================================
   تنقل المراحل أسفل البطاقة
========================================================= */

.home-matches-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;

    padding: 10px 14px;

    border-top: 1px solid #eef0f2;
    background: #fafafa;
}


.home-matches-pagination > span {
    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
}


.home-matches-pagination > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 28px;
    height: 28px;

    border: 1px solid #e5e7eb;
    border-radius: 7px;

    background: #ffffff;

    color: #4b5563;
    font-size: 18px;
    line-height: 1;

    text-decoration: none;
}


.home-matches-pagination > a:hover {
    background: #f3f4f6;
    color: #006633;
}


/* =========================================================
   Responsive
========================================================= */

@media (max-width: 700px) {

    .home-matches-competition__header {
        align-items: flex-start;
        flex-direction: column;

        gap: 11px;

        padding: 13px 14px;
    }


    .home-matches-competition__identity {
        width: 100%;
    }


    .home-matches-phase-filter,
    .home-matches-phase-filter__trigger {
        width: 100%;
    }


    .home-matches-phase-filter__trigger {
        justify-content: space-between;
    }


    .home-matches-phase-filter__list {
        left: 0;
        right: 0;
        width: auto;
    }


    .home-matches-phase-label {
        width: 100%;
        text-align: center;
    }


    .home-match {
        padding: 12px 12px 10px;
    }

    .home-match {
    grid-template-columns: minmax(0, 1fr) 68px minmax(0, 1fr);
    column-gap: 8px;
}


    .home-match__team {
        gap: 6px;
    }


    .home-match__team img {
        width: 30px;
        height: 30px;
    }


    .home-match__team > span {
        font-size: 11px;
    }


    .home-match__time {
        font-size: 13px;
    }


    .home-match__score {
        font-size: 14px;
    }


    .home-match__stadium {
         margin-top: 0;
    }

}


/* =========================================================
   الهاتف الصغير
========================================================= */

@media (max-width: 420px) {

    .home-matches-competition__logo {
        width: 36px;
        height: 36px;
    }


    .home-matches-competition__title {
        font-size: 13px;
    }


  .home-match {
    grid-template-columns: minmax(0, 1fr) 58px minmax(0, 1fr);
    column-gap: 5px;
}


    .home-match__team > span {
        font-size: 10px;
    }


    .home-match__team img {
        width: 27px;
        height: 27px;
    }


    .home-match__score {
        font-size: 13px;
    }


    .home-match__time {
        font-size: 12px;
    }


    .home-match__status {
        font-size: 9px;
    }


    .home-match__stadium {
        font-size: 11px;
    }


    .home-match__changes > span {
        font-size: 9px;
    }

}

/* =========================================================
   تثبيت أعمدة أسماء الفرق والشعارات
========================================================= */

.home-match__team {
    display: grid;
    align-items: center;

    min-width: 0;

    column-gap: 10px;
}


/* الفريق على اليمين
   الاسم خارجي — الشعار داخلي قرب الوسط
*/
.home-match__team--home {
    grid-template-columns: minmax(0, 1fr) 34px;
}


/* الفريق على اليسار
   الشعار داخلي قرب الوسط — الاسم خارجي
*/
.home-match__team--away {
    grid-template-columns: 34px minmax(0, 1fr);
}


/* الاسم */

.home-match__team-name {
    min-width: 0;

    color: #1f2937;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* اسم الفريق الأيمن */

.home-match__team--home .home-match__team-name {
    text-align: right;
}


/* اسم الفريق الأيسر */

.home-match__team--away .home-match__team-name {
    text-align: left;
}


/* الشعارات */

.home-match__team-logo {
    display: block;

    width: 34px;
    height: 34px;

    object-fit: contain;
}


/* =========================================================
   الهاتف
========================================================= */

@media (max-width: 700px) {

    .home-match__team--home {
        grid-template-columns: minmax(0, 1fr) 30px;
    }

    .home-match__team--away {
        grid-template-columns: 30px minmax(0, 1fr);
    }

    .home-match__team {
        column-gap: 7px;
    }

    .home-match__team-logo {
        width: 30px;
        height: 30px;
    }
}


@media (max-width: 420px) {

    .home-match__team--home {
        grid-template-columns: minmax(0, 1fr) 27px;
    }

    .home-match__team--away {
        grid-template-columns: 27px minmax(0, 1fr);
    }

    .home-match__team {
        column-gap: 6px;
    }

    .home-match__team-logo {
        width: 27px;
        height: 27px;
    }
}

/* =========================================================
   زوايا بطاقة المنافسة
========================================================= */

.home-matches-competition__header {
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}


/* آخر مباراة = أسفل البطاقة */

.home-matches-list > .home-match:last-child {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.home-matches-list > .home-matches-date:first-child {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

@media (max-width: 768px) {


    .home-matches-competition__identity {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
        flex: 1;
    }

    .home-matches-competition__title {
        min-width: 0;
    }

}

/* =========================================================
   فلتر المراحل
   شكل بسيط داخل الهيدر الأخضر
   ========================================================= */

.home-matches-phase-filter {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    margin: 0;
    direction: rtl;
}

.home-matches-phase-filter__trigger {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    width: auto;
    min-width: 120px;
    height: 42px;
    padding: 0 28px;

    border: none;
    border-radius: 0;

    background: transparent;
    color: #ffffff;

    font-family: inherit;
    font-size: 13px;
    font-weight: 700;

    box-sizing: border-box;
    cursor: pointer;
}

.home-matches-phase-filter__trigger:hover,
.home-matches-phase-filter__trigger:focus {
    background: transparent;
    color: #ffffff;
    outline: none;
}


/* السهم الموجود داخل الزر = سهم القائمة */

.home-matches-phase-filter__trigger i {
    color: #ffffff;
    font-size: 9px;
    flex-shrink: 0;
}


/* اسم الجولة */

.home-matches-phase-filter__trigger span {
    color: #ffffff;
    white-space: nowrap;
}


/* =========================================================
   القائمة المنسدلة
   ========================================================= */

.home-matches-phase-filter__list {
    display: none;

    position: absolute;
    z-index: 50;

    top: calc(100% + 6px);
    right: 0;

    width: 120px;

    margin: 0;
    padding: 6px 0;

    list-style: none;

    background: #ffffff;
    border: 1px solid #d9dee5;
    border-radius: 10px;

    box-shadow: 0 10px 24px rgba(20, 25, 30, .12);

    max-height: 260px;
    overflow-y: auto;
}

.home-matches-phase-filter.is-open
.home-matches-phase-filter__list {
    display: block;
}

.home-matches-phase-filter__list li {
    margin: 0;
    padding: 0;
}

.home-matches-phase-filter__list li a {
    display: block;

    padding: 9px 14px;

    color: #20252b;
    font-size: 13px;
    font-weight: 700;

    text-align: center;
    text-decoration: none;
    white-space: nowrap;
}

.home-matches-phase-filter__list li a:hover {
    background: #f5f7fa;
}

.home-matches-phase-filter__list li a.is-selected {
    background: #008F4C;
    color: #ffffff;
}


/* =========================================================
   الهاتف
   ========================================================= */

@media (max-width: 768px) {

    .home-matches-phase-filter__trigger {
        min-width: 120px;
        height: 40px;
        padding: 0 26px;

        font-size: 12px;
    }
}

.home-matches-phase-filter__trigger {
    white-space: nowrap;
}

.home-matches-phase-filter__trigger i {
    flex-shrink: 0;
}

.home-match__date {
    grid-area: date;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 6px;

    margin-bottom: 0;

    color: #6b7280;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
}

.home-match__date i {
    color: #9ca3af;
    font-size: 11px;
    flex: 0 0 auto;
}

.home-match__date span {
    white-space: nowrap;
}

.home-matches-phase-filter__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0px;
}

.home-matches-phase-filter__nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 24px;
    height: 24px;

    border-radius: 50%;

    background: #ffffff;
    color: #008f4c;

    font-size: 20px;
    font-weight: 500;
    line-height: 1;

    text-decoration: none;

    cursor: pointer;

    transition:
        transform 0.2s ease,
        background-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease;
}

.home-matches-phase-filter__nav:hover {
    background: #ffffff;
    color: #006633;

       transform: scale(1.08);

    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.home-matches-phase-filter__nav.is-disabled {
    opacity: .3;
    pointer-events: none;
}

.home-matches-phase-filter__nav svg {
    width: 12px;
    height: 12px;

    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.home-matches-phase-filter__chevron {
    position: relative;

    width: 14px;
    height: 14px;

    flex: 0 0 auto;

    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;

   top: -2px;
    right: 0;
}

.home-matches-phase-filter__trigger {
    color: #ffffff;
}

/* =========================================================
   ضبط المسافات بين أسهم التنقل وفلتر الجولة
   ========================================================= */

.home-matches-phase-filter__controls {
    gap: 0;
}

.home-matches-phase-filter__trigger {
    min-width: 0;
    width: auto;
    gap: 2px;
    padding: 0 10px;
      position: relative;
    top: 2px;
}

/* =========================================================
   انتقال محتوى الجولة
   ========================================================= */

.home-matches-list {
    position: relative;
}

.home-matches-list.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: .65;
    pointer-events: none;
    z-index: 50;
  animation: homeMatchesLoading .2s ease-in-out infinite alternate;
}

@keyframes homeMatchesLoading {
    from {
        opacity: .45;
    }

    to {
        opacity: .75;
    }
}

/* =========================================================
   الهاتف — اسم المنافسة والفلتر في نفس السطر
========================================================= */

@media (max-width: 700px) {

    .home-matches-competition__header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .home-matches-competition__identity {
        width: auto;
        min-width: 0;
        flex: 1;
    }

    .home-matches-phase-filter {
        width: auto;
        flex: 0 0 auto;
    }

    .home-matches-phase-filter__trigger {
        width: auto;
    }

}

/* =========================================================
   LWFG — Home Matches Loading Effect
   ========================================================= */

.home-matches-competition {
    position: relative;
}

.home-matches-competition.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: .65;
    pointer-events: none;
    z-index: 20;
    animation: homeMatchesLoading .45s ease-in-out infinite alternate;
}

@keyframes homeMatchesLoading {
    from {
        opacity: .45;
    }

    to {
        opacity: .75;
    }
}

/* =========================================================
   HOME MATCHES — FRENCH LTR
========================================================= */

.home-matches--fr {
    direction: ltr;
}

.home-matches--fr .home-match {
    direction: ltr;
}

.home-matches--fr .home-match__meta {
    direction: ltr;
}

/* =========================================================
   HOME MATCHES — French team spacing
========================================================= */

.home-matches--fr .home-match__team--home {
    grid-template-columns: max-content 34px;
    justify-content: end;
}

.home-matches--fr .home-match__team--away {
    grid-template-columns: 34px max-content;
    justify-content: start;
}

.home-matches--fr .home-match__team {
    column-gap: 9px;
}

.home-matches--fr .home-match__team--home .home-match__team-name {
    text-align: right;
}

.home-matches--fr .home-match__team--away .home-match__team-name {
    text-align: left;
}


/* تثبيت اتجاه عرض النتيجة حسب اللغة */
.home-matches:not(.home-matches--fr) .home-match__score {
    direction: rtl;
    unicode-bidi: isolate;
}

.home-matches--fr .home-match__score {
    direction: ltr;
    unicode-bidi: isolate;
}
