/* Leagues Page Styles */

.leagues-section {
    background: white;
    margin: 2rem auto;
    padding: 2rem 0;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    min-height: 70vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    margin-bottom: 2rem;
}

.page-header h1 {
    color: #2c3e50;
    font-size: 2rem;
    margin: 0;
}

.create-league-btn {
    background: linear-gradient(135deg, #2B5A9E 0%, #4A90E2 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.create-league-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(43, 90, 158, 0.4);
}

/* Filters Section */
.filters-container {
    display: flex;
    gap: 1rem;
    padding: 0 20px;
    margin-bottom: 2rem;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.filter-group-compact {
    flex: 0 0 auto;
    min-width: 140px;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #555;
    margin-bottom: 0.5rem;
}

.filter-input,
.filter-select {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #2B5A9E;
    box-shadow: 0 0 0 3px rgba(43, 90, 158, 0.1);
}

.clear-filters-btn {
    padding: 0.75rem 1.5rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-filters-btn:hover {
    background: #5a6268;
}

/* Leagues Grid */
.leagues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    padding: 0 20px;
}

.league-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.league-card:hover {
    border-color: #2B5A9E;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.league-header {
    margin-bottom: 0.75rem;
}

.league-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.league-abbreviation {
    display: inline-block;
    background: linear-gradient(135deg, #2B5A9E 0%, #4A90E2 100%);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.league-status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.league-status-badge.active {
    background: #d4edda;
    color: #155724;
}

.league-status-badge.completed {
    background: #e2e3e5;
    color: #383d41;
}

.league-status-badge.upcoming {
    background: #fff3cd;
    color: #856404;
}

.league-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.league-organization {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.league-organization::before {
    content: "\1F3E2";
}

.league-dates {
    font-size: 0.85rem;
    color: #888;
}

.league-description-preview {
    font-size: 0.85rem;
    color: #777;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.league-stats {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2B5A9E;
}

.stat-label {
    font-size: 0.8rem;
    color: #666;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: #999;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.no-results-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 0.5rem;
}

.no-results-subtext {
    font-size: 1rem;
    color: #999;
}

/* Create League Modal Overflow Fix */
#create-league-modal {
    overflow-y: auto;
}

#create-league-modal .modal-content {
    margin: 2rem auto;
}

/* Modal Styles */
.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.cancel-btn {
    flex: 1;
    padding: 0.75rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cancel-btn:hover {
    background: #5a6268;
}

.form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Rich Text Editor (League Description) */
.rich-text-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    align-items: center;
}

.toolbar-btn {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.toolbar-btn:hover {
    background: #e9ecef;
}

.toolbar-divider {
    color: #ccc;
    margin: 0 0.25rem;
}

.rich-text-editor {
    min-height: 150px;
    max-height: 500px;
    width: 100%;
    overflow-y: auto;
    padding: 1rem;
    border: 2px solid #e0e0e0;
    border-top: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    background: #fff;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    outline: none;
    display: block;
    box-sizing: border-box;
}

.rich-text-editor:focus {
    border-color: #2B5A9E;
    box-shadow: 0 0 0 3px rgba(43, 90, 158, 0.15);
}

.rich-text-editor:empty:before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
}

.rich-text-editor img {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
    display: block;
    margin: 1rem 0;
    border-radius: 8px;
}

/* ========================================
   Category Type & Points Type Toggles
   ======================================== */
.category-type-toggle,
.points-type-toggle {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
    margin-bottom: 1rem;
}

.category-type-toggle .toggle-btn,
.points-type-toggle .toggle-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    background: white;
    font-size: 0.9rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.category-type-toggle .toggle-btn:not(:last-child),
.points-type-toggle .toggle-btn:not(:last-child) {
    border-right: 2px solid #e0e0e0;
}

.category-type-toggle .toggle-btn.active,
.points-type-toggle .toggle-btn.active {
    background: linear-gradient(135deg, #2B5A9E 0%, #4A90E2 100%);
    color: white;
}

.category-type-toggle .toggle-btn:not(.active):hover,
.points-type-toggle .toggle-btn:not(.active):hover {
    background: #f0f7ff;
    color: #2B5A9E;
}

/* ========================================
   Color Category Checkboxes
   ======================================== */
.color-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.color-category-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.9rem;
}

.color-category-label:hover {
    border-color: #aaa;
}

.color-category-label input[type="checkbox"] {
    margin: 0;
}

.color-category-label input[type="checkbox"]:checked + .color-swatch + span {
    font-weight: 700;
}

.color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.color-swatch.swatch-Gold { background: #D4AF37; }
.color-swatch.swatch-White { background: #E8E8E8; border-color: #ccc; }
.color-swatch.swatch-Red { background: #C41E3A; }
.color-swatch.swatch-Blue { background: #2B5A9E; }
.color-swatch.swatch-Purple { background: #7B2D8E; }
.color-swatch.swatch-Green { background: #2E7D32; }
.color-swatch.swatch-Yellow { background: #F9A825; }

/* Highlight checked color categories */
.color-category-label:has(input:checked) {
    border-color: #2B5A9E;
    background: #f0f7ff;
}

/* PDGA Categories Section (reused from tournament create) */
.league-categories-section .category-group {
    margin-bottom: 0.75rem;
}

.league-categories-section .category-group h4 {
    font-size: 0.85rem;
    color: #555;
    margin: 0 0 0.35rem;
    font-weight: 600;
}

.league-categories-section .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0;
    font-size: 0.88rem;
    cursor: pointer;
}

/* ========================================
   Points Table (Multi-Column)
   ======================================== */
.points-table-container {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.points-table {
    max-height: 400px;
    overflow: auto;
}

.points-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.points-table table th {
    background: #f8f9fa;
    padding: 0.5rem 0.6rem;
    font-weight: 600;
    font-size: 0.82rem;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
}

.points-table table th:first-child {
    text-align: left;
    width: 70px;
}

.points-table table th .th-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.35rem;
    vertical-align: middle;
    border: 1px solid rgba(0,0,0,0.15);
}

.points-table table td {
    padding: 0.3rem 0.4rem;
    border-bottom: 1px solid #f0f0f0;
    text-align: center;
}

.points-table table td:first-child {
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    padding-left: 0.75rem;
}

.points-table table td input {
    width: 60px;
    padding: 0.3rem 0.4rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.88rem;
    text-align: center;
}

.points-table table td input:focus {
    outline: none;
    border-color: #2B5A9E;
    box-shadow: 0 0 0 2px rgba(43, 90, 158, 0.15);
}

.points-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.btn-add-position,
.btn-remove-position,
.btn-prefill-points {
    padding: 0.4rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-position:hover {
    background: #e8f4fd;
    border-color: #2B5A9E;
    color: #2B5A9E;
}

.btn-remove-position:hover {
    background: #fde8e8;
    border-color: #dc3545;
    color: #dc3545;
}

.btn-prefill-points:hover {
    background: #e8f8e8;
    border-color: #28a745;
    color: #28a745;
}

/* Points table note */
.points-table-note {
    font-size: 0.82rem;
    color: #888;
    margin: 0.5rem 0 0;
    line-height: 1.4;
}

/* ========================================= */
/* League Detail Page Styles */
/* ========================================= */

.league-detail-section {
    background: white;
    margin: 2rem auto;
    padding: 2rem 0;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    min-height: 70vh;
}

.league-detail-header {
    padding: 0 20px 1.5rem;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 1.5rem;
}

.league-detail-header .back-link {
    color: #2B5A9E;
    text-decoration: none;
    font-size: 0.95rem;
    margin-bottom: 1rem;
    display: inline-block;
}

.league-detail-header .back-link:hover {
    text-decoration: underline;
}

.league-detail-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.league-detail-title h1 {
    font-size: 2rem;
    color: #2c3e50;
    margin: 0;
}

.league-detail-meta {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    color: #666;
    font-size: 0.95rem;
}

.league-detail-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.league-detail-description {
    padding: 0 20px;
    margin-bottom: 1.5rem;
    color: #555;
    line-height: 1.6;
}

.league-detail-description img {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
    display: block;
    margin: 1rem 0;
    border-radius: 8px;
}

.league-detail-rules {
    padding: 0 20px;
    margin-bottom: 1.5rem;
}

.league-rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.rule-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.rule-card .rule-label {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.25rem;
}

.rule-card .rule-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #2B5A9E;
}

/* Tabs */
.league-tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e9ecef;
}

.league-tab {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    font-size: 1rem;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.league-tab:hover {
    color: #555;
}

.league-tab.active {
    color: #2B5A9E;
    border-bottom-color: #2B5A9E;
}

.league-tab-content {
    display: none;
    padding: 0 20px;
}

.league-tab-content.active {
    display: block;
}

/* Standings Category Tabs */
.standings-category-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.standings-cat-tab {
    padding: 8px 20px;
    border: 2px solid #dee2e6;
    border-radius: 20px;
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    color: #555;
    transition: all 0.2s;
}

.standings-cat-tab:hover {
    border-color: #2B5A9E;
    color: #2B5A9E;
}

.standings-cat-tab.active {
    background: #2B5A9E;
    color: white;
    border-color: #2B5A9E;
}

/* Standings Table */
.standings-category-section {
    margin-bottom: 2rem;
}

.standings-category-section h3 {
    font-size: 1.2rem;
    color: #2c3e50;
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
}

.standings-table-wrapper {
    overflow-x: auto;
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.standings-table th {
    background: #f8f9fa;
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}

.standings-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.standings-table tr:hover {
    background: #f8f9fa;
}

.standings-table .rank-cell {
    font-weight: 700;
    color: #2B5A9E;
    width: 40px;
}

.standings-table .player-cell {
    font-weight: 600;
}

.standings-table .total-cell {
    font-weight: 700;
    color: #2B5A9E;
    font-size: 1rem;
}

.standings-table .tournament-points {
    text-align: center;
    min-width: 50px;
}

.standings-table .tournament-points.no-play {
    color: #ccc;
}

.standings-table .tournament-points.dropped {
    color: #999;
    text-decoration: line-through;
}

.standings-table .not-qualified {
    opacity: 0.5;
}

/* Tournament List in Detail */
.league-tournament-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.league-tournament-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s;
}

.league-tournament-item:hover {
    border-color: #2B5A9E;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.league-tournament-info h4 {
    margin: 0 0 0.25rem 0;
    color: #2c3e50;
    font-size: 1rem;
}

.league-tournament-info h4 a {
    color: #2B5A9E;
    text-decoration: none;
}

.league-tournament-info h4 a:hover {
    text-decoration: underline;
}

.league-tournament-info .tournament-meta {
    font-size: 0.85rem;
    color: #888;
}

.league-tournament-status {
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.league-tournament-status.completed {
    background: #d4edda;
    color: #155724;
}

.league-tournament-status.upcoming {
    background: #fff3cd;
    color: #856404;
}

.league-tournament-status.live {
    background: #f8d7da;
    color: #721c24;
}

/* Points Distribution Table in Detail */
.points-distribution {
    max-width: 300px;
}

.points-dist-row {
    display: grid;
    grid-template-columns: 60px 1fr;
    padding: 0.35rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.points-dist-row.header {
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e9ecef;
}

.points-dist-pos {
    font-weight: 600;
    color: #2c3e50;
}

/* Edit League Modal Overflow Fix */
#edit-league-modal {
    overflow-y: auto;
}

#edit-league-modal .modal-content {
    margin: 2rem auto;
}

/* Points Formula Note (in create/edit modals) */
.points-formula-note {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

/* Points Formula Display (detail page Points tab) */
.points-formula-display {
    max-width: 500px;
}

.points-formula-max {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f0f7ff;
    border-radius: 8px;
    border-left: 4px solid #2B5A9E;
}

.points-formula-equation {
    font-size: 1rem;
    font-weight: 600;
    color: #2B5A9E;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    font-family: monospace;
}

.points-formula-explanation {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.points-formula-example {
    margin-top: 1rem;
}

.points-formula-example h4 {
    font-size: 0.95rem;
    color: #2c3e50;
    margin: 0 0 0.75rem;
}

/* Admin actions on detail page */
.league-admin-actions {
    padding: 0 20px;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-edit-league,
.btn-manage-tds,
.btn-request-delete {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-edit-league {
    background: #2B5A9E;
    color: white;
}

.btn-edit-league:hover {
    background: #1e4380;
}

.btn-manage-tds {
    background: #27ae60;
    color: white;
}

.btn-manage-tds:hover {
    background: #1e8449;
}

.btn-request-delete {
    background: #6c757d;
    color: white;
}

.btn-request-delete:hover {
    background: #dc3545;
}

/* TD Management Section */
.td-management-section {
    margin: 0 20px 1.5rem;
    padding: 1.25rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.td-management-section h3 {
    margin: 0 0 1rem;
    font-size: 1.05rem;
    color: #2c3e50;
}

.td-search-container {
    position: relative;
    margin-bottom: 1rem;
}

.td-search-container input {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.td-search-container input:focus {
    border-color: #2B5A9E;
    outline: none;
}

.td-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #2B5A9E;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
    display: none;
}

.td-search-result-item {
    padding: 0.6rem 0.85rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    transition: background 0.15s;
}

.td-search-result-item:hover {
    background: #e8f0fe;
}

.td-search-result-item:last-child {
    border-bottom: none;
}

.td-result-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.td-result-email {
    color: #888;
    font-size: 0.8rem;
}

.td-search-empty {
    padding: 0.75rem 0.85rem;
    color: #999;
    font-size: 0.85rem;
    text-align: center;
}

/* TD List */
.td-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.td-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.td-list-info {
    flex: 1;
    min-width: 0;
}

.td-list-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
    display: block;
}

.td-list-email {
    color: #888;
    font-size: 0.8rem;
    display: block;
}

.td-role-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.td-role-badge.creator {
    background: #27ae60;
    color: white;
}

.td-role-badge.td {
    background: #2B5A9E;
    color: white;
}

.btn-remove-td {
    padding: 0.3rem 0.6rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-remove-td:hover {
    background: #c82333;
}

/* View Toggle */
.league-view-toggle {
    display: none;
    padding: 0 20px;
    margin-bottom: 0.75rem;
}

.league-view-toggle .view-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 2px solid #e0e0e0;
    background: white;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.league-view-toggle .view-btn:first-child {
    border-radius: 6px 0 0 6px;
    border-right: none;
}

.league-view-toggle .view-btn:last-child {
    border-radius: 0 6px 6px 0;
}

.league-view-toggle .view-btn.active {
    background: linear-gradient(135deg, #2B5A9E 0%, #4A90E2 100%);
    border-color: #2B5A9E;
    color: white;
}

.league-view-toggle .view-icon {
    font-size: 1rem;
}

/* List View */
.leagues-grid.list-view {
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.leagues-grid.list-view .league-card {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    gap: 1rem;
}

.leagues-grid.list-view .league-header {
    flex: 1;
    margin-bottom: 0;
    min-width: 0;
}

.leagues-grid.list-view .league-name {
    font-size: 1rem;
    margin: 0;
}

.leagues-grid.list-view .league-meta {
    flex-direction: row;
    gap: 1rem;
    margin-bottom: 0;
    font-size: 0.82rem;
}

.leagues-grid.list-view .league-organization {
    display: none;
}

.leagues-grid.list-view .league-stats {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    gap: 1rem;
    flex-shrink: 0;
}

.leagues-grid.list-view .stat-value {
    font-size: 1.1rem;
}

.leagues-grid.list-view .stat-label {
    font-size: 0.72rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .leagues-section {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        padding: 1.25rem 0;
    }

    .leagues-grid {
        grid-template-columns: 1fr;
        padding: 0 15px;
    }

    .filters-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        padding: 0 15px;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .filters-container .filter-group:first-child {
        grid-column: 1 / -1;
    }

    .filters-container .filter-group-compact {
        min-width: 0;
    }

    .filters-container .clear-filters-btn {
        grid-column: 1 / -1;
    }

    .filter-group label {
        font-size: 0.85rem;
        margin-bottom: 0.3rem;
    }

    .filter-input,
    .filter-select {
        padding: 0.6rem 0.75rem;
        font-size: 0.95rem;
    }

    .clear-filters-btn {
        align-self: flex-end;
        padding: 0.6rem 1.25rem;
        font-size: 0.9rem;
    }

    .page-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
        padding: 0 15px;
        margin-bottom: 1.25rem;
    }

    .page-header h1 {
        font-size: 1.4rem;
    }

    .create-league-btn {
        width: 100%;
        padding: 0.7rem 1rem;
        font-size: 0.95rem;
        text-align: center;
    }

    .league-view-toggle {
        display: flex;
        padding: 0 15px;
    }

    .form-row-2col {
        grid-template-columns: 1fr;
    }

    .league-card {
        padding: 1rem;
    }

    .league-name {
        font-size: 1.1rem;
    }

    .league-stats {
        gap: 1rem;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    .leagues-grid.list-view .league-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .leagues-grid.list-view .league-name {
        font-size: 1rem;
    }

    .leagues-grid.list-view .league-meta {
        display: none;
    }

    .leagues-grid.list-view .league-stats {
        width: 100%;
    }

    .leagues-grid.list-view .stat-value {
        font-size: 1rem;
    }

    .league-detail-title h1 {
        font-size: 1.5rem;
    }

    .league-tabs {
        overflow-x: auto;
    }

    .league-tab {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .standings-table {
        font-size: 0.8rem;
    }

    .standings-table th,
    .standings-table td {
        padding: 0.4rem 0.5rem;
    }

    .league-tournament-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .league-rules-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .league-admin-actions {
        flex-direction: column;
        padding: 0 15px;
    }

    .btn-edit-league,
    .btn-manage-tds,
    .btn-request-delete {
        width: 100%;
        text-align: center;
    }

    .td-management-section {
        margin: 0 15px 1.5rem;
    }

    .td-list-item {
        flex-wrap: wrap;
    }

    .activity-log-table th,
    .activity-log-table td {
        padding: 0.5rem 0.6rem;
        font-size: 0.8rem;
    }

    .activity-details {
        max-width: 200px;
    }
}

/* ========================================
   Activity Log
   ======================================== */

.activity-log-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.activity-log-table thead {
    background: #2c3e50;
    color: white;
}

.activity-log-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-log-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #eee;
    font-size: 0.88rem;
    color: #333;
}

.activity-log-table tbody tr:hover {
    background: #f8f9fa;
}

.activity-log-table tbody tr:last-child td {
    border-bottom: none;
}

.activity-when {
    white-space: nowrap;
    color: #666;
    font-size: 0.82rem;
}

.activity-details {
    max-width: 400px;
    word-break: break-word;
}

.activity-who {
    font-weight: 600;
    color: #2c3e50;
    white-space: nowrap;
}

.activity-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    white-space: nowrap;
}

.activity-badge.badge-blue {
    background: #e8f0fe;
    color: #1a56db;
}

.activity-badge.badge-green {
    background: #d4edda;
    color: #155724;
}

.activity-badge.badge-orange {
    background: #fff3cd;
    color: #856404;
}

.activity-badge.badge-red {
    background: #f8d7da;
    color: #721c24;
}

/* Playoff Points Toggle */
.playoff-points-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}
.toggle-switch-label {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}
.toggle-switch-label input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-switch-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 24px;
    transition: background 0.2s;
}
.toggle-switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch-label input:checked + .toggle-switch-slider {
    background: #2e7d32;
}
.toggle-switch-label input:checked + .toggle-switch-slider::before {
    transform: translateX(20px);
}
.toggle-switch-text {
    font-size: 0.95rem;
    color: #333;
}
