/* Apply box-sizing to all elements for easier layout */
* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f2f2f2;
    margin: 20px;
    color: #333;
}

h1, h2, h3 {
    text-align: center;
    color: #333;
}

h2, h3 {
    margin-top: 30px;
}

img.logo { /* Style for the main logo */
    display: block;
    margin: 20px auto;
    width: 150px; /* Adjusted size */
    height: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    margin-bottom: 20px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 5px; /* Added border radius */
    overflow: hidden; /* Ensures radius applies to children */
    font-size: 14px; /* Reduce font size for the entire table */
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

th, td {
    padding: 6px 8px; /* Slightly reduced padding */
    text-align: left;
    border-bottom: 1px solid #ddd;
    vertical-align: middle; /* Ensure vertical alignment */
}

th {
    background-color: #f8f8f8;
    font-weight: bold;
    text-align: center;
}

th:first-child {
    text-align: left;
}

/* Centered text for specific paragraphs */
.center-text {
    text-align: center;
}

/* Table context box styles */
.table-context-box {
    padding: 25px 0;
    margin: 30px 0;
}

.league-header {
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.league-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.league-header h3 {
    margin: 0;
    color: #333;
    font-size: 24px;
}

.standings-preview {
    display: flex;
    justify-content: center;
    overflow: hidden;
    border-radius: 10px;
}

.mini-standings {
    width: 100% !important;
    max-width: 500px !important;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid #ddd;
    margin: 0 auto 20px auto !important;
}

.mini-standings tr {
    transition: all 0.3s ease;
}

.mini-standings td {
    padding: 12px 15px !important;
    text-align: center;
    border-bottom: 1px solid #eee;
    font-weight: 500;
}

.rank-cell {
    width: 60px;
    font-weight: bold;
    font-size: 18px;
    color: #333;
}

.team-cell {
    text-align: left !important;
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-logo-small {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

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

.points-cell {
    width: 80px;
    font-weight: bold;
    font-size: 16px;
    color: #2c5aa0;
}

.dynamo-row {
    background: linear-gradient(90deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%) !important;
    font-weight: bold;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    transform: scale(1.02);
}

.dynamo-row td {
    border-bottom: 2px solid #e6c200;
    color: #1a1a2e;
}

.dynamo-row .team-name {
    color: #1a1a2e;
    font-weight: bold;
}

.fade-top {
    background: linear-gradient(to bottom, transparent 0%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0.7) 100%);
    opacity: 0.6;
}

.fade-bottom {
    background: linear-gradient(to top, transparent 0%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0.7) 100%);
    opacity: 0.6;
}

.fade-top td, .fade-bottom td {
    color: #666;
}

.mini-standings tr:last-child td {
    border-bottom: none;
}

@media (max-width: 600px) {
    .table-context-box {
        padding: 15px 0;
        margin: 20px 0;
    }
    
    .league-logo {
        width: 50px;
        height: 50px;
    }

    .league-header h3 {
        font-size: 20px;
    }
    
    .mini-standings td {
        padding: 8px 10px;
        font-size: 14px;
    }
    
    .team-logo-small {
        width: 25px;
        height: 25px;
    }
}

/* Remove bottom border for last row */
tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: #f1f1f1;
}

.container {
    max-width: 900px; /* Unified max-width */
    margin: 20px auto; /* Added top/bottom margin */
    padding: 30px; /* Increased padding */
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 8px; /* Increased radius */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); /* Added shadow */
}

.footer {
    text-align: center;
    font-size: 11px;
    color: #aaa; /* Lighter color */
    margin-top: 30px; /* Increased margin */
}

.footer em {
    font-style: normal;
}

/* Status Message Style */
.status-message {
    text-align: center;
    font-size: 0.8em; /* Smaller font size */
    color: #888; /* Grey color */
    margin-top: 25px;
    margin-bottom: 5px; /* Space before footer link */
}

/* Chart specific styles (from verlauf.php) */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    margin-bottom: 30px;
    background-color: #fff;
    padding: 15px;
    box-shadow: 0 2px 3px rgba(0,0,0,0.1);
    border-radius: 5px;
    border: 1px solid #eee; /* Added subtle border */
}

/* Button style for links */
.button-link {
    display: inline-block;
    padding: 10px 22px;
    background-color: #ffd600; /* Dynamo Yellow */
    color: #222;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
    text-align: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.button-link:hover,
.button-link:focus {
    background-color: #e6c000; /* Darker yellow on hover */
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    color: #000;
    outline: none;
}

/* Center align buttons within paragraphs */
p.center-button {
    text-align: center;
}

/* Specific table cell alignments/styles if needed */
td.center-align {
    text-align: center;
}

/* Styles for result highlighting in verlauf.php */
.result-win { background-color: #c8e6c9; }
.result-loss { background-color: #ffcdd2; }
.result-draw { background-color: #eeeeee; }
.home-match { background-color: #fff9c4; }

/* Style for opponent logo in table */
td img.opponent-logo {
    height: 20px;
    vertical-align: middle;
    margin-right: 5px;
}

/* Style for assist text in scorer list */
.assist-text {
    color: #666; /* Gray color */
    font-style: italic; /* Optional: make it italic */
}

/* Style for scorers summary table */
.scorers-table {
    flex: 1; /* Allow tables to grow and shrink */
    min-width: 250px; /* Minimum width before wrapping */
    background:#fff;
    border:1px solid #eee;
    border-radius:4px;
    margin-bottom: 0; /* Remove bottom margin if container handles spacing */
}
.scorers-table th, .scorers-table td {
    padding: 8px 12px;
}
.scorers-table td:last-child {
    text-align: center;
}

/* Container for the two scorer tables */
.scorers-container {
    display: flex;
    justify-content: space-between; /* Distribute space between tables */
    flex-wrap: wrap; /* Allow tables to wrap on smaller screens */
    gap: 20px; /* Space between the tables */
    margin-top: 20px;
}

/* Styles for Pie Chart Layout */
.chart-row {
    display: flex;
    justify-content: space-around; /* Distribute space evenly */
    align-items: flex-start; /* Align items at the top */
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 20px; /* Space between chart wrappers */
    margin-top: 30px; /* Space above the chart row */
    margin-bottom: 20px;
}

.pie-chart-wrapper {
    flex: 1; /* Allow wrappers to grow */
    min-width: 280px; /* Minimum width before wrapping */
    max-width: 48%; /* Roughly half width, accounting for gap */
    padding: 15px;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 5px;
    box-shadow: 0 2px 3px rgba(0,0,0,0.05);
    text-align: center; /* Center title */
    height: 350px; /* Fixed height for consistency */
    display: flex; /* Use flexbox for vertical centering */
    flex-direction: column; /* Stack title and canvas */
}

.pie-chart-wrapper h4 {
    margin-top: 0;
    margin-bottom: 15px; /* Space below title */
    font-size: 1.1em;
    color: #555;
}

.pie-chart-wrapper canvas {
    max-height: 250px; /* Limit canvas height within wrapper */
}

/* Average Stats Section */
.average-stats {
    text-align: center;
    margin-top: 30px; /* Space above the stats */
    margin-bottom: 20px;
    font-size: 1em;
    color: #555;
}
.average-stats p {
    margin: 5px 0; /* Space between average lines */
}

/* Flash Animation */
@keyframes flash {
  0%, 100% { background-color: transparent; } /* Start and end transparent */
  25%, 75% { background-color: rgba(255, 255, 0, 0.3); } /* Light yellow flash */
  50% { background-color: transparent; } /* Back to transparent between flashes */
}

.flash-effect {
  animation: flash 0.8s ease-in-out 1; /* Apply animation once over 0.8 seconds */
  /* Note: The JS removes the class after 800ms, allowing re-trigger */
}

/* --- Responsive Adjustments --- */

@media (max-width: 768px) {
    body {
        font-size: 17px; /* Increased base font size for mobile */
        margin: 10px; /* Reduce body margin */
    }

    .container {
        padding: 15px; /* Reduce container padding */
        margin: 10px auto;
    }

    h1 {
        font-size: 1.6em; /* Adjust heading size */
    }

    h2 {
        font-size: 1.4em;
    }

    h3 {
        font-size: 1.2em;
    }

    th, td {
        padding: 9px 7px; /* Adjust padding */
        font-size: 1em; /* Use 1em to match body font size */
    }

    /* Reduce padding specifically for the result column */
    th.col-ergebnis,
    td.col-ergebnis {
        padding-left: 4px;
        padding-right: 4px;
        text-align: center; /* Center the result */
    }

    .button-link {
        padding: 9px 16px; /* Adjust button size */
        font-size: 1em;
    }

    .chart-container {
        height: 250px; /* Adjust chart height */
        padding: 10px;
    }

    /* Adjust scorer tables for better stacking */
    .scorers-container {
        gap: 15px;
    }

    .scorers-table {
        min-width: 100%; /* Make tables stack vertically */
        flex-basis: 100%;
    }
    .scorers-table th, .scorers-table td {
         padding: 7px 9px; /* Adjust padding */
    }

    /* Adjust Pie Chart Layout */
    .chart-row {
        gap: 15px;
        margin-top: 25px;
    }

    .pie-chart-wrapper {
        flex-basis: 100%; /* Stack charts vertically */
        max-width: 100%;
        height: 320px; /* Adjust height */
    }
     .pie-chart-wrapper canvas {
        max-height: 230px;
    }
     .pie-chart-wrapper h4 {
        font-size: 1em;
        margin-bottom: 10px;
    }

    /* Status Message Style on Mobile */
    .status-message {
        font-size: 0.85em; /* Slightly larger on mobile relative to base */
        margin-top: 20px;
    }

    /* Average Stats Section on Mobile */
    .average-stats {
        margin-top: 25px;
        font-size: 0.95em;
    }
}

@media (max-width: 480px) {
     body {
        font-size: 16px; /* Increased base font size for small screens */
     }
     th, td {
        padding: 7px 5px; /* Adjust padding */
        font-size: 1em; /* Use 1em */
     }

     /* Further reduce padding for result column on very small screens */
     th.col-ergebnis,
     td.col-ergebnis {
        padding-left: 3px;
        padding-right: 3px;
     }

     .button-link {
        padding: 7px 14px; /* Adjust button size */
     }
     img.logo {
        width: 100px; /* Smaller logo */
     }

     /* Adjust Pie Chart Layout */
    .pie-chart-wrapper {
        height: 300px; /* Further adjust height */
        padding: 10px;
    }
     .pie-chart-wrapper canvas {
        max-height: 210px;
    }

     /* Status Message Style on Small Mobile */
     .status-message {
        font-size: 0.9em; /* Adjust as needed */
     }

     /* Average Stats Section on Small Mobile */
     .average-stats {
        font-size: 0.9em;
     }
}
