/* Styles for the Football Pitch Display - Enhanced Version */
.fl-football-pitch-section {
  padding: 2px 2px;
  background-color: rgb(255, 255, 255);
  border-top: 1px solid rgb(255, 255, 255);
  text-align: center;
  backdrop-filter: blur(2px);
  margin-bottom: 4px;
}

.fl-football-pitch-section h4 {
  margin-top: 0;
  color: #333;
  font-size: 1.5em;
  margin-bottom: 20px;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.fl-football-pitch {
  position: relative;
  width: 100%;
  padding-bottom: 66%; /* Better aspect ratio for football pitch */
  background: linear-gradient(135deg, #3a9e3a 0%, #4caf50 50%, #3a9e3a 100%);
  border: 2px solid #ffffff;
  border-radius: 8px;
  overflow: hidden;
  margin: 0 auto;
  max-width: 900px;
  box-sizing: border-box;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);

  /* Grass Texture with subtle stripes */
  background-image: linear-gradient(
      to bottom,
      rgba(58, 158, 58, 0.8) 0%,
      rgba(76, 175, 80, 0.8) 20%,
      rgba(58, 158, 58, 0.8) 40%,
      rgba(76, 175, 80, 0.8) 60%,
      rgba(58, 158, 58, 0.8) 80%,
      rgba(76, 175, 80, 0.8) 100%
    ),
    /* Pitch Markings */
      linear-gradient(
        to right,
        transparent 49.85%,
        #ffff00 49.85%,
        #ffff00 50.15%,
        transparent 50.15%
      ),
    /* Halfway line */
      radial-gradient(
        circle at 50% 50%,
        transparent 9%,
        #ffff00 9%,
        #ffff00 10%,
        transparent 10%
      ); /* Centre circle */
}

/* Enhanced Penalty Areas with D-box arcs */
/* الكود الحالي لعنوان القسم */
.fl-football-pitch-section h4 {
  margin-top: 0;
  color: #333;
  font-size: 1.5em;
  margin-bottom: 20px;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

/* الكود الحالي للملعب نفسه */
.fl-football-pitch {
  position: relative;
  width: 100%;
  padding-bottom: 66%; /* Better aspect ratio for football pitch */
  background: linear-gradient(135deg, #3a9e3a 0%, #4caf50 50%, #3a9e3a 100%);
  border: 2px solid #ffffff;
  border-radius: 8px;
  overflow: hidden;
  margin: 0 auto;
  max-width: 900px;
  box-sizing: border-box;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);

  /* Grass Texture with subtle stripes */
  background-image: 
  
  
  /* Pitch Markings */ linear-gradient(
      to right,
      transparent 49.85%,
      #ffffff 49.85%,
      #ffffff 50.15%,
      transparent 50.15%
    ),
    /* Halfway line */
      radial-gradient(
        circle at 50% 50%,
        transparent 9%,
        #ffffff 9%,
        #ffffff 10%,
        transparent 10%
      ),
    /* Centre circle */
      linear-gradient(
        to bottom,
        rgba(11, 190, 11, 0.8) 0%,
        rgba(11, 190, 11, 0.8) 20%,
        rgba(11, 190, 11, 0.8) 40%,
        rgba(11, 190, 11, 0.8) 60%,
        rgba(11, 190, 11, 0.8) 80%,
        rgba(11, 190, 11, 0.8) 100%
      );
}

/* إعادة تعريف Pseudo-elements لخط الـ 18 ياردة */
.fl-football-pitch::before,
.fl-football-pitch::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 16.5%;
  height: 44%;
  transform: translateY(-50%);
  border: 0.2vmin solid rgba(255, 255, 255, 0.8);
  box-sizing: border-box;
  z-index: 1;
}

/* منطقة الجزاء اليسرى */
.fl-football-pitch::before {
  left: 0;
  border-left: none; /* لا حدود على الجانب الخارجي */
  background:
    /* خط أفقي علوي للـ 6 ياردات */ linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.8) 0.2vmin,
        transparent 0.2vmin
      )
      0 22% / 50% 0.2vmin no-repeat,
    /* خط أفقي سفلي للـ 6 ياردات */
      linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.8) 0.2vmin,
        transparent 0.2vmin
      )
      0 78% / 50% 0.2vmin no-repeat,
    /* خط عمودي للـ 6 ياردات */
      linear-gradient(
        to right,
        rgba(255, 255, 255, 0.8) 0.2vmin,
        transparent 0.2vmin
      )
      center center / 0.2vmin 55% no-repeat;
}

/* منطقة الجزاء اليمنى */
.fl-football-pitch::after {
  right: 0;
  border-right: none;
  background:
    /* خط أفقي علوي للـ 6 ياردات */ linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.8) 0.2vmin,
        transparent 0.2vmin
      )
      100% 22% / 50% 0.2vmin no-repeat,
    /* خط أفقي سفلي للـ 6 ياردات */
      linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.8) 0.2vmin,
        transparent 0.2vmin
      )
      100% 78% / 50% 0.2vmin no-repeat,
    /* خط عمودي للـ 6 ياردات */
      linear-gradient(
        to left,
        rgba(255, 255, 255, 0.8) 0.2vmin,
        transparent 0.2vmin
      )
      center center / 0.2vmin 55% no-repeat;
}

/* خط الـ 18 الأيمن */
.fl-football-pitch::after {
  right: 0;
  border-right: none; /* لا حدود على الجانب الأيمن الخارجي */
  /* إضافة الخط العمودي لمنطقة الـ 6 أمتار على اليمين */
  background-image:
    /* الخط العلوي لمنطقة الـ 6 أمتار */ linear-gradient(
        to top,
        rgba(255, 255, 255, 0.8) 0.2vmin,
        transparent 0.2vmin
      )
      0 11.5% / 100% 0.2vmin no-repeat,
    /* الخط السفلي لمنطقة الـ 6 أمتار */
      linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.8) 0.2vmin,
        transparent 0.2vmin
      )
      0 88.5% / 100% 0.2vmin no-repeat,
    /* الخط العمودي لمنطقة الـ 6 أمتار (من الداخل) */
      linear-gradient(
        to left,
        rgba(255, 255, 255, 0.8) 0.2vmin,
        transparent 0.2vmin
      )
      98% 0 / 0.2vmin 55% no-repeat; /* 83% تمثل المسافة من اليسار (أو 17% من اليمين) */
}

/* Corner Arcs */
.fl-football-pitch .corner-arc {
  position: absolute;
  width: 2%;
  height: 4%;
  border: 2px solid #ffffff;
  border-color: transparent transparent #ffffff #ffffff;
}

.fl-football-pitch .corner-arc.top-left {
  top: 0;
  left: 0;
  border-radius: 0 0 100% 0;
}

.fl-football-pitch .corner-arc.top-right {
  top: 0;
  right: 0;
  border-radius: 0 0 0 100%;
  border-color: transparent #ffff00 #ffff00 transparent;
}

.fl-football-pitch .corner-arc.bottom-left {
  bottom: 0;
  left: 0;
  border-radius: 0 100% 0 0;
  border-color: #ffff00 transparent transparent #ffff00;
}

.fl-football-pitch .corner-arc.bottom-right {
  bottom: 0;
  right: 0;
  border-radius: 100% 0 0 0;
  border-color: #ffff00 #ffff00 transparent transparent;
}

/* Enhanced Player Dots with Team Badges */
.fl-player-dot {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1em;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  transform: translate(-50%, -50%);
  z-index: 10;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.fl-home-player {
  background: linear-gradient(135deg, #0073aa 0%, #005f88 100%);
  border: 3px solid #fff;
}

.fl-away-player {
  background: linear-gradient(135deg, #dc3232 0%, #b72b2b 100%);
  border: 3px solid #fff;
}

.fl-player-dot:hover {
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  z-index: 20;
}

/* Enhanced Tooltips with Formation Info */
.fl-player-name-tooltip {
  visibility: hidden;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 8px 12px;
  position: absolute;
  z-index: 30;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: all 0.3s;
  font-size: 0.95em;
  min-width: 120px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.fl-player-name-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

.fl-player-dot:hover .fl-player-name-tooltip {
  visibility: visible;
  opacity: 1;
  bottom: calc(100% + 5px);
}

.player-on-pitch {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 7%;
  font-size: 1.6vmin;
  transform: translate(-50%, -50%);
  z-index: 5;
}

.player-visual-wrapper {
  position: relative;
  width: 65%;
  padding-bottom: 65%;
  margin-bottom: 0.3em;
}

.player-number-badge {
  position: absolute;
  top: -0.4em;
  left: -0.4em;
  background-color: #555555;
  color: #ffffff;
  font-size: 0.65em;
  font-weight: bold;
  width: 1.9em;
  height: 1.9em;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 1;
  border: 0.1em solid #ffffff;
  box-shadow: 0 0 0.2em rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

.player-name-display {
  font-size: 0.75em;
  color: #ffffff;
  background-color: transparent;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
}

.player-photo-on-pitch {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 0.12em solid var(--modern-icon-border, #ffffff);
  object-fit: cover;
  background-color: var(--modern-bg, #f70000) #f4f6f8;
  display: block;
  box-sizing: border-box;
}

/**************** Responsive Adjustments *************************/
/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199px) {
  .fl-football-pitch {
    padding-bottom: 55%; /* Slightly more vertical space */
  }

  .fl-player-dot {
    width: 45px;
    height: 45px;
    font-size: 1.1em;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991px) {
  .fl-football-pitch {
    padding-bottom: 60%; /* Even more vertical space for tablets */
  }

  .fl-player-dot {
    width: 40px;
    height: 40px;
    font-size: 1em;
  }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767px) {
  .fl-football-pitch {
    padding-bottom: 55%; /* Optimized for landscape phones */
  }

  .fl-player-dot {
    width: 35px;
    height: 35px;
    font-size: 0.9em;
  }
}

/******************************* subs *****************************/

/* الوضع العادي */
.fl-lineups-wrapper {
  display: flex;
  gap: 2px;
  justify-content: space-between;
  margin: 2px 0;
}

.fl-team-lineup {
  width: 49.5%;
  border-radius: 8px;
  padding: 2px;
  background-color: #ffffff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.fl-team-info {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

.fl-players-list {
  margin-top: 10px;
}

.fl-players-list h5 {
  margin-bottom: 2px;
}

.fl-player-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid #ddd;
}

.fl-player-number {
  font-weight: bold;
  width: 30px;
}

.fl-player-name {
  flex-grow: 1;
  margin-left: 10px;
}

.fl-player-pos {
  color: #777;
  font-style: italic;
}

/* تنسيقات خاصة بالقوائم داخل هذا القسم */
.fl-team-lineup ol,
.fl-team-lineup ul {
  margin: 0 1em 0.5em 0;
}

/************** responsive لكل الشاشات ****************/
@media (max-width: 768px) {
  .fl-lineups-wrapper {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 2px;
  }

  .fl-team-lineup {
    width: 49.5%;
  }

  .fl-player-item {
    flex-direction: row;
    align-items: center;
  }

  .fl-player-number,
  .fl-player-name,
  .fl-player-pos {
    width: auto;
    margin-bottom: 0;
  }

  .fl-player-name {
    margin-left: 2px;
  }
}

/************** تقليل حجم الخط لأقل من 350px ************/
@media (max-width: 350px) {
  .fl-player-name,
  .fl-player-number,
  .fl-player-pos,
  .fl-team-name,
  .fl-formation,
  .fl-events,
  .fl-players-list h5 {
    font-size: 10px !important;
  }

  .fl-team-logo {
    width: 20px;
    height: 20px;
  }
}

/************* hedaer lineups sub ***************

/* الحاوية الرئيسية للرأس */
.fl-lineups-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #ffffff;
  direction: rtl; /* لأن المحتوى بالعربية */
  border-radius: 8px;
  margin-bottom: 10px;
  font-family: Arial, sans-serif;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* كل عمود داخل الرأس */
.fl-lineups-col {
  flex: 1;
  text-align: center;
}

/* العمود الأوسط أصغر */
.fl-events-title {
  flex: 0.5;
}

/* نص التشكيلة */
.fl-formation {
  font-size: 15px;
  font-weight: bold;
  color: #222;
  margin: 0;
}

/* نص الأحداث */
.fl-events {
  font-size: 14px;
  font-weight: bold;
  color: #555;
  margin: 0;
}

.fl-team-info {
  display: flex;
  align-items: center;
  justify-content: center; /* يوسّط المحتوى أفقيًا */
  gap: 8px; /* مسافة بين الصورة والاسم */
  direction: rtl; /* لأن النص عربي */
  margin-bottom: 2px;
}

.fl-team-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.fl-team-name {
  font-size: 16px;
  font-weight: bold;
  color: #333;
}

/************ responsive code hedaer lineups sub **********/

@media (max-width: 768px) {
  .fl-lineups-header {
    flex-direction: row; /* حافظ على التنسيق الأفقي */
    flex-wrap: wrap; /* يسمح بتغليف العناصر إذا ضاق العرض */
  }

  .fl-lineups-col,
  .fl-events-title {
    width: auto;
    margin-bottom: 0;
  }

  .fl-team-info {
    flex-direction: row;
    gap: 5px;
  }

  .fl-formation,
  .fl-events,
  .fl-team-name {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .fl-lineups-header {
    padding: 8px;
  }

  .fl-team-logo {
    width: 22px;
    height: 22px;
  }

  .fl-formation,
  .fl-events,
  .fl-team-name {
    font-size: 13px;
  }

  .fl-lineups-col,
  .fl-events-title {
    margin-bottom: 8px;
  }
}

@media (max-width: 400px) {
  .fl-lineups-header {
    padding: 6px;
  }

  .fl-team-logo {
    width: 20px;
    height: 20px;
  }

  .fl-formation,
  .fl-events,
  .fl-team-name {
    font-size: 12.5px;
  }

  .fl-lineups-col,
  .fl-events-title {
    margin-bottom: 6px;
  }
}

@media (max-width: 350px) {
  .fl-lineups-header {
    padding: 5px;
  }

  .fl-team-logo {
    width: 18px;
    height: 18px;
  }

  .fl-formation,
  .fl-events,
  .fl-team-name {
    font-size: 12px;
  }

  .fl-lineups-col,
  .fl-events-title {
    margin-bottom: 5px;
  }

  .fl-team-info {
    gap: 1px;
  }
}
