/**
 * Styles for MyLocalLeague Tables - Consistent styling with plugin theme
 */
.mll-league-tables-wrapper {
    max-width: 100%;
    margin: 30px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    background: #fff;
    box-shadow: 0 1px 6px var(--mll-primary-bg-light, rgba(63, 102, 117, 0.15));
    border-radius: 6px;
    overflow: hidden;
}

/* League selector styling */
.mll-league-selector {
    background: #f5f8fa;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
}

.mll-league-selector label {
    font-weight: 600;
    margin-right: 12px;
    color: var(--mll-primary-color, #3f6675);
    font-size: 15px;
}

.mll-league-selector select {
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #ced4da;
    width: 300px;
    max-width: 100%;
    background: #fff;
    font-size: 15px;
    color: #333;
    height: auto;
    min-height: 42px;
    line-height: 1.5;
}

.mll-league-selector select:focus {
    border-color: var(--mll-primary-color, #3f6675);
    outline: none;
    box-shadow: 0 0 0 2px var(--mll-primary-bg-light, rgba(63, 102, 117, 0.2));
}

#mll-league-table-display {
    padding: 15px;
}

/* Table container */
.mll-league-table-container {
    margin-bottom: 30px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(63, 102, 117, 0.1);
    overflow: visible;
}

.mll-league-table-container h3 {
    margin: 0;
    padding: 15px 20px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    background: var(--mll-primary-color, #3f6675);
    border: none;
}

/* Table controls */
.mll-table-controls {
    padding: 8px 15px;
    background: #f8fafc;
    border-bottom: 1px solid #edf2f7;
    text-align: right;
}

.mll-toggle-expanded-stats {
    background: var(--mll-primary-color, #3f6675);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.mll-toggle-expanded-stats:hover {
    background: var(--mll-primary-dark, #2c4b57);
}

/* Main table styling */
.mll-league-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 15px;
    background: #fff;
    border: none;
    margin: 0;
}

/* Table header */
.mll-league-table thead {
    background: #f1f5f9;
}

.mll-league-table thead th {
    color: var(--mll-primary-color, #3f6675);
    font-weight: 600;
    padding: 12px 8px;
    border: none;
    text-align: center;
    font-size: 14px;
    border-bottom: 2px solid #e2e8f0;
    letter-spacing: 0px;
}

.mll-league-table thead th:first-child {
    width: 35px; /* Make position column narrower */
    text-align: center;
    font-size: 0; /* Hide the "Pos" text */
}

.mll-league-table thead th:first-child::after {
    content: "#"; /* Replace with just a # symbol */
    font-size: 14px; /* Restore font size for the # symbol */
}

/* Table body */
.mll-league-table tbody td {
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
    text-align: center;
    color: #374151;
    font-size: 14px;
}

.mll-league-table tbody td:nth-child(2) {
    text-align: left;
    font-weight: 500;
}

/* Position column */
.mll-league-table tbody td:first-child {
    font-weight: 600;
    color: var(--mll-primary-color, #3f6675);
    text-align: center;
}

/* Alternating row colors */
.mll-league-table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

.mll-league-table tbody tr:hover {
    background-color: var(--mll-primary-bg-light, rgba(63, 102, 117, 0.05));
}

/* Points column */
.mll-league-table tbody td:last-child {
    font-weight: 700;
    color: var(--mll-primary-color, #3f6675);
    background-color: var(--mll-primary-bg-light, rgba(63, 102, 117, 0.05));
}

/* Champions - Highlight (1st position only) */
.mll-league-table tbody tr.champion {
    background-color: var(--mll-primary-bg-medium, rgba(63, 102, 117, 0.15));
}

.mll-league-table tbody tr.champion td:first-child {
    color: var(--mll-primary-color, #3f6675);
}

/* Mathematical Champions - Simple but prominent styling */
.mll-league-table tbody tr.mathematical-champion {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.05));
    box-shadow: inset 0 0 0 2px rgba(255, 215, 0, 0.4);
    position: relative;
}

.mll-league-table tbody tr.mathematical-champion:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.22), rgba(255, 215, 0, 0.08));
    box-shadow: inset 0 0 0 2px rgba(255, 215, 0, 0.6);
    transition: all 0.3s ease;
}

.mll-league-table tbody tr.mathematical-champion td {
    font-weight: 600;
    color: #2c3e50;
}

.mll-league-table tbody tr.mathematical-champion td:first-child {
    color: #d97706;
    font-weight: 700;
}

.mll-league-table tbody tr.mathematical-champion td:last-child {
    font-weight: 700;
    color: #d97706;
    background-color: rgba(255, 215, 0, 0.1);
}

/* Wooden Spoon - Light highlight (last position only) */
.mll-league-table tbody tr.wooden-spoon {
    background-color: var(--mll-primary-bg-light, rgba(63, 102, 117, 0.08));
}

.mll-league-table tbody tr.wooden-spoon td:first-child {
    color: var(--mll-primary-color, #3f6675);
}

/* Tiebreaker highlight */
.mll-league-table td.tiebreaker-highlight {
    background-color: var(--mll-primary-bg-medium, rgba(63, 102, 117, 0.15));
    font-weight: 700;
    position: relative;
}

.mll-league-table td.tiebreaker-highlight::after {
    content: "*";
    position: absolute;
    top: 2px;
    right: 2px;
    color: var(--mll-primary-color, #3f6675);
    font-size: 11px;
}

/* Empty tables */
.mll-league-table-container p {
    padding: 20px;
    color: #6b7280;
    font-style: italic;
    background: #f9fafb;
    margin: 0;
    text-align: center;
    border-top: 1px solid #e5e7eb;
}

/* Table legends and keys */
.mll-table-key {
    margin: 10px auto;
    font-size: 13px;
    color: #6b7280;
    padding: 10px 15px;
    background: #f9fafb;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 800px;
}

.mll-key-item {
    display: flex;
    align-items: center;
    margin-right: 15px;
}

/* Special styling for mathematical champion key item */
.mll-mathematical-champion-key {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.05));
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    font-weight: 600;
    color: #d97706;
    box-shadow: 0 2px 4px rgba(255, 215, 0, 0.2);
}

.mll-key-symbol {
    width: 14px;
    height: 14px;
    display: inline-block;
    margin-right: 6px;
    border-radius: 3px;
}

.mll-key-champions {
    background-color: rgba(63, 102, 117, 0.4);
}

.mll-key-wooden-spoon {
    background-color: rgba(63, 102, 117, 0.2);
}

/* Champions icon in key */
.mll-key-item .mll-champions-icon {
    margin-right: 8px;
    font-size: 16px;
    animation: mll-champions-pulse-slow 3s ease-in-out infinite;
    filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.6));
}

@keyframes mll-champions-pulse-slow {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.6));
    }
    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.8));
    }
}

/* Extended stats key */
.mll-extended-stats-key {
    margin-top: 10px;
    background: #f8fafc;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    border: 1px solid #e2e8f0;
}

/* Extended stats styling */
.mll-league-table .extended-stats th,
.mll-league-table .extended-stats td {
    padding: 8px 6px;
    font-size: 13px;
}

/* Special columns for home/away stats */
.mll-league-table .extended-stats th:nth-child(6),
.mll-league-table .extended-stats th:nth-child(7),
.mll-league-table .extended-stats th:nth-child(8),
.mll-league-table .extended-stats th:nth-child(9),
.mll-league-table .extended-stats td:nth-child(6),
.mll-league-table .extended-stats td:nth-child(7),
.mll-league-table .extended-stats td:nth-child(8),
.mll-league-table .extended-stats td:nth-child(9) {
    background-color: rgba(63, 102, 117, 0.05);
}

/* Balls scored/against columns */
.mll-league-table .extended-stats th:nth-child(10),
.mll-league-table .extended-stats th:nth-child(11),
.mll-league-table .extended-stats th:nth-child(12),
.mll-league-table .extended-stats th:nth-child(13),
.mll-league-table .extended-stats td:nth-child(10),
.mll-league-table .extended-stats td:nth-child(11),
.mll-league-table .extended-stats td:nth-child(12),
.mll-league-table .extended-stats td:nth-child(13) {
    background-color: rgba(63, 102, 117, 0.08);
}

/* Balls difference column styling */
.mll-league-table .extended-stats th:nth-child(14),
.mll-league-table .extended-stats td:nth-child(14) {
    background-color: rgba(63, 102, 117, 0.12);
    font-weight: 600;
}

/* Points column */
.mll-league-table .extended-stats th:nth-child(15),
.mll-league-table .extended-stats td:nth-child(15) {
    font-weight: 700;
    color: #3f6675;
    background-color: rgba(63, 102, 117, 0.05);
}

/* Loading indicator styling */
.mll-loading-container {
    text-align: center;
    padding: 30px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    margin: 15px 0;
}

.mll-loading-container p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--mll-primary-color, #3f6675);
    font-size: 16px;
}

.mll-loading-container img {
    margin-right: 10px;
    vertical-align: middle;
}

/* Team name links */
.mll-team-link {
    color: var(--mll-primary-color, #3f6675);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.mll-team-link:hover {
    color: var(--mll-primary-dark, #2c4b57);
    text-decoration: underline;
}

.mll-team-link:visited {
    color: var(--mll-primary-color, #3f6675);
}

/* Champions icon styling */
.mll-champions-icon {
    font-size: 16px;
    margin-right: 6px;
    display: inline-block;
    color: #ffd700;
    text-shadow: 0 0 3px rgba(255, 215, 0, 0.6);
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .mll-league-selector {
        padding: 15px;
    }
    
    .mll-league-selector select {
        width: 100%;
    }
    
    .mll-table-controls {
        text-align: center;
        padding: 10px;
    }
    
    .mll-league-table {
        min-width: unset; /* Remove fixed min-width to allow table to shrink */
        width: 100%;
        table-layout: fixed; /* Use fixed table layout to control column widths */
    }
    
    /* Adjust column widths for mobile */
    .mll-league-table th:first-child,
    .mll-league-table td:first-child {
        width: 25px; /* Position column - make even narrower */
    }
    
    .mll-league-table th:nth-child(2),
    .mll-league-table td:nth-child(2) {
        width: 30%; /* Team column - limit width on mobile */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .mll-league-table tbody td:nth-child(2) {
        font-size: 13px; /* Slightly smaller font for team names on mobile */
    }
    
    /* Ensure other important columns are visible */
    .mll-league-table th:nth-child(3),
    .mll-league-table td:nth-child(3),
    .mll-league-table th:nth-child(4),
    .mll-league-table td:nth-child(4),
    .mll-league-table th:nth-child(5),
    .mll-league-table td:nth-child(5),
    .mll-league-table th:last-child,
    .mll-league-table td:last-child {
        width: 12%; /* Equal width for P, W, L, PTS columns */
        padding: 8px 2px; /* Reduce padding */
    }
    
    .mll-league-table th,
    .mll-league-table td {
        padding: 8px 4px;
        font-size: 12px; /* Slightly smaller font size */
    }
}

/* For extra small screens, further optimize the layout */
@media screen and (max-width: 480px) {
    .mll-key-item {
        margin-bottom: 5px;
    }
    
    .mll-table-key {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    /* Adjust column widths for very small screens */
    .mll-league-table th:first-child,
    .mll-league-table td:first-child {
        width: 20px; /* Position column even narrower */
    }
    
    .mll-league-table th:nth-child(2),
    .mll-league-table td:nth-child(2) {
        width: 50%; /* Make team column narrower */
    }
    
    /* Further reduce padding and font size */
    .mll-league-table th,
    .mll-league-table td {
        padding: 6px 2px;
        font-size: 11px;
    }
    
    /* Hide any content overflow with ellipsis */
    .mll-league-table td {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Adjust champions icon size for very small screens */
    .mll-champions-icon {
        font-size: 14px;
        margin-right: 4px;
    }
}

/* Add landscape orientation media query to provide better experience when phone is rotated */
@media screen and (max-width: 840px) and (orientation: landscape) {
    .mll-league-table {
        min-width: 100%;
        table-layout: auto; /* Auto layout for landscape */
    }
    
    /* Reset column widths for landscape mode */
    .mll-league-table th:nth-child(2),
    .mll-league-table td:nth-child(2) {
        width: auto; /* Allow team column to expand in landscape */
        white-space: normal; /* Allow text to wrap if needed */
    }
    
    .mll-league-table th,
    .mll-league-table td {
        padding: 8px 6px;
        font-size: 13px; /* Restore font size */
    }
}

/* =============================================================================
   ALV (Appagee League Viewer) - New Shortcode Styles
   Prefix: .alv-  (replaces .mll- for new shortcodes)
   ============================================================================= */

/* CSS Custom Properties */
:root {
    --alv-primary: #3f6675;
    --alv-primary-dark: #2c4b57;
    --alv-primary-light: rgba(63, 102, 117, 0.12);
    --alv-primary-bg: rgba(63, 102, 117, 0.06);
    --alv-gold: #d97706;
    --alv-silver: #64748b;
    --alv-bronze: #92400e;
    --alv-green: #16a34a;
    --alv-red: #dc2626;
    --alv-border: #e2e8f0;
    --alv-bg-alt: #f8fafc;
    --alv-text: #374151;
    --alv-text-muted: #6b7280;
    --alv-radius: 6px;
    --alv-shadow: 0 1px 6px rgba(63, 102, 117, 0.15);
}

/* -----------------------------------------------------------------------
   Widget Container
   ----------------------------------------------------------------------- */
.alv-widget {
    max-width: 100%;
    margin: 24px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    color: var(--alv-text);
    font-size: 14px;
    line-height: 1.5;
}

.alv-widget-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--alv-primary);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--alv-border);
}

/* -----------------------------------------------------------------------
   Filters Bar
   ----------------------------------------------------------------------- */
.alv-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--alv-bg-alt);
    border: 1px solid var(--alv-border);
    border-radius: var(--alv-radius);
}

.alv-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
    flex: 1;
}

.alv-filter-group label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--alv-text-muted);
}

.alv-league-select,
.alv-division-select,
.alv-tournament-select,
.alv-team-select,
.alv-venue-select,
.alv-venue-group-select {
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    color: var(--alv-text);
    width: 100%;
    cursor: pointer;
    transition: border-color 0.2s;
}

.alv-league-select:focus,
.alv-division-select:focus,
.alv-tournament-select:focus,
.alv-team-select:focus,
.alv-venue-select:focus,
.alv-venue-group-select:focus {
    outline: none;
    border-color: var(--alv-primary);
    box-shadow: 0 0 0 2px var(--alv-primary-light);
}

.alv-filter-group-tabs {
    min-width: auto;
    flex: 0 0 auto;
}

.alv-filter-group-tabs .alv-tab-buttons {
    margin-bottom: 0;
}

/* -----------------------------------------------------------------------
   Tab Buttons
   ----------------------------------------------------------------------- */
.alv-tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
    align-items: center;
}

.alv-tab {
    padding: 6px 14px;
    border: 1px solid var(--alv-border);
    border-radius: 20px;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: var(--alv-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}

.alv-tab:hover {
    border-color: var(--alv-primary);
    color: var(--alv-primary);
}

.alv-tab.alv-active {
    background: var(--alv-primary);
    border-color: var(--alv-primary);
    color: #fff;
}

/* -----------------------------------------------------------------------
   Content Area
   ----------------------------------------------------------------------- */
.alv-content {
    position: relative;
}

.alv-hidden {
    display: none !important;
}

.alv-loading {
    text-align: center;
    padding: 32px;
    color: var(--alv-text-muted);
    font-style: italic;
}

.alv-empty {
    padding: 20px 16px;
    background: var(--alv-bg-alt);
    border: 1px solid var(--alv-border);
    border-radius: var(--alv-radius);
    color: var(--alv-text-muted);
    font-style: italic;
    text-align: center;
}

.alv-notice {
    padding: 12px 16px;
    border-radius: var(--alv-radius);
    border: 1px solid transparent;
    margin-bottom: 12px;
    font-size: 13px;
}

.alv-notice-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.alv-notice-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

/* -----------------------------------------------------------------------
   Section Headers (division / round separators)
   ----------------------------------------------------------------------- */
.alv-division-section {
    margin-bottom: 28px;
}

.alv-division-header {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: var(--alv-primary);
    margin: 0 0 1px;
    padding: 10px 16px;
    border-radius: var(--alv-radius) var(--alv-radius) 0 0;
}

.alv-date-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--alv-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0 4px;
    border-bottom: 1px solid var(--alv-border);
    margin: 16px 0 8px;
}

.alv-round-group {
    margin-bottom: 24px;
}

.alv-round-header {
    display: inline-block;
    padding: 3px 10px;
    background: var(--alv-primary-light);
    color: var(--alv-primary-dark);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Round header bar (new tournament layout) */
.alv-round-header-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background: var(--alv-primary-light);
    border-left: 4px solid var(--alv-primary);
    border-radius: 0 var(--alv-radius) var(--alv-radius) 0;
    margin-bottom: 12px;
}

.alv-round-header-bar .alv-round-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--alv-primary-dark);
}

.alv-round-header-bar .alv-round-date {
    font-size: 12px;
    color: var(--alv-text-muted);
}

.alv-round-header-bar .alv-round-match-count {
    font-size: 11px;
    color: var(--alv-text-muted);
    margin-left: auto;
}

/* Tournament match card grid */
.alv-tournament-match-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

/* Individual match card */
.alv-tournament-match-card {
    background: #fff;
    border: 1px solid var(--alv-border);
    border-left: 4px solid var(--alv-primary);
    border-radius: var(--alv-radius);
    padding: 12px;
    position: relative;
    transition: box-shadow 0.2s;
}

.alv-tournament-match-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.alv-tournament-match-card.alv-match-completed {
    border-left-color: #22c55e;
}

.alv-tournament-match-card.alv-match-preliminary {
    border-left-color: #f59e0b;
}

/* Match number badge */
.alv-match-number {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 10px;
    font-weight: 700;
    color: var(--alv-text-muted);
    background: var(--alv-bg-alt);
    padding: 1px 6px;
    border-radius: 8px;
}

/* Vertical team layout (team1 / vs / team2) */
.alv-match-teams-vertical {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
    padding-right: 32px;
}

.alv-match-team {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.alv-match-team-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--alv-text);
}

.alv-match-team.alv-winner .alv-match-team-name {
    color: #166534;
}

.alv-match-team.alv-team-placeholder .alv-match-team-name {
    font-style: italic;
    font-weight: 500;
    color: #92400e;
    font-size: 12px;
}

.alv-match-team-score {
    font-size: 16px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
    color: var(--alv-text);
}

.alv-match-team.alv-winner .alv-match-team-score {
    color: #22c55e;
}

.alv-match-vs {
    font-size: 11px;
    color: var(--alv-text-muted);
    text-transform: lowercase;
    padding-left: 2px;
}

/* Hand scores */
.alv-match-hands {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    border-top: 1px solid var(--alv-border);
    margin-top: 4px;
}

.alv-hand {
    font-size: 11px;
    color: var(--alv-text-muted);
    font-weight: 500;
}

/* Match meta (date/time/venue) */
.alv-match-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
    color: var(--alv-text-muted);
    padding-top: 6px;
    border-top: 1px solid var(--alv-border);
    margin-top: 4px;
}

.alv-tournament-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--alv-bg-alt);
    border: 1px solid var(--alv-border);
    border-radius: var(--alv-radius);
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 15px;
    color: var(--alv-primary-dark);
}

/* Tournament type badges */
.alv-tournament-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.alv-type-pairs {
    background: #fef3c7;
    color: #92400e;
}

.alv-type-league {
    background: #dbeafe;
    color: #1e40af;
}

.alv-type-division {
    background: #d1fae5;
    color: #065f46;
}

/* -----------------------------------------------------------------------
   Standings Table (.alv-standings-table)
   ----------------------------------------------------------------------- */
.alv-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--alv-radius);
    box-shadow: var(--alv-shadow);
    margin-bottom: 8px;
}

.alv-standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #fff;
}

.alv-standings-table thead tr {
    background: var(--alv-primary);
    color: #fff;
}

.alv-standings-table thead th {
    padding: 10px 8px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.3px;
    border: none;
    white-space: nowrap;
}

.alv-standings-table thead th.alv-col-team {
    text-align: left;
}

.alv-col-pos,
.alv-col-num,
.alv-col-pts {
    text-align: center;
}

.alv-col-team {
    text-align: left;
    min-width: 120px;
}

.alv-col-pts {
    font-weight: 700;
}

.alv-standings-table tbody td {
    padding: 9px 8px;
    border-bottom: 1px solid var(--alv-border);
    color: var(--alv-text);
    text-align: center;
    font-size: 14px;
}

.alv-standings-table tbody td.alv-col-team {
    text-align: left;
    font-weight: 500;
}

.alv-standings-table tbody tr:last-child td {
    border-bottom: none;
}

.alv-standings-table tbody tr:nth-child(even) {
    background: var(--alv-bg-alt);
}

.alv-standings-table tbody tr:hover {
    background: var(--alv-primary-bg);
}

/* Position highlights */
.alv-top-1 td {
    background: linear-gradient(135deg, rgba(255,215,0,0.18), rgba(255,215,0,0.06)) !important;
}

.alv-top-1 td:first-child {
    color: var(--alv-gold) !important;
    font-weight: 700 !important;
}

.alv-top-2 td:first-child {
    color: var(--alv-silver) !important;
    font-weight: 700 !important;
}

.alv-top-3 td:first-child {
    color: var(--alv-bronze) !important;
    font-weight: 700 !important;
}

.alv-standings-table tbody td:last-child {
    font-weight: 700;
    color: var(--alv-primary);
}

/* Table key */
.alv-table-key {
    font-size: 12px;
    color: var(--alv-text-muted);
    padding: 6px 0;
}

/* -----------------------------------------------------------------------
   Fixtures
   ----------------------------------------------------------------------- */
.alv-fixtures-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.alv-fixture-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--alv-border);
    border-radius: var(--alv-radius);
    transition: box-shadow 0.15s;
}

.alv-fixture-row:hover {
    box-shadow: 0 2px 8px rgba(63,102,117,0.12);
}

.alv-fixture-row.alv-played {
    border-left: 3px solid var(--alv-primary);
}

.alv-fixture-row.alv-upcoming {
    border-left: 3px solid #93c5fd;
}

.alv-fixture-teams {
    display: contents; /* use the grid above */
}

.alv-home-team {
    text-align: right;
    font-weight: 600;
    color: var(--alv-text);
    font-size: 14px;
}

.alv-away-team {
    text-align: left;
    font-weight: 600;
    color: var(--alv-text);
    font-size: 14px;
}

.alv-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 16px;
    font-weight: 700;
    color: var(--alv-primary-dark);
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
}

.alv-score-home,
.alv-score-away {
    min-width: 22px;
    text-align: center;
}

.alv-score-sep {
    color: var(--alv-text-muted);
    font-weight: 400;
}

.alv-vs {
    color: var(--alv-text-muted);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 24px;
    text-align: center;
}

/* Fixture meta (date/time/venue) */
.alv-fixture-meta-row {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    color: var(--alv-text-muted);
    padding-top: 4px;
    border-top: 1px dashed var(--alv-border);
    margin-top: 4px;
}

.alv-fixture-meta-row span {
    display: flex;
    align-items: center;
    gap: 3px;
}

/* TBD team name */
.alv-tbd-team {
    font-style: italic;
    color: var(--alv-text-muted);
    font-weight: 400;
}

/* -----------------------------------------------------------------------
   Teams Grid
   ----------------------------------------------------------------------- */
.alv-teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

/* Team card base styles moved to Enhanced Styles section below */

.alv-teams-count {
    font-size: 12px;
    color: var(--alv-text-muted);
    margin-bottom: 8px;
}

/* -----------------------------------------------------------------------
   Responsive
   ----------------------------------------------------------------------- */
@media (max-width: 640px) {
    .alv-filters {
        flex-direction: column;
    }

    .alv-filter-group {
        min-width: 100%;
    }

    .alv-fixture-row {
        grid-template-columns: 1fr auto 1fr;
        gap: 4px;
        padding: 8px 10px;
    }

    .alv-home-team,
    .alv-away-team {
        font-size: 12px;
    }

    .alv-score {
        font-size: 14px;
        min-width: 48px;
    }

    .alv-teams-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .alv-standings-table thead th,
    .alv-standings-table tbody td {
        padding: 7px 5px;
        font-size: 12px;
    }
}

/* =============================================================================
   ALV Enhanced Styles — Collapsible Dates, Color-Coded Results,
   Champion/Wooden Spoon, Rich Team Cards
   ============================================================================= */

/* -----------------------------------------------------------------------
   Expand / Collapse All Bar
   ----------------------------------------------------------------------- */
.alv-expand-collapse-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.alv-expand-all-btn,
.alv-collapse-all-btn {
    padding: 6px 14px;
    border: 1px solid var(--alv-border);
    border-radius: 4px;
    background: var(--alv-bg-alt);
    font-size: 13px;
    font-weight: 500;
    color: var(--alv-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.alv-expand-all-btn:hover,
.alv-collapse-all-btn:hover {
    background: var(--alv-primary);
    color: #fff;
    border-color: var(--alv-primary);
}

/* -----------------------------------------------------------------------
   Collapsible Date Headers
   ----------------------------------------------------------------------- */
.alv-date-header.alv-collapsible {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    padding: 10px 15px;
    background: var(--alv-primary);
    color: #fff;
    border-radius: var(--alv-radius);
    margin-top: 8px;
    font-size: 14px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    border-bottom: none;
    transition: background 0.2s;
}

.alv-date-header.alv-collapsible:hover {
    background: var(--alv-primary-dark);
}

.alv-date-header.alv-collapsible[aria-expanded="false"] {
    border-radius: var(--alv-radius);
}

.alv-date-header.alv-collapsible[aria-expanded="true"] {
    border-radius: var(--alv-radius) var(--alv-radius) 0 0;
}

.alv-date-toggle {
    font-size: 12px;
    transition: transform 0.2s;
    flex-shrink: 0;
    width: 16px;
    text-align: center;
}

.alv-date-label {
    flex: 1;
    color: inherit;
}

.alv-date-count {
    font-size: 12px;
    opacity: 0.8;
    font-weight: 400;
    margin-left: auto;
}

.alv-division-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-weight: 500;
}

.alv-date-content {
    border: 1px solid var(--alv-border);
    border-top: none;
    border-radius: 0 0 var(--alv-radius) var(--alv-radius);
    padding: 6px;
    background: #fff;
}

/* -----------------------------------------------------------------------
   Color-Coded Win/Loss for Fixture Team Names
   ----------------------------------------------------------------------- */
.alv-winner {
    color: var(--alv-green) !important;
}

.alv-loser {
    color: var(--alv-red) !important;
}

/* -----------------------------------------------------------------------
   Champion & Wooden Spoon Table Rows
   ----------------------------------------------------------------------- */
.alv-champion td {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(255, 215, 0, 0.06)) !important;
    font-weight: 600;
}

.alv-champions-icon {
    font-size: 14px;
    margin-right: 4px;
    display: inline-block;
    animation: alv-trophy-pulse 3s ease-in-out infinite;
    filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.6));
}

@keyframes alv-trophy-pulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 3px rgba(255, 215, 0, 0.6));
    }
    50% {
        transform: scale(1.15);
        filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.9));
    }
}

.alv-wooden-spoon td {
    background: rgba(63, 102, 117, 0.08) !important;
}

.alv-wooden-spoon td:first-child {
    color: var(--alv-text-muted) !important;
}

/* Table Key */
.alv-table-key {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 12px;
    color: var(--alv-text-muted);
    padding: 8px 4px;
}

.alv-key-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.alv-key-symbol {
    width: 14px;
    height: 14px;
    display: inline-block;
    border-radius: 3px;
}

.alv-key-champion {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.5), rgba(255, 215, 0, 0.2));
    border: 1px solid rgba(255, 215, 0, 0.4);
}

.alv-key-top-3 {
    background: var(--alv-primary-light);
    border: 1px solid var(--alv-primary);
}

.alv-key-wooden-spoon {
    background: rgba(63, 102, 117, 0.15);
    border: 1px solid rgba(63, 102, 117, 0.25);
}

/* -----------------------------------------------------------------------
   Rich Team Cards
   ----------------------------------------------------------------------- */
.alv-team-card {
    background: #fff;
    border: 1px solid var(--alv-border);
    border-radius: var(--alv-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
}

.alv-team-card:hover {
    box-shadow: 0 4px 14px rgba(63,102,117,0.18);
    transform: translateY(-2px);
}

.alv-team-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
}

.alv-category-league .alv-team-header {
    background: var(--alv-primary);
}

.alv-category-pairs .alv-team-header {
    background: var(--alv-gold);
}

.alv-team-header .alv-team-icon {
    font-size: 20px;
    line-height: 1;
}

.alv-team-header .alv-team-name {
    color: #fff;
}

.alv-team-content {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alv-team-detail {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 13px;
    color: var(--alv-text);
    line-height: 1.4;
}

.alv-detail-icon {
    flex-shrink: 0;
    font-size: 14px;
    line-height: 1.4;
}

/* -----------------------------------------------------------------------
   Fixture Meta (below teams line) — inside .alv-date-content
   ----------------------------------------------------------------------- */
.alv-date-content .alv-fixture-meta {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12px;
    color: var(--alv-text-muted);
    padding-top: 4px;
    border-top: 1px dashed var(--alv-border);
    margin-top: 4px;
}

/* -----------------------------------------------------------------------
   Responsive adjustments for new features
   ----------------------------------------------------------------------- */
@media (max-width: 640px) {
    .alv-date-header.alv-collapsible {
        padding: 8px 10px;
        font-size: 13px;
    }

    .alv-date-count {
        display: none;
    }

    .alv-expand-collapse-bar {
        flex-direction: column;
    }

    .alv-team-header {
        padding: 10px 12px;
        font-size: 14px;
    }

    .alv-team-content {
        padding: 10px 12px;
    }

    .alv-table-key {
        flex-direction: column;
        gap: 6px;
    }
}

/* =============================================================================
   Toggle Button — Show Detailed / Show Basic Stats
   ============================================================================= */
.alv-table-controls {
    padding: 8px 12px;
    background: var(--alv-bg-alt);
    border-bottom: 1px solid var(--alv-border);
    text-align: right;
}

.alv-toggle-stats-btn {
    background: var(--alv-primary);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.alv-toggle-stats-btn:hover {
    background: var(--alv-primary-dark);
}

/* =============================================================================
   Extended Stats Key
   ============================================================================= */
.alv-extended-stats-key {
    margin-top: 8px;
    background: var(--alv-bg-alt);
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--alv-text-muted);
    line-height: 1.5;
    border: 1px solid var(--alv-border);
}

.alv-extended-stats-key p {
    margin: 0;
}

/* =============================================================================
   Extended Stats Table — smaller text, tighter padding
   ============================================================================= */
.alv-standings-table .alv-extended-stats th,
.alv-standings-table .alv-extended-stats td {
    padding: 8px 5px;
    font-size: 12px;
    white-space: nowrap;
}

/* =============================================================================
   COMPREHENSIVE MOBILE RESPONSIVE — Tables, Fixtures, Teams, Tournaments
   ============================================================================= */

/* ---------- Tablets & Small Laptops (≤ 768px) ---------- */
@media (max-width: 768px) {
    /* Tables */
    .alv-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .alv-standings-table {
        min-width: 100%;
    }

    .alv-standings-table thead th,
    .alv-standings-table tbody td {
        padding: 8px 4px;
        font-size: 12px;
    }

    .alv-standings-table .alv-col-team {
        min-width: 90px;
        max-width: 130px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .alv-standings-table .alv-col-pos {
        width: 30px;
    }

    .alv-champions-icon {
        font-size: 12px;
        margin-right: 2px;
    }

    /* Toggle button */
    .alv-table-controls {
        text-align: center;
        padding: 8px;
    }

    .alv-toggle-stats-btn {
        width: 100%;
    }

    /* Fixtures */
    .alv-fixture-row {
        padding: 8px 10px;
    }

    .alv-home-team,
    .alv-away-team {
        font-size: 13px;
    }

    .alv-score {
        font-size: 15px;
        min-width: 50px;
    }

    /* Teams */
    .alv-teams-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 10px;
    }

    /* Tournament */
    .alv-tournament-header {
        flex-wrap: wrap;
        font-size: 14px;
        padding: 8px 12px;
    }

    .alv-round-header {
        font-size: 11px;
    }

    .alv-round-header-bar {
        flex-wrap: wrap;
        gap: 6px;
        padding: 6px 10px;
    }

    .alv-round-header-bar .alv-round-label {
        font-size: 13px;
    }

    .alv-tournament-match-grid {
        grid-template-columns: 1fr;
    }

    /* Widget title */
    .alv-widget-title {
        font-size: 18px;
    }
}

/* ---------- Phones (≤ 480px) ---------- */
@media (max-width: 480px) {
    /* Widget spacing */
    .alv-widget {
        margin: 12px 0;
        font-size: 13px;
    }

    .alv-widget-title {
        font-size: 16px;
        padding-bottom: 6px;
    }

    /* Filters */
    .alv-filters {
        padding: 8px 10px;
        gap: 8px;
    }

    .alv-filter-group label {
        font-size: 10px;
    }

    .alv-league-select,
    .alv-division-select,
    .alv-tournament-select {
        font-size: 13px;
        padding: 6px 8px;
    }

    /* Tab buttons */
    .alv-tab-buttons {
        gap: 4px;
    }

    .alv-tab {
        padding: 5px 10px;
        font-size: 12px;
    }

    /* Tables — tight layout */
    .alv-standings-table thead th,
    .alv-standings-table tbody td {
        padding: 6px 2px;
        font-size: 11px;
    }

    .alv-standings-table .alv-col-team {
        min-width: 70px;
        max-width: 100px;
        font-size: 11px;
    }

    .alv-standings-table .alv-col-pos {
        width: 24px;
    }

    .alv-champions-icon {
        font-size: 11px;
    }

    .alv-division-header {
        font-size: 14px;
        padding: 8px 12px;
    }

    /* Extended stats on phone — even smaller */
    .alv-standings-table .alv-extended-stats th,
    .alv-standings-table .alv-extended-stats td {
        padding: 5px 2px;
        font-size: 10px;
    }

    /* Fixtures — stack vertically on very small screens */
    .alv-fixture-row {
        grid-template-columns: 1fr auto 1fr;
        gap: 2px;
        padding: 6px 8px;
    }

    .alv-home-team,
    .alv-away-team {
        font-size: 12px;
    }

    .alv-score {
        font-size: 14px;
        min-width: 44px;
    }

    .alv-vs {
        font-size: 11px;
    }

    .alv-fixture-meta,
    .alv-fixture-meta-row {
        font-size: 11px;
        gap: 6px;
    }

    .alv-date-header.alv-collapsible {
        padding: 6px 8px;
        font-size: 12px;
    }

    .alv-date-content {
        padding: 4px;
    }

    /* Teams — single column */
    .alv-teams-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .alv-team-header {
        padding: 8px 10px;
        font-size: 13px;
    }

    .alv-team-content {
        padding: 8px 10px;
    }

    .alv-team-detail {
        font-size: 12px;
    }

    /* Tournament */
    .alv-tournament-header {
        padding: 6px 10px;
        font-size: 13px;
    }

    .alv-tournament-type-badge {
        font-size: 10px;
        padding: 1px 6px;
    }

    .alv-round-header {
        font-size: 10px;
        padding: 2px 8px;
    }

    /* Keys */
    .alv-table-key {
        font-size: 11px;
        gap: 4px;
    }

    .alv-extended-stats-key {
        font-size: 11px;
        padding: 8px 10px;
    }

    /* Expand/collapse */
    .alv-expand-all-btn,
    .alv-collapse-all-btn {
        font-size: 12px;
        padding: 5px 10px;
    }
}

/* ---------- Landscape phones (≤ 840px landscape) ---------- */
@media (max-width: 840px) and (orientation: landscape) {
    .alv-standings-table {
        table-layout: auto;
    }

    .alv-standings-table thead th,
    .alv-standings-table tbody td {
        padding: 8px 5px;
        font-size: 12px;
    }

    .alv-standings-table .alv-col-team {
        max-width: none;
        white-space: normal;
    }
}
