/* ============================
   NEXT MATCH / NEXT EVENT
   ============================ */

.section-next-match {
  position: relative;
  overflow: hidden;
}

/* اللوحة الرمادية المائلة (المربع المائل) */
.section-next-match::before {
  content: "";
  position: absolute;
  width: 140vmin;
  height: 140vmin;
  background-color: var(--color-main-dark);
  border-radius: 10%;
  top: -95vmin;
  transform: rotate(45deg);
  z-index: -3;
}

/* RTL: من أعلى اليسار */
html[dir="rtl"] .section-next-match::before {
  left: -40vmin;
  right: auto;
}

/* LTR: من أعلى اليمين */
html[dir="ltr"] .section-next-match::before {
  right: -40vmin;
  left: auto;
}

/* طبقة النقش السداسي */
.section-next-match::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../images/patterns/hexagon.svg");
  background-repeat: no-repeat;
  z-index: -2;
}

html[dir="rtl"] .section-next-match::after {
  background-position: 30% 0;
}
html[dir="ltr"] .section-next-match::after {
  background-position: 70% 0;
}

/* خطوط قطرية خفيفة داخل الكونتينر */
.next-match-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.4) 0,
    rgba(255, 255, 255, 0.4) 2px,
    transparent 2px,
    transparent 30px
  );
  background-size: 32px 32px;
  background-repeat: no-repeat;
  opacity: 0.45;
  z-index: -1;
}
html[dir="rtl"] .next-match-inner::before {
  background-position: -10% 110%;
}
html[dir="ltr"] .next-match-inner::before {
  background-position: 110% 110%;
}

/* بنية السكشن (جريد) */

.next-match-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  grid-template-rows: auto auto;
  grid-template-areas:
    "header card"
    "chevrons card";
  column-gap: 32px;
  row-gap: 20px;
  align-items: flex-start;
}

/* في LTR نقلب أماكن الهيدر والبطاقة */
html[dir="ltr"] .next-match-inner {
  grid-template-areas:
    "card header"
    "card chevrons";
}

/* ربط العناصر بالجريد */

.next-match-header {
  grid-area: header;
  margin-bottom: 16px;
}

.next-match-chevrons {
  grid-area: chevrons;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
}

.next-match-card {
  grid-area: card;
  max-width: 520px;
  border-radius: 20px;
  padding: 18px 22px;
  position: relative;
}

/* في RTL البطاقة تلتصق باليمين، في LTR باليسار */
html[dir="rtl"] .next-match-card {
  justify-self: end;
}
html[dir="ltr"] .next-match-card {
  justify-self: start;
}

/* ============================
   HEADER داخل السكشن
   ============================ */

.next-match-icon .shield-icon {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid #ffffff;
  border-radius: 12px 12px 2px 12px;
}

/* كل عبارة في سطر مستقل */
.next-event-title,
.next-event-name,
.next-event-category {
  display: block;
  margin: 0;
}

/* أحجام بدون ألوان */
.next-event-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
}

.next-event-name {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.next-event-category {
  font-size: 16px;
  font-weight: 400;
  margin-bottom: 10px;
}

/* ============================
   الأسهم
   ============================ */

.chevron {
  width: 54px;
  height: 32px;
  transform: skewX(-24deg);
  position: relative;
}

.chevron--solid {
  background-color: #ffffff;
}

.chevron--outline {
  border: 2px solid #ffffff;
  background-color: transparent;
}

/* ============================
   محتوى البطاقة (يوم + صور + وقت + ملعب)
   ============================ */

.next-match-day {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
  text-align: center;
}

/* حاويتان: واحدة للحدث العام، والثانية للمباراة */

.next-event-visual {
  margin-bottom: 16px;
}

/* حدث عام (شعار واحد أكبر) */
.next-event-visual--single {
  display: flex;
  justify-content: center;
}

.next-event-logo-single {
  display: block;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: contain;
  background-color: #ffffff;
  padding: 8px;
}

/* مباراة (شعارين + VS) */
.next-event-visual--match {
  display: none; /* افتراضياً مخفية – يظهرها كلاس match */
  justify-content: center;
  align-items: center;
  gap: 24px;
}

.team img {
  display: block;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: contain;
  background-color: #ffffff;
  padding: 8px;
}

.vs-label {
  font-size: 22px;
  font-weight: 700;
}

/* تبديل العرض حسب نوع البطاقة */
.next-match-card--event .next-event-visual--single {
  display: flex;
}
.next-match-card--event .next-event-visual--match {
  display: none;
}

.next-match-card--match .next-event-visual--single {
  display: none;
}
.next-match-card--match .next-event-visual--match {
  display: flex;
}

.next-match-info {
  text-align: center;
}

.next-match-datetime {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.next-match-venue {
  font-size: 18px;
}

/* شعار النادي في الزاوية */

.next-match-logo-mark {
  position: absolute;
  top: 32px;
  inset-inline-end: 40px;
}

.next-match-logo-mark img {
  width: 70px;
  height: auto;
}

/* ============================
   استجابة الشاشات الصغيرة
   ============================ */

@media (max-width: 768px) {
  .section-next-match::before {
    width: 160vmin;
    height: 160vmin;
    top: -110vmin;
  }

  html[dir="rtl"] .section-next-match::before {
    left: -60vmin;
  }

  html[dir="ltr"] .section-next-match::before {
    right: -60vmin;
  }

  .next-match-inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "header"
      "card"
      "chevrons";
    row-gap: 16px;
  }

  .next-match-card {
    justify-self: stretch;
    transform: translateY(-40px);
  }

  .team img {
    width: 140px;
    height: 140px;
  }

  .next-event-logo-single {
    width: 110px;
    height: 110px;
  }

  .next-match-chevrons {
    justify-content: flex-start;
    margin-top: 0;
  }

  .next-match-logo-mark {
    top: 16px;
    inset-inline-end: 20px;
  }
}


/* ============================
   RTL — Arabic
   ============================ */

html[dir="rtl"] .section-next-match::before {
  left: -40vmin;
  right: auto;
  transform: rotate(45deg);
}

html[dir="rtl"] .section-next-match::after {
  background-position: 30% 0;
}

/* ============================
   LTR — English
   ============================ */

html[dir="ltr"] .section-next-match::before {
  right: -40vmin;
  left: auto;
  transform: rotate(-45deg);
}

html[dir="ltr"] .section-next-match::after {
  background-position: 70% 0;
}
html[dir="rtl"] .next-match-inner {
  grid-template-areas:
    "header card"
    "chevrons card";
}

html[dir="ltr"] .next-match-inner {
  grid-template-areas:
    "card header"
    "card chevrons";
}
/* بطاقة: حدث عام */
.next-event-general .next-event-visual img {
  width: 160px;
  height: 160px;
}

/* بطاقة: مباراة */
.next-event-match .team img {
  width: 180px;
  height: 180px;
}



html[dir="ltr"] .next-match-card{
position: unset !important;
}


/* في الإنجليزي (LTR): الهيدر يسار، البطاقة يمين */
html[dir="ltr"] .next-match-inner {
  grid-template-areas:
    "header card"
    "chevrons card";
}
/* ============================
   تخطيط خاص للشاشات المتوسطة والصغيرة
   بدون المساس بنسخة الكمبيوتر
   ============================ */

@media (max-width: 992px) {

  /* نخلي الجريد عمودي وعناصره في المنتصف في RTL و LTR */
  html[dir="rtl"] .next-match-inner,
  html[dir="ltr"] .next-match-inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "header"
      "card"
      "chevrons";
    column-gap: 0;
    row-gap: 20px;
    justify-items: center;   /* يخلي العناصر في المنتصف أفقياً */
  }

  /* الهيدر فوق ومتمركز */
  .next-match-header {
    text-align: center;
  }

  /* البطاقة في المنتصف وبداخل إطار الشاشة دائماً */
  .next-match-card {
    box-sizing: border-box;
    width: 100%;
    max-width: 420px;        /* عرض مناسب للموبايل والتابلت */
    margin-inline: auto;
    justify-self: center;
    transform: none;         /* نلغي الرفع عشان ما تطلع برا */
  }

  .next-match-day,
  .next-match-datetime,
  .next-match-venue {
    text-align: center;
  }

  /* الأسهم أسفل، ومتمركزة */
  .next-match-chevrons {
    justify-content: center;
    padding-top: 4px;
  }

  /* ترتيب أفضل لشعارات المباراة في الشاشات الضيقة */
  .next-event-visual--match {
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;         /* يسمح لهم ينزلون سطر ثاني لو ضاقت الشاشة */
  }

  /* الشعارات (فريقين أو شعار واحد) تتناسب تلقائياً مع العرض */
  .team img,
  .next-event-logo-single {
    width: min(40vw, 140px);
    height: min(40vw, 140px);
    border-radius: 50%;
    object-fit: contain;
    background-color: #ffffff;
    padding: 8px;
  }
}

/* موبايل صغير جداً – زيادة أمان */
@media (max-width: 576px) {
  .next-match-card {
    max-width: 100%;
    padding-inline: 12px;
  }

  .team img,
  .next-event-logo-single {
    width: min(46vw, 120px);
    height: min(46vw, 120px);
  }
}
/* ============================
   ترتيب شعارين المباراة + VS
   للشاشات الصغيرة والمتوسطة
   ============================ */
@media (max-width: 992px) {

  /* عرض أفقي متناسق */
  .next-event-visual--match {
    display: flex !important;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 14px;
    flex-wrap: nowrap; /* يمنع النزول سطر بطريقة مزعجة */
    width: 100%;
  }

  /* حجم الشعارين */
  .team img {
    width: min(32vw, 120px);
    height: min(32vw, 120px);
    border-radius: 50%;
    object-fit: contain;
    padding: 8px;
    background-color: #ffffff;
  }

  /* حجم ودور VS */
  .vs-label {
    font-size: 20px;
    font-weight: 700;
    min-width: 32px;
    text-align: center;
  }

  /* إزالة أي محاذاة عمودية سابقة */
  .next-event-visual--match .team,
  .next-event-visual--match .vs-label {
    margin: 0;
  }
}

/* هواتف صغيرة جداً */
@media (max-width: 576px) {

  .next-event-visual--match {
    gap: 10px;
  }

  .team img {
    width: min(36vw, 100px);
    height: min(36vw, 100px);
  }

  .vs-label {
    font-size: 18px;
  }
}


/* ============================
   تحسين عرض سكشن الحدث القادم
   لنسخة الجوال فقط
   ============================ */

@media (max-width: 992px) {

  /* تخطيط الجريد: الهيدر فوق، البطاقة في الوسط، الأسهم تحت – في AR و EN */
  html[dir="rtl"] .next-match-inner,
  html[dir="ltr"] .next-match-inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "header"
      "card"
      "chevrons";
    column-gap: 0;
    row-gap: 20px;
    justify-items: center;
  }

  /* الهيدر في المنتصف */
  .next-match-header {
    text-align: center;
  }

  /* البطاقة في الوسط وبأقصى عرض مناسب للموبايل */
  .next-match-card {
    box-sizing: border-box;
    width: 100%;
    max-width: 420px;
    margin-inline: auto;
    justify-self: center;
    transform: none;  /* إلغاء الرفع السابق */
    padding-inline: 16px;
  }

  /* محاذاة محتوى البطاقة في المنتصف */
  .next-match-day,
  .next-match-datetime,
  .next-match-venue {
    text-align: center;
  }

  /* الأسهم أسفل وبالمنتصف */
  .next-match-chevrons {
    justify-content: center;
    padding-top: 8px;
  }

  /* مباراة: شعارين + VS جنب بعض في الموبايل */
  .next-event-visual--match {
    display: flex !important;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 14px;
    flex-wrap: nowrap;
    width: 100%;
  }

  /* حجم الشعارات (حدث عام أو مباراة) حسب عرض الشاشة */
  .team img,
  .next-event-logo-single {
    width: min(40vw, 140px);
    height: min(40vw, 140px);
    border-radius: 50%;
    object-fit: contain;
    background-color: #ffffff;
    padding: 8px;
  }

  /* شكل VS */
  .vs-label {
    font-size: 20px;
    font-weight: 700;
    min-width: 32px;
    text-align: center;
  }
}

/* هواتف صغيرة جداً */
@media (max-width: 576px) {

  .next-match-card {
    max-width: 100%;
    padding-inline: 12px;
  }

  .team img,
  .next-event-logo-single {
    width: min(46vw, 110px);
    height: min(46vw, 110px);
  }

  .vs-label {
    font-size: 18px;
  }
}
