/* General Body and Container Styling */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    width: 100%;
    margin: 20px auto;
    background: #ffffff;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    box-sizing: border-box; /* Include padding in width calculation */
}

/* Headings */
h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.2em;
    font-weight: 700;
}

h2 {
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 12px;
    margin-top: 35px;
    margin-bottom: 25px;
    color: #34495e;
    font-size: 1.6em;
    font-weight: 600;
}

/* Form Group Layout */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column; /* Stack label and input on small screens */
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a4a4a;
    font-size: 1.05em;
}

/* Input, Select, and File Styling */
input[type="text"],
input[type="file"],
select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #cdd4da;
    border-radius: 8px;
    font-size: 1em;
    color: #333;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="text"]:focus,
input[type="file"]:focus,
select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    outline: none;
}

/* Checkbox specific styling */
input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    transform: scale(1.2); /* Make checkbox slightly larger */
    vertical-align: middle;
}

.form-group label[for="terms_accepted"] {
    display: inline; /* Keep label inline with checkbox */
    font-weight: normal;
    color: #333;
}

/* Buttons */
button {
    background-color: #007bff;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    width: auto; /* Allow buttons to size to content */
    display: inline-block; /* Ensure they don't take full width by default */
}

button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

#add_player_btn {
    background-color: #28a745; /* Green for add */
    margin-top: 10px;
    display: block; /* Make add player button take full width */
    width: 100%; /* Or set a max-width if desired */
}

#add_player_btn:hover {
    background-color: #218838;
}

.player-input-group button.remove-player-btn {
    background-color: #dc3545; /* Red for remove */
    padding: 8px 15px;
    font-size: 0.95em;
    margin-left: 10px; /* Space between input and button */
    width: auto; /* Override general button width */
}

.player-input-group button.remove-player-btn:hover {
    background-color: #c82333;
}


/* Message Styles */
.success-message, .error-message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Rules Box */
.rules-box {
    border: 1px solid #e0e0e0;
    padding: 20px;
    background-color: #fdfdfd;
    border-radius: 8px;
    margin-bottom: 30px;
}

.rules-box ul {
    list-style: disc;
    margin-left: 25px;
    padding: 0;
    color: #555;
}

.rules-box li {
    margin-bottom: 8px;
}

/* Player Input Group */
.player-input-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px; /* Space between label, input, and button */
    flex-wrap: wrap; /* Allow wrapping on small screens */
}

.player-input-group label {
    flex-shrink: 0; /* Prevent label from shrinking */
    margin-bottom: 0; /* Reset margin for flex item */
}

.player-input-group input[type="text"] {
    flex-grow: 1; /* Input takes up available space */
    margin-right: 0; /* Reset margin */
}

/* Team Color Dropdown Enhancement */
/* No specific CSS for option::before, as it's not well-supported across browsers.
   We'll rely on background-color and text color for contrast. */
select#team_color option {
    padding: 5px 10px; /* Add some padding to options */
    font-weight: normal;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 20px 25px;
        margin: 15px auto;
    }

    h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.4em;
        margin-top: 25px;
        margin-bottom: 20px;
    }

    .form-group {
        flex-direction: column; /* Stack label and input */
    }

    input[type="text"],
    input[type="file"],
    select {
        width: 100%;
        padding: 10px;
    }

    button {
        padding: 10px 20px;
        font-size: 1em;
        width: 100%; /* Make buttons full width on small screens */
        margin-top: 10px; /* Add margin between stacked buttons */
    }

    .player-input-group {
        flex-direction: column; /* Stack player input elements */
        align-items: flex-start; /* Align left */
    }

    .player-input-group label {
        width: 100%; /* Label takes full width */
        margin-bottom: 5px;
    }

    .player-input-group input {
        width: 100%; /* Input takes full width */
        margin-bottom: 10px; /* Space between input and button */
    }

    .player-input-group button.remove-player-btn {
        width: 100%; /* Remove button takes full width */
        margin-left: 0; /* Reset margin */
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px 20px;
        margin: 10px auto;
    }

    h1 {
        font-size: 1.6em;
        margin-bottom: 20px;
    }

    h2 {
        font-size: 1.2em;
        margin-top: 20px;
        margin-bottom: 15px;
    }

    .rules-box {
        padding: 15px;
    }

    .rules-box ul {
        margin-left: 15px;
    }
}