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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    color: white;
    font-size: 2.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 10px;
}

/* Sections */
section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

section h2 {
    color: #1e3c72;
    font-size: 1.5rem;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
}

section h3 {
    color: #374151;
    font-size: 1.2rem;
    margin-bottom: 16px;
}

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

input, select {
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s ease;
    background: white;
}

input:focus, select:focus {
    outline: none;
    border-color: #2a5298;
    box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(30, 60, 114, 0.4);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 2px solid #e5e7eb;
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

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

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

/* Add Player Section */
.add-player-section {
    margin-bottom: 24px;
}

.add-player-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

/* Current Players */
.current-players {
    margin-bottom: 24px;
}

.player-card {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: 1fr auto auto auto auto;
    gap: 12px;
    align-items: center;
}

.player-card.motm {
    background: #fef3c7;
    border-color: #f59e0b;
}

.player-name {
    font-weight: 600;
    color: #1f2937;
}

.player-stats {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-input {
    width: 60px;
    padding: 6px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 4px;
}

.motm-btn {
    padding: 6px 12px;
    background: #fbbf24;
    color: #92400e;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.motm-btn.active {
    background: #f59e0b;
    color: white;
}

.remove-btn {
    padding: 6px 12px;
    background: #fca5a5;
    color: #dc2626;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Season Overview */
.player-stats {
    display: grid;
    gap: 12px;
}

.stat-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr auto auto auto auto;
    gap: 12px;
    align-items: center;
}

.stat-card:first-child {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-color: #f59e0b;
}

.stat-name {
    font-weight: 600;
    color: #1f2937;
}

.stat-value {
    font-weight: 600;
    color: #374151;
    text-align: center;
    min-width: 40px;
}

/* Matches List */
.matches-list {
    display: grid;
    gap: 16px;
}

.match-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.match-info h3 {
    color: #1f2937;
    margin: 0 0 4px 0;
}

.match-details {
    color: #6b7280;
    font-size: 14px;
}

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

.match-players {
    display: grid;
    gap: 8px;
}

.match-player {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.match-player.motm {
    background: #fef3c7;
    border-color: #f59e0b;
}

.match-player-stats {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: #6b7280;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 1001;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
}

.modal.active {
    display: block;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-overlay.active {
    display: block;
}

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

.modal-header h3 {
    margin: 0;
    color: #1f2937;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.saved-players-list {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.saved-player-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.saved-player-name {
    flex: 1;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .add-player-form {
        grid-template-columns: 1fr;
    }
    
    .player-card {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: center;
    }
    
    .stat-card {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: center;
    }
    
    .match-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .match-player {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .modal {
        width: 95%;
        margin: 20px;
    }
}

@media (max-width: 480px) {
    section {
        padding: 16px;
    }
    
    .match-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .match-actions .btn-secondary,
    .match-actions .btn-danger {
        width: 100%;
    }
}