/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: block;
}

/* Header Layout */
.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    width: 40px;
    height: 40px;
    max-width: 40px;
    max-height: 40px;
    object-fit: contain;
}

.admin-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Login Screen */
#loginScreen {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.logo {
    margin-bottom: 30px;
}

.logo-img {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
}

.logo h1 {
    color: #667eea;
    font-size: 24px;
    font-weight: 600;
}

.login-form {
    text-align: left;
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    max-width: 300px;
    padding: 10px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Login Modal Specific Styling */
#loginModal .modal-content {
    max-width: 400px;
    width: 90%;
}

#loginModal .modal-header {
    padding: 20px 20px 10px 20px;
    border-bottom: 1px solid #e9ecef;
}

#loginModal .modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

#loginModal .form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

#loginModal .btn {
    padding: 8px 16px;
    font-size: 14px;
    min-width: 80px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

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

.login-help {
    margin-top: 20px;
    font-size: 14px;
    color: #666;
}

/* Main App Screen */
#mainScreen {
    background: #f8f9fa;
}

.header {
    background: white;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header h1 {
    color: #667eea;
    font-size: 24px;
}

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

.main-content {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Stats Cards */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card h3 {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card span {
    color: #667eea;
    font-size: 32px;
    font-weight: bold;
}

/* Records Section */
.records-section {
    margin-bottom: 40px;
}

.records-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
}

.player-records {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.player-record-card {
    position: relative;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.player-record-card:hover {
    transform: translateY(-3px);
}

.player-name-header {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.player-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    display: block;
}

.stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.win-rate {
    font-size: 16px;
    font-weight: bold;
    color: #28a745;
}

/* Teams Section */
.teams-section {
    margin-bottom: 40px;
}

.teams-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
}

.team-rankings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.team-ranking-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    position: relative;
}

.team-ranking-card:hover {
    transform: translateY(-3px);
}

.team-ranking-card.rank-1 {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border: 2px solid #ff6b35;
}

.team-ranking-card.rank-2 {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
    border: 2px solid #a0a0a0;
}

.team-ranking-card.rank-3 {
    background: linear-gradient(135deg, #cd7f32 0%, #daa520 100%);
    border: 2px solid #b8860b;
}

.team-rank {
    position: absolute;
    top: -10px;
    left: 20px;
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.team-ranking-card.rank-1 .team-rank {
    background: #ff6b35;
}

.team-ranking-card.rank-2 .team-rank {
    background: #a0a0a0;
}

.team-ranking-card.rank-3 .team-rank {
    background: #b8860b;
}

.player-rank {
    position: absolute;
    top: -10px;
    left: 20px;
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.player-record-card.rank-1 .player-rank {
    background: #ff6b35;
}

.player-record-card.rank-2 .player-rank {
    background: #a0a0a0;
}

.player-record-card.rank-3 .player-rank {
    background: #b8860b;
}

.team-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    margin-top: 10px;
}

.team-players-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.team-player-tag {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.team-ranking-card.rank-1 .team-player-tag {
    background: #ff6b35;
}

.team-ranking-card.rank-2 .team-player-tag {
    background: #a0a0a0;
}

.team-ranking-card.rank-3 .team-player-tag {
    background: #b8860b;
}

.team-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.team-stat-item {
    text-align: center;
}

.team-stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
    display: block;
}

.team-ranking-card.rank-1 .team-stat-value {
    color: #d2691e;
}

.team-ranking-card.rank-2 .team-stat-value {
    color: #666;
}

.team-ranking-card.rank-3 .team-stat-value {
    color: #8b4513;
}

.team-stat-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.team-win-rate {
    font-size: 16px;
    font-weight: bold;
    color: #28a745;
    text-align: center;
}

/* Photo Enlargement Modal */
.photo-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    width: auto;
    height: auto;
}

.photo-container {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.enlarged-photo {
    max-width: 100%;
    max-height: 70vh;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.enlarged-photo:hover {
    transform: scale(1.02);
}

/* Make game photos clickable */
.game-photo {
    cursor: pointer;
    transition: transform 0.3s ease;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* General image sizing rules */
img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.game-photo:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Games Section */
.games-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
}

.games-list {
    display: grid;
    gap: 15px;
}

.game-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.game-date {
    color: #666;
    font-size: 14px;
}

.game-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

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

.btn-danger:hover {
    background: #c82333;
}

.game-players {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.player-score {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.player-name {
    font-weight: 500;
    color: #333;
}

.player-score-value {
    font-weight: bold;
    color: #667eea;
    font-size: 18px;
}

/* Team Display */
.game-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: center;
    margin: 15px 0;
}

.team-display {
    text-align: center;
    padding: 15px;
    border-radius: 10px;
    background: #f8f9fa;
}

.team-display.team1 {
    border: 2px solid #667eea;
}

.team-display.team2 {
    border: 2px solid #764ba2;
}

.team-display.winner {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border: 3px solid #ff6b35;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.3);
    transform: scale(1.02);
}

.team-display.winner h4 {
    color: #d2691e;
    font-weight: bold;
}

.team-display h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 16px;
}

.team-players {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
}

.team-players .player-name {
    font-size: 14px;
    color: #666;
}

.team-score-display {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.vs-divider {
    font-size: 18px;
    font-weight: bold;
    color: #666;
    background: #e9ecef;
    padding: 10px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e1e5e9;
}

.modal-header h2 {
    color: #333;
    font-size: 20px;
}

.modal-body {
    padding: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f8f9fa;
    color: #333;
}

/* Game Form */
.game-form {
    padding: 20px;
}

/* Game Setup */
.game-setup {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Rounds Section */
.rounds-section {
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    background: #f8f9fa;
    margin-bottom: 20px;
}

.rounds-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.rounds-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rounds-info {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.round-item {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    position: relative;
}

.round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.round-title {
    font-weight: 600;
    color: #333;
    margin: 0;
}

.remove-round {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
}

.remove-round:hover {
    background: #c82333;
}

.round-scores {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 15px;
    align-items: center;
}

.round-score-input {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.round-score-input label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
}

.round-score-input input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
}

.kaboot-label {
    font-size: 11px;
    font-weight: 500;
    color: #666;
    margin-top: 5px;
    display: block;
}

.round-kaboot {
    width: 100%;
    padding: 6px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    margin-top: 2px;
}

.round-vs {
    text-align: center;
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

.round-result {
    margin-top: 10px;
    padding: 8px;
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
    font-weight: 500;
}

.round-result.team1-win {
    background: #d4edda;
    color: #155724;
}

.round-result.team2-win {
    background: #d4edda;
    color: #155724;
}

.round-result.draw {
    background: #fff3cd;
    color: #856404;
}

/* Game Details */
.game-details {
    border-top: 1px solid #e9ecef;
    padding-top: 20px;
}

/* Rounds Summary */
.rounds-summary {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
}

.rounds-wins {
    font-weight: 600;
    color: #28a745;
}

.rounds-details {
    color: #666;
    font-size: 11px;
}

.rounds-kaboots {
    color: #28a745;
    font-size: 11px;
    font-weight: 600;
}

/* Round details in game details modal */
.rounds-breakdown {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.rounds-breakdown h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 16px;
}

.rounds-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.round-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.round-number {
    font-weight: 600;
    color: #495057;
    min-width: 80px;
}

.round-scores {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    justify-content: center;
}

.round-scores .team1-score,
.round-scores .team2-score {
    font-size: 18px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 4px;
    min-width: 40px;
    text-align: center;
}

.round-scores .team1-score.winner,
.round-scores .team2-score.winner {
    background: #d4edda;
    color: #155724;
}

.round-scores .vs {
    font-weight: bold;
    color: #6c757d;
}

.round-kaboots {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #28a745;
    font-size: 12px;
    font-weight: 600;
    min-width: 120px;
    justify-content: flex-end;
}

.kaboot-count {
    background: #e8f5e8;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

/* Round Scores Breakdown in Game Cards */
.round-scores-breakdown {
    margin-top: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.round-scores-breakdown h5 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.round-scores-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.round-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    font-size: 13px;
}

.round-score-item .round-number {
    font-weight: 600;
    color: #495057;
    min-width: 30px;
    text-align: center;
}

.round-score-item .round-scores {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.round-score-item .team1-score,
.round-score-item .team2-score {
    font-size: 16px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 30px;
    text-align: center;
    background: #f8f9fa;
    color: #495057;
}

.round-score-item .team1-score.winner,
.round-score-item .team2-score.winner {
    background: #d4edda;
    color: #155724;
}

.round-score-item .vs {
    font-weight: bold;
    color: #6c757d;
    font-size: 12px;
}

.round-score-item .round-kaboots {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #28a745;
    font-size: 11px;
    font-weight: 600;
    min-width: 80px;
    justify-content: flex-end;
}

.round-score-item .kaboot-count {
    background: #e8f5e8;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    min-width: 20px;
    text-align: center;
}

/* Game Status */
.game-status {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.incomplete {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-badge.draw {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.status-badge.draws {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-badge.incomplete-win {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.status-badge.incomplete-draw {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.team-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 2px solid #e9ecef;
}

.team-section h3 {
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
}

.team-score {
    margin-top: 15px;
    text-align: center;
}

.team-score input {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    max-width: 120px;
    margin: 0 auto;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e1e5e9;
}

/* Photo Preview */
.photo-preview {
    margin-top: 10px;
    text-align: center;
}

.photo-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin: 5px;
}

.existing-photo-container {
    position: relative;
    display: inline-block;
    margin: 5px;
}

.delete-photo-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.delete-photo-btn:hover {
    background: #cc0000;
}

.photo-upload-info {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* Ranking Colors */
.player-record-card.rank-1 {
    border: 3px solid #FFD700;
    background: linear-gradient(135deg, #FFF8DC, #FFD700);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

.player-record-card.rank-2 {
    border: 3px solid #C0C0C0;
    background: linear-gradient(135deg, #F8F8FF, #C0C0C0);
    box-shadow: 0 4px 20px rgba(192, 192, 192, 0.3);
}

.player-record-card.rank-3 {
    border: 3px solid #CD7F32;
    background: linear-gradient(135deg, #FFF8DC, #CD7F32);
    box-shadow: 0 4px 20px rgba(205, 127, 50, 0.3);
}

.team-ranking-card.rank-1 {
    border: 3px solid #FFD700;
    background: linear-gradient(135deg, #FFF8DC, #FFD700);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

.team-ranking-card.rank-2 {
    border: 3px solid #C0C0C0;
    background: linear-gradient(135deg, #F8F8FF, #C0C0C0);
    box-shadow: 0 4px 20px rgba(192, 192, 192, 0.3);
}

.team-ranking-card.rank-3 {
    border: 3px solid #CD7F32;
    background: linear-gradient(135deg, #FFF8DC, #CD7F32);
    box-shadow: 0 4px 20px rgba(205, 127, 50, 0.3);
}

/* Game Details */
.game-details {
    padding: 20px;
}

.game-details-photo {
    text-align: center;
    margin-bottom: 20px;
}

.game-details-photo img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: white;
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    z-index: 1000;
    overflow: hidden;
}

.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: background-color 0.3s ease;
}

.dropdown-content a:hover {
    background-color: #f8f9fa;
}

.dropdown-content hr {
    margin: 0;
    border: none;
    border-top: 1px solid #e1e5e9;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        text-align: center;
    }

    .header-actions {
        justify-content: center;
    }

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

    .game-players {
        grid-template-columns: 1fr;
    }

    .game-teams {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .vs-divider {
        order: 2;
        margin: 10px auto;
    }

    .team-display.team1 {
        order: 1;
    }

    .team-display.team2 {
        order: 3;
    }

    .player-records {
        grid-template-columns: 1fr;
    }

    .player-stats {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .team-rankings {
        grid-template-columns: 1fr;
    }

    .team-stats {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .footer-content {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .btn {
        width: 100%;
    }

    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 15px;
    }

    .stats-cards {
        grid-template-columns: 1fr;
    }

    .game-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .game-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #333;
}

.empty-state p {
    margin-bottom: 20px;
}

/* Notifications */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Footer */
.footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 20px;
    margin-top: 40px;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    color: #666;
}

.footer-logo {
    height: 16px;
    width: auto;
    max-height: 16px;
    max-width: 100px;
    object-fit: contain;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer-logo:hover {
    opacity: 1;
}

.footer-text {
    font-weight: 500;
}

/* Player Name Autocomplete */
input[list] {
    position: relative;
}

input[list]:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* Autocomplete suggestions styling */
datalist {
    position: absolute;
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

datalist option {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
}

datalist option:hover {
    background: #f8f9fa;
}

datalist option:last-child {
    border-bottom: none;
}

/* Player Validation Errors */
.form-group input.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.2);
}

.form-group input.error:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.3);
}

.error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

/* Tournament Styles */
.tournament-modal-content {
    max-width: 95vw;
    max-height: 90vh;
    width: auto;
}

.tournament-content {
    padding: 20px;
    overflow-x: auto;
    overflow-y: auto;
}

.tournament-header {
    margin-bottom: 20px;
}

.tournament-add-game {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

/* FIFA World Cup Style Bracket */
.fifa-bracket-holder {
    display: flex;
    flex-direction: column;
    gap: 40px;
    padding: 20px;
    align-items: center;
}

.bracket-section {
    width: 100%;
    max-width: 1400px;
}

.bracket-section h3 {
    text-align: center;
    color: #667eea;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #667eea;
}

.bracket-columns {
    display: flex;
    justify-content: space-between;
    gap: 60px;
}

.bracket-left,
.bracket-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.bracket-left {
    align-items: flex-end;
}

.bracket-right {
    align-items: flex-start;
}

.bracket-match-box {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s ease;
}

.bracket-match-box:hover {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.bracket-team-row {
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bracket-team-row.winner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    border: 2px solid #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.match-score-badge {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
}

.bracket-team-row.winner .match-score-badge {
    background: white;
    color: #667eea;
}

.vs-divider-bracket {
    text-align: center;
    color: #666;
    font-weight: 600;
    font-size: 12px;
    padding: 5px;
}

.bracket-final {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.bracket-final .bracket-match-box {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border: 3px solid #ff6b35;
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
    min-width: 300px;
    padding: 20px;
}

.bracket-final .bracket-team-row {
    background: white;
    border: 2px solid #ff6b35;
}

.champion {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #FFD700 0%, #FFED4E 100%);
    border-radius: 12px;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
    border: 3px solid #ff6b35;
}

@media (max-width: 768px) {
    .fifa-bracket-holder {
        gap: 20px;
    }

    .bracket-columns {
        flex-direction: column;
        gap: 20px;
    }

    .bracket-left,
    .bracket-right {
        align-items: stretch;
    }

    .bracket-match-box {
        min-width: auto;
    }
}

.bracket-section h3 {
    color: #667eea;
    text-align: center;
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.matchup-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.matchup {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    gap: 10px;
}

.matchup:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.matchup-final {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    border-radius: 12px;
    gap: 20px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.matchup-final .vs {
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.team-slot {
    flex: 1;
    padding: 10px 15px;
    background: white;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    color: #333;
    border: 2px solid #e9ecef;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.team-slot.filled {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.matchup-final .team-slot {
    background: white;
    color: #667eea;
    font-weight: 600;
    font-size: 16px;
    min-height: 50px;
}

.matchup .vs {
    color: #666;
    font-weight: 600;
    font-size: 14px;
}

.champion {
    text-align: center;
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #FFD700 0%, #FFED4E 100%);
    border-radius: 8px;
    font-size: 20px;
    font-weight: bold;
    color: #333;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

@media (max-width: 768px) {
    .bracket-container {
        grid-template-columns: 1fr;
    }

    .matchup {
        flex-direction: column;
        gap: 8px;
    }

    .matchup .vs {
        transform: rotate(90deg);
    }

    .team-slot {
        width: 100%;
    }
}

/* New FIFA Bracket Styles */
.bracket-container-fifa {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.round-section {
    margin-bottom: 50px;
}

.round-title {
    text-align: center;
    color: #667eea;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 4px solid #667eea;
}

.bracket-layout {
    display: flex;
    justify-content: space-between;
    gap: 100px;
    padding: 20px 0;
}

.bracket-left-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: flex-end;
    position: relative;
}

.bracket-left-side::before {
    content: '';
    position: absolute;
    right: -50px;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, #667eea, #764ba2);
}

.bracket-right-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: flex-start;
    position: relative;
}

.bracket-right-side::before {
    content: '';
    position: absolute;
    left: -50px;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, #667eea, #764ba2);
}

.match-card {
    background: white;
    border: 3px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    padding-top: 30px;
    min-width: 280px;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s ease;
    position: relative;
}

.game-label-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    z-index: 10;
}

.edit-match-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    z-index: 15;
}

.edit-match-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Add connecting lines to next round */
.bracket-left-side .match-card::after {
    content: '';
    position: absolute;
    right: -50px;
    top: 50%;
    width: 50px;
    height: 3px;
    background: linear-gradient(to right, #667eea, transparent);
    transform: translateY(-50%);
}

.bracket-right-side .match-card::before {
    content: '';
    position: absolute;
    left: -50px;
    top: 50%;
    width: 50px;
    height: 3px;
    background: linear-gradient(to left, #667eea, transparent);
    transform: translateY(-50%);
}

.match-card:hover {
    border-color: #667eea;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25);
    transform: translateY(-3px);
}

.team-cell {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
}

.team-cell.winner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.team-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.team-cell.winner .team-name {
    color: white;
}

.score-display {
    margin-top: 8px;
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
}

.team-cell.winner .score-display {
    color: white;
}

.match-vs {
    text-align: center;
    color: #6c757d;
    font-weight: 700;
    font-size: 14px;
    padding: 8px;
}

.bracket-final-container {
    display: flex;
    justify-content: center;
}

.bracket-final-container .match-card {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    border: 4px solid #ff6b35;
    box-shadow: 0 10px 30px rgba(255, 107, 53, 0.4);
    min-width: 350px;
    max-width: 400px;
}

.bracket-final-container .team-cell {
    background: white;
    border-color: #ff6b35;
}

.bracket-final-container .team-cell.winner {
    background: linear-gradient(135deg, #ff6b35 0%, #ff8844 100%);
}

.bracket-final-container .team-cell.winner .team-name {
    color: white;
}

@media (max-width: 1200px) {
    .bracket-layout {
        gap: 40px;
    }

    .match-card {
        min-width: 220px;
        max-width: 280px;
    }
}

@media (max-width: 768px) {
    .bracket-layout {
        flex-direction: column;
        gap: 20px;
    }

    .bracket-left-side,
    .bracket-right-side {
        align-items: stretch;
    }

    .match-card {
        min-width: auto;
        max-width: 100%;
    }

    /* Hide connecting lines on mobile */
    .bracket-left-side::before,
    .bracket-right-side::before,
    .bracket-left-side .match-card::after,
    .bracket-right-side .match-card::before {
        display: none;
    }

    /* Stack third place and final sections on mobile */
    .final-section {
        display: flex !important;
        flex-direction: column !important;
        gap: 30px !important;
    }
}