/* style.css (Version 6.5 - Merged Fixture UI Improvements) */

/* ------------------------- */
/* --- Global Variables & Resets --- */
/* ------------------------- */
:root {
    --team-color: #007BFF; 
    --light-gray: #f4f7f6;
    --medium-gray: #e0e0e0;
    --dark-gray: #333;
    --white: #fff;
    --green: #28a745;
    --red: #dc3545;
    --orange: #fd7e14;
    --pitch-green: #53a157;
    --pitch-line: rgba(255, 255, 255, 0.6);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding-bottom: 2em;
    background: var(--light-gray);
    color: var(--dark-gray);
}

body.login-page-body { 
    min-height: 100vh; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    padding: 1em; 
    box-sizing: border-box; 
    background-color: var(--team-color);
}
h1, h2, h3, h4, h5 { margin: 0.25em 0; font-weight: 600; }
hr { border: none; border-top: 1px solid #eee; margin: 1.5em 0; }

/* ------------------------- */
/* --- Login Page Styles --- */
/* ------------------------- */
.login-container {
    background: var(--white);
    padding: 2em;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-container img {
    max-width: 150px;
    margin-bottom: 1.5em;
}
.login-container h1 {
    margin-bottom: 1.5em;
}
.login-container .form-group {
    text-align: left;
    margin-bottom: 1em;
}
.login-container .error {
    color: var(--red);
    margin-top: 1em;
}


/* ------------------------- */
/* --- Common Components --- */
/* ------------------------- */

header { display: flex; align-items: center; justify-content: space-between; gap: 1em; padding: 1em 1.5em; background-color: var(--white); border-bottom: 1px solid var(--medium-gray); }
header .header-content { display: flex; align-items: center; gap: 1em; }
header img { height: 45px; border-radius: 8px; }
header h1 { font-size: 1.5em; margin: 0; }
header h2, header h3 { font-size: 1em; font-weight: 400; color: #666; margin: 0; }

.container { padding: 1em; max-width: 1200px; margin: 20px auto; }
.section { background: var(--white); padding: 1.5em; margin-bottom: 1.5em; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); border: 1px solid var(--medium-gray); }

input, select, button, textarea { margin: 0.5em 0; padding: 0.85em; width: 100%; box-sizing: border-box; border: 1px solid var(--medium-gray); border-radius: 8px; font-size: 1em; transition: border-color 0.2s, box-shadow 0.2s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--team-color); box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2); }
label { display: block; margin-bottom: 0.25em; margin-top: 0.75em; color: #555; font-weight: 500; }

button, .btn { background-color: var(--team-color); color: white; border: none; cursor: pointer; font-weight: bold; transition: filter 0.2s, transform 0.2s; text-decoration: none; display: inline-block; text-align: center; }
button:hover, .btn:hover { filter: brightness(110%); transform: translateY(-1px); }
button.success, .btn.success { background-color: var(--green); }
button.danger, .btn.danger { background-color: var(--red); }
.btn.small-btn { padding: 0.4em 0.8em; font-size: 0.9em; width: auto; }

.header-menu { margin-left: auto; position: relative; }
.menu-btn { background: none; border: none; padding: 0.5em; cursor: pointer; width: auto; margin: 0; }
.menu-btn svg { width: 24px; height: 24px; stroke: var(--team-color); }
.dropdown-menu { display: none; position: absolute; right: 0; top: 100%; background: white; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 110; min-width: 180px; overflow: hidden; }
.dropdown-menu.active { display: block; }
.dropdown-menu a { display: block; padding: 0.8em 1.2em; text-decoration: none; color: #333; font-weight: normal; }
.dropdown-menu a:hover { background-color: #f2f2f2; }
.dropdown-menu a.logout { color: var(--red); }

.modal { display: none; position: fixed; z-index: 200; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: #fefefe; margin: 10% auto; padding: 20px; border: 1px solid #888; width: 90%; max-width: 600px; border-radius: 12px; }
.modal-content img { max-width: 100%; height: auto; border-radius: 8px; }
.close-btn { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
.close-btn:hover, .close-btn:focus { color: black; text-decoration: none; }

/* ------------------------- */
/* --- Share Card Styles --- */
/* ------------------------- */
#shareCard {
    width: 600px;
    background-color: var(--white);
    border: 1px solid var(--medium-gray);
    color: var(--dark-gray);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
.share-card-header {
    background-color: var(--team-color);
    color: var(--white);
    padding: 30px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}
.share-card-header div {
    display: flex;
    flex-direction: column;
}
#shareCardLogo {
    height: 70px;
    width: 70px;
    border-radius: 8px;
}
#shareCardClubName {
    font-size: 1.8em;
    margin: 0;
    line-height: 1.1;
}
#shareCardTeamName {
    font-size: 1.2em;
    margin: 0;
    opacity: 0.8;
    font-weight: normal;
}
.share-card-body {
    padding: 30px;
    text-align: center;
}
.share-card-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-size: 1em;
    color: #666;
    margin: 0 0 5px 0;
}
.interpunct {
    font-weight: bold;
    font-size: 1.5em;
    line-height: 1;
}
.share-card-location {
    font-size: 1em;
    color: #666;
    margin: 0 0 20px 0;
    text-align: center;
}
.share-card-body h2 {
    font-size: 1.5em;
    margin: 0;
    color: var(--dark-gray);
}
.share-card-score {
    font-size: 5em;
    font-weight: 700;
    margin: 10px 0;
    color: var(--dark-gray);
}
.share-card-result-badge {
    display: inline-block;
    padding: 0.4em 1em;
    border-radius: 20px;
    color: white;
    font-weight: bold;
    margin: 10px auto;
    font-size: 1.1em;
}
.share-card-result-badge.win { background-color: var(--green); }
.share-card-result-badge.loss { background-color: var(--red); }
.share-card-result-badge.draw { background-color: var(--orange); }
.share-card-opponent {
    font-size: 1.4em; /* Reduced from 1.5em to prevent bunching */
    color: #444;
    margin: 0;
    word-wrap: break-word; /* Added to fix bunching */
}
.share-card-match-type {
    font-size: 1em;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}
.share-card-footer {
    background-color: var(--light-gray);
    padding: 15px;
    display: block;
    width: 100%;
    box-sizing: border-box;
}
.footer-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.footer-section {
    vertical-align: top;
    text-align: center;
    font-size: 0.85em;
    padding: 0 10px;
    border-right: 1px solid var(--medium-gray);
    min-height: 50px;
}
.footer-section:last-child {
    border-right: none;
}
.footer-section h4 {
    margin: 0 0 8px 0;
    font-size: 1.05em;
    color: var(--dark-gray);
}
.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 1em;
    color: #444;
}
.footer-section li {
     margin-bottom: 0.3em;
}
.footer-section p {
    margin: 0;
    padding: 0;
    color: #444;
}
#shareCardCaptain {
    font-weight: normal;
}
.share-card-disclaimer-bar {
    height: 5px;
    background-color: var(--team-color);
    width: 100%;
}
.share-card-disclaimer-text {
    background-color: var(--team-color);
    padding: 8px 10px;
    font-size: 10px;
    color: #FFFFFF;
    text-align: center;
    line-height: 1.4;
}


/* ------------------------- */
/* --- Page Specific Styles --- */
/* ------------------------- */

/* Public History Page */
.back-link { display: inline-block; margin-bottom: 1.5em; color: var(--team-color); text-decoration: none; font-weight: 600; }

.history-game-card { display: flex; justify-content: space-between; align-items: stretch; background: var(--white); border-radius: 12px; border: 1px solid var(--medium-gray); margin-bottom: 1em; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.game-card-info { padding: 1.5em; flex-grow: 1; }
.game-card-info h4 { margin: 0 0 0.5em 0; }
.game-card-info p { margin: 0 0 1em 0; color: #666; }
.game-card-result { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 1em; color: white; min-width: 120px; text-align: center; }
.game-card-result.win { background-color: var(--green); }
.game-card-result.loss { background-color: var(--red); }
.game-card-result.draw { background-color: var(--orange); }
.game-card-result .score { font-size: 1.8em; font-weight: 700; }
.game-card-result .result-text { font-size: 1em; font-weight: 600; margin-top: 0.25em; }

.game-card-detail { background: var(--white); padding: 1.5em; border-radius: 12px; border: 1px solid var(--medium-gray); }
.game-card-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--medium-gray); padding-bottom: 1em; margin-bottom: 1.5em; }
.game-card-header h2 { margin: 0; }
.score-container-detail { text-align: right; }
.score-large { font-size: 2.5em; font-weight: 700; display: block; color: var(--dark-gray); }
.result-badge-detail { font-weight: 600; padding: 0.3em 0.8em; border-radius: 6px; color: white; display: inline-block; margin-top: 0.5em; }
.score-container-detail.win .result-badge-detail { background-color: var(--green); }
.score-container-detail.loss .result-badge-detail { background-color: var(--red); }
.score-container-detail.draw .result-badge-detail { background-color: var(--orange); }

.details-panes { display: grid; grid-template-columns: 1fr; gap: 1.5em; }
@media (min-width: 768px) { .details-panes { grid-template-columns: repeat(2, 1fr); } }
.details-pane { background: var(--light-gray); padding: 1.5em; border-radius: 12px; }
.details-pane.full-width { grid-column: 1 / -1; }
.details-pane h4 { margin-top: 0; margin-bottom: 1em; padding-bottom: 0.5em; border-bottom: 1px solid var(--medium-gray); }
.details-pane .details-list li { background: none; padding: 0.5em 0; }
.weather-icon { font-size: 1.5em; vertical-align: middle; }
.award-icon { margin-right: 0.5em; }

.event-log-columns { display: grid; grid-template-columns: 1fr; gap: 1.5em; }
@media (min-width: 600px) { .event-log-columns { grid-template-columns: repeat(2, 1fr); } }
.event-log h5 { margin-top: 0; margin-bottom: 0.5em; }
.event-log p { margin: 0.3em 0; font-size: 0.9em; }
.event-icon { font-size: 1.4em; vertical-align: middle; margin-right: 0.5em; }
.location-map { width: 100%; height: 300px; border: 0; border-radius: 8px; margin-top: 10px; }

/* Dashboard Panes */
.dashboard-panes { display: grid; grid-template-columns: 1fr; gap: 1.5em; }
@media (min-width: 768px) { .dashboard-panes { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .dashboard-panes { grid-template-columns: repeat(4, 1fr); } }
.dashboard-pane { background: var(--white); padding: 1.5em; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); border: 1px solid var(--medium-gray); display: flex; flex-direction: column; }
.dashboard-pane h3 { margin-top: 0; margin-bottom: 1em; border-bottom: 1px solid var(--medium-gray); padding-bottom: 0.5em; }
.pane-highlight { font-size: 1.3em; font-weight: 600; color: var(--team-color); margin-bottom: 0.5em; }
.actions-pane { background: var(--team-color); color: white; }
.actions-pane h3 { color: white; border-bottom-color: rgba(255, 255, 255, 0.3); }
.action-buttons { display: grid; gap: 0.8em; margin-top: auto; }
.action-btn { display: block; padding: 0.8em; background-color: rgba(255, 255, 255, 0.15); color: white; text-decoration: none; border-radius: 8px; font-weight: 500; transition: background-color 0.2s; }
.action-btn:hover { background-color: rgba(255, 255, 255, 0.3); }
.last-match-score { margin: 1em 0; text-align: center; }
.score-value { font-size: 2.5em; font-weight: 700; margin-right: 0.5em; }
.result-badge { display: inline-block; padding: 0.3em 0.8em; font-size: 0.9em; font-weight: bold; color: white; border-radius: 6px; }
.result-badge.result-win { background-color: var(--green); }
.result-badge.result-loss { background-color: var(--red); }
.result-badge.result-draw { background-color: var(--orange); }
.stats-list { list-style: none; padding: 0; margin: 0; }
.stats-list li { display: flex; justify-content: space-between; align-items: center; padding: 0.8em 0; border-bottom: 1px solid var(--medium-gray); }
.stats-list li:last-child { border-bottom: none; }
.stats-list .label { font-size: 0.9em; color: #555; }
.stats-list .value { font-size: 1.2em; font-weight: 600; color: var(--dark-gray); }

/* History Admin Page */
.history-item-card { 
    display: flex; 
    flex-direction: column;
    background-color: var(--white); 
    border-radius: 12px; 
    border: 1px solid var(--medium-gray); 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); 
    margin-bottom: 1.5em; 
    overflow: hidden; 
}
@media (min-width: 768px) { 
    .history-item-card { 
        flex-direction: row;
        align-items: stretch; 
    } 
}
.history-item-result { 
    padding: 1.5em; 
    text-align: center; 
    color: white; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
}
@media (min-width: 768px) {
    .history-item-result {
        flex: 0 0 150px;
    }
}
.history-item-result.win { background-color: var(--green); }
.history-item-result.draw { background-color: var(--orange); }
.history-item-result.loss { background-color: var(--red); }
.history-item-result.status { background-color: #6c757d; }
.history-item-result .score { font-size: 2em; font-weight: 700; margin: 0; }
.history-item-result .result-text { font-size: 1.2em; font-weight: 600; margin-top: 0.25em; display: block; }
.history-item-details { padding: 1.5em; display: flex; flex-direction: column; justify-content: center; flex: 1 1 auto; }
.history-item-details h4 { margin: 0 0 0.5em 0; font-size: 1.2em; }
.history-item-details p { margin: 0.25em 0; color: #666; font-size: 0.9em; }
.history-item-actions { padding: 1.5em; display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 0.5em; align-content: center; }
@media (min-width: 768px) { .history-item-actions { grid-template-columns: 1fr; } }
@media (min-width: 1024px) { .history-item-actions { grid-template-columns: repeat(2, 1fr); } }
.history-item-actions .btn, .history-item-actions button { width: 100%; padding: 0.6em; font-size: 0.8em; margin: 0; }

/* Player Stats Page */
.player-stats-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5em; flex-wrap: wrap; gap: 1em; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1em; margin-bottom: 2em; }
.stat-item { background: var(--light-gray); padding: 1.5em 1em; border-radius: 12px; border: 1px solid var(--medium-gray); text-align: center; }
.stat-item .value { font-size: 2.5em; font-weight: 700; color: var(--team-color); line-height: 1; display: block; }
.stat-item .label { margin-top: 0.5em; font-size: 0.9em; color: #555; display: block; }

.stats-panes { display: grid; grid-template-columns: 1fr; gap: 1.5em; margin-top: 1.5em; }
@media (min-width: 768px) { .stats-panes { grid-template-columns: repeat(2, 1fr); } }
.stat-pane { background: var(--white); padding: 1.5em; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); border: 1px solid var(--medium-gray); }
.stat-pane h4, .stat-pane h5 { margin-top: 0; margin-bottom: 1em; padding-bottom: 0.5em; border-bottom: 1px solid var(--medium-gray); }
.details-list { list-style-type: none; padding: 0; margin: 0; }
.details-list.scrollable { max-height: 200px; overflow-y: auto; }
.details-list li { display: flex; justify-content: space-between; padding: 0.5em 0; border-bottom: 1px solid #eee; }
.details-list li:last-child { border-bottom: none; }
.details-list .date { font-size: 0.9em; color: #777; }
.position-chart { margin-top: 1em; }
.bar-container { display: flex; align-items: center; margin-bottom: 8px; font-size: 0.9em; }
.bar-label { width: 120px; text-align: right; padding-right: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.bar-wrapper { flex-grow: 1; background-color: #eee; border-radius: 3px; }
.bar { height: 20px; background-color: var(--team-color); border-radius: 3px; color: white; text-align: right; padding-right: 5px; line-height: 20px; white-space: nowrap; }
.inactive-banner { background-color: var(--orange); color: white; padding: 1em; border-radius: 8px; text-align: center; font-weight: bold; margin-bottom: 1.5em; }

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Record Game Page Fixes */
.attendance-list { list-style-type: none; padding: 0; max-height: 200px; overflow-y: auto; border: 1px solid #eee; border-radius: 8px; }
.attendance-list li { display: flex; align-items: center; padding: 10px; border-bottom: 1px solid #eee; }
.attendance-list li:last-child { border-bottom: none; }
.attendance-list input[type="checkbox"] { width: auto; margin-right: 10px; flex-shrink: 0; }
.attendance-list li label { width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; }

.clock-controls { display: flex; justify-content: center; gap: 1em; margin-bottom: 1em; }
.clock-controls button { width: auto; padding: 0.5em 1.5em; font-size: 1.2em; max-width: 120px; }
#gameClock { font-size: 3em; font-weight: 700; text-align: center; color: var(--dark-gray); margin-bottom: 0.25em; }
.score { font-size: 2.5em; font-weight: bold; margin: 0.5em 0; color: var(--dark-gray); text-align: center; }

.team-sheet-container { display: grid; grid-template-columns: 1fr; gap: 1.5em; }
@media (min-width: 768px) { .team-sheet-container { grid-template-columns: 2.5fr 1fr; } }
.pitch-container { background: var(--pitch-green); border: 2px solid var(--pitch-line); border-radius: 8px; padding: 1em; position: relative; aspect-ratio: 7 / 5; display: flex; flex-direction: column; justify-content: space-around; overflow: hidden; }
.pitch-row { display: flex; justify-content: space-around; gap: 1vmin; }
.position-zone { border: 2px dashed rgba(255, 255, 255, 0.3); border-radius: 8px; min-height: 8vmin; width: 100%; display: flex; justify-content: center; align-items: center; flex-direction: column; color: var(--pitch-line); font-size: 1.5vmin; transition: background-color 0.2s; font-weight: bold; }
.position-zone:empty::before { content: attr(data-position); opacity: 0.6; font-size: 1.8vmin; }
#bench { border: 2px dashed var(--medium-gray); border-radius: 8px; padding: 1em; min-height: 200px; }
.player-card-draggable { background: var(--light-gray); padding: 0.8em; margin: 0.5em 0; border-radius: 6px; cursor: pointer; border-left: 5px solid var(--team-color); transition: all 0.3s ease; user-select: none; }
.player-token { background-color: var(--team-color); color: white; border-radius: 50%; width: 8vmin; height: 8vmin; max-width: 60px; max-height: 60px; display: flex; flex-direction: column; justify-content: center; align-items: center; font-size: 1.5vmin; font-weight: bold; text-align: center; padding: 2px; box-shadow: 0 2px 4px rgba(0,0,0,0.3); cursor: pointer; border: 0.3vmin solid white; user-select: none; position: relative; }
.player-token .player-name-token { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90%; font-size: 1.1em; }
.player-token .player-position-token { font-size: 0.8em; opacity: 0.8; }
.player-card-draggable.selected, .player-token.selected { box-shadow: 0 0 0 3px var(--team-color); filter: brightness(1.1); }
.position-zone.targetable, #bench.targetable { background-color: rgba(255, 255, 255, 0.2); border-style: solid; }

/* --- Settings Page v2 --- */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5em;
}

.settings-pane {
    background: var(--white);
    padding: 1.5em;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid var(--medium-gray);
}

.settings-pane h3 {
    margin-top: 0;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid var(--medium-gray);
}

.settings-pane.player-pane {
    grid-row: span 2 / auto;
}

.branding-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5em;
    align-items: start;
}

.logo-preview-area {
    width: 100%;
    max-width: 150px;
    height: auto;
    aspect-ratio: 1 / 1;
    background-color: var(--light-gray);
    border: 2px dashed var(--medium-gray);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1em;
    overflow: hidden;
}

#logoPreview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.color-picker-wrapper {
    width: 100%;
    height: 40px;
    border: 1px solid var(--medium-gray);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background-color: var(--team-color); /* Fallback */
    transition: background-color 0.2s;
}

#teamColor {
    position: absolute;
    top: -10px;
    left: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

.theme-preview-widget {
    border: 1px solid var(--medium-gray);
    border-radius: 8px;
    padding: 1em;
    margin-top: 0.5em;
}

.theme-preview-header {
    background-color: var(--team-color);
    color: white;
    padding: 0.5em;
    border-radius: 6px;
    text-align: center;
    font-weight: bold;
    margin-bottom: 1em;
    transition: background-color 0.2s;
}

.theme-preview-button {
    width: 100%;
    padding: 0.85em;
    background-color: var(--team-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.warning-text {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    padding: 1em;
    border-radius: 8px;
    margin-bottom: 1em;
}

/* --- Toast Notification System --- */
#toastContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-left: 5px solid var(--dark-gray);
    min-width: 280px;
    max-width: 320px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.hide {
    opacity: 0;
    transform: translateX(100%);
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-message {
    font-weight: 500;
    color: var(--dark-gray);
}

.toast.success { border-color: var(--green); }
.toast.success .toast-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2328a745' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E"); }

.toast.error { border-color: var(--red); }
.toast.error .toast-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dc3545' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E"); }

.toast.info { border-color: var(--team-color); }
.toast.info .toast-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'%3E%3C/line%3E%3C/svg%3E"); color: var(--team-color); }

/* --- Fixture Share Card Styles --- */
.fixture-share-card {
    width: 600px;
    background-color: var(--white);
    border: 1px solid var(--medium-gray);
    color: var(--dark-gray);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden; /* Ensures footer color doesn't bleed out */
}
.fixture-share-header {
    background-color: var(--team-color);
    color: var(--white);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}
.fixture-share-header img {
    height: 100px;
    width: 100px;
    border-radius: 8px;
}
.fixture-share-header h3 {
    font-size: 1.8em;
    margin: 0;
    line-height: 1.1;
}
.fixture-share-header h4 {
    font-size: 1.3em;
    margin: 0;
    opacity: 0.8;
    font-weight: normal;
}
.fixture-share-body {
    padding: 25px;
}
.fixture-share-title-section {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Better vertical alignment */
    margin-bottom: 1em;
}
.fixture-share-opponent-details {
    display: flex;
    flex-direction: column;
}
.fixture-share-opponent-details h2 {
    font-size: 1.9em;
    font-weight: 700;
    margin: 0 0 0.25em 0; /* Adjusted spacing */
    color: var(--dark-gray);
    line-height: 1.2;
}
#fixtureCardType {
    font-size: 1.1em;
    font-style: italic;
    color: #666;
    margin: 0; /* Removed top margin */
}
.fixture-home-badge, .fixture-away-badge {
    padding: 0.4em 0.8em;
    border-radius: 6px;
    color: white;
    font-weight: bold;
    font-size: 0.9em;
    text-transform: uppercase;
    flex-shrink: 0;
    margin-left: 1em;
}
.fixture-home-badge {
    background-color: var(--team-color);
}
.fixture-away-badge {
    background-color: #888;
}
.fixture-share-body p {
    font-size: 1.1em;
    margin: 0.5em 0;
    color: #444;
}
#fixtureCardDateTime strong {
    font-weight: 700; /* Bolder */
    color: var(--dark-gray);
}
.fixture-meet-time {
    font-style: italic;
    font-weight: 500;
    color: var(--team-color);
    margin-top: 1em !important;
}
.fixture-notes-section, .fixture-away-section {
    margin-top: 1.5em;
    padding-top: 1.5em;
    border-top: 1px solid var(--medium-gray);
}
.fixture-notes-section h4, .fixture-away-section h4 {
    margin: 0 0 0.5em 0;
    color: var(--dark-gray);
}
.fixture-notes-section p, .fixture-away-section p {
    font-size: 1em;
    color: #555;
    white-space: pre-wrap;
}
#fixtureCardMap {
    width: 100%;
    border-radius: 8px;
    margin-top: 1em;
    border: 1px solid var(--medium-gray);
}
.fixture-share-footer {
    background-color: var(--team-color);
    height: 10px;
}

/* --- Public Fixtures Page --- */
.fixture-card-public {
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--medium-gray);
    margin-bottom: 1.5em;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (min-width: 768px) {
    .fixture-card-public {
        flex-direction: row;
    }
}

.fixture-info {
    padding: 1.5em;
    flex: 1 1 60%;
}

.fixture-opponent {
    font-size: 2em;
    font-weight: 700;
    color: var(--dark-gray);
    margin-top: 0;
    margin-bottom: 0.25em;
}

.fixture-datetime {
    font-size: 1.2em;
    color: var(--team-color);
    margin-bottom: 1em;
}

.fixture-meta p {
    margin: 0.25em 0;
    color: #555;
}

.fixture-notes {
    margin-top: 1em !important;
    background-color: var(--light-gray);
    padding: 0.8em;
    border-radius: 8px;
    font-size: 0.9em;
}

.fixture-map {
    flex: 1 1 40%;
    min-height: 250px;
    background-color: var(--light-gray);
}

.fixture-map img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}
.map-link-button-wrapper {
    margin-top: 1.5em;
}

/* --- Player Stats Infographic Card --- */
#playerCardInfographic {
    width: 600px;
    background-color: var(--white);
    border: 1px solid var(--medium-gray);
    color: var(--dark-gray);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
.player-card-header {
    background-color: var(--team-color);
    color: var(--white);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}
.player-card-header img {
    height: 60px;
    width: 60px;
    border-radius: 8px;
}
.player-card-header h3 { font-size: 1.5em; margin: 0; }
.player-card-header h4 { font-size: 1.1em; margin: 0; opacity: 0.8; font-weight: normal; }

.player-card-body { padding: 25px; }
.player-card-player-info { text-align: center; margin-bottom: 25px; }
.player-card-player-info h2 { font-size: 2.8em; margin: 0; }
.player-card-number { font-size: 1.5em; font-weight: bold; color: var(--team-color); }

.player-card-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr; /* Use explicit columns for html2canvas compatibility */
    gap: 10px;
    text-align: center;
    margin-bottom: 25px;
}
.player-card-stat-item { background: var(--light-gray); padding: 15px 10px; border-radius: 8px; }
.player-card-stat-item .value { font-size: 1.8em; font-weight: 700; color: var(--dark-gray); }
.player-card-stat-item .label { font-size: 0.75em; color: #666; }

.player-card-details-section {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--medium-gray);
}
.player-card-details-section h4 { margin: 0 0 10px 0; color: var(--dark-gray); font-size: 1.1em;}
.player-card-details-section ul { list-style: none; padding: 0; margin: 0; color: #444; font-size: 0.9em; }
.player-card-details-section ul li { margin-bottom: 5px; }
#infographic-position-chart .bar-label { width: 90px; } /* Adjust label width for the card */


.player-card-footer {
    background-color: var(--team-color);
    height: 15px;
}

/* --- Live Match Page Redesign (NEW STYLES) --- */
.live-match-body {
    background-color: #eef1f4; /* Lighter, more neutral background */
}
.live-scoreboard {
    background-color: var(--team-color);
    color: white;
    padding: 1em;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25em;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.scoreboard-row {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 500px;
}
.scoreboard-row.names {
    font-size: 1.1em;
    font-weight: 600;
}
.scoreboard-row.main {
    font-size: 1.2em;
    font-weight: 700;
}
.scoreboard-team-name {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 0.5em;
}
.scoreboard-logo { 
    height: 40px; 
    width: 40px; 
    border-radius: 50%; 
    background: white; 
    padding: 4px; 
    box-sizing: border-box;
    object-fit: contain;
    flex-shrink: 0;
    margin: 0 1em;
}
.scoreboard-score-number {
    font-size: 2.5em; 
    font-weight: 700; 
    flex: 1;
    text-align: center;
}
.scoreboard-row.scorers {
    font-size: 0.8em;
    justify-content: center;
    min-height: 1.2em;
}
.scoreboard-row.info {
    gap: 1em;
    padding-top: 0.5em;
    margin-top: 0.5em;
    border-top: 1px solid rgba(255,255,255,0.2);
    justify-content: center;
}
.scoreboard-row.details {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.5em;
    font-size: 0.8em;
    opacity: 0.9;
    overflow-x: auto;
    padding-bottom: 0.25em;
}
.scoreboard-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4em;
    white-space: nowrap;
}
.scoreboard-meta-item svg {
    width: 14px;
    height: 14px;
    stroke-width: 2.5;
    flex-shrink: 0;
}
.meta-separator {
    opacity: 0.5;
    font-weight: bold;
}
@media (max-width: 380px) {
    .scoreboard-team-name { font-size: 0.9em; }
    .scoreboard-score-number { font-size: 2em; }
    .scoreboard-logo { height: 35px; width: 35px; }
    .scoreboard-row.details { font-size: 0.7em; }
}


.match-clock { font-size: 1em; font-weight: bold; background: rgba(0,0,0,0.2); padding: 0.2em 0.6em; border-radius: 6px; }

.live-status-badge { display: flex; align-items: center; gap: 0.5em; font-weight: bold; padding: 0.3em 0.8em; border-radius: 6px; font-size: 0.9em; }
.live-status-badge.live { background-color: var(--red); }
.live-status-badge.finished { background-color: #6c757d; }
.live-status-badge .pulse { display: block; width: 8px; height: 8px; background-color: white; border-radius: 50%; animation: pulse-animation 1.5s infinite; }
@keyframes pulse-animation { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); } }

.live-match-container { max-width: 900px; }
.live-layout-grid { display: grid; grid-template-columns: 1fr; gap: 1.5em; }
@media(min-width: 768px) { .live-layout-grid { grid-template-columns: 1fr 1fr; } }
.timeline-column, .teamsheet-column { background: var(--white); padding: 1.5em; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.timeline-column h3, .teamsheet-column h3 { margin-top: 0; padding-bottom: 0.5em; border-bottom: 1px solid var(--medium-gray); color: var(--team-color); }

.match-timeline { list-style: none; padding: 0; margin: 0; }
.match-timeline li { display: flex; align-items: flex-start; gap: 1em; padding: 0.8em 0; border-bottom: 1px solid #eee; }
.match-timeline li:last-child { border-bottom: none; }
.match-timeline li.home-event .timeline-detail { font-weight: bold; color: var(--dark-gray); }
.timeline-icon { font-size: 1.2em; flex-shrink: 0; width: 25px; text-align: center; }
.timeline-time { font-weight: bold; margin-right: 0.5em; color: #555; }

.team-sheet-list { list-style: none; padding: 0; margin: 0 0 1.5em 0; }
.team-sheet-list li { padding: 0.6em 0; border-bottom: 1px solid #eee; font-size: 0.9em; }
.team-sheet-list li:last-child { border-bottom: none; }

.final-summary-card { background: var(--white); padding: 2em; text-align: center; border-radius: 12px; margin-top: 1.5em; }
.final-summary-card h2 { color: var(--team-color); }
.final-summary-card .awards-list { list-style: none; padding: 0; margin: 1em 0; text-align: left; max-width: 300px; display: inline-block; }
.final-summary-card .awards-list li { display: flex; align-items: center; gap: 0.5em; font-size: 1.1em; margin-bottom: 0.5em; }
.final-summary-card .awards-list li span { font-size: 1.5em; }

/* Existing Live Match Styles (kept for reference) */
.live-container { text-align: center; }
.live-match-title .vs-text { font-size: 0.8em; color: #999; }
.live-score { font-size: 5em; font-weight: 700; margin: 0.2em 0; }
.live-period { font-size: 1.2em; color: #666; margin-bottom: 1.5em; }
.meta-item { display: flex; flex-direction: column; align-items: center; font-size: 0.9em; color: #555; }
.meta-item .label { display: flex; align-items: center; gap: 0.5em; font-weight: bold; margin-bottom: 0.25em; }
.meta-item .label svg { stroke-width: 2.5; }
#weatherInfo { font-size: 1.2em; }
.live-details-grid { display: grid; grid-template-columns: 1fr; gap: 1.5em; text-align: left; margin-top: 2em; }
@media (min-width: 768px) { .live-details-grid { grid-template-columns: 1fr 1fr; } }
.live-detail-pane { background: var(--light-gray); padding: 1.5em; border-radius: 12px; }
.live-detail-pane h3 { margin-top: 0; border-bottom: 1px solid var(--medium-gray); padding-bottom: 0.5em; color: var(--team-color); }
.live-event-log, .live-team-sheet { list-style: none; padding: 0; margin: 0; }
.live-event-log li, .live-team-sheet li { padding: 0.5em 0; border-bottom: 1px solid var(--medium-gray); font-size: 0.9em; }
.live-event-log li:last-child, .live-team-sheet li:last-child { border-bottom: none; }
.event-time { font-weight: bold; margin-right: 0.5em; color: var(--team-color); }

/* --- Goal Animation Styles --- */
.goal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}
.goal-overlay.active {
    opacity: 1;
}
.goal-text {
    font-size: 15vw;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 20px var(--team-color);
    animation: goal-text-pop 4s ease-out forwards;
}
.live-scoreboard.goal-flash {
    animation: goal-flash-animation 0.8s ease-in-out;
}
.scoreboard-score-number.goal-pop {
    animation: goal-pop-animation 0.5s ease-out;
}
@keyframes goal-flash-animation {
    0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
    50% { box-shadow: 0 0 30px 15px rgba(255, 255, 255, 0.9); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
}
@keyframes goal-pop-animation {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}
@keyframes goal-text-pop {
    0% { transform: scale(0.5); opacity: 0; }
    20% { transform: scale(1.1); opacity: 1; }
    40% { transform: scale(1); }
    80% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}
.raining-footballs {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}
.football-emoji {
    position: absolute;
    top: -50px; /* Start off-screen */
    font-size: 2em;
    animation-name: rain-fall;
    animation-timing-function: linear;
}
@keyframes rain-fall {
    to {
        transform: translateY(100vh);
    }
}

/* --- Settings Page Layout (v6.4 ADDITION) --- */
.settings-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5em;
}

.settings-nav {
    display: none; /* Hidden on mobile by default */
    background: var(--white);
    border-radius: 12px;
    padding: 1em;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid var(--medium-gray);
    align-self: start;
}

.settings-nav a {
    display: block;
    padding: 0.8em 1.2em;
    text-decoration: none;
    color: var(--dark-gray);
    font-weight: 500;
    border-radius: 8px;
    margin-bottom: 0.5em;
    transition: background-color 0.2s, color 0.2s;
}

.settings-nav a:hover {
    background-color: var(--light-gray);
}

.settings-nav a.active {
    background-color: var(--team-color);
    color: var(--white);
    font-weight: 600;
}

#mobileSettingsNav {
    display: block; /* Visible on mobile */
    margin-bottom: 1em;
}

.settings-content {
    grid-column: 1 / -1;
}

.settings-pane {
    display: none; /* All panes hidden by default */
    background: var(--white);
    padding: 1.5em;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    border: 1px solid var(--medium-gray);
}

.settings-pane.active {
    display: block; /* Show the active pane */
}

.settings-pane h3 {
    margin-top: 0;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid var(--medium-gray);
}

/* Desktop layout */
@media (min-width: 768px) {
    .settings-layout {
        grid-template-columns: 1fr 3fr; /* 25% nav, 75% content */
    }
    .settings-nav {
        display: block; /* Show desktop nav */
    }
    #mobileSettingsNav {
        display: none; /* Hide mobile dropdown */
    }
    .settings-content {
        grid-column: 2 / -1;
    }
}

/* Player list in Settings */
.player-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8em 0;
    border-bottom: 1px solid var(--light-gray);
}
.player-list-item:last-child {
    border-bottom: none;
}
.player-info {
    display: flex;
    flex-direction: column;
}
.player-name {
    font-weight: 500;
    color: var(--dark-gray);
}
.player-number {
    font-size: 0.9em;
    color: #666;
}
.captain-badge {
    display: inline-block;
    background-color: var(--orange);
    color: white;
    font-size: 0.7em;
    font-weight: bold;
    padding: 0.2em 0.4em;
    border-radius: 4px;
    margin-left: 0.5em;
    vertical-align: middle;
}
.btn-group {
    display: flex;
    gap: 0.5em;
    flex-shrink: 0;
    margin-left: 1em;
}

/* Formation Designer */
.formation-designer {
    padding: 1em;
    border-radius: 8px;
    background: var(--pitch-green);
    border: 2px solid var(--pitch-line);
}
.formation-designer .position-zone {
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    min-height: 10vmin;
}
.formation-designer .position-zone select {
    width: 90%;
    padding: 0.5em;
    font-size: 0.8em;
    margin: 0;
    text-align: center;
    border-radius: 6px;
    background-color: var(--white);
    color: var(--dark-gray);
}

/* --- Fixture Improvement Styles (v6.5 ADDITION) --- */

/* --- Tab Navigation --- */
.tab-nav {
    display: flex;
    border-bottom: 2px solid var(--medium-gray);
    margin-bottom: 1.5em;
}

.tab-btn {
    padding: 0.8em 1.2em;
    margin-bottom: -2px; /* Pulls button border over the container border */
    border: 2px solid transparent;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    background-color: transparent;
    color: #666;
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto; /* Override default button width */
    margin-right: 0.5em;
}

.tab-btn:hover {
    background-color: var(--light-gray);
    color: var(--dark-gray);
}

.tab-btn.active {
    background-color: var(--white);
    color: var(--team-color);
    border-color: var(--medium-gray);
    border-bottom-color: var(--white);
}

/* --- Tab Panels --- */
.tab-panel {
    display: none; /* Hide all panels by default */
}
.tab-panel.active {
    display: block; /* Show only the active one */
}

/* Header for the list panel */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5em; /* Space between header and first card */
}
.list-header h2 {
    margin: 0;
}
.list-header .btn {
    width: auto; /* Make button fit content */
    margin: 0; /* Reset button margin */
}

/* --- New Fixture Card Style --- */
/* This is the style that was missing */
.fixture-card {
    display: flex;
    background-color: var(--white);
    border: 1px solid var(--medium-gray);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-bottom: 1.5em;
    overflow: hidden;
}

.fixture-card-date {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--team-color);
    color: var(--white);
    padding: 1.5em;
    flex: 0 0 80px; /* Fixed width */
    text-align: center;
}
.fixture-card-date-month {
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
    opacity: 0.8;
    margin-bottom: 0.25em;
}
.fixture-card-date-day {
    font-size: 2.2em;
    font-weight: 700;
    line-height: 1;
}

.fixture-card-details {
    padding: 1.5em;
    flex-grow: 1;
}
.fixture-card-details h3 {
    margin: 0 0 0.5em 0;
    font-size: 1.3em;
    color: var(--dark-gray);
}
.fixture-card-details p {
    margin: 0.25em 0;
    color: #666;
    font-size: 0.9em;
}

.fixture-card-details .btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-top: 1.5em;
}
.fixture-card-details .btn-group .btn {
    width: auto; /* Override default */
    margin: 0; /* Override default */
}

/* Responsive card for mobile */
@media (max-width: 600px) {
    .fixture-card {
        flex-direction: column;
    }
    .fixture-card-date {
        flex-direction: row;
        flex-basis: auto;
        width: 100%;
        gap: 0.5em;
        padding: 0.8em 1.5em;
        box-sizing: border-box;
    }
    .fixture-card-date-month {
        font-size: 1.1em;
        margin-bottom: 0;
    }
    .fixture-card-date-day {
        font-size: 1.3em;
    }
}