/* General Styles */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-color: #dee2e6;
    --focus-ring: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    --transition-speed: 0.2s;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    margin: 0;
    font-size: 1rem;
    min-height: 100vh;
}

/* Default Title Styling for Desktop/Laptop */
h1 {
    text-align: center;
    color: #007bff; /* Default blue color */
    padding: 10px;
    background-color: transparent; /* Default transparent background */
    font-size: 2.5rem; /* Responsive header size (40px) */
}

/* Container for page content */
.container {
    max-width: 1200px; /* Set max width for larger screens */
    margin: 0 auto; /* Center the container */
    padding: 0 5px; /* Add side padding */
}

/* Divider Line */
.divider {
    border-top: 1px solid #cbcbcb;
    margin: 15px 0;
}

/* Filter Styles */
.day-filter, .sport-filter, .playLevel-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 10px;
}

.toggle-filters {
    display: flex;
    justify-content: center;
    border-bottom: 1px solid #b0b0b0;
    padding-bottom: 10px; /* Adds spacing before the line */
    margin-bottom: 10px;
}

/* Box Styles for Days, Sports, Play Levels, and Toggle Buttons */
.day-box, .sport-box, .playLevel-box, .toggle-button, .signuptype-box {
    padding: 8px 16px;
    border: 1px solid var(--primary-color);
    background-color: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
    text-align: center;
    user-select: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.day-box:hover, .sport-box:hover, .playLevel-box:hover, .toggle-button:hover, .signuptype-box:hover {
    background-color: #f8f9fa;
    transform: translateY(-1px);
}

.day-box.active, .sport-box.active, .playLevel-box.active, .signuptype-box.active, .toggle-button.active {
    background-color: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Navbar and Filter Button Styles */
.navbar {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.navbar-brand {
    font-weight: 600;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    color: white;
    border-radius: 0.25rem;
}

.filter-toggle:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.filter-toggle i {
    font-size: 1rem;
}

.filter-toggle:focus {
    box-shadow: var(--focus-ring);
    outline: none;
}

/* Filter Status Bar */
.filter-status-bar {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filter-status-bar::after {
    content: attr(data-count) " results";
    font-size: 12px;
    color: #6c757d;
    display: none; /* Hide by default, shown by JavaScript */
}

.results-count {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1rem;
}

.active-filters-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

/* Filter Section Styling */
.filter-section {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-section:last-child {
    border-bottom: none;
}

.filter-title {
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Filter Option Boxes */
.day-box, .sport-box, .playLevel-box, .signuptype-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.day-box:hover, .sport-box:hover, .playLevel-box:hover, .signuptype-box:hover {
    background-color: #e9ecef;
}

.day-box.active, .sport-box.active, .playLevel-box.active, .signuptype-box.active {
    background-color: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

/* Filter Box Styles (common for all filter types) */
.filter-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    background-color: white;
    border: 2px solid #e9ecef;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.filter-box:hover {
    background-color: #f8f9fa;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.filter-box.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

/* Toggle Switch Styling */
.form-check-label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
}

.form-check-input:focus {
    box-shadow: var(--focus-ring);
    border-color: #86b7fe;
}

/* Table Styles */
.table {
    font-size: 0.9rem;
    border-radius: 0.375rem;
    overflow: hidden;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    margin-bottom: 1.5rem;
}

.table td {
    vertical-align: middle;
    padding: 1rem 0.75rem; /* Increase padding for better breathing room */
}

/* Table Header Styling */
.table thead {
    background-color: var(--primary-color);
}

.table th {
    color: white;
    background-color: var(--primary-color);
    font-weight: 600;
    border-bottom-width: 2px;
    white-space: nowrap;
    padding: 1rem 0.75rem; /* Consistent padding */
    font-size: 0.875rem; /* Slightly smaller header text */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table th.sorted-asc::after,
.table th.sorted-desc::after {
    margin-left: 0.5rem;
    color: white;
}

/* First row of the table (header row) rounded corners */
.table thead tr:first-child th:first-child {
    border-top-left-radius: 0.375rem;
}

.table thead tr:first-child th:last-child {
    border-top-right-radius: 0.375rem;
}

.table td {
    vertical-align: middle;
}

/* Column Width Settings */
th:nth-child(1), td:nth-child(1) {
    width: 12%; /* Sport column */
}

th:nth-child(2), td:nth-child(2) {
    width: 7%; /* Day column */
}

th:nth-child(3), td:nth-child(3) {
    width: 15%; /* League column */
}

th:nth-child(4), td:nth-child(4) {
    width: 12%; /* Signup Type column */
}

th:nth-child(5), td:nth-child(5) {
    width: 15%; /* Location column */
}

th:nth-child(6), td:nth-child(6) {
    width: 10%; /* Start Date column */
}

th:nth-child(7), td:nth-child(7) {
    width: 14%; /* Game Times column */
}

th:nth-child(8), td:nth-child(8) {
    width: 8%; /* Team column */
}

th:nth-child(9), td:nth-child(9) {
    width: 7%; /* Indy column */
}

tr:nth-child(even) {
    background-color: #f2f2f2;
}

tr:hover {
    background-color: #e9ecef;
}

a {
    color: #007bff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.green-check {
    color: green;
}

.red-cross {
    color: red;
}

.highlight-red {
    color: var(--danger-color);
    font-weight: 500;
}

/* Keyword Search Styles */
.keyword-search .input-group {
    margin-bottom: 0.5rem;
}

.keyword-search input[type="text"] {
    border-radius: 0.375rem 0 0 0.375rem;
    border: 1px solid var(--border-color);
    font-size: 0.875rem;
    transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.keyword-search input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: var(--focus-ring);
    outline: none;
}

.keyword-search .btn {
    border-radius: 0 0.375rem 0.375rem 0;
    border: 1px solid var(--border-color);
    border-left: none;
    padding: 0.375rem 0.75rem;
    background-color: white;
    color: var(--secondary-color);
    transition: all var(--transition-speed) ease;
}

.keyword-search .btn:hover {
    background-color: var(--light-color);
    color: var(--danger-color);
}

.keyword-search small {
    font-size: 0.75rem;
    line-height: 1.2;
}

/* Highlight matching text */
.search-highlight {
    background-color: #fff3cd;
    padding: 0.1em 0.2em;
    border-radius: 0.2em;
    font-weight: 500;
}

/* Main Page Search Section */
.search-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 1rem;
    padding: 2rem 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.search-section .input-group-lg .form-control {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    border-radius: 0;
    box-shadow: none;
    transition: all var(--transition-speed) ease;
}

.search-section .input-group-lg .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

.search-section .input-group-text {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem 0 0 0.5rem;
    border: 2px solid var(--primary-color);
}

.search-section .form-control {
    border-left: none;
    border-right: none;
    border-top: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.search-section .btn {
    border-radius: 0 0.5rem 0.5rem 0;
    border: 2px solid var(--primary-color);
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
    transition: all var(--transition-speed) ease;
}

.search-section .btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.search-section small {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Responsive Adjustments */
@media (max-width: 1080px) and (min-resolution: 2dppx), 
       (max-width: 1080px) and (-webkit-min-device-pixel-ratio: 2), 
       (max-width: 700px) {
    body {
        font-size: calc(16px + 1vw); /* Dynamic scaling for a responsive font size */
        overflow-x: hidden; /* Prevent horizontal overflow on smaller screens */
    }

    .container {
        max-width: 100%; /* Set max width to full width */
        padding: 0 2px; /* Reduce padding for smaller screens */
        margin: 0; /* Remove margins */
        overflow-x: auto; /* Allow horizontal scrolling if necessary */
    }

    .day-box, .sport-box, .playLevel-box, .signuptype-box, .toggle-button {
        font-size: calc(16px + 1vw); /* Set a responsive size */
        padding: 30px 30px;
    }

    table {
        width: 100%; /* Ensure the table takes up the full width */
        table-layout: auto; /* Allow table to auto-adjust column widths */
        border-collapse: collapse; /* Make sure cells are not spaced out */
    }

    th, td {
        font-size: calc(16px + 1vw); /* Ensure table cells scale dynamically */
        padding-left: 3px; /* Adjust padding for a more compact layout */
        padding-right: 3px; /* Adjust padding for a more compact layout */
        padding-top: 5px;
        padding-bottom: 5px;
        word-break: break-word; /* Ensure content wraps properly within cells */
        overflow-wrap: break-word; /* Break long words to fit within cells */
    }

    /* Specific H1 style for high-density and smaller screens */
    h1 {
        font-size: calc(40px + 1vw); /* Adjust the header font size for small screens */
        background-color: transparent; /* Highlight background for high-density screens - debugging purposes */
        color: blue; /* Change text color */
    }

    /* Prevent wrapping for specific columns */
    td.sport, td.day, td.start-date {
        white-space: nowrap; /* Keep content on a single line */
        overflow: hidden; /* Hide any overflow */
        text-overflow: ellipsis; /* Add ellipsis if content overflows */
        font-size: calc(16px + 1vw); /* Dynamically scale these columns */
    }

    td.game-times {
        white-space: normal; /* Allow wrapping */
        word-break: break-word; /* Break long words if needed */
        overflow-wrap: break-word; /* Ensure text wraps within words */
        max-width: 100%; /* Allow the cell to use the full width available */
    }
}

.hidden {
    display: none;
}

th.sorted-asc::after {
    content: " ↑";
    color: white;
}

th.sorted-desc::after {
    content: " ↓";
    color: white;
}

/* Card Styles */
.card {
    border: none;
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
}

.card-header {
    font-weight: 500;
}

.signup-indicator {
    font-size: 0.9rem;
    color: #666;
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .day-box, .sport-box, .playLevel-box, .signuptype-box, .toggle-button {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .day-box, .sport-box, .playLevel-box, .signuptype-box {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .filter-box {
        padding: 0.375rem 0.625rem;
        font-size: 0.8125rem;
    }
    
    .card-title {
        font-size: 1.125rem;
    }
    
    .offcanvas {
        max-width: 280px;
    }
    
    .filter-toggle {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .filter-toggle span {
        display: none;
    }
}

.signup-type-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 2px; /* Adjust gap as needed */
    justify-content: center; /* Center align the buttons */
    margin-bottom: 10px;
    border-bottom: 1px solid #b0b0b0;
    padding-bottom: 10px; /* Adds spacing before the line */
    
}

.playLevel-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 2px; /* Adjust gap as needed */
    justify-content: center; /* Center align the buttons */
}

.filter-content {
    display: none; /* Initially collapsed */
    transition: max-height 0.3s ease-out;
}

.filter-header {
    cursor: pointer;
    user-select: none;
}

/* Badge Styling */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    text-transform: none;
}

/* Offcanvas Styling */
.offcanvas {
    max-width: 350px;
    z-index: 1050;
    box-shadow: -0.25rem 0 1rem rgba(0, 0, 0, 0.15);
}

.offcanvas-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.offcanvas-title {
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.league-card, tbody tr {
    animation: fadeIn 0.3s ease-in-out;
}

/* Card Styling for Mobile */
.league-card .card {
    border: none;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
    transition: all 0.3s ease;
}

.league-card .card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.league-card .card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    border-bottom: none;
    padding: 1rem 1.25rem;
}

.league-card .card-body {
    padding: 1.25rem;
}

.signup-indicator {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--secondary-color);
}

/* Focus styles for accessibility */
button:focus, a:focus, input:focus, select:focus, textarea:focus, [tabindex]:focus {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Print styles */
@media print {
    .navbar, .filter-status-bar, .filter-toggle, #filterOffcanvas {
        display: none !important;
    }
    
    .d-none.d-lg-block {
        display: block !important;
    }
    
    .d-lg-none {
        display: none !important;
    }
    
    body {
        background-color: white;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .table {
        box-shadow: none;
    }
}

.table tbody tr[data-sport]:first-of-type {
    border-top: 3px solid var(--primary-color);
}

.table tbody tr:hover {
    background-color: #f8f9fa;
    transform: scale(1.005);
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 0.25rem;
    height: 1.25rem;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.time-indicator {
    position: relative;
    padding-left: 1.5rem;
}

.time-indicator.early-morning::before {
    content: "🌅";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.time-indicator.late-night::before {
    content: "🌙";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}