/* --- Theme Variables --- */
:root {
    --primary-color: #ff470f;
    /* Premier League Purple */
    --secondary-color: #048145;
    /* Bright Green */
    --accent-color: #02aa59;
    /* Bright Green */
    --background-color: #f8f8f8;
    --card-background: #ffffff;
    --text-color: #333;
    --text-color-light: #fff;
}

/* Basic Reset & App Container */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    margin: 0;
    color: var(--text-color);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 600px;
    /* Mobile-first focus */
    margin: 0 auto;
    background-color: var(--card-background);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Top Header */
.app-header {
    display: grid;
    grid-template-columns: 50px 1fr 50px;
    align-items: center;
    padding: 0 16px;
    height: 56px;
    background-color: var(--secondary-color);
    color: var(--text-color-light);
    flex-shrink: 0;
    gap: 10px;
}

.header-icons {
    display: flex;
    justify-content: flex-end;
}

.header-nav-left {
    display: flex;
    justify-content: flex-start;
}

.header-nav-left a {
    color: var(--primary-color);
    font-size: 1.2em;
    padding: 10px;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-icon {
    color: var(--primary-color);
    font-size: 1.2em;
    padding: 10px;
    text-decoration: none;
    display: flex;
}

.icon-placeholder {
    width: 24px;
    height: 24px;
    /* Placeholder style */
    border: 1px solid var(--text-color-light);
    border-radius: 50%;
}

/* Main Content Area */
#app-content {
    flex-grow: 1;
    overflow-y: auto;
}

.view-container {
    width: 100%;
    padding: 16px;
    box-sizing: border-box;
}

/* Bottom Navigation */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    background-color: var(--primary-color);
    /* Orange background */
    flex-shrink: 0;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
}

.bottom-nav a {
    color: var(--text-color-light);
    /* Use light color for better contrast */
    opacity: 0.7;
    /* Dim inactive items */
    text-decoration: none;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    padding: 4px 8px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    transition: opacity 0.2s;
    border-top: 3px solid transparent;
}

.bottom-nav .nav-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

.bottom-nav a.active {
    opacity: 1;
    /* Make active item fully visible */
    border-top-color: var(--secondary-color);
    /* Keep the green accent for the active border */
}

/* Simple Form Styles */
#login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#login-form input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

#login-form button {
    padding: 12px;
    background-color: #1877f2;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

/* --- List & Fixture Styles --- */
.list-container .list-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
}

.fixture-item {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: inherit;
}

.item-logo {
    width: 30px;
    height: 30px;
    margin-right: 15px;
}

.fixture-item:last-child {
    border-bottom: none;
}

.fixture-item .team {
    display: flex;
    align-items: center;
    font-size: 1em;
    font-weight: 600;
    gap: 8px;
}

.fixture-item .away-team {
    justify-content: flex-end;
    text-align: right;
}

.table-logo {
    width: 24px;
    height: 24px;
}

.score-box {
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    padding: 4px 12px;
    background-color: #f0f2f5;
    border-radius: 6px;
    min-width: 60px;
}

.score-box .time,
.score-box .date {
    display: block;
    font-size: 0.75em;
    font-weight: normal;
    color: #666;
}

.score-box .date {
    font-size: 0.65em;
}

/* --- League Table & Tabs Styles --- */
.tabs {
    display: flex;
    background-color: var(--card-background);
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
}

.tab-link {
    flex-grow: 1;
    text-align: center;
    padding: 14px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: bold;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-bottom-color 0.2s;
}

.tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    padding: 0;
}

/* Remove padding to allow lists to go edge-to-edge */

.table-wrapper {
    overflow-x: auto;
    padding: 0 16px;
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1em;
}

.styled-table thead tr {
    background-color: var(--secondary-color);
    color: var(--text-color-light);
    text-align: left;
}

.styled-table th,
.styled-table td {
    padding: 14px 10px;
    text-align: center;
}

.styled-table th:nth-child(2),
.styled-table td:nth-child(2) {
    text-align: left;
}

.styled-table tbody tr {
    border-bottom: 1px solid #eee;
}

.styled-table .team-name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.styled-table .actions-cell {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.btn-sm {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.8em;
}

.btn-edit {
    background-color: #ffc107;
    color: #212529;
}

.btn-delete {
    background-color: #dc3545;
    color: white;
}

.btn-save {
    background-color: #28a745;
    color: white;
}

.btn-sm:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* --- Account Panel Styles --- */
.account-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    z-index: 99;
    transition: opacity 0.3s, visibility 0.3s;
}

.account-panel-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.account-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--card-background);
    padding: 20px;
    padding-bottom: 80px;
    /* Space for nav bar */
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 100;
    max-height: 70vh;
    overflow-y: auto;
}

.account-panel.visible {
    transform: translateY(0);
}

.account-panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.account-panel li {
    padding: 14px 0;
    border-bottom: 1px solid #eee;
}

.account-panel a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: bold;
}

/* --- Match Detail Styles --- */
.match-detail-section {
    margin-top: 24px;
}

.match-detail-section h3 {
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.lineups-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.lineup-team h4 {
    margin-top: 0;
}

.lineup-team h5 {
    margin-bottom: 5px;
    color: #666;
}

.lineup-team ul {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
    font-size: 0.9em;
}

.lineup-team li {
    padding: 4px 0;
}

.timeline-event {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
}

.timeline-event .minute {
    font-weight: bold;
    width: 30px;
}

.timeline-event .event-icon {
    width: 20px;
    text-align: center;
    font-size: 1.1em;
}

/* Icon-specific colors */
.event-icon .yellow-card {
    color: #ffc107;
}

.event-icon .red-card {
    color: #dc3545;
}

.event-icon .substitution-in {
    color: green;
}

.event-icon .substitution-out {
    color: red;
}

/* --- New Match Detail Hero & Tabs --- */
.match-hero {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    background-color: var(--primary-color);
    color: var(--text-color-light);
    padding: 20px 16px;
}

.hero-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.hero-team.away {
    align-items: flex-end;
}

.hero-team.home {
    align-items: flex-start;
}

.hero-logo {
    width: 60px;
    height: 60px;
    background-color: #fff;
    border-radius: 50%;
    padding: 5px;
    box-sizing: border-box;
}

.hero-team-name {
    font-weight: bold;
    font-size: 1.1em;
}

.hero-score {
    text-align: center;
}

.hero-score .score {
    font-size: 2.5em;
    font-weight: bold;
}

.hero-score .match-status {
    font-size: 0.8em;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 5px;
    text-transform: uppercase;
}

.match-tabs {
    display: flex;
    background-color: var(--card-background);
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 10;
}

.match-tab-link {
    flex-grow: 1;
    text-align: center;
    padding: 14px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: bold;
    border-bottom: 3px solid transparent;
}

.match-tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.match-tab-content {
    padding: 16px;
}

/* Match Event Timeline */
.timeline-container {
    padding: 20px 15px;
    position: relative;
}

.timeline-container::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: calc(100% - 40px);
    background-color: #e0e0e0;
    z-index: 1;
}

.timeline-event {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
    width: 50%;
    box-sizing: border-box;
}

.timeline-event.home-event {
    flex-direction: row-reverse;
    padding-right: 30px;
    text-align: right;
}

.timeline-event.away-event {
    flex-direction: row;
    margin-left: 50%;
    padding-left: 30px;
}

.timeline-event .minute {
    font-weight: bold;
    color: #555;
    min-width: 30px;
}

.timeline-event.home-event .event-icon {
    left: 100%;
    transform: translateX(-50%);
}

.timeline-event.away-event .event-icon {
    right: 100%;
    transform: translateX(50%);
}

.assist-text {
    font-size: 0.8em;
    color: #666;
    display: block;
    margin-top: 2px;
}

/* Comments Section */
.comments-container {
    padding: 16px;
}

.comment {
    margin-bottom: 16px;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.85em;
    color: #777;
}

.comment-author {
    font-weight: bold;
}

.comment-body {
    font-size: 0.9em;
}

.comment-form {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #ccc;
}

.comment-form textarea {
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
}

#submit-comment-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}


/* --- Visual Lineup Styles --- */
.pitch {
    background-color: #53a053;
    background-image:
        linear-gradient(to bottom, transparent 49.5%, white 49.5%, white 50.5%, transparent 50.5%),
        radial-gradient(circle at center, white 1px, transparent 1px);
    background-size: 100% 100%, 15px 15px;
    border: 2px solid white;
    border-radius: 8px;
    height: 400px;
    display: flex;
    flex-direction: column-reverse;
    /* Build from defense up */
    justify-content: space-around;
    padding: 10px;
}

.pitch-row {
    display: flex;
    justify-content: space-around;
}

.player-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    font-size: 10px;
    text-align: center;
}

.player-marker::before {
    content: '';
    display: block;
    width: 30px;
    height: 30px;
    background-color: var(--primary-color);
    border: 2px solid white;
    border-radius: 50%;
    margin-bottom: 4px;
}

.player-marker span {
    background-color: rgba(0, 0, 0, 0.5);
    padding: 1px 4px;
    border-radius: 3px;
}

.subs-list {
    font-size: 0.9em;
    list-style: none;
    padding: 0;
}

/* --- Dashboard / Latest View Styles --- */
.dashboard-view {
    padding: 0;
}

.dashboard-section {
    margin-bottom: 16px;
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.dashboard-title {
    font-size: 1.1em;
    padding: 12px 16px;
    margin: 0;
    background-color: #f7f7f7;
    border-bottom: 1px solid #eee;
}

.fixture-list {
    padding: 0;
}

.no-data-msg {
    padding: 16px;
    color: #888;
    text-align: center;
}

.live-badge {
    display: block;
    font-size: 0.6em;
    color: #dc3545;
    font-weight: bold;
}

.table-wrapper-snapshot {
    padding: 0 16px;
}

.view-full-link {
    display: block;
    text-align: center;
    padding: 12px;
    background-color: #f0f2f5;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: bold;
    transition: background-color 0.2s;
}

.view-full-link:hover {
    background-color: #e4e6eb;
}

.fantasy-dashboard {
    padding: 0;
    background-color: #f0f2f5;
}

.fantasy-header {
    background: var(--primary-color);
    color: var(--text-color-light);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.points-display {
    text-align: center;
}

.points-display .points-value {
    font-size: 2.5em;
    font-weight: bold;
    display: block;
}

.points-display .points-label {
    font-size: 0.8em;
    opacity: 0.8;
}

.team-name-display {
    text-align: right;
}

.team-name-display h4 {
    margin: 0 0 4px 0;
    font-size: 1.2em;
}

/* Fantasy Pitch & Players */
.fantasy-pitch {
    background-color: #53a053;
    border: 2px solid white;
    position: relative;
    /* For line positioning */
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 10px;
    box-sizing: border-box;
}

/* Pitch Lines */
.fantasy-pitch::before {
    /* Center Line */
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 2px solid rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.fantasy-pitch::after {
    /* Center Circle */
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* Bench Styles */
.bench {
    background-color: #e4e6eb;
    padding: 10px;
    display: flex;
    justify-content: space-around;
    border-top: 4px solid #333;
}

.bench-player {
    text-align: center;
    cursor: pointer;
}

.bench-player .player-image,
.fantasy-player .player-image {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    object-fit: cover;
    background-color: #fff;
}

.bench-player-info {
    font-size: 0.8em;
}

.bench-player .player-points {
    font-weight: bold;
}

.fantasy-player {
    cursor: pointer;
}

.fantasy-player .player-name,
.bench-player .player-name {
    background-color: var(--primary-color);
    color: var(--text-color-light);
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 3px;
    display: block;
    max-width: 70px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fantasy-player.selected .player-image,
.bench-player.selected .player-image {
    border-color: #ffc107;
    box-shadow: 0 0 10px #ffc107;
}

/* --- Form Table Styles --- */
.form-cell {
    display: flex;
    gap: 4px;
    justify-content: flex-start;
}

.form-bubble {
    display: inline-flex;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.8em;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.form-w {
    background-color: #28a745;
}

/* Win - Green */
.form-d {
    background-color: #fd7e14;
}

/* Draw - Orange */
.form-l {
    background-color: #dc3545;
}

/* Loss - Red */

/* --- New Filter Bar & Sub-tabs --- */
.filter-bar {
    padding: 10px 16px;
    background-color: #f0f2f5;
    border-bottom: 1px solid #ddd;
}

.gameweek-filter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-background);
    border-radius: 20px;
    padding: 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.gameweek-filter .arrow-btn {
    background: none;
    border: none;
    font-size: 1em;
    color: var(--primary-color);
    cursor: pointer;
    padding: 5px 10px;
}

.gameweek-filter #gameweek-display {
    font-weight: bold;
}

.sub-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 16px 0 16px;
    overflow-x: auto;
}

.sub-tab-link {
    padding: 8px 16px;
    border-radius: 20px;
    background-color: #e4e6eb;
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
}

.sub-tab-link.active {
    background-color: var(--primary-color);
    color: var(--text-color-light);
}

/* Season Selector in Header */
#season-selector {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color-light);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    padding: 2px 5px;
    font-weight: bold;
    margin-left: 10px;
}

.header-title-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Stats List Styles --- */
.stats-list h3 {
    padding: 0 16px;
}

.stats-row {
    display: grid;
    grid-template-columns: 30px 1fr 40px;
    align-items: center;
    gap: 15px;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
}

.stats-row .rank {
    font-weight: bold;
    color: #888;
    text-align: center;
}

.stats-row .player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats-row .player-name-club {
    display: flex;
    flex-direction: column;
}

.stats-row .player-name {
    font-weight: 600;
}

.stats-row .club-name {
    font-size: 0.85em;
    color: #666;
}

.stats-row .stat-value {
    font-weight: bold;
    font-size: 1.1em;
    text-align: center;
}


/* --- Form Table Styles --- */
.form-cell {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.form-bubble {
    display: inline-flex;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.8em;
}

.form-w {
    background-color: #28a745;
}

/* Win - Green */
.form-d {
    background-color: #fd7e14;
}

/* Draw - Orange */
.form-l {
    background-color: #dc3545;
}

/* Loss - Red */

/* --- New Filter Bar & Sub-tabs --- */
.filter-bar {
    padding: 10px 16px;
    background-color: #f0f2f5;
    border-bottom: 1px solid #ddd;
}

.gameweek-filter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--card-background);
    border-radius: 20px;
    padding: 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.gameweek-filter .arrow-btn {
    background: none;
    border: none;
    font-size: 1em;
    color: var(--primary-color);
    cursor: pointer;
    padding: 5px 10px;
}

.gameweek-filter #gameweek-display {
    font-weight: bold;
}

.sub-tabs {
    display: flex;
    gap: 10px;
    padding: 0 16px 16px 16px;
    border-bottom: 1px solid #eee;
    margin-bottom: 16px;
}

.sub-tab-link {
    padding: 8px 16px;
    border-radius: 20px;
    background-color: #eee;
    color: #555;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
}

.sub-tab-link.active {
    background-color: var(--primary-color);
    color: var(--text-color-light);
}


/* --- Stats List Styles --- */
.stats-list h3 {
    padding: 0 16px;
}

.stats-row {
    .fantasy-form-container {
        padding: 20px;
    }

    .fantasy-form-container h3 {
        text-align: center;
        margin-bottom: 20px;
        color: var(--primary-color);
    }

    .fantasy-form-container p {
        text-align: center;
        margin-bottom: 20px;
    }

    #create-fantasy-team-form {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    #create-fantasy-team-form input {
        padding: 12px;
        border: 1px solid #ddd;
        border-radius: 8px;
        font-size: 1em;
    }

    #create-fantasy-team-form button {
        padding: 12px;
        background-color: var(--primary-color);
        color: var(--text-color-light);
        border: none;
        border-radius: 8px;
        font-size: 1.1em;
        font-weight: bold;
        cursor: pointer;
    }

    /* Player Selection List */
    .player-selection-list {
        margin-top: 20px;
        border-top: 1px solid #eee;
    }

    .player-selection-item {
        display: grid;
        grid-template-columns: 2fr 2fr 1fr 60px;
        align-items: center;
        padding: 12px 0;
        border-bottom: 1px solid #eee;
    }

    .player-selection-item .player-name {
        font-weight: bold;
    }

    .player-selection-item .player-details {
        font-size: 0.85em;
        color: #666;
    }

    .player-selection-item .player-price {
        font-weight: bold;
        text-align: right;
    }

    .player-selection-item .add-player-btn {
        background-color: var(--secondary-color);
        color: var(--primary-color);
        border: none;
        border-radius: 5px;
        padding: 6px 10px;
        font-size: 0.8em;
        cursor: pointer;
    }

    .player-selection-item .add-player-btn.selected {
        background-color: #dc3545;
        /* Red for remove */
        color: white;
    }

    #squad-summary {
        background-color: #f0f2f5;
        padding: 10px;
        border-radius: 8px;
        margin-bottom: 15px;
        text-align: center;
        font-weight: bold;
    }

    #submit-squad-btn {
        margin-top: 20px;
        padding: 12px;
        background-color: var(--primary-color);
        color: var(--text-color-light);
        border: none;
        border-radius: 8px;
        font-size: 1.1em;
        font-weight: bold;
        cursor: pointer;
    }

    #submit-squad-btn:disabled {
        background-color: #ccc;
        cursor: not-allowed;
    }

    /* Fantasy Controls */
    .fantasy-controls {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
        padding: 10px;
        background-color: #f0f2f5;
        border-radius: 8px;
    }

    .fantasy-controls input,
    .fantasy-controls select {
        width: 100%;
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 5px;
        box-sizing: border-box;
    }

    .position-filters {
        display: flex;
        justify-content: space-between;
        gap: 5px;
    }

    .pos-filter-btn {
        flex-grow: 1;
        padding: 8px;
        border: 1px solid #ccc;
        background-color: #fff;
        border-radius: 5px;
        font-weight: bold;
        cursor: pointer;
        transition: background-color 0.2s, color 0.2s;
    }

    .pos-filter-btn.active {
        background-color: var(--primary-color);
        color: var(--text-color-light);
        border-color: var(--primary-color);
    }

    /* Livescorer View Styles */
    .livescorer-view {
        padding: 0;
    }

    .timer-bar {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        padding: 10px 16px;
        background-color: var(--primary-color);
        color: var(--text-color-light);
        position: sticky;
        top: 0;
        z-index: 20;
    }

    .score-display {
        font-size: 1.5em;
        font-weight: bold;
    }

    .timer-display {
        font-size: 2em;
        font-weight: bold;
        text-align: center;
    }

    .timer-controls {
        display: flex;
        justify-content: flex-end;
        gap: 10px;
    }

    .timer-controls button {
        background: rgba(255, 255, 255, 0.2);
        border: none;
        color: white;
        width: 35px;
        height: 35px;
        border-radius: 50%;
        font-size: 1em;
        cursor: pointer;
    }

    .livescorer-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        padding: 16px;
    }

    .team-column h4 {
        text-align: center;
        margin-top: 0;
        margin-bottom: 10px;
    }

    .event-group {
        margin-bottom: 15px;
        padding-bottom: 15px;
        border-bottom: 1px solid #eee;
    }

    .event-buttons-container {
        display: flex;
        flex-direction: column;
        gap: 8px;
        height: 100%;
    }

    .event-btn {
        padding: 12px;
        font-size: 1em;
        font-weight: 600;
        border: 1px solid #ddd;
        background-color: #fff;
        border-radius: 5px;
        cursor: pointer;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 10px;
        flex-grow: 1;
        /* Make buttons fill space */
        transition: background-color 0.2s;
    }

    .event-btn:hover {
        background-color: #f5f5f5;
    }

    .event-btn i {
        width: 20px;
        text-align: center;
    }

    .event-btn.event-color-goal {
        background-color: #28a745;
        color: white;
        border-color: #28a745;
    }

    .event-btn.event-color-penalty {
        background-color: #6f42c1;
        color: white;
        border-color: #6f42c1;
    }

    .event-btn.event-color-shot-on {
        background-color: #007bff;
        color: white;
        border-color: #007bff;
    }

    .event-btn.event-color-shot-off {
        background-color: #17a2b8;
        color: white;
        border-color: #17a2b8;
    }

    .event-btn.event-color-set-piece {
        background-color: #ffc107;
        color: #212529;
        border-color: #ffc107;
    }

    .event-btn.event-color-foul {
        background-color: #fd7e14;
        color: white;
        border-color: #fd7e14;
    }

    .event-btn.event-color-sub {
        background-color: #6c757d;
        color: white;
        border-color: #6c757d;
    }

    .event-btn.event-color-yellow-card {
        background-color: #fff;
        color: #212529;
        border-color: #ffc107;
        border-width: 2px;
    }

    .event-btn.event-color-red-card {
        background-color: #fff;
        color: #212529;
        border-color: #dc3545;
        border-width: 2px;
    }

    .event-btn.event-color-yellow-card i {
        color: #ffc107;
    }

    .event-btn.event-color-red-card i {
        color: #dc3545;
    }

    .modal-actions .btn.event-color-goal {
        background-color: #28a745;
        border-color: #28a745;
        color: white;
    }

    .modal-actions .btn.event-color-foul {
        background-color: #fd7e14;
        border-color: #fd7e14;
        color: white;
    }

    /* Modal Styles */
    .modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1000;
    }

    .modal-text {
        font-size: 1.1em;
        text-align: center;
        margin: 20px 0;
    }

    .modal-content {
        background: white;
        padding: 20px;
        border-radius: 8px;
        width: 90%;
        max-width: 400px;
    }

    .modal-content h3 {
        margin-top: 0;
        padding-bottom: 10px;
        border-bottom: 1px solid #eee;
    }

    .modal-content form {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .modal-actions {
        display: flex;
        gap: 10px;
        margin-top: 10px;
    }

    .modal-actions .btn,
    .modal-actions .btn-secondary {
        background-color: #6c757d;
        flex-grow: 1;
        padding: 10px;
        border: none;
        color: white;
        border-radius: 4px;
        cursor: pointer;
    }

    .match-controls-container {
        padding: 16px;
        position: sticky;
        bottom: 0;
        background-color: #f0f2f5;
        border-top: 1px solid #ddd;
    }

    .match-control-btn {
        width: 100%;
        padding: 15px;
        font-size: 1.2em;
        font-weight: bold;
        background-color: var(--secondary-color);
        color: white;
        border: none;
        border-radius: 8px;
        cursor: pointer;
    }

    /* Livescorer View Styles */
    .livescorer-view .match-hero {
        border-radius: 8px;
        margin-bottom: 20px;
    }

    .livescorer-panel {
        background: var(--card-background);
        padding: 16px;
        border-radius: 8px;
        margin-bottom: 20px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }

    .livescorer-panel h4 {
        margin-top: 0;
        border-bottom: 1px solid #eee;
        padding-bottom: 10px;
    }

    .livescorer-actions {
        display: flex;
        gap: 10px;
    }

    .livescorer-actions .action-btn {
        flex-grow: 1;
        padding: 10px;
        font-weight: bold;
        border-radius: 5px;
        border: 1px solid;
        cursor: pointer;
    }

    .livescorer-actions .action-btn[data-status="live"] {
        background-color: #d4edda;
        border-color: #c3e6cb;
        color: #155724;
    }

    .livescorer-actions .action-btn[data-status="finished"] {
        background-color: #f8d7da;
        border-color: #f5c6cb;
        color: #721c24;
    }

    #log-event-form {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    #log-event-form select,
    #log-event-form input {
        padding: 10px;
        border: 1px solid #ddd;
        border-radius: 5px;
    }

    /* Match Stats View */
    .match-stats-container {
        padding: 16px;
    }

    .stat-row-display {
        margin-bottom: 16px;
    }

    .stat-label {
        display: flex;
        justify-content: space-between;
        font-weight: bold;
        font-size: 1.1em;
        margin-bottom: 8px;
    }

    .stat-label span:nth-child(2) {
        color: #666;
        font-size: 0.9em;
    }

    .stat-bar-container {
        display: flex;
        height: 8px;
        border-radius: 4px;
        overflow: hidden;
        background-color: #e9ecef;
    }

    .stat-bar {
        height: 100%;
        transition: width 0.5s ease-in-out;
    }

    .home-bar {
        background-color: var(--primary-color);
    }

    .away-bar {
        background-color: #6c757d;
    }

    /* Search View Styles */
    .search-view {
        padding: 16px;
    }

    .search-input-container {
        position: relative;
        margin-bottom: 20px;
    }

    #global-search-input {
        width: 100%;
        padding: 12px 40px 12px 15px;
        /* Adjust padding for icon */
        border: 1px solid #ddd;
        border-radius: 25px;
        font-size: 1em;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .search-icon {
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        color: #888;
    }

    /* Club Profile View */
    .club-profile-hero {
        background: var(--primary-color);
        color: var(--text-color-light);
        padding: 20px;
        text-align: center;
    }

    .club-hero-logo {
        width: 100px;
        height: 100px;
        border-radius: 50%;
        background-color: #fff;
        padding: 5px;
        box-sizing: border-box;
        margin: 0 auto 10px auto;
        display: block;
        object-fit: cover;
    }

    .club-profile-hero h1 {
        margin: 0;
        font-size: 2em;
    }

    .club-profile-hero p {
        margin: 5px 0 0 0;
        opacity: 0.8;
    }

    .squad-number {
        font-weight: bold;
        color: #888;
        width: 40px;
        text-align: center;
    }

    .squad-player-info {
        display: flex;
        flex-direction: column;
    }

    .squad-player-info .player-position {
        font-size: 0.85em;
        color: #666;
    }

    /* Follow Button */
    .follow-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        max-width: 200px;
        margin: 16px auto;
        padding: 10px;
        font-size: 1em;
        font-weight: bold;
        border-radius: 20px;
        cursor: pointer;
        transition: background-color 0.2s, color 0.2s;
    }

    .follow-btn {
        background-color: var(--secondary-color);
        color: var(--primary-color);
        border: 2px solid var(--secondary-color);
    }

    .follow-btn.following {
        background-color: transparent;
        color: var(--secondary-color);
        border: 2px solid var(--secondary-color);
    }

    .player-profile-hero .follow-btn.following {
        color: var(--text-color-light);
        border-color: var(--text-color-light);
    }

    .blinking-colon {
        animation: blink 1s infinite;
    }

    /* Lineup Builder Styles */
    .formation-selection-container {
        display: flex;
        flex-direction: column;
        gap: 20px;
        padding: 20px;
        align-items: center;
    }

    .formation-selection-container select {
        width: 100%;
        max-width: 300px;
        padding: 10px;
        font-size: 1em;
    }

    .lineup-builder-pitch {
        background-color: #53a053;
        border: 2px solid rgba(255, 255, 255, 0.5);
        height: 400px;
        position: relative;
        display: flex;
        flex-direction: column-reverse;
        /* GK at the bottom */
        justify-content: space-around;
        padding: 10px;
        box-sizing: border-box;
        margin-bottom: 20px;
    }

    .lineup-builder-row {
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    .player-slot {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        background-color: rgba(0, 0, 0, 0.3);
        border: 2px dashed rgba(255, 255, 255, 0.5);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        color: white;
        font-size: 0.7em;
        cursor: pointer;
        text-align: center;
        position: relative;
    }

    .player-slot.filled {
        background-color: var(--primary-color);
        border: 2px solid white;
    }

    .player-slot .player-name {
        font-weight: bold;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 55px;
    }

    .lineup-builder-bench {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
        gap: 10px;
    }

    .player-picker-modal .list-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        cursor: pointer;
    }

    .player-picker-modal .list-item:hover {
        background-color: #f0f0f0;
    }

    .player-picker-modal .list-item.unavailable {
        color: #999;
        cursor: not-allowed;
        text-decoration: line-through;
    }