/* General Page Styling */

:root {

    /* Spacing */

    --margin-none: 0;
    --padding-none: 0;

    --padding-small: 2px;
    --padding-medium: 5px;
    --padding-large: 10px;
    --margin-small: 2px;
    --margin-medium: 5px;
    --margin-large: 10px;

    /* Borders & Radius */
    --border-color: #ccc;
    --border-radius: 1vh;
    --border-thickness: 2px;

    /* Opacity Levels */
    --opacity-light: 0.6;

    /* Background colours */
    --color-current-year-training: #4D9FE6;
    --color-last-year-training: #B6D4FF;
    --color-unavailable: #A0A0A0;
    /* Lighter grey */
    --color-available: #FFFEF0;
    /* Subtle pale yellow */
    --color-current-year-graded-dp: #A093D1;
    /* More complementary shade */
    --color-reserved-matches: #7F8C8D;
    --color-current-year-social-dp: #5EBF6A;
    --color-current-year-club-program: #B8EDB5;
    --color-text-dark: black;
    --color-text-light: white;
    --color-background: #F4F4F4;

    --color-light-yellow: #FFFEF0;

    --header-background-color: #ED7E22;

    --schedule-header-row-height: 20px;
    /* Define a global variable */

    --ground-column-width: 100px;
    --pitch-column-width: 80px;
    --grid-columns-to-show: 240;

    --grid-columns-setup: var(--ground-column-width) var(--pitch-column-width) repeat(var(--grid-columns-to-show), minmax(5px, 1fr));

    --day-start-time: "16:00";

}

html,
body {
    height: 100%;
    /* This ensures that the html and body tags do not exceed the viewport height */
    margin: var(--margin-none);
    padding: var(--padding-none);
    overflow: hidden;
    /* Prevents scrolling on the body directly */
    border-collapse: collapse;
}

body {
    font-family: Arial, sans-serif;
    background-color: var(--color-background);
}

table {
    border-collapse: collapse;
}


h1,
h3,
p {
    margin: var(--margin-none);
    padding: var(--padding-small);
}

p {
    line-height: 1.5;
}

h1 {
    font-size: clamp(1.2rem, calc(0.65vw + 1.25vh), 2rem);
}

h3 {
    font-size: clamp(0.8rem, calc(0.5vw + 0.5vh), 1.2rem);
}

p,
a,
label,
td,
th,
li,
ul,
input[type="text"],
input[type="select"],
input[type="search"],
select,
option {
    font-size: clamp(0.75rem, calc(0.45vw + 0.3vh), 1rem) !important;
}

ul li {
    line-height: 1.5;
  }



button {
    font-size: clamp(0.75rem, calc(0.45vw + 0.15vh), 0.85rem)
}

;

footer,
.footer-link,
footer p {
    font-size: clamp(0.5rem, calc(0.4vw + 0.15vh), 0.75rem);
}

#scheduleGridTable,
#hoverInfoBox {
    font-size: clamp(0.6rem, calc(0.55vw + 0.15vh), 1rem);
    border-collapse: separate;
}

#viewportInfoTable td {
    font-size: clamp(0.5rem, calc(0.2vw + 0.2vw), 0.6rem);
}


.flex-row {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    flex-wrap: nowrap;
}

.page-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    height: 100vh;
}

.header-container {
    background-color: var(--header-background-color);
    color: var(--color-text-dark);
    flex: 0;
    height: 75px;
}

#viewportInfoContainer {
    flex: 2;
    padding: var(--padding-small);
    border: none;
    margin: 0;
    color: var(--color-text-light);

}

#viewportInfoTable {
    margin: var(--margin-small);
    /* Hide the viewport table but leave it in the layout */
    visibility: hidden;
}

#viewportInfoTable td {
    border: none;
    padding: var(--padding-small);
    text-align: left;
    opacity: 0.6;
}

.page-header {
    flex: 6;
    text-align: center;
    align-items: center;
    justify-content: center;
    margin-top: auto;
    margin-bottom: auto;
    padding: var(--padding-medium);
}




.header-button-container {
    flex: 2;
    display: flex;
    flex-wrap: wrap;
    /* Allows wrapping when space is limited */
    gap: 10px;
    /* Adds space between buttons */
    justify-content: center;
    /* Centers buttons */
}

/* Button Styling */

.header-button-container button {
    min-width: 30px;
    /* Sets a minimum size before wrapping */
    max-width: 190px;
    height: 75%;
}


button {
    flex: 1;
    /* Ensures both buttons take equal space */
    padding: var(--padding-medium);
    text-align: center;
    border: 2px solid transparent;
    /* Transparent for gradient effect */
    border-radius: 6px;
    /* Slightly more rounded */
    cursor: pointer;
    margin: 5px;
    margin-top: auto;
    margin-bottom: auto;
    white-space: normal; /* Allows text to wrap onto multiple lines */
    word-wrap: break-word; /* Breaks long words if necessary */
    overflow-wrap: break-word; /* Modern equivalent */
    text-align: center; /* Centers text inside the button */
    max-width: 100%; /* Ensures the button doesn't overflow its container */
    width: auto; /* Button size adapts to text */
    box-sizing: border-box; /* Includes padding and border in total width */
    overflow: hidden;
    background-color: #e0e0e0;
    /* Updated background color */
    color: black;
    position: relative;
    transition: all 0.3s ease;
    /* Smooth transition */
    /* Dark to Light Gradient Border */
    background-image: linear-gradient(#e0e0e0, #e0e0e0), linear-gradient(90deg, #000000, #B0B0B0);
    /* Black to Light Grey */
    background-origin: border-box;
    background-clip: padding-box, border-box;
    /* Subtle shadow for depth */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Hover Effect */
button:hover {
    background-color: #d0d0d0;
    /* Slightly darker grey on hover */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
    /* Stronger shadow */
}

/* Focus Outline for Accessibility */
button:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5);
    /* Dark focus ring */
}


.info-panel-content-container {
    display: flex;
    flex-direction: column;
    border: 2px solid grey;
    margin: var(--margin-medium);
    padding: var(--padding-large);
    background-color: white;
    border-radius: var(--border-radius);
}


#gridViewInfoPanelFilters {
    flex: 2;
}

#gridViewInfoPanelNotes {
    flex: 3;
}

#gridViewInfoPanelLegend {
    flex: 2;
}

#legendTable {
    flex: 2;
}

#legendTable {
    width: 100%;
    border: none;
}


#legendTable td {
    padding: var(--padding-medium);
    border: 1px solid grey;
    border-radius: 2px;
}

#filterOptionsTable {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

#filterOptionsTable tbody {
    display: flex;
    flex-direction: column;
    /* Keeps rows stacked */
}

#filterOptionsTable tr {
    display: flex;
    width: 100%;
    padding-top: var(--padding-medium);
    padding-bottom: var(--padding-medium);
}

#filterOptionsTable tr:not(:first-child) {
    border-top: 1px dotted grey;
}

#filterOptionsTable .filter-label-column {
    display: flex;
    flex: 1;
    /* Equal column widths */
    align-items: center;
}

#filterOptionsTable label {
    width: calc(33%);
    text-align: left;
}


#filterOptionsTable .filter-value-column {
    flex: 4;
    /* Equal column widths */
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
}

#filterOptionsTable input[type='text'] {
    width: calc(100% - 10px);
    text-align: left;
}

#resetFiltersButton {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    margin-top: var(--margin-medium);
    margin-bottom: var(--margin-medium);
    max-height: 40px;
}




#scheduleGridTable {
    flex: 4;
    overflow-y: auto;
    /* Keeps the scrolling ability for the table */
    overflow-x: auto;
    width: 100%;
    padding: var(--padding-none);
    margin-left: auto;
    margin-right: auto;
    display: flex;
    flex-direction: column;
}

#noDataMessage {
    color: red;
    font-size: 1.5rem;
    font-weight: bold;
    flex: 4;
    overflow: hidden;
    width: 100%;
    padding: var(--padding-none);
    margin-left: auto;
    margin-right: auto;
    margin: var(--margin-medium);
    padding: var(--padding-large);
    background-color: white;
    border-radius: var(--border-radius);
    border: var(--border-thickness) solid var(--border-color);
    text-align: center;
    display: none;
}

.pitch-column,
.ground-column {
    display: flex;
    align-items: center;
    background-color: darkgrey;
    color: black;
}

.grid-layout {
    display: grid;
    grid-template-columns: var(--grid-columns-setup);
    /* Fixed + Variable */
    width: 100%;
    grid-auto-rows: auto;
    /* Rows grow naturally */
    align-items: stretch;
    /* Ensure all cells match the tallest */
    overflow: hidden;
    /* remove if needed */

}

.ground-change-row {
    border-top: 2px solid black;
}

.grid-header-row,
.grid-body-row {
    display: grid;
    flex-basis: 100%;
    width: 100%;
    grid-template-columns: var(--grid-columns-setup);
}

.grid-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%
}

.grid-body-row {
    flex: 1;
}

.grid-header {
    display: block;
    position: sticky;
    top: 0;
    /* Sticks to the top of the viewport */
    z-index: 20;
    /* Ensures it stays above other elements */
    background-color: #fff;
    /* Background to avoid transparency when scrolling */
    width: 100%;

}

.grid-header-cell {
    background-color: black;
    color: white;
}

.grid-cell {
    padding: 5px;
    grid-column: span 1;
    /* Allows spanning if needed */
    border-bottom: 1px dotted grey;
    border-top: 1px dotted grey;

}


.time-increment-row {
    display: none;
}

.time-slot {
    display: flex;
    justify-content: center;
    /* Horizontal alignment */
    align-items: center;
    /* Vertical alignment */
    padding: 5px;
    text-align: center;
    background-color: #f9f9f9;


}

.grid-header-row:nth-child(2) {
    text-align: left;
    padding: 0;

}

.grid-header-row:nth-child(1) {
    text-align: center;
    padding: 0;
    text-transform: uppercase;

}


.highlight-search {
    color: red !important;
    font-weight: bold !important;
}


/* Sticky Ground Column */
.ground-column {
    position: sticky;
    left: 0;
    z-index: 15;
    /* Above body but below header if needed */
    background-color: #f0f0f0;
    /* Background to avoid transparency */
    border-right: 1px solid #ccc;
}

/* Sticky Pitch Column */
.pitch-column {
    position: sticky;
    left: 100px;
    /* Width of the Ground Column */
    z-index: 15;
    background-color: #f0f0f0;
    border-right: 1px solid #ccc;
}

.ground-column.super-sticky-1 {
    position: sticky;
    top: 0px;
    left: 0px;
    background-color: black;
    z-index: 50;
    color: black;
}

.pitch-column.super-sticky-1 {
    position: sticky;
    top: 0px;
    left: 100px;
    background-color: black;
    z-index: 40;
}

.ground-column.super-sticky-2 {
    position: sticky;
    top: 20px;
    left: 0px;
    background-color: black;
    color: black;
    z-index: 40;
}

.pitch-column.super-sticky-2 {
    position: sticky;
    top: 20px;
    left: 100px;
    background-color: black;
    z-index: 30;
}


.time-slot[data-start-time="16:00"]:not([data-has-allocation="true"]),
.grid-header-cell[data-time="16:00"] {
    border-left: 2px solid grey;
}

.time-slot[data-start-time$="00"]:not([data-start-time="16:00"]):not([data-has-allocation="true"]),
.time-slot[data-start-time$="30"]:not([data-start-time="16:00"]):not([data-has-allocation="true"]),
.grid-header-cell[data-time$="00"]:not([data-time="16:00"]),
.grid-header-cell[data-time$="30"]:not([data-time="16:00"]) {
    border-left: 1px dotted grey;
}

.hidden {
    display: none;
}

.time-slot[data-has-allocation="true"] {
    border-radius: 3px; /* Works visually even if table layout clips it */
    color: black;
    box-shadow: inset 0 0 0 1px darkslategrey
    /* Inner shadow for depth */
}





tr[data-allocation-type='current-year-team-training'],
.time-slot[data-allocation-type='current-year-team-training'],
.current-year-team-training {
    color: var(--color-text-dark);
    background-color: var(--color-current-year-training) !important;
}

/* Style for last year allocations */
tr[data-allocation-type='last-year-team-training'],
.time-slot[data-allocation-type='last-year-team-training'],
.last-year-team-training {
    font-style: italic;
    opacity: 0.7;
    /* Lighten font */
    background-color: var(--color-last-year-training) !important;
}

.time-slot[data-allocation-type='unavailable'],
.unavailable {
    background: var(--color-unavailable);
    color: var(--color-text-dark);
}

.time-slot[data-allocation-type='available'],
.available {
    background-color: var(--color-available);
}

tr[data-allocation-type='current-year-graded-dp-training'],
.time-slot[data-allocation-type='current-year-graded-dp-training'],
.current-year-graded-dp-training {
    background-color: var(--color-current-year-graded-dp) !important;
}

.time-slot[data-allocation-type='reserved-for-matches'],
.reserved-for-matches {
    background-color: var(--color-reserved-matches);
    color: var(--color-text-dark);
}

tr[data-allocation-type='current-year-team-training-program'],
.time-slot[data-allocation-type='current-year-team-training-program'],
.current-year-team-training-program {
    background-color: var(--color-current-year-social-dp) !important;
}


.time-slot[data-allocation-type='current-year-club-program'],
.current-year-club-program {
    background-color: var(--color-current-year-club-program);
}



#hoverInfoBox {
    position: absolute;
    background-color: #fff;
    border: 1px solid black;
    border-radius: 6px;
    padding: var(--padding-medium);
    display: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    max-width: 300px;
    z-index: 1000;
}


#mainContent {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1200px;
    min-width: 400px;
    margin: 0 auto;
}

#infoPanelListView {
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    flex-direction: column;
}

#tableContainer {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;

}


#listViewNotesPanel {
    flex: 1;
    overflow: auto;
}

/* Table Layout & Styling */
#dataTableContainer {
    margin: var(--margin-medium);
    padding: var(--padding-medium);
    background-color: white;
    border: 2px solid grey;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;

}

#listViewTable_wrapper {
    display: flex;
    flex-direction: column;
    overflow: hidden;

}




/* Force both header and body to use the same table layout */
#listViewTable {
    width: 100% !important;
    table-layout: auto;
    border-collapse: collapse;
}

#listViewTable tr {
    border-bottom: 1px solid darkgrey;
    border-top: 1px solid darkgrey;
}


#listViewTable th,
#listViewTable td {
    text-align: left;
    padding: var(--padding-small);
}

#listViewTable thead select,
#listViewTable thead input {
    width: 100%;
    padding: 3px;
    box-sizing: border-box;
    font-size: 0.9rem;
}

#listViewTable_filter {
    padding: var(--padding-medium);
}

#listViewTableContainer {
    max-height: 700px;
    overflow: auto;
    margin-top: var(--margin-medium);
    margin-bottom: var(--margin-medium);
}


#listViewTable thead tr {
    background-color: grey;
    color: white;
}

/* Apply styles only to the first row in the thead */
#listViewTable thead tr:first-child th {
    height: 30px;
    /* Set header height */
    line-height: 30px;
    position: sticky;
    top: 0;

}

#listViewTable thead tr:not(:first-child) th {
    height: auto;
    /* Allow natural height for other rows */
    line-height: normal;
    position: sticky;
    top: 30px;
    /* Offset by the height of the first row */
}

/* Make the table header sticky */
#listViewTable thead th {
    background-color: grey;
    /* Background color for header */
    z-index: 20;
    /* Ensure header stays above body rows */
    border-bottom: 2px solid #ccc;
}

#listViewTable_info {
    border-top: 1px solid grey;
    background-color: lightgrey;
    padding-bottom: var(--padding-medium);
    padding-top: var(--padding-medium);
}


#gridViewFooterPanel {
    flex-grow: 0;
}

footer {
    width: 100%;
    text-align: center;
    background-color: black;
    color: white;
    height: 25px;
    padding-left: 1vw;
    padding-right: 1vw;
    padding-top: 0.5vh;
    padding-bottom: 0.5vh;
}


footer p {
    display: block;
    align-items: center;
    text-align: right;
}

.footer-link {
    color: white;
}

select,
input[type="text"],
input[type="search"] {
    background-color: var(--color-light-yellow) !important;
}

#longNotes {
    display: none;
}

#shortNotes {
    display: block;
}


/* Style the filter containers */
#yearFilterContainer, #ageGroupFilterContainer {
    display: flex;
    align-items: center; /* Vertically align label and select */
    gap: 8px; /* Space between label and select */
    margin-bottom: 5px;
    margin-top: 5px;
}

/* Style labels */
#yearFilterContainer label,
#ageGroupFilterContainer label {
    min-width: 120px; /* Ensure labels align */
    text-align: right;
    font-weight: bold;
}

/* Style select dropdowns */
#yearFilterContainer select,
#ageGroupFilterContainer select {
    flex: 3; /* Make select expand to fill available space */
    max-width: 180px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
}


@media (max-width: 1000px) {
    #gridViewInfoPanelNotes {
        display: none;
    }
}

@media (max-width: 500px) {
    #gridViewInfoPanelLegend {
        display: none;
    }
}

@media (max-width: 750px) {
    #switchToGridViewButton {
        display: none;
    }
}








/* For screens wider than 600px */
@media (min-width: 901px) {
    #longNotes {
        display: block;
    }

    #shortNotes {
        display: none;
    }
    
}

@media (max-width: 900px) {
    #longNotes {
        display: none;
    }

    #shortNotes {
        display: block;
    }
    
}



/* For screens wider than 600px */
@media (min-width: 601px) {
    
    #ageGroupFilterContainer,
    #yearFilterContainer {
        display: none;
    }
}



/* For screens 600px and below */
@media (max-width: 600px) {
    /* Hide elements */
    #listViewNotesPanel,
    #listViewTableFilterContainer
    {
        display: none;
    }

    
    #ageGroupFilterContainer,
    #yearFilterContainer {
        display: flex;
    }

    /* Add spacing for year filter */
    #yearFilterContainer {
        margin-bottom: 10px;
    }
}


