/**
 * MyBiz League Manager Frontend Styles
 * Consistent styling based on MyLocalLeague design
 */

:root {
    --mybiz-lm-primary: #3f6675;
    --mybiz-lm-primary-dark: #2c4b57;
    --mybiz-lm-primary-light: rgba(63, 102, 117, 0.15);
    --mybiz-lm-primary-medium: rgba(63, 102, 117, 0.25);
}

/* League Tables Wrapper */
.mybiz-lm-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(--mybiz-lm-primary-light);
    border-radius: 6px;
    overflow: hidden;
}

/* League Selector */
.mybiz-lm-league-selector {
    background: #f5f8fa;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.mybiz-lm-league-selector label {
    font-weight: 600;
    margin-right: 8px;
    color: var(--mybiz-lm-primary);
    font-size: 15px;
}

.mybiz-lm-league-selector select,
.mybiz-lm-select {
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #ced4da;
    width: auto;
    min-width: 200px;
    max-width: 100%;
    background: #fff;
    font-size: 15px;
    color: #333;
    height: auto;
    min-height: 42px;
    line-height: 1.5;
}

.mybiz-lm-league-selector select:focus,
.mybiz-lm-select:focus {
    border-color: var(--mybiz-lm-primary);
    outline: none;
    box-shadow: 0 0 0 2px var(--mybiz-lm-primary-light);
}

#mybiz-lm-league-table-display {
    padding: 15px;
}

/* League Table Container */
.mybiz-lm-league-table-container {
    margin-bottom: 30px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(63, 102, 117, 0.1);
    overflow: visible;
}

/* League Table */
.mybiz-lm-league-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 15px;
    background: #fff;
    border: none;
    margin: 0;
}

/* Table Header */
.mybiz-lm-league-table thead {
    background: #f1f5f9;
}

.mybiz-lm-league-table thead th {
    color: var(--mybiz-lm-primary);
    font-weight: 600;
    padding: 12px 8px;
    border: none;
    text-align: center;
    font-size: 14px;
    border-bottom: 2px solid #e2e8f0;
    letter-spacing: 0px;
}

.mybiz-lm-league-table thead th:first-child {
    width: 35px;
    text-align: center;
}

.mybiz-lm-league-table thead th:nth-child(2) {
    text-align: left;
}

/* Table Body */
.mybiz-lm-league-table tbody td {
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
    text-align: center;
    color: #374151;
    font-size: 14px;
}

.mybiz-lm-league-table tbody td:nth-child(2) {
    text-align: left;
    font-weight: 500;
}

/* Position Column */
.mybiz-lm-league-table tbody td:first-child {
    font-weight: 600;
    color: var(--mybiz-lm-primary);
    text-align: center;
}

/* Alternating Rows */
.mybiz-lm-league-table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

.mybiz-lm-league-table tbody tr:hover {
    background-color: var(--mybiz-lm-primary-light);
}

/* Points Column */
.mybiz-lm-league-table tbody td:last-child {
    font-weight: 700;
    color: var(--mybiz-lm-primary);
    background-color: var(--mybiz-lm-primary-light);
}

/* Champion Row */
.mybiz-lm-league-table tbody tr.champion {
    background-color: #fef3c7 !important;
    border-left: 4px solid #f59e0b;
}

.mybiz-lm-league-table tbody tr.champion td:first-child {
    color: var(--mybiz-lm-primary-dark);
}

/* Wooden Spoon Row */
.mybiz-lm-league-table tbody tr.wooden-spoon {
    background-color: #fee2e2 !important;
    border-left: 4px solid #ef4444;
}

/* Table Controls */
.mybiz-lm-table-controls {
    padding: 12px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.mybiz-lm-toggle-expanded-stats {
    padding: 8px 16px;
    background: var(--mybiz-lm-primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.mybiz-lm-toggle-expanded-stats:hover {
    background: var(--mybiz-lm-primary-dark);
}

/* Legend */
.mybiz-lm-legend {
    margin: 20px 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.mybiz-lm-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mybiz-lm-legend-champion {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    animation: celebrate 2s ease-in-out infinite;
}

.mybiz-lm-legend-badge {
    font-size: 20px;
    animation: bounce 1s ease-in-out infinite;
}

.mybiz-lm-legend-text {
    color: #92400e;
}

@keyframes celebrate {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 4px 8px rgba(245, 158, 11, 0.4);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

/* Extended Stats Key */
.mybiz-lm-extended-stats-key {
    padding: 12px 16px;
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
    font-size: 13px;
    color: #64748b;
}

.mybiz-lm-extended-stats-key p {
    margin: 5px 0;
}

.mybiz-lm-extended-stats-key strong {
    color: var(--mybiz-lm-primary);
}

/* Fixtures Wrapper */
.mybiz-lm-fixtures-wrapper {
    max-width: 1200px;
    margin: 20px auto;
}

.mybiz-lm-fixtures-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 15px;
}

/* Fixture Card */
.mybiz-lm-fixture-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.mybiz-lm-fixture-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mybiz-lm-fixture-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--mybiz-lm-primary-light);
}

.mybiz-lm-fixture-date {
    font-weight: 600;
    color: var(--mybiz-lm-primary);
    font-size: 14px;
}

.mybiz-lm-fixture-time {
    font-weight: 500;
    color: #666;
    font-size: 13px;
}

.mybiz-lm-fixture-teams {
    text-align: center;
    margin: 15px 0;
}

.mybiz-lm-team {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    padding: 5px 0;
}

.mybiz-lm-vs {
    font-size: 12px;
    color: #999;
    margin: 8px 0;
    font-weight: 500;
}

.mybiz-lm-fixture-venue {
    text-align: center;
    color: #666;
    font-size: 13px;
    margin-top: 12px;
}

.mybiz-lm-venue-icon {
    font-size: 14px;
}

.mybiz-lm-fixture-score {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.mybiz-lm-score {
    font-weight: 700;
    font-size: 18px;
    color: var(--mybiz-lm-primary);
}

/* Teams Wrapper */
.mybiz-lm-teams-wrapper {
    max-width: 1200px;
    margin: 20px auto;
    padding: 15px;
}

.mybiz-lm-teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.mybiz-lm-team-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.mybiz-lm-team-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mybiz-lm-team-name {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--mybiz-lm-primary);
}

.mybiz-lm-team-captain,
.mybiz-lm-team-phone {
    margin: 8px 0;
    font-size: 14px;
    color: #666;
}

/* Tournaments Wrapper */
.mybiz-lm-tournaments-wrapper {
    max-width: 1200px;
    margin: 20px auto;
    padding: 15px;
}

.mybiz-lm-tournaments-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.mybiz-lm-tournament-card {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.mybiz-lm-tournament-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mybiz-lm-tournament-name {
    margin: 0 0 15px 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--mybiz-lm-primary);
}

.mybiz-lm-tournament-dates {
    margin: 10px 0;
    font-size: 14px;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mybiz-lm-league-selector {
        flex-direction: column;
        align-items: flex-start;
    }

    .mybiz-lm-league-selector select,
    .mybiz-lm-select {
        width: 100%;
        min-width: unset;
    }

    .mybiz-lm-fixtures-list,
    .mybiz-lm-teams-grid,
    .mybiz-lm-tournaments-list {
        grid-template-columns: 1fr;
    }

    .mybiz-lm-league-table {
        font-size: 12px;
    }

    .mybiz-lm-league-table thead th,
    .mybiz-lm-league-table tbody td {
        padding: 8px 4px;
    }
}

/* Loading State */
.mybiz-lm-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.mybiz-lm-loading::after {
    content: "...";
    animation: mybiz-lm-dots 1.5s steps(4, end) infinite;
}

@keyframes mybiz-lm-dots {
    0%, 20% {
        content: ".";
    }
    40% {
        content: "..";
    }
    60% {
        content: "...";
    }
    80%, 100% {
        content: "";
    }
}

/* Score Updater Styles */
.mybiz-lm-score-updater-wrapper {
    max-width: 100%;
    margin: 30px auto;
}

.mybiz-lm-score-updater-wrapper h2 {
    color: var(--mybiz-lm-primary);
    margin-bottom: 20px;
    font-size: 28px;
}

.mybiz-lm-score-filters {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: end;
    border: 1px solid #e9ecef;
}

.mybiz-lm-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mybiz-lm-filter-group label {
    font-weight: 600;
    font-size: 13px;
    color: var(--mybiz-lm-primary);
}

.mybiz-lm-filter {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    min-width: 150px;
}

.mybiz-lm-filter:focus {
    outline: none;
    border-color: var(--mybiz-lm-primary);
    box-shadow: 0 0 0 3px var(--mybiz-lm-primary-light);
}

.mybiz-lm-view-toggle {
    margin-left: auto;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

.mybiz-lm-view-btn {
    padding: 8px 16px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #495057;
}

.mybiz-lm-view-btn:hover {
    background: #f8f9fa;
    border-color: var(--mybiz-lm-primary);
}

.mybiz-lm-view-btn.active {
    background: var(--mybiz-lm-primary);
    color: white;
    border-color: var(--mybiz-lm-primary);
}

.mybiz-lm-score-updater-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.mybiz-lm-date-group {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.mybiz-lm-date-header {
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--mybiz-lm-primary);
    color: var(--mybiz-lm-primary);
    font-size: 24px;
    font-weight: 700;
}

.mybiz-lm-division-group {
    margin-bottom: 25px;
}

.mybiz-lm-division-group:last-child {
    margin-bottom: 0;
}

.mybiz-lm-division-header {
    margin: 0 0 15px 0;
    padding: 10px 15px;
    background: white;
    border-left: 4px solid var(--mybiz-lm-primary);
    border-radius: 4px;
    color: var(--mybiz-lm-primary-dark);
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.mybiz-lm-fixtures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 15px;
}

.mybiz-lm-view-list .mybiz-lm-fixtures-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mybiz-lm-no-results {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-size: 16px;
}

.mybiz-lm-no-results p {
    margin: 0;
}

.mybiz-lm-score-card {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s;
}

.mybiz-lm-score-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.mybiz-lm-score-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
    gap: 10px;
}

.mybiz-lm-score-date {
    font-weight: 600;
    color: var(--mybiz-lm-primary);
    font-size: 16px;
}

.mybiz-lm-score-time {
    color: #6c757d;
    font-size: 14px;
}

.mybiz-lm-score-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.mybiz-lm-score-status.scheduled {
    background: #fef3c7;
    color: #92400e;
}

.mybiz-lm-score-status.completed {
    background: #d1fae5;
    color: #065f46;
}

.mybiz-lm-score-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
    margin-bottom: 15px;
}

.mybiz-lm-score-team {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mybiz-lm-score-team.mybiz-lm-home {
    align-items: flex-end;
}

.mybiz-lm-score-team.mybiz-lm-away {
    align-items: flex-start;
}

.mybiz-lm-score-team .mybiz-lm-team-name {
    font-weight: 600;
    font-size: 16px;
    color: #212529;
}

.mybiz-lm-score-display {
    width: 80px;
    padding: 10px;
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    border: 3px solid var(--mybiz-lm-primary);
    border-radius: 8px;
    background: #f8f9fa;
    color: var(--mybiz-lm-primary);
}

.mybiz-lm-score-input {
    width: 80px;
    padding: 10px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    border: 2px solid var(--mybiz-lm-primary);
    border-radius: 6px;
    background: #fff;
}

.mybiz-lm-score-input:focus {
    outline: none;
    border-color: var(--mybiz-lm-primary-dark);
    box-shadow: 0 0 0 3px var(--mybiz-lm-primary-light);
}

.mybiz-lm-score-teams .mybiz-lm-vs {
    font-weight: 700;
    font-size: 18px;
    color: #6c757d;
}

.mybiz-lm-score-week {
    background: #e9ecef;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: #495057;
}

.mybiz-lm-hand-scores {
    background: #fff;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    border: 2px dashed #e9ecef;
}

.mybiz-lm-hand-scores h4 {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: var(--mybiz-lm-primary);
    font-weight: 600;
}

.mybiz-lm-hand-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.mybiz-lm-hand-row:last-child {
    margin-bottom: 0;
}

.mybiz-lm-hand-row label {
    font-weight: 600;
    min-width: 60px;
    font-size: 14px;
}

.mybiz-lm-hand-input {
    width: 70px;
    padding: 8px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    border: 2px solid #ced4da;
    border-radius: 6px;
    transition: all 0.2s;
}

.mybiz-lm-hand-input:focus {
    outline: none;
    border-color: var(--mybiz-lm-primary);
    box-shadow: 0 0 0 3px var(--mybiz-lm-primary-light);
    background: #fffef7;
}

.mybiz-lm-hand-row span {
    color: #6c757d;
    font-weight: 600;
}

.mybiz-lm-score-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.mybiz-lm-toggle-hands,
.mybiz-lm-save-score {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.mybiz-lm-toggle-hands {
    background: #e9ecef;
    color: #495057;
}

.mybiz-lm-toggle-hands:hover {
    background: #dee2e6;
}

.mybiz-lm-save-score {
    background: var(--mybiz-lm-primary);
    color: #fff;
}

.mybiz-lm-save-score:hover:not(:disabled) {
    background: var(--mybiz-lm-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.mybiz-lm-save-score:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.mybiz-lm-save-status {
    font-weight: 600;
    font-size: 14px;
}

.mybiz-lm-save-status.success {
    color: #10b981;
}

.mybiz-lm-save-status.error {
    color: #ef4444;
}

.mybiz-lm-score-venue {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
    color: #6c757d;
    font-size: 14px;
}

@media (max-width: 768px) {
    .mybiz-lm-score-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .mybiz-lm-filter-group {
        width: 100%;
    }

    .mybiz-lm-filter {
        width: 100%;
        min-width: unset;
    }

    .mybiz-lm-view-toggle {
        margin-left: 0;
        justify-content: stretch;
    }

    .mybiz-lm-view-btn {
        flex: 1;
    }

    .mybiz-lm-fixtures-grid {
        grid-template-columns: 1fr;
    }

    .mybiz-lm-date-header {
        font-size: 20px;
    }

    .mybiz-lm-division-header {
        font-size: 16px;
    }

    .mybiz-lm-score-teams {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .mybiz-lm-score-teams .mybiz-lm-vs {
        text-align: center;
    }

    .mybiz-lm-score-team.mybiz-lm-home,
    .mybiz-lm-score-team.mybiz-lm-away {
        align-items: center;
    }

    .mybiz-lm-hand-row {
        flex-wrap: wrap;
    }

    .mybiz-lm-score-display {
        font-size: 28px;
        width: 70px;
        padding: 8px;
    }
}
