/* ==========================================================================
   Public CSS for Score Tank Leagues Add-on - Single League Scorers Tab
   ========================================================================== */

.scorers-table {
    /* يمكنك استخدام نفس تنسيقات .btolat-stats-table العامة */
    font-size: 0.9em;
}

/* تخصيص عمود اسم اللاعب */
.scorers-table td.player-name-cell {
    text-align: right; /* RTL */
    font-weight: 500;
    white-space: nowrap;
}

.scorers-table td.player-name-cell img.player-logo {
    width: 30px; /* حجم أكبر لصورة اللاعب */
    height: 30px;
    margin-inline-end: 10px; /* RTL */
    vertical-align: middle;
    border-radius: 50%; /* جعل صورة اللاعب دائرية */
    object-fit: cover; /* لضمان ملء الدائرة بشكل جيد */
    border: 1px solid #eee; /* حد بسيط */
}
.scorers-table td.player-name-cell span {
     vertical-align: middle;
}

/* تخصيص عمود اسم الفريق */
.scorers-table td.team-name-cell {
    text-align: right; /* RTL */
    white-space: nowrap;
    font-size: 0.9em; /* خط أصغر لاسم الفريق */
    color: #555;
}

.scorers-table td.team-name-cell img.team-logo-small {
    width: 20px; /* حجم أصغر لشعار الفريق */
    height: 20px;
    margin-inline-end: 6px; /* RTL */
    vertical-align: middle;
}
.scorers-table td.team-name-cell span {
     vertical-align: middle;
}


/* تمييز عدد الأهداف */
.scorers-table td:last-child strong {
    color: #0073aa;
    font-size: 1.1em; /* تكبير بسيط لرقم الأهداف */
}

/* تنسيقات الاستجابة لجدول الهدافين */
@media (max-width: 768px) {
    .scorers-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        border: none;
        box-shadow: none;
    }
     .scorers-table thead { display: none; }
     .scorers-table tbody,
     .scorers-table tr,
     .scorers-table td {
         display: block;
         width: 100% !important;
         box-sizing: border-box;
         border: none;
         text-align: right !important;
         padding: 8px 10px;
         border-bottom: 1px solid #eee;
     }
     .scorers-table tr {
         margin-bottom: 10px;
         border: 1px solid #eee;
         border-radius: 4px;
         padding-bottom: 0;
     }
      .scorers-table tr:last-child { margin-bottom: 0; }
      .scorers-table tbody tr:last-child td:last-child { border-bottom: none;}


     /* إضافة عناوين الأعمدة قبل كل خلية */
     .scorers-table td::before {
         content: attr(data-label);
         float: left;
         font-weight: bold;
         margin-inline-end: 10px;
         color: #555;
     }

      /* تحديد data-label للخلايا */
      .scorers-table td:nth-of-type(1)::before { content: "#"; }
      .scorers-table td:nth-of-type(2)::before { content: "اللاعب:"; }
      .scorers-table td:nth-of-type(3)::before { content: "الفريق:"; }
      .scorers-table td:nth-of-type(4)::before { content: "الأهداف:"; }

      /* تنسيق خاص لخلايا اللاعب والفريق في الجوال */
      .scorers-table td.player-name-cell,
      .scorers-table td.team-name-cell {
         white-space: normal; /* السماح بالتفاف */
      }
       .scorers-table td.player-name-cell::before,
       .scorers-table td.team-name-cell::before {
         display: none; /* إخفاء العناوين المكررة */
       }
       /* إظهار الصور والأسماء بشكل أفضل في الجوال */
       .scorers-table td.player-name-cell,
       .scorers-table td.team-name-cell {
          padding-top: 10px;
          padding-bottom: 10px;
       }
       .scorers-table td.player-name-cell img.player-logo { float: right; margin-inline-end: 0; margin-inline-start: 10px;} /* RTL float */
       .scorers-table td.team-name-cell img.team-logo-small { float: right; margin-inline-end: 0; margin-inline-start: 8px;} /* RTL float */


} /* نهاية @media */

/* --- 3. إصلاح جداول الترتيب والهدافين (Table-Cell أفقي) --- */
    
    /* إلغاء التمرير */
    #tab-standings,
    #tab-scorers {
        overflow-x: visible !important;
    }

    /* إجبار الجدول على شغل 100% من العرض بنظام ثابت */
    .standings-table,
    .scorers-table {
        display: table !important;
        overflow-x: visible !important;
        border: 1px solid #e2e2e2 !important; 
        box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important;
        min-width: 100% !important;
        width: 100% !important;
        table-layout: fixed !important; /* ★ الأهم: إجبار الأعمدة على الالتزام بالنسب */
    }

    /* استعادة الرأس */
    .standings-table thead, .scorers-table thead { display: table-header-group !important; }
    .standings-table tbody, .scorers-table tbody { display: table-row-group !important; }
    .standings-table tr, .scorers-table tr { display: table-row !important; }
    
    /* ★ استعادة الخلايا الأفقية (إلغاء display: flex/block) */
    .standings-table td, .scorers-table td,
    .standings-table th, .scorers-table th {
        display: table-cell !important; /* ★ الأهم: استعادة سلوك الخلية */
        width: auto !important; /* إلغاء العرض 100% */
        border: none !important;
        border-bottom: 1px solid #e2e2e2 !important;
        text-align: center !important;
        padding: 8px 2px !important; /* حشو صغير جداً */
        vertical-align: middle !important;
        font-size: 10px; /* خط صغير جداً */
        white-space: normal; /* السماح بالالتفاف الضروري */
        word-break: break-word; /* قص الكلمات الطويلة */
        /* إلغاء أي خصائص flex */
        flex-direction: unset !important;
        align-items: unset !important;
        justify-content: unset !important;
        gap: unset !important;
    }
    /* إلغاء العناوين المخفية (data-label) */
    .standings-table td::before,
    .scorers-table td::before {
        content: none !important;
    }

    /* ★ استعادة الشكل الأفقي (شعار بجوار اسم) وتصغيره */
    .standings-table td.team-name-cell,
    .scorers-table td.player-name-cell,
    .scorers-table td.team-name-cell {
        text-align: right !important; /* محاذاة لليمين */
        white-space: normal !important; /* السماح بالالتفاف */
    }
    .standings-table td.team-name-cell img,
    .scorers-table td.player-name-cell img.player-logo,
    .scorers-table td.team-name-cell img.team-logo-small {
        width: 18px !important;
        height: 18px !important;
        margin: 0 0 0 4px !important; /* هامش لليسار (RTL) */
        vertical-align: middle;
    }

    /* --- توزيع النسب المئوية (جدول الترتيب) --- */
    .standings-table th:nth-child(1), .standings-table td:nth-child(1) { width: 7%; }  /* # */
    .standings-table th:nth-child(2), .standings-table td:nth-child(2) { width: 28%; } /* الفريق */
    .standings-table th:nth-child(3), .standings-table td:nth-child(3) { width: 7%; }  /* لعب */
    .standings-table th:nth-child(4), .standings-table td:nth-child(4) { width: 7%; }  /* ف */
    .standings-table th:nth-child(5), .standings-table td:nth-child(5) { width: 7%; }  /* ت */
    .standings-table th:nth-child(6), .standings-table td:nth-child(6) { width: 7%; }  /* خ */
    .standings-table th:nth-child(7), .standings-table td:nth-child(7) { width: 7%; }  /* له */
    .standings-table th:nth-child(8), .standings-table td:nth-child(8) { width: 7%; }  /* عليه */
    .standings-table th:nth-child(9), .standings-table td:nth-child(9) { width: 7%; }  /* الفرق */
    .standings-table th:nth-child(10),.standings-table td:nth-child(10){ width: 9%; font-weight: bold; } /* النقاط */

    /* --- توزيع النسب المئوية (جدول الهدافين) --- */
    .scorers-table th:nth-child(1), .scorers-table td:nth-child(1) { width: 10%; } /* # */
    .scorers-table th:nth-child(2), .scorers-table td:nth-child(2) { width: 40%; } /* اللاعب */
    .scorers-table th:nth-child(3), .scorers-table td:nth-child(3) { width: 35%; } /* الفريق */
    .scorers-table th:nth-child(4), .scorers-table td:nth-child(4) { width: 15%; font-weight: bold; } /* الأهداف */
}