* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.keyboard-help {
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-content {
    padding: 30px;
}

section {
    margin-bottom: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 10px;
}

h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

h3 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

/* Player Management */
.import-section {
    margin-bottom: 25px;
}

.file-label {
    display: inline-block;
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.file-label:hover {
    background: #2980b9;
}

#fileInput {
    display: none;
}

small {
    display: block;
    margin-top: 8px;
    color: #666;
}

.player-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#playerName {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

#addPlayer {
    padding: 10px 25px;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

#addPlayer:hover {
    background: #229954;
}

.btn-demo {
    padding: 10px 25px;
    background: #f39c12;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

.btn-demo:hover {
    background: #e67e22;
}

.player-list {
    background: white;
    padding: 15px;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

#playerList {
    list-style: none;
}

#playerList li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 5px;
    background: #ecf0f1;
    border-radius: 5px;
    transition: background 0.2s;
}

#playerList li:hover {
    background: #d5dbdd;
}

.remove-btn {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background 0.3s;
}

.remove-btn:hover {
    background: #c0392b;
}

.btn-export-players {
    margin-top: 15px;
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    width: 100%;
}

.btn-export-players:hover {
    background: #2980b9;
}

/* Captain selection styles */
.player-item {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 8px;
}

.captain-checkbox {
    margin-right: 8px;
    transform: scale(1.2);
    accent-color: #ffd700;
}

.player-name-display {
    flex: 1;
    font-weight: 500;
}

/* Style for captain items */
#playerList li:has(.captain-checkbox:checked) {
    background: linear-gradient(135deg, #fff9c4 0%, #fef7d6 100%);
    border-left: 4px solid #ffd700;
}

.captain-checkbox:checked + .player-name-display::before {
    content: '⭐ ';
    font-size: 1.1em;
}

/* Hover effect for captain items */
#playerList li:has(.captain-checkbox:checked):hover {
    background: linear-gradient(135deg, #fff8b3 0%, #fef0c4 100%);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

/* Settings */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-item label {
    font-weight: 600;
    color: #555;
}

.setting-item input,
.setting-item select {
    padding: 8px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.setting-item span {
    padding: 8px;
    background: #ecf0f1;
    border-radius: 5px;
    text-align: center;
}

.formation-description {
    margin-top: 15px;
    padding: 15px;
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    border-radius: 5px;
}

.formation-description p {
    color: #1565c0;
    font-size: 14px;
    margin: 0;
}

/* Generate Section */
.generate-section {
    text-align: center;
    background: white;
}

.btn-primary, .btn-secondary {
    padding: 15px 40px;
    margin: 10px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
}

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

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

.btn-primary:disabled {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    cursor: not-allowed;
    opacity: 0.8;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

/* Lineup Display */
.lineup-section {
    background: white;
}

.hidden {
    display: none;
}

.validation-messages {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.validation-messages.has-issues {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

.validation-messages p {
    margin: 5px 0;
}

.validation-messages .success {
    color: #155724;
    font-weight: 600;
}

.lineup-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.quarter-lineup {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #dee2e6;
    min-width: 250px;
}

.quarter-lineup h3 {
    background: #34495e;
    color: white;
    padding: 10px;
    margin: -15px -15px 15px;
    border-radius: 8px 8px 0 0;
    text-align: center;
}

.quarter-lineup table {
    width: 100%;
}

.quarter-lineup tr {
    border-bottom: 1px solid #dee2e6;
}

.quarter-lineup td {
    padding: 8px;
}

.position {
    font-weight: 600;
    color: #495057;
    width: 40%;
}

.player-name {
    color: #212529;
}

.keeper-row {
    background: #fff3cd;
}

.sitting-row {
    background: #f8d7da;
    font-style: italic;
}

.player-summary {
    grid-column: 1 / -1;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.player-summary table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.player-summary thead {
    background: #34495e;
    color: white;
}

.player-summary th,
.player-summary td {
    padding: 10px;
    text-align: left;
    border: 1px solid #dee2e6;
}

.player-summary tbody tr:nth-child(even) {
    background: #ecf0f1;
}

.player-summary tbody tr:hover {
    background: #d5dbdd;
}

/* Action Buttons */
.action-buttons {
    text-align: center;
    margin-top: 20px;
}

.btn-export, .btn-print {
    padding: 12px 30px;
    margin: 0 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.btn-export {
    background: #3498db;
    color: white;
}

.btn-export:hover {
    background: #2980b9;
}

.btn-print {
    background: #9b59b6;
    color: white;
}

.btn-print:hover {
    background: #8e44ad;
}

/* Soccer Field Visualization */
.field-container {
    margin: 15px 0;
    background: white;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.soccer-field {
    width: 100%;
    height: auto;
    max-width: 250px;
    margin: 0 auto;
    display: block;
}

.player-marker {
    cursor: pointer;
    transition: transform 0.2s;
}

.player-marker:hover {
    transform: scale(1.1);
}

.field-legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 1px solid #333;
}

.legend-color.keeper {
    background: #ffcc00;
}

.legend-color.defensive {
    background: #3498db;
}

.legend-color.offensive {
    background: #e74c3c;
}

/* Footer */
footer {
    background: #34495e;
    color: white;
    padding: 20px;
    text-align: center;
}

footer p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: 500;
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 350px;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
}

.notification-error {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    color: white;
}

.notification-warning {
    background: linear-gradient(135deg, #e67e22 0%, #f39c12 100%);
    color: white;
}

.notification-info {
    background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
    color: white;
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.btn-primary:disabled {
    animation: pulse 1.5s ease-in-out infinite;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Smooth Transitions */
button {
    transition: all 0.3s ease;
}

button:active {
    transform: scale(0.98);
}

/* Keyboard Shortcut Hints */
.kbd-hint {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 10px 15px;
    background: rgba(52, 73, 94, 0.9);
    color: white;
    border-radius: 5px;
    font-size: 0.85rem;
    z-index: 100;
    display: none;
}

.kbd-hint.show {
    display: block;
}

.kbd-hint kbd {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 3px;
    margin: 0 2px;
    font-family: monospace;
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
        overflow: hidden !important;
    }
    
    html, body {
        overflow: hidden !important;
        height: auto !important;
    }
    
    .container {
        box-shadow: none;
        border-radius: 0;
        max-width: 100%;
        overflow: hidden !important;
    }
    
    .player-section,
    .settings-section,
    .generate-section,
    .action-buttons,
    header,
    footer {
        display: none;
    }
    
    .lineup-section {
        background: white;
        padding: 10px;
        overflow: hidden !important;
    }
    
    /* Hide the Game Lineup header and validation messages */
    .lineup-section h2,
    .validation-messages {
        display: none !important;
    }
    
    /* Hide soccer field visualizations when printing */
    .field-container,
    .soccer-field,
    .field-legend {
        display: none !important;
    }
    
    /* Ensure all quarters fit on one page */
    .lineup-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        page-break-inside: avoid;
        margin-bottom: 10px;
        overflow: hidden !important;
    }
    
    .quarter-lineup {
        page-break-inside: avoid;
        padding: 10px;
        font-size: 0.9em;
        overflow: hidden !important;
    }
    
    .quarter-lineup h3 {
        margin: -10px -10px 10px;
        padding: 8px;
        font-size: 1em;
    }
    
    .quarter-lineup td {
        padding: 5px;
        font-size: 0.85em;
    }
    
    /* Keep the entire game lineup section on one page */
    #lineupResult {
        page-break-inside: avoid;
    }
    
    /* Reduce spacing for print */
    section {
        margin-bottom: 15px;
        padding: 15px;
    }
    
    h2 {
        font-size: 1.3em;
        margin-bottom: 10px;
    }
    
    /* Hide all scrollbars when printing */
    * {
        overflow: visible !important;
        -ms-overflow-style: none !important;
        scrollbar-width: none !important;
    }
    
    *::-webkit-scrollbar {
        display: none !important;
    }
    
    /* Captain indicators in print */
    .captain-star {
        color: #ffd700;
        font-weight: bold;
    }
    
    /* Ensure captain summary shows in print */
    .player-summary {
        page-break-before: always;
        padding-top: 20px;
    }
    
    .player-summary table {
        font-size: 0.8em;
    }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .lineup-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    .main-content {
        padding: 15px;
    }
    
    section {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .lineup-grid {
        grid-template-columns: 1fr;
    }
    
    .player-input {
        flex-direction: column;
        gap: 10px;
    }
    
    #playerName {
        width: 100%;
    }
    
    #addPlayer, .btn-demo {
        width: 100%;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        margin-bottom: 10px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .action-buttons button {
        width: 100%;
    }
    
    /* Notification adjustments for mobile */
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    /* Field visualization for mobile */
    .field-container {
        max-width: 100%;
    }
    
    /* Quarter lineup tables */
    .quarter-lineup {
        min-width: auto;
    }
    
    .quarter-lineup td {
        font-size: 0.9em;
    }
    
    /* Player summary table */
    .player-summary {
        overflow-x: auto;
    }
    
    .player-summary table {
        font-size: 0.75em;
    }
    
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.2rem;
    }
    
    .main-content {
        padding: 10px;
    }
    
    section {
        padding: 12px;
    }
    
    .quarter-lineup h3 {
        font-size: 1rem;
    }
    
    footer {
        padding: 15px;
        font-size: 0.8rem;
    }
}