/* elokickers/public_html/css/style.css */

body {
    font-family: sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
}

header {
    background: #243039; /* Updated color */
    color: #fff;
    padding: 0.5rem 0; /* Adjusted padding */
    /* text-align: center; Removed as flex handles alignment */
}

/* New rule for the wrapper */
header .header-content {
    display: flex;
    align-items: center; /* Vertically center */
    justify-content: center; /* Horizontally center */
    padding: 0.5rem 1rem; /* Padding within the content area */
}

/* New rule for the logo */
img#header-logo {
    max-height: 40px; /* Adjust as needed */
    margin-right: 15px; /* Space between logo and title */
}

header h1 {
    margin: 0; /* Reset default h1 margin */
    padding-bottom: 0; /* Reset padding */
    font-size: 1.8rem; /* Example size adjustment */
}

nav ul {
    padding: 0;
    list-style: none;
    text-align: center;
}

nav ul li {
    display: inline;
    margin-right: 20px;
}

nav a {
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
}

nav a:hover {
    text-decoration: underline;
}

main#app_content {
    padding: 20px;
    margin: 20px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    color: #777;
    font-size: 0.9em;
}

h2, h3 {
    color: #333;
}

/* Table Styling */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    margin-bottom: 20px;
}

table th, table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

table th {
    background-color: #f0f0f0;
    font-weight: bold;
}

table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* List Styling (for matches) */
ul.matches-list {
    list-style: none;
    padding: 0;
}

ul.matches-list li {
    background-color: #fff;
    border: 1px solid #eee;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.elo-positive {
    color: green;
    font-weight: bold;
}

.elo-negative {
    color: red;
    font-weight: bold;
}

ul.matches-list .match-summary {
    font-size: 1.1em;
    margin-bottom: 5px;
}
ul.matches-list .match-summary .match-date {
    font-weight: bold;
    margin-right: 10px;
    color: #555;
}
ul.matches-list .match-score {
    font-size: 1em;
    color: #333;
}

/* Player Details Match List Highlighting */
ul.matches-list li.match-win {
    border-left: 5px solid green;
}
ul.matches-list li.match-loss {
    border-left: 5px solid red;
}
ul.matches-list li.match-draw {
    border-left: 5px solid orange;
}


/* Form Styling */
form {
    margin-top: 20px;
}

form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

form input[type="text"],
form input[type="number"],
form input[type="date"],
form select {
    width: calc(100% - 22px); /* Account for padding and border */
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box; /* Important for width calculation */
}

form .team-section, form .match-details-section, form .player-add-section {
    background-color: #f9f9f9;
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
}

form h3 {
    margin-top: 0;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

form button[type="submit"] {
    background-color: #5cb85c;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

form button[type="submit"]:hover {
    background-color: #4cae4c;
}

/* Message Area Styling */
.message-area {
    padding: 10px;
    margin-top: 15px;
    border-radius: 4px;
    text-align: center;
}

.message-area.success {
    background-color: #dff0d8;
    color: #3c763d;
    border: 1px solid #d6e9c6;
}

.message-area.error {
    background-color: #f2dede;
    color: #a94442;
    border: 1px solid #ebccd1;
}

.message-area.info {
    background-color: #d9edf7;
    color: #31708f;
    border: 1px solid #bce8f1;
}

/* Links within content */
#app_content a {
    color: #007bff;
    text-decoration: none;
}

#app_content a:hover {
    text-decoration: underline;
}

/* Player Statistics Styling */
.player-stats {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
}

.player-stats dt {
    font-weight: bold;
    color: #555;
    float: left;
    width: 200px; /* Adjust as needed */
    clear: left;
    margin-bottom: 5px;
}

.player-stats dd {
    margin-left: 210px; /* Should be slightly more than dt width */
    margin-bottom: 5px;
    color: #333;
}

/* Clearfix for the dl element if using floats for dt/dd */
.player-stats::after {
    content: "";
    clear: both;
    display: table;
}


/* Charts Layout Styling */
.charts-container {
    display: flex;
    flex-wrap: wrap; /* Allow charts to stack on smaller screens */
    justify-content: space-around; /* Distribute space around charts */
    align-items: flex-start; /* Align items at the start of the cross axis */
    margin-top: 20px;
    margin-bottom: 20px;
}

.chart-wrapper {
    flex-basis: 100%; /* Default to full width for smaller screens */
    margin-bottom: 20px; /* Space below chart if they stack */
    padding: 10px;
    box-sizing: border-box;
    background-color: #fff; /* Optional: if charts need a background */
    border: 1px solid #eee; /* Optional: border around each chart */
    border-radius: 4px;
    /* New properties for equal height: */
    display: flex;
    flex-direction: column;
    height: 350px; /* Fixed height for chart wrappers */
}

.chart-wrapper h4 { /* Styling for chart titles */
    text-align: center;
    margin-top: 0;
    flex-shrink: 0; /* Prevent title from shrinking if canvas wants more space */
    margin-bottom: 15px;
    font-size: 1.2rem;
    color: #444;
}

/* Medium screens and up - side-by-side charts */
@media (min-width: 768px) {
    .chart-wrapper {
        flex-basis: 48%; /* Two charts side-by-side with a little space */
    }
}

/* Ensure canvas is responsive within its wrapper */
.chart-wrapper canvas {
    max-width: 100%;
    /* height: auto !important; /* REMOVED */
    /* The canvas should now expand to the flex container's height if Chart.js maintainAspectRatio is false */
    flex-grow: 1; /* Allow canvas to grow and take available space in flex column */
    min-height: 0; /* Fix for flexbox in some browsers with canvas */
}

/* Styles for elo_explanation.html content */
body:has(main#app_content section h2) main#app_content section {
    margin-bottom: 25px; /* Add space between sections */
    padding-bottom: 15px; /* Add padding below content before margin */
    border-bottom: 1px solid #eee; /* Add a light separator line */
}

body:has(main#app_content section h2) main#app_content section:last-of-type {
    border-bottom: none; /* No border for the very last section */
    margin-bottom: 0; /* No bottom margin for the last section */
    padding-bottom: 0; /* No bottom padding for the last section */
}

main#app_content code {
    background-color: #f0f0f0; /* Light grey background for code blocks */
    padding: 2px 5px;          /* Some padding around the code text */
    border-radius: 4px;        /* Slightly rounded corners */
    font-family: "Courier New", Courier, monospace; /* Monospace font */
    font-size: 0.95em;         /* Slightly smaller font size */
    border: 1px solid #e0e0e0; /* Light border */
}

main#app_content p code { /* More specific selector for inline code in paragraphs */
    display: inline-block; /* Allows padding and border to display correctly */
}

main#app_content ul li code, main#app_content ol li code { /* For code within list items */
    display: inline-block;
}

/* Make headers within the explanation page a bit more distinct */
body:has(main#app_content section h2) main#app_content h2 {
    border-bottom: 2px solid #243039; /* Accent color from header */
    padding-bottom: 8px;
    margin-top: 10px; /* Add some space above H2s if they are not the first child */
}

body:has(main#app_content section h2) main#app_content h2:first-child {
    margin-top: 0; /* No top margin for the first H2 in a section */
}
