/**
 * Styles appropriate to EGC golf specific page elements.
 */
 /* Default colour values if they have not been set through 'Settings' page */
:root {
    --gw-table-bgcolour: darkslateblue;
    --gw-table-fgcolour: white;
    --gw-table-hoverbgcolour: rgb(68, 73, 196);
    --gw-table-selectbgcolour: rgb(140, 186, 150);
}

* {
    box-sizing: border-box;
}

/* Table style laid out like original ASP.NET site (for use in Webgrid generated tables) */
/* Note use of variables, which are defined via the plugin page. */
.gw_table {
    width: auto;
    margin: 0 auto;
    border-collapse: separate;
    text-align: left;
}
.gw_table thead {
    background-color: var(--gw-table-bgcolour);
    color: var(--gw-table-fgcolour);
    border-top: 1px solid var(--gw-table-bgcolour);
    font-weight: bold;
    font-size: 1.2em;
    padding: 2px 2px;
    position: sticky;
    z-index: 10;
    top: 2%; 
}
.gw_table thead th {
    font-size: inherit;
    border-right: 2px solid #ffffff;
    letter-spacing: normal;
    text-transform: none;
}
.gw_table thead th:first-child {
    border-left: 2px solid var(--gw-table-bgcolour);
}
.gw_table thead th:last-child {
    border-right: 2px solid var(--gw-table-bgcolour);
}
.gw_table thead a {
    color: var(--gw-table-fgcolour);
    text-decoration: underline;
}
.gw_table thead a:hover {
    background-color: var(--gw-table-hoverbgcolour);
}
.gw_table tbody tr:nth-child(even):not(.gw_selectedrow) {
    background-color: var(--gw-table-altcolour);
    cursor: default;
}
.gw_table td {
    border: 1px solid var(--gw-table-bgcolour);
    line-height: 1.2;
    padding-left: 2px;
    overflow-wrap: break-word;
    column-width: auto;
    -webkit-column-width: auto;
    -moz-column-width: auto;
    font-size: 1em;
    color: black;
}


.post-table-header {
    display: block;
    background-color: var(--gw-table-bgcolour);
    color: var(--gw-table-fgcolour);
    font-weight: bold;
}

.listing-item {
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid darkgray;
}

.listing-item .title {
    position: absolute;
    left: 10.4em;
    padding-left: 5px;
    border-left: 1px solid darkgray;
}

.listing-item .date {
    padding-left: 5px;
}

.ladies-news > li > a {
    color: red !important;
}
.gw_error {
    text-align: center;
    color: red;
    font-size: 1.2em;
}
.gw_success {
    text-align: center;
    color: rgb(4, 132, 32);
    font-size: 1.2em;    
}

.leftcell {
    padding-right: 10px;
}

.fivep {
    width: 5%;
}
.largetextcell {
    width: 75%;
    margin: 0 auto;
}
.centredcell {
    text-align: center;
    padding-right: 2px;
}

.responsivewidth {
    width: auto;
    margin: 0 auto;

}
@media only screen and (max-width: 393px) {
    .responsivewidth {
        width: 100%;
        padding: 4px;
    }
}

.gw_selectedrow {
    background-color: var(--gw-table-selectbgcolour) !important;
    color: var(--gw-table-fgcolour) !important;
}

.gw_selectedrow:hover {
    cursor: pointer;
    background-color: var(--gw-table-hoverbgcolour) !important;
}

.gw-last-updated {
    color: blue;
    text-align: center;
    margin-top: 1em;
}

/* support for handicap master page inserts */
.hminsert {
width: 100%;
margin: 0 auto;
padding: 0px;
border-style: none;
border-color: var(--gw-table-bgcolour);
border-width: 0;
}
.hminsert > iframe {
text-align: center;
padding: 0px;
}
@media only screen and (max-width: 393px) {
.hminsert {
width: 100%;
padding: 0px;
border-width: 0;
}
.hminsert > iframe {
padding: 0px;
}
}

/* Sometimes nice to have a border one side or the either to separate columns */
.col-with-right-border {
    border-right: 2px solid blue;
}

.col-with-left-border {
    border-left: 2px solid blue;
}

/* Style for table display of Posts in a category. */
.post-block-70  {
    width: 70%;
    margin: 0 auto;
    color: black;
}
.post-block-50 {
    width: 50%;
    margin: 0 auto;
    color: black;
}
@media only screen and (max-width: 393px) {
    .post-block-70, .post-block-50 {
        width: 100%;
    }
}

/* CSS for honours db edit forms */
.compform {
    width: fit-content;
    margin: 0 auto;
    @media only screen and (max-width: 393px) {
        width: 100%;
        margin: 2px;
    }
    @media print {
        input::-webkit-outer-spin-button,
        input::-webkit-inner-spin-button {
          -webkit-appearance: none;
          margin: 0;
        }   
        /* Firefox */
        input[type=number] {
            appearance: textfield;
            -moz-appearance: textfield;
        }
        legend {
            display: none;
        }
    }
    &:first-of-type {
        page-break-before: avoid;
    }
    div {
        margin-top: 10px;
        margin-bottom: 10px;
        text-align: center;
    }
    .alignright {
        display: inline-block;
        float: none;
        width: 20%; 
        margin-left: 10px;
        text-align: left;
        > label {
            width: fit-content;
        }
        @media only screen and (max-width: 393px) {
            width: auto;
        }
        @media print {
            display: none;
        }
    }
    fieldset {
        border: none;
        padding: 0;
    }
    table {
        padding: 0 2px;
        border-collapse: collapse;
        table-layout: auto;
        border: 1px solid grey;
        @media print {
            border: 2px solid black;
        }
        td, th {
            border: 1px solid grey;
            width: auto;
            @media print {
                border: 1px solid black;
            }
        }
        
    }  
    label {
        display: inline-block;
        color: darkblue;       
        font-weight: bold;
        text-align: right;
        max-width: 72ch;
        padding-right: 6px;
        padding-left: 0px;
        vertical-align: middle;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-bottom: 0;
        @media print {
            color: black;
        }
    }
    input[type="text"], input[type="number"] {
        display: inline-block;
        text-align: left;
        width: 80ch;
        margin-top: 0px;
        padding-top: 4px;
        padding-bottom: 4px;
        @media print {
            appearance: none;
            overflow:visible;
            resize: none;
        }
    }
    input[type="number"] {
        width: 20ch;
    }
    input[type="submit"] {
        width: fit-content;
        max-height: 50px;
        /* border-bottom: 5px solid #173814; */
        border-top: none;
        border-left: none;
        border-right: none;
        background: linear-gradient(lightblue,var(--gw-table-bgcolour));
        color: white;
        border-radius: 10px;
        box-shadow: 0px 2px 10px grey;
        transition: 150ms ease;
        text-align: center;
        font-weight: bold;
        margin-right: 10px;
        @media print {
            display: none;
        }
    }
    input[type="file"] {
        vertical-align: middle;
        width: auto;
        margin: 0;
        padding: 0;
        @media print {
            display: none;
        }
    }
    input[type="image"] {
        width: 36px;
        margin: 0 0 0 0;
        padding: 0;
        vertical-align: middle;
        &:disabled {
            opacity: 0.5;
        }
    }
    textarea {
        display: inline-block;
        text-align: left;
        width: 80ch;
        padding-top: 4px;
        padding-bottom: 4px;
        vertical-align: middle;
        @media print {
            border: none;
            background-color: white;
            overflow: hidden;
            resize: none;
        }
    }
    img {
        width: 100px;
        @media print {
            width: 150px;
            margin-left: 10px;
        }
    }
    h2 {
        text-align: center;
        margin-top: 10px;
        page-break-before: always;
        &:first-of-type {
            page-break-before: avoid;
        }   
    }
    input[type="text"], input[type="textarea"] {
        @media only screen and (max-width: 393px) {
            width: 100%;
        }
    }
}

.compform select, .honsmenu select {
    display: inline-block;
    vertical-align: middle;
    width: 24ch;
    height: 1.6rem;
    margin-left: 6px;
    margin-right: 6px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: rgb(0, 0, 0);
    @media print {
        appearance: none;
        height: auto;
        border: none;
    }
}
select#compyear {
    width: 10ch;
    font-weight: bold;
}

/* Leaderboard css */
/* Ensure the input form always sticks to the top of the screen and doesn't scroll off */
.gw_leaderboardfixed {
    position: sticky;
    top: 0;
    margin-bottom: 10px;
    z-index: 20;
}
/*
 * Adjustments to table layout specifically for leaderboard
*/
table#leadertable {
    .pname {
        width: 40%;
        min-width: 10em;
    }
    .teetime {
        width: 20%;
        text-align: center;
    }
    .tee {
        width: 4em;
        text-align: center;
    }
    .score {
        max-width: 6em;
        word-wrap: break-word;
        text-align: center;
    }
}

.gold {
    background: #f5f589;
    background: radial-gradient(circle, rgba(245, 245, 137, 1) 0%, rgba(222, 205, 53, 0.98) 51%, rgba(247, 236, 79, 1) 100%);
    font-weight: bold;
}
.silver  {
    font-weight: bold;
    background: #f7f7f7;
    background: radial-gradient(circle, rgba(247, 247, 247, 1) 0%, rgba(207, 202, 202, 0.98) 67%, rgba(184, 176, 176, 1) 100%);
}

.bronze { 
    background: #e08f0b;
    background: radial-gradient(circle, rgba(224, 143, 11, 1) 0%, rgba(189, 119, 6, 1) 62%, rgba(140, 90, 8, 1) 100%);
    font-weight: bold;
}

form.leader {
    fieldset {
        border: rgb(140, 109, 77) 2px solid;
        padding: 4px;
        margin-bottom: 10px;
        legend {
            font-weight: bold;
            color: var(--gw-table-bgcolour);
            font-size: 1.2em;
        }
        input.button {
            display: inline-block !important;
            margin: 0 auto;
            vertical-align: middle;
        }
        select {
            display:inline-block;
            margin-left: 10px;
            margin-right: 10px;
            vertical-align: middle;
            height: 2.6em;
            font-size: 1.2em;
            background:rgb(255, 255, 255) !important;
            color: black;
        }
    }
    input[type=submit] {
        width: fit-content;
        margin: 0 auto;
        border-bottom: 2px solid #686a67;
        border-top: none;
        border-left: none;
        border-right: none;
        border-radius: 10px;
        box-shadow: 0px 2px 10px rgb(126, 124, 124);
        background: var(--gw-table-bgcolour);
        color: white;
        transition: 150ms ease;
        text-align: center;
        line-height: 1.2;
        font-weight: bold;
        margin-top: 4px;
    }
    
    input[type=number], input[type=time] {
        width: 6em;
        margin-left: 2px;
        margin-right: 2px;
        text-align: center;
    }

    label {
        input {
            display: block;
            background:rgb(255, 255, 255) !important;
            border: 1px solid darkgray;
            color: black;
        }
        select {
            display: block;
        }
        display: inline-block;
        width: auto;
        margin-right: 10px;
        font-weight: bold;
        color: darkblue;
    }

    width: fit-content;
    margin: 0 auto;
    padding: 2px;
    border: 2px solid darkblue;
    border-radius: 8px;
    background-color: #D6F1F3;
    @media only screen and (max-width: 393px) {
        width: 100%;
        margin: 2px;
        padding: 2px;
    }
}


/* Honours board tables - listings of competition winners .
 * Display a background image (of a wooden board). Turn off borders on tables on screens.
 */
.honours-image {
    max-width: 50%;
    min-width: 400px;
    margin-top: 10px;
    margin-bottom: 20px;
    margin-inline: auto;
    padding: 4px;
    border: 8px ridge black;
    background-image: url("../icons/honsbackground.jpg");
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: scroll;
    @media only screen and (max-width: 393px) {
        max-width: 380px;
        min-width: 350px;
        padding: 0px;
        margin: 0;
    }
    img {
        display: block;
        width: 80%;
        margin-left: auto;
        margin-right: auto;
        margin-top: 20px;
    }
    .winners-table-web td, .winners-table-web th {
        border: none;
    }
    @media print {
        page-break-before: always;
        color: black;
    }
}

/* CSS for laying out names of honours winners on web and printed pages */
.winners-table-web {
    padding: 4px;
    width: fit-content;
    margin: auto;
    table {
        border: none;
        @media not print {
            width: fit-content;
            margin: 0 auto;
        }
        tr {
            border: none;
            @media not print {
                overflow: hidden;
                white-space: nowrap;
            }
        }
        td, th {
            border: none;
            line-height: 1em;
            font-weight: bold;
            color: black;
            padding-bottom: 2px;
            overflow: hidden;
            white-space: nowrap;
            border: 1px solid black;
        }
        th {
            font-size: 1.2em;
        }
    }
    table.fullhonslist {
        tr > th:nth-child(even), tr > td:nth-child(even)  {
            text-align: center;
        }
    }
    table.specifichonour {
        tr > th:nth-child(odd), tr > td:nth-child(odd)  {
            text-align: center;
        }
        tr > th:nth-child(2), tr > td:nth-child(2)  {
            padding-right: 6%;
        }       
    }
    p {
        text-align: center;
        margin-bottom: 10px;
        margin-top: 10px;
        color:#ac2626;
        font-size: 26px;
        font-weight: bold;
        @media print {
            page-break-before: always;
            color: black;
        }
    }
}

.honshistory {
    width: 60%;
    margin: 0 auto;
    @media print {
        width: 75% !important;
    }
    @media only screen and (max-width: 393px) {      
        width: 100%;
        margin: 2px;
    }
    h3 {
        color: black;
        text-align: center;
        margin-top: 20px;
    }
    table  {
        border: 2px solid black;
        tr > th  {
            color: black;
            background-color: lightyellow;
            font-size: 1.2em;
            border: 2px solid black;
        }
        tr > td  {
            color: black;
            border: 1px solid black;
        }
    }
}

/* Trial menu rendering with grid layout */
.gridhead {
    h2 {
        text-align: center;
        color: rgb(0, 0, 255);
    }
    grid-column: 1 / span 2;
}

.gridbutton {
    button {
        width: fit-content;
        max-height: 50px;
        border-bottom: 2px solid #686a67;
        border-top: none;
        border-left: none;
        border-right: none;
        border-radius: 10px;
        box-shadow: 0px 2px 10px rgb(126, 124, 124);
        background: linear-gradient(45deg, rgb(147, 166, 227),blue);
        color: white;
        transition: 150ms ease;
        text-align: center;
        line-height: 2;
        font-weight: bold;
    }
    button:hover {
        background:rgb(0, 0, 255);
    }
    text-align: right;
    align-self: center;
}

.griddesc {
    color: black;
}

.menugrid {
    width: 80%;
    margin: 0 auto;
    display: grid;
    /* Just spec first column, css grid will implicitly add rows using these column sizes */
    grid-template-columns: 1fr 3fr;
    grid-gap: 10px;
}
.gridbox {
    background-color: none;
    padding: 5px;
}

/* Properties for section select box */

.section-select {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: auto;
    width: 100%;
    min-width: 6ch;
    max-width: 15ch;
    padding: 0.25em 0.5em;
    font-size: 1.3em;
    cursor: pointer;
    line-height: 1.5;
}

.section-select p {
    color: blue;
    text-align: center;
    font-weight: bold;
    margin: 0 0 0.25em 0;
}

.section-select select {
    appearance: none;
    background-color: blue;
    color: white;
    border: none;
    padding: 2px 1em 0 1em;
    margin: 0;
    width: 100%;
    font-family: inherit;
    font-size: inherit;
    cursor: inherit;
    line-height: inherit;
}

/* Optional: Custom arrow for select (pseudo-element) */
.section-select {
    position: relative;
}
.section-select select {
    padding-right: 2em;
}
.section-select::after {
    content: "";
    position: absolute;
    right: 1em;
    top: 2.2em;
    width: 0.8em;
    height: 0.5em;
    background-color: white;
    clip-path: polygon(100% 0%, 0 0%, 50% 100%);
    pointer-events: none;
}


/* Properties for controlling printing (safari ignores these) */
@page {
    width: 100%;
    size: A4;
    margin-right: 2cm;
    margin-left: 2cm;
    margin-top: 2cm;
}

@media print {
    thead {
        display: table-header-group;
    }
    header, footer {
        display: none;
    }
}

/* Scrolling experiment for knockout table */
.scrollable-block {
    overflow-x: scroll;
    overflow-y: hidden;
    white-space: nowrap;
    table {
        min-width: 150ch;
        border: 2px solid black;;
        td, th {
            height: 2em;
            border-color: black !important;
            border-top: none;
            border-bottom: none;
            border-left: none;
            border-right: 1px solid black;
        }
        th {
            overflow: hidden;
            font-size: 14px;
            letter-spacing: normal;
            text-transform: none;
            border-left: 2px solid black !important;
        }       
        tr:nth-child(4n-3) > td:nth-child(1), tr:nth-child(4n-2)  > td:nth-child(1) {
            background-color: rgb(207, 204, 233);
            border: 1px solid black;
        }
        tr:nth-child(4n-1)  > td:nth-child(1), tr:nth-child(4n)  > td:nth-child(1) {
            background-color: rgb(240, 240, 235);
            border: 1px solid black;
        }
        tr:nth-child(4n-2)  > td:nth-child(2), tr:nth-child(4n-1)  > td:nth-child(2) {
            background-color: rgb(237, 237, 188);
            border: 1px solid black;
        }        
        tr:nth-child(8n-4)  > td:nth-child(3), tr:nth-child(8n-3)  > td:nth-child(3) {
            background-color: rgb(146, 230, 192);
            border: 1px solid black;
        }        
        tr:nth-child(16n-8)  > td:nth-child(4), tr:nth-child(16n-7)  > td:nth-child(4) {
            background-color: rgb(227, 204, 143);
            border: 1px solid black;
        }         
        tr:nth-child(32n-16)  > td:nth-child(5), tr:nth-child(32n-15)  > td:nth-child(5) {
            background-color: rgb(136, 178, 232);
            border: 1px solid black;

        }
        tr:nth-child(32n-16)  > td:nth-child(6), tr:nth-child(32n-15)  > td:nth-child(6) {
                background-color: rgb(228, 214, 91);
                border: 1px solid black;
        }
        tr:nth-child(32n-16)  > td:nth-child(6) {
            border-bottom: none;
        }
        tr:nth-child(32n-15)  > td:nth-child(6) {
            border-top: none;
        }
    }  
    .sixteenrows table {
        tr:nth-child(32n-16)  > td:nth-child(5), tr:nth-child(32n-15)  > td:nth-child(5) {
            background-color: white;
            border: none;
        }
        tr:nth-child(16n-8)  > td:nth-child(5), tr:nth-child(16n-7)  > td:nth-child(5) {
            background-color: rgb(228, 214, 91);
            border: 1px solid black;
        }
        tr:nth-child(16n-8)  > td:nth-child(5) {
            border-bottom: none;
        }
        tr:nth-child(16n-7)  > td:nth-child(5) {
            border-top: none;
        }        
    }     
}

/* Popover experiment - styles that allow hidden elements to appear as mouse pointer hovers over them */
/* To use 'position: absolute' in .popcontent below, we need to have a positioned ancestor, hence position: relative */
.popwrapper {
    position: relative;
    display: inline-block;
/* As popup message is already there, we just need to make it visible when the mouse is over its ancestor */
    &:hover .popcontent {
        opacity: 0.9;
    }
}
/* Position the message box to the left of its container and make it invisible */
.popcontent {
    border: 2px solid rgba(0,0,0,0.7);
    border-radius: 8px;
    background-color: rgba(255,255,255,0.7);
    opacity: 0.0;
    position: absolute;
    left: -250px;
    top: 0px;   
    width: 250px;
    p {
        color: red;
        font-weight: bold;
        padding: 4px;
        overflow: hidden;
        margin: 0;
    }
}

