/* K-Espoo Color Palette */
:root {
    --k-espoo-dark-blue: #001f3f; /* Dark Navy/Blue */
    --k-espoo-light-blue: #007bff; /* Brighter Blue Accent */
    --k-espoo-white: #ffffff;
    --k-espoo-off-white: #f8f9fa;
    --k-espoo-gray: #6c757d; /* For text and borders */
    --k-espoo-light-gray: #dee2e6;
    --k-espoo-gold: #ffc107; /* Optional accent */
    /* Adjusted variables for a lighter, modern menu */
    --background-color: var(--k-espoo-off-white);
    --text-color: var(--k-espoo-dark-blue);
    --header-bg: var(--k-espoo-white); /* Changed to white */
    --header-text: var(--k-espoo-dark-blue); /* Changed to dark blue for contrast */
    --nav-link-hover: var(--k-espoo-light-blue); /* Changed hover color */
    --nav-link-active: var(--k-espoo-gold); /* New active state color */
    --logo-color: var(--k-espoo-dark-blue); /* Logo text color */
    --card-bg: var(--k-espoo-white);
    --card-border: var(--k-espoo-light-gray);
    --table-header-bg: var(--k-espoo-light-blue);
    --table-header-text: var(--k-espoo-white);
    --button-bg: var(--k-espoo-light-blue);
    --button-text: var(--k-espoo-white);
    --link-color: var(--k-espoo-light-blue);
    --link-hover-color: #0056b3; /* Darker blue on hover */
    --footer-bg: var(--k-espoo-dark-blue);
    --footer-text: var(--k-espoo-white);
}
/* General Body Styling */
body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
/* Header & Navigation */
.header { /* Changed from .navbar to .header as it contains the whole header */
    background-color: var(--header-bg);
    padding: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Lighter, more modern shadow */
    border-bottom: 1px solid var(--k-espoo-light-gray); /* Subtle border */
}
.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo { /* Targeting the anchor tag directly */
    display: flex;
    align-items: center;
    color: var(--logo-color);
    text-decoration: none;
    font-size: 1.9rem;
    font-weight: bold;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}
.logo:hover {
    color: var(--k-espoo-light-blue); /* Hover effect for logo */
}
/* .brand-logo .logo { This was for an image, removed as there's no image in HTML */
/*     height: 45px;
    margin-right: 12px;
} */
.navbar-nav { /* Changed from .nav-links */
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center; /* Align items vertically in nav */
}
.navbar-nav .nav-item { /* Changed from .nav-links li */
    margin-left: 30px;
}
.navbar-nav .nav-link { /* Changed from .nav-links a */
    color: var(--header-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.05rem;
    transition: color 0.3s ease, transform 0.2s ease;
    position: relative;
    padding: 5px 0; /* Adjusted padding */
}
.navbar-nav .nav-link:hover {
    color: var(--nav-link-hover);
    transform: translateY(-2px);
}
.navbar-nav .nav-link.active { /* New style for active link */
    color: var(--nav-link-active);
    font-weight: 700;
}
.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px; /* Adjust position for underline */
    left: 0;
    width: 0;
    height: 3px; /* Thicker underline */
    background-color: var(--nav-link-hover);
    transition: width 0.3s ease;
}
.navbar-nav .nav-link.active::after { /* Underline for active link */
    width: 100%;
    background-color: var(--nav-link-active);
}
.navbar-nav .nav-link:hover::after {
    width: 100%;
}
/* Main Content */
.main-content { /* Changed from .main */
    padding: 2rem 0;
}
.content-wrapper {
    background-color: var(--k-espoo-white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    margin-top: 30px;
    margin-bottom: 30px;
}
.page-title {
    color: var(--k-espoo-dark-blue);
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5rem;
    font-weight: 700;
}
.section-title {
    color: var(--k-espoo-dark-blue);
    border-bottom: 2px solid var(--k-espoo-light-blue);
    padding-bottom: 10px;
    margin-top: 40px;
    margin-bottom: 20px;
    font-size: 1.8rem;
}
/* Cards & Grid Layouts */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.dashboard-grid.two-column {
    grid-template-columns: repeat(auto-fit, minmax(45%, 1fr));
}
.card, .section-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}
.card h2, .section-card h2 {
    color: var(--k-espoo-dark-blue);
    margin-top: 0;
    font-size: 1.5rem;
    margin-bottom: 15px;
}
.stat-number {
    font-size: 3rem;
    font-weight: bold;
    color: var(--k-espoo-light-blue);
    text-align: center;
    margin: 10px 0;
}
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.team-card {
    display: block; /* Make the whole card clickable */
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.team-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}
.team-card p {
    margin: 5px 0;
    color: var(--k-espoo-gray);
}
.view-details-link {
    font-weight: bold;
/*    color: var(--k-espoo-white); */
    margin-top: 15px;
}
/* Tables */
.table-container {
    overflow-x: auto; /* For responsive tables */
    margin-top: 20px;
    margin-bottom: 30px;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background-color: var(--k-espoo-white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden; /* Ensures rounded corners apply to content */
}
.data-table th, .data-table td {
    padding: 10px 12px; /* Reduced padding */
    text-align: left;
    border-bottom: 1px solid var(--k-espoo-light-gray);
    vertical-align: middle;
    font-size: 0.9rem; /* Further reduced font size for table body text */
}
.data-table th {
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.85rem; /* Slightly reduced font size for table headers */
    position: relative;
}
.data-table tbody tr:nth-child(even) {
    background-color: var(--k-espoo-off-white);
}
.data-table tbody tr:hover {
    background-color: #e9ecef; /* Lighter grey on hover */
}
.data-table a {
    color: var(--link-color);
    text-decoration: none;
}
.data-table a:hover {
    text-decoration: underline;
}
/* Sortable Table Headers */
.sortable {
    cursor: pointer;
    user-select: none;
    padding-right: 25px; /* Space for sorting icon */
}
.sortable.sorted::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
}
.sortable.sorted.asc::after {
    border-bottom: 5px solid var(--table-header-text);
}
.sortable.sorted.desc::after {
    border-top: 5px solid var(--table-header-text);
}
.data-table.compact-table th,
.data-table.compact-table td {
    padding: 8px 12px;
}
/* Player Detail Specifics */
.player-position {
    text-align: center;
    font-style: italic;
    color: var(--k-espoo-gray);
    margin-bottom: 30px;
}
.simple-list {
    list-style: none;
    padding: 0;
}
.simple-list li {
    margin-bottom: 5px;
    padding-left: 10px;
    border-left: 3px solid var(--k-espoo-light-blue);
}
/* Info Box for Formulas */
.info-box {
    background-color: var(--k-espoo-white);
    border: 1px solid var(--k-espoo-light-gray);
    border-left: 5px solid var(--k-espoo-light-blue); /* Accent border */
    border-radius: 8px;
    padding: 15px 20px;
    margin-top: 30px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}
.info-box h3 {
    color: var(--k-espoo-dark-blue);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.2rem;
}
.info-box p, .info-box ul {
    font-size: 0.8rem; /* Very small font */
    color: var(--k-espoo-gray);
    margin-bottom: 5px;
}
.info-box ul {
    padding-left: 20px;
    margin-top: 5px;
    list-style-type: disc; /* Use disc for list items */
}
.info-box ul li {
    margin-bottom: 3px;
}
.info-box strong {
    color: var(--k-espoo-dark-blue); /* Make strong text slightly darker for emphasis */
}
/* Buttons and Links */
.button {
    display: inline-block;
    background-color: var(--button-bg);
    color: var(--button-text);
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
    border: none;
    cursor: pointer;
}
.button:hover {
    background-color: var(--link-hover-color);
    transform: translateY(-2px);
}
.view-all-link {
    text-align: right;
    margin-top: 20px;
}
/* Footer */
.footer {
    background-color: var(--footer-bg);
    color: var(--footer-text);
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 40px;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}
/* Utility Classes */
.margin-top-large {
    margin-top: 40px;
}
/* Error Page */
.error-container {
    text-align: center;
    padding: 50px;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    margin-top: 50px;
}
.error-container h1 {
    color: #dc3545; /* Red for error */
    font-size: 3rem;
    margin-bottom: 20px;
}
.error-container p {
    font-size: 1.2rem;
    color: var(--k-espoo-gray);
    margin-bottom: 25px;
}
/* Responsive Design */
@media (max-width: 768px) {
    .header .container { /* Changed from .navbar .container */
        flex-direction: column;
        text-align: center;
        padding: 0 15px;
    }
    .logo { /* Changed from .brand-logo */
        margin-bottom: 15px;
        font-size: 1.6rem;
    }
    /* .brand-logo .logo { This was for an image, removed as there's no image in HTML */
    /*     height: 35px;
    } */
    .navbar-nav { /* Changed from .nav-links */
        flex-direction: column;
        width: 100%;
        margin-top: 10px;
    }
    .navbar-nav .nav-item { /* Changed from .nav-links li */
        margin: 0;
        padding: 8px 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05); /* Lighter separator for mobile */
    }
    .navbar-nav .nav-item:last-child {
        border-bottom: none;
    }
    .navbar-nav .nav-link { /* Changed from .nav-links a */
        display: block;
        font-size: 1rem;
        padding: 5px 0;
    }
    .navbar-nav .nav-link::after { /* Hide underline effect on mobile for cleaner look */
        display: none;
    }
    .dashboard-grid.two-column {
        grid-template-columns: 1fr;
    }
    .data-table th, .data-table td {
        padding: 6px 8px;
        font-size: 0.8rem;
    }
    .table-container {
        border: 1px solid var(--card-border);
        border-radius: 8px;
    }
    .content-wrapper {
        padding: 20px;
    }
    .page-title {
        font-size: 2rem;
    }
    .section-title {
        font-size: 1.5rem;
    }
    .info-box {
        padding: 10px 15px;
        margin-top: 20px;
    }
    .info-box h3 {
        font-size: 1.1rem;
    }
    .info-box p, .info-box ul {
        font-size: 0.75rem; /* Even smaller on mobile */
    }
}
/* --- Game Logs List (game_logs.html) --- */
.filter-sort-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px;
    background-color: var(--k-espoo-white);
    border: 1px solid var(--k-espoo-light-gray);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}
.filter-form label {
    margin-right: 10px;
    font-weight: 500;
    color: var(--k-espoo-dark-blue);
}
.filter-form select {
    padding: 8px 12px;
    border: 1px solid var(--k-espoo-gray);
    border-radius: 5px;
    background-color: var(--k-espoo-off-white);
    color: var(--text-color);
    font-size: 0.95rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
}
.filter-form select:hover {
    border-color: var(--k-espoo-light-blue);
}
.sort-options span {
    margin-right: 10px;
    font-weight: 500;
    color: var(--k-espoo-dark-blue);
}
.sort-link {
    display: inline-block;
    padding: 6px 12px;
    background-color: var(--k-espoo-light-gray);
    color: var(--k-espoo-gray);
    text-decoration: none;
    border-radius: 5px;
    margin-left: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.sort-link:hover {
    background-color: var(--k-espoo-light-blue);
    color: var(--k-espoo-white);
}
.sort-link.active {
    background-color: var(--k-espoo-light-blue);
    color: var(--k-espoo-white);
    font-weight: bold;
}
.game-list-table .team-name {
    font-weight: bold;
    color: var(--k-espoo-dark-blue);
}
.game-list-table .score {
    font-weight: bold;
    font-size: 1.1em;
    color: var(--k-espoo-light-blue);
}
.game-list-table .view-details-link {
    /* Style for buttons in tables */
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
    text-align: center;
}
.button-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
    display: inline-block; /* Ensure it respects padding */
    text-decoration: none;
    background-color: var(--k-espoo-light-blue);
    color: var(--k-espoo-white) !important;
    transition: background-color 0.2s ease;
}
.button-small:hover {
    background-color: #0056b3;
}
.no-data-message {
    text-align: center;
    color: var(--k-espoo-gray);
    font-style: italic;
    padding: 40px 0;
    font-size: 1.1rem;
}
/* --- Game Detail (game_detail.html) --- */
.game-detail-wrapper {
    padding-top: 20px;
}
.game-header-title {
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.game-header-title .team-name {
    font-weight: 700;
    color: var(--k-espoo-dark-blue);
    white-space: nowrap; /* Prevent wrapping for team names */
}
.game-header-title .game-score {
    font-size: 2.8rem; /* Larger score */
    font-weight: 900;
    color: var(--k-espoo-light-blue);
    margin: 0 20px;
    min-width: 150px; /* Ensure score has enough space */
    text-align: center;
}
.game-date-info {
    text-align: center;
    color: var(--k-espoo-gray);
    font-size: 1.1rem;
    margin-bottom: 40px;
}
.game-timeline {
    position: relative;
    padding: 20px 0;
    max-width: 900px;
    margin: 0 auto;
}
.game-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background-color: var(--k-espoo-light-gray);
    transform: translateX(-50%);
    border-radius: 2px;
}
.timeline-period {
    margin-bottom: 40px;
    position: relative;
}
.timeline-period h3 {
    text-align: center;
    background-color: var(--k-espoo-light-blue);
    color: var(--k-espoo-white);
    padding: 8px 15px;
    border-radius: 20px;
    display: inline-block;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 25px;
    font-size: 1.3rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.period-events {
    margin-top: 15px;
}
.timeline-event {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: relative;
}
.timeline-event::before {
    content: '';
    position: absolute;
    top: 50%;
    width: 20px;
    height: 4px;
    background-color: var(--k-espoo-light-blue);
    transform: translateY(-50%);
}
.timeline-event .event-time {
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--k-espoo-dark-blue);
    min-width: 80px; /* Allocate space for time */
    text-align: center;
}
.timeline-event .event-details {
    flex-grow: 1;
    padding-left: 20px;
    color: var(--text-color);
}
.timeline-event p {
    margin: 0;
    line-height: 1.4;
}
.timeline-event strong {
    color: var(--k-espoo-light-blue);
    margin-right: 5px;
}
.timeline-event .score-update {
    font-weight: bold;
    color: var(--k-espoo-dark-blue);
    margin-left: 10px;
}
/* Specific event types styling */
.event-goal {
    border-left: 5px solid #28a745; /* Green for goal */
    padding-left: 10px;
}
.event-goal strong { color: #28a745; }
.event-penalty {
    border-left: 5px solid #dc3545; /* Red for penalty */
    padding-left: 10px;
}
.event-penalty strong { color: #dc3545; }
/* Positioning for timeline events */
.timeline-event:nth-child(odd) { /* Events on the left side of the timeline */
    left: 0;
    width: calc(50% - 60px); /* Adjust width, considering the timeline line */
    text-align: right;
    flex-direction: row-reverse; /* Reverse order for time on the right */
    padding-right: 20px;
}
.timeline-event:nth-child(odd)::before {
    right: -20px; /* Connect to the central line */
    left: auto;
}
.timeline-event:nth-child(odd) .event-details {
    padding-right: 20px;
    padding-left: 0;
}
.timeline-event:nth-child(odd) .event-time {
    text-align: left; /* Align time to the left within its container */
}
.timeline-event:nth-child(even) { /* Events on the right side of the timeline */
    left: calc(50% + 20px);
    width: calc(50% - 30px);
    text-align: left;
    padding-left: 20px;
}
.timeline-event:nth-child(even)::before {
    left: -20px; /* Connect to the central line */
    right: auto;
}
.back-button-container {
    text-align: center;
    margin-top: 50px;
    margin-bottom: 30px;
}
/* Responsive Adjustments for Game Log Detail */
@media (max-width: 768px) {
    .game-header-title {
        flex-direction: column;
        font-size: 1.8rem;
        padding-top: 20px;
        line-height: 1.2;
    }
    .game-header-title .game-score {
        font-size: 2.2rem;
        margin: 10px 0;
    }
    .game-header-title .team-name {
        margin: 5px 0;
    }
    .game-timeline::before {
        left: 20px; /* Move central line to the left for mobile */
    }
    .timeline-period h3 {
        left: 20px; /* Align period title to the left */
        transform: translateX(0);
        margin-bottom: 20px;
    }
    .timeline-event,
    .timeline-event:nth-child(odd),
    .timeline-event:nth-child(even) {
        width: calc(100% - 40px); /* Full width minus margin */
        left: 40px; /* Start from left after the timeline line */
        text-align: left;
        flex-direction: row; /* Default order for all events */
        padding-left: 15px;
        padding-right: 15px;
    }
    .timeline-event::before {
        left: -20px; /* Connect to the left timeline line */
        right: auto;
    }
    .timeline-event:nth-child(odd)::before,
    .timeline-event:nth-child(even)::before {
        left: -20px; /* Ensure all connect to the left line */
        right: auto;
    }
    .timeline-event .event-time {
        min-width: 60px; /* Smaller time width on mobile */
        font-size: 1rem;
    }
    .timeline-event .event-details {
        padding-left: 15px;
        padding-right: 0;
    }
}
/* Adjustments for Game Logs filter */
@media (max-width: 600px) {
    .filter-sort-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    .filter-form {
        margin-bottom: 15px;
        width: 100%;
    }
    .filter-form select {
        width: calc(100% - 100px); /* Adjust to label width */
    }
    .sort-options {
        width: 100%;
        text-align: left;
    }
    .sort-link {
        margin-top: 8px;
        margin-left: 0;
        margin-right: 8px;
    }
}
