/* ==========================================================================
   Public CSS for Score Tank Leagues Add-on - Single League Page (v1.1)
   ========================================================================== */

/* --- General Layout --- */
.btolat-league-single .league-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.btolat-league-single .league-logo-single {
    max-height: 100px;
    margin-bottom: 15px;
    display: inline-block; /* Prevents potential layout shifts */
}

.btolat-league-single .league-title-single {
    font-size: 2.2em;
    margin-top: 0;
    margin-bottom: 20px;
    color: #333; /* Ensure readability */
}

/* --- Tabs Navigation --- */
.btolat-stats-tabs-container {
    margin-top: 20px;
}

.btolat-stats-tabs-nav {
    list-style: none;
    padding: 0;
    margin: 0 0 25px 0;
    display: flex;
    justify-content: center;
    border-bottom: 2px solid #ddd;
    flex-wrap: wrap; /* Allow wrapping on smaller screens if needed */
}

.btolat-stats-tabs-nav li {
    margin: 0 5px;
}

.btolat-stats-tabs-nav a.tab-button {
    display: inline-block;
    padding: 12px 25px;
    text-decoration: none;
    color: #555;
    font-weight: 600;
    font-size: 1.1em;
    border: none;
    border-bottom: 3px solid transparent;
    transition: color 0.3s ease, border-bottom-color 0.3s ease;
    margin-bottom: -2px; /* Overlap with container border */
    background: none;
    cursor: pointer;
    white-space: nowrap; /* Prevent button text wrapping */
}

.btolat-stats-tabs-nav a.tab-button:hover {
    color: #0073aa;
}

.btolat-stats-tabs-nav a.tab-button.active {
    color: #0073aa;
    border-bottom-color: #0073aa;
}

/* --- Tab Content --- */
.btolat-stats-tab-content {
    display: none; /* Shown by JS */
    padding: 20px 0;
    animation: fadeIn 0.5s ease;
}

.btolat-stats-tab-content.active {
    display: block;
}

.btolat-stats-tab-content h2 { /* Titles like "Upcoming Matches", "Standings" */
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.8em;
    color: #444;
}

/* Loading Spinner Alignment */
.btolat-stats-tab-content .spinner {
    float: none;
    vertical-align: middle;
    margin-inline-end: 8px; /* RTL support */
}
/* Ensure loading div itself is centered */
#league-fixtures-loading,
#league-standings-loading,
#league-scorers-loading {
    text-align: center;
    padding: 30px;
    color: #777;
}


/* Last Updated Notice */
.last-updated-notice {
     clear: both;
     text-align: center;
     font-size: 0.8em;
     color: #777;
     margin-top: 15px;
}

/* Fade In Animation */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- Fixtures Tab Specific Styles --- */
#tab-fixtures .fixtures-filters {
    text-align: center;
    margin-bottom: 20px;
}

#tab-fixtures #fixtures-week-filter {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    min-width: 200px;
    background-color: #fff;
    font-size: 1em; /* Ensure readability */
}

/* Week Title Header (when showing all weeks) */
#tab-fixtures .fixtures-week-title {
    background-color: #f0f0f0;
    padding: 10px 15px;
    margin: 25px 0 0 0;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}
/* Remove top margin for the first week title */
#league-fixtures-container > h3.fixtures-week-title:first-child {
    margin-top: 0;
}


/* Date Header */
.fixtures-date-header {
    background-color: #e9e9e9;
    padding: 8px 15px;
    margin: 15px 0 0 0;
    font-size: 1em;
    font-weight: bold;
    text-align: center;
    color: #333;
    border-top: 1px solid #ddd;
}
/* Remove top margin/border for first date header after week title or at start */
h3.fixtures-week-title + h4.fixtures-date-header,
#league-fixtures-container > h4.fixtures-date-header:first-of-type {
    margin-top: 0;
    border-top: none;
}


/* Fixtures Table */
.btolat-stats-table.fixtures-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 20px 0; /* Remove top margin */
    box-shadow: none; /* Remove individual table shadow if headers are used */
    background-color: #fff;
    border: 1px solid #eee; /* Add subtle border */
    border-top: none; /* Remove top border if following a header */
}
/* Ensure first table after week title doesn't have top border */
h3.fixtures-week-title + h4.fixtures-date-header + .fixtures-table,
h3.fixtures-week-title + .fixtures-table {
     border-top: none;
}


.fixtures-table thead { display: none; } /* Hide the basic thead */

.fixtures-table tbody tr:last-child td.match-cell {
    border-bottom: none; /* Remove border from last cell in table */
}

.fixtures-table td.match-cell {
    padding: 0;
    border: none;
    border-bottom: 1px solid #eee;
}

/* --- Fixture Row Layout v2 (Corrected) --- */
.fixture-match-info-v2 {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Distribute space */
    padding: 12px 10px; /* Slightly reduced padding */
    gap: 8px; /* Consistent gap */
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

/* Team Name */
.fixture-match-info-v2 .team-name {
    flex: 1 1 30%; /* Allow shrinking/growing, base 30% width */
    font-weight: 500;
    font-size: 0.95em;
    padding: 0 5px;
    overflow-wrap: break-word;
    min-width: 80px; /* Prevent extreme shrinking */
}
.fixture-match-info-v2 .team-name-1 { text-align: right; }
.fixture-match-info-v2 .team-name-2 { text-align: left; }

/* Team Logo */
.fixture-match-info-v2 .team-logo {
    flex: 0 0 35px; /* Fixed width, no shrink/grow */
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.fixture-match-info-v2 .team-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Center Area (Score + Status/Time) */
.fixture-match-info-v2 .match-center-info {
    flex: 0 1 140px; /* Allow shrinking, base 140px */
    display: flex;
    align-items: center;
    justify-content: space-between; /* Space between scores and status */
    gap: 5px;
    min-width: 110px; /* Ensure content visibility */
}

/* Score Display */
.fixture-match-info-v2 .team-score {
    flex: 0 0 auto; /* Width based on content */
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    padding: 0 4px; /* Slightly more padding */
    line-height: 1;
    text-align: center;
    /* --- Visibility Confirmation --- */
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important; /* Let content define width */
    height: auto !important;
    position: static !important;
    overflow: visible !important;
    /* --- End Visibility Confirmation --- */
}

/* Status/Time Container */
.fixture-match-info-v2 .match-status-time {
    flex: 1 1 auto; /* Allow shrinking/growing within center */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    padding: 4px 6px; /* Adjusted padding */
    border-radius: 4px;
    min-width: 60px;
    text-align: center;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Status Text */
.fixture-match-info-v2 .match-status-time .status-text {
    font-weight: bold;
    margin-bottom: 3px;
    white-space: nowrap;
    line-height: 1.2;
}
/* Time/Timer */
.fixture-match-info-v2 .match-status-time .match-time-convert {
    color: inherit;
    white-space: nowrap;
    line-height: 1.2;
    font-size: 0.9em;
}

/* Status Colors */
.fixture-match-info-v2 .match-status-time.notYet { background-color: #f0f0f0; color: #555; }
.fixture-match-info-v2 .match-status-time.live { background-color: #e74c3c; color: #fff; }
.fixture-match-info-v2 .match-status-time.ended { background-color: #2ecc71; color: #fff; }
.fixture-match-info-v2 .match-status-time.Postponed { background-color: #f39c12; color: #fff; }
.fixture-match-info-v2 .match-status-time.unknown { background-color: #bdc3c7; color: #fff; }


/* --- Responsive Adjustments --- */

/* Smaller Desktops / Tablets */
@media (max-width: 768px) {
    .btolat-league-single .league-title-single {
        font-size: 1.8em;
    }
    .btolat-stats-tabs-nav a.tab-button {
        padding: 10px 15px;
        font-size: 1em;
    }
    .fixture-match-info-v2 {
        gap: 5px; /* Reduce gap */
    }
    .fixture-match-info-v2 .team-name {
        font-size: 0.9em;
        min-width: 60px;
    }
    .fixture-match-info-v2 .team-logo {
        flex-basis: 30px; height: 30px;
    }
     .fixture-match-info-v2 .match-center-info {
        flex-basis: 120px; /* Slightly smaller base */
        min-width: 90px;
    }
    .fixture-match-info-v2 .team-score {
        font-size: 1.1em;
    }
    .fixture-match-info-v2 .match-status-time {
        font-size: 0.75em;
        min-width: 55px;
    }
}

/* Mobile Devices */
@media (max-width: 600px) {
     /* Stacked Tabs */
     .btolat-stats-tabs-nav {
         flex-direction: column;
         align-items: stretch; /* Stretch buttons */
         border-bottom: none;
     }
     .btolat-stats-tabs-nav li {
        width: 100%;
        margin: 0 0 5px 0;
     }
      .btolat-stats-tabs-nav a.tab-button {
        width: 100%;
        text-align: center;
         border: 1px solid #ddd;
         border-radius: 4px;
         margin-bottom: 0;
         border-bottom: 1px solid #ddd; /* Reset border */
      }
       .btolat-stats-tabs-nav a.tab-button.active {
        background-color: #f0f0f0;
         border-bottom-color: #ddd; /* Reset border */
       }

    /* Stacked Fixture Row */
    .fixture-match-info-v2 {
        flex-wrap: wrap;
        justify-content: center;
        padding: 10px 5px;
        gap: 5px 0; /* Vertical gap only */
    }
    .fixture-match-info-v2 .team-name {
        flex-basis: 100% !important; /* Force full width */
        text-align: center !important;
        order: 3; /* Order: Logo -> Center -> Name */
        margin-top: 5px;
        font-size: 0.9em;
        min-width: unset;
    }
     .fixture-match-info-v2 .team-name-1 { order: 3; }
     .fixture-match-info-v2 .team-name-2 { order: 4; }

    .fixture-match-info-v2 .team-logo {
        flex-basis: 30px !important; /* Ensure size */
        height: 30px !important;
        order: 1;
    }
     .fixture-match-info-v2 .logo-team1 { order: 1; }
     .fixture-match-info-v2 .logo-team2 { order: 5; } /* Last element */


    .fixture-match-info-v2 .match-center-info {
        flex-basis: 100% !important; /* Force full width */
        order: 2; /* Between logos */
        justify-content: space-around;
        margin: 5px 0;
        padding: 8px 0; /* Increased padding */
        border-top: 1px solid #eee;
        border-bottom: 1px solid #eee;
        min-width: unset;
    }
     /* Ensure correct order inside center */
     .fixture-match-info-v2 .match-status-time { order: 0; }
     .fixture-match-info-v2 .score-team1 { order: -1; }
     .fixture-match-info-v2 .score-team2 { order: 1; }

     .fixture-match-info-v2 .team-score {
        font-size: 1.1em;
     }
     .fixture-match-info-v2 .match-status-time {
         padding: 3px 6px;
         min-width: 60px;
         font-size: 0.75em;
     }
}

/* --- General Table Styles (For Standings/Scorers later) --- */
.btolat-stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    background-color: #fff;
    border: 1px solid #e2e2e2;
}

.btolat-stats-table th,
.btolat-stats-table td {
    border-bottom: 1px solid #e2e2e2; /* Bottom border for rows */
    padding: 10px 12px;
    text-align: center;
    vertical-align: middle;
}
.btolat-stats-table td {
    font-size: 0.9em;
}

.btolat-stats-table thead th {
    background-color: #f7f7f7;
    font-weight: 600;
    color: #333;
    border-bottom-width: 2px; /* Thicker border for header */
}
.btolat-stats-table tbody tr:last-child td {
    border-bottom: none; /* No border on last row */
}
.btolat-stats-table tbody tr:hover {
    background-color: #f9f9f9; /* Subtle hover effect */
}

/* Align text in specific columns (Example) */
.btolat-stats-table td.team-name-cell { /* Add this class in JS if needed */
    text-align: right; /* RTL */
    font-weight: 500;
}
.btolat-stats-table td.team-name-cell img {
    width: 20px;
    height: 20px;
    margin-inline-end: 8px; /* RTL */
    vertical-align: middle;
}