
body, input,td,th,button, select {
    font-size:clamp(0.5rem, -.5rem + 5.333vw, 1.8rem);
    font-family:sans-serif;
}
body {
    margin:0;
    padding:0;
}
p {
    font-size:14px;
}

button {
    padding:8px;
    background:purple;
    border:0;
    color:white;
    cursor:pointer;
    position:relative;
    border-radius:12px;
    white-space:nowrap;
}
dialog, [popover] {
    white-space:nowrap;
    width:fit-content;
    background:white;
    z-index:5;
    border-radius:12px;
    overflow:visible;
}
dialog div, [popover] div {
    text-align:left;
    padding:3px;
}
:popover-open {
    min-width:250px;
    background:white;
    border:thick solid black;
}


/* general pop-up menu behavor */
select {
    appearance: none;
    border:0;
    background-color: white;
    padding-right:40px;
}
select:focus {
    outline:none;
}
option {
    padding:0 10px;
}
menu-frame {
    border: thin gray solid;
    border-radius: 6px;
    padding: 1px 10px;
    position:relative;
}
menu-frame > div.transparent {
    position:absolute;
    bottom:0;
    right:0;
    height:100%;
    pointer-events: none;
    padding:0 !important;
}
menu-frame > div.transparent::before {
    content:' \25BE';
    padding-right:10px;
}



/* Useful classes */
.small {
    font-size:50%;
}
.red-border {
    border-color:red;
}
.red {
    color:#e55;
}


/* General input appearance */
input {
    background-color: #fffbff;
    border:thin solid;
    padding-left:5px;
    color:purple;
    font-size:clamp(16px, -.5rem + 5.333vw, 1.8rem);
}
input:focus {
    outline:none;
    outline-style: double;
    outline-offset: -1px;
    outline-color:#a64da6;
    color:black;
}
input.red-border:focus {
    outline-color: red;
}
input:not(.red-border) {
    border-color:purple;
}
input.hideText {
    display: none;
}
input::placeholder {
    color:lightgray;
}

/* Checkbox scaling */
input[type="checkbox"] {
    --scaling-factor: clamp(
        1,                                            /* minimum (when width < 500px) */
        calc((100vw - 500px) / (1000px - 500px) + 1),  /* calculated value */
        2                                            /* maximum (when width > 1000px) */
    );
    transform: scale(var(--scaling-factor));
    vertical-align: middle;
}




/* Overall appearance */
#body {
    max-width:1000px;
    margin:auto;
}
#body:has(.open) {
    padding-bottom:500px; /* so overflow can show on current reservations */
}



/* Notify user with a 3-second message */
.notification {
    position:fixed;
    top: 20px;
    width: 80%;
    left:10%;
    z-index:25;
    padding:25px;
    text-align: center;
    box-shadow: 0 0 5px 2px gray;
    background-color: white;  
    border:solid black thin;
    transition: visibility 1s 2s, opacity 1s 2s linear;

}
.notification-fade {
    visibility: hidden;
    opacity: 0;
}


/* Context menu */
.contextMenu {
    position:absolute;
    left:20px;
    top:75%;
    z-index:10;
    background:white;
    border-width:1px 3px 3px 1px; 
    color:purple;
    font-size:smaller;
    border-style: solid;
    border-color:black;
    padding:0;
    cursor:pointer;
    text-wrap: nowrap;
}
.contextMenu div {
    padding:3px 8px;
}
.contextMenu div:hover {
    background-color: #eee;
}




/* Contains the action menu and the help icons */
#menuHolder {
    position:fixed;
    top:3px;
    right:25px;
    background:white;
    z-index:10;
    display: flex;
    align-items:stretch;
    column-gap: 3px;
}

/* Action menu and help icons */
#menuLink, #helpLink, #firecrackerLink {
    font-size: clamp(12px, 5vw, 32px);
    padding:1px 1vw;
    float:right;
    border:2px purple solid;
    color:purple;
    font-weight: bold;
    cursor:pointer;
}
#menuLink.open, #helpLink.open {
    background-color: purple;
    color:white;
}


/* temp */
#firecracker ul {
    padding-left: min(25px, 5vw);
    margin:5px;

}


/* Menu items */
#menuItems {
    position:absolute;
    top:60px;
    right:40px;
    right:0;
    display:none;
    border:thin solid gray;
    z-index:10;
}
#menuLink.open ~ #menuItems {
    display:block;
}
#menuItems div {
    background-color: purple;
    color:white;
    display:none;
    border:thin solid gray;
    padding:4px 9px;
    cursor: pointer;
    white-space: nowrap;
    text-align: right;
}
.director #menuItems div.directorOnly {
    display:block;
}
body:not(.director) #menuItems div.public {
    display:block;
}
#menuItems div:hover {
    background-color: plum;
}
#menuItems div.clicked {
    animation: flash-twice 0.5s;
}
@keyframes flash-twice {
    0% {
      background-color: plum;
    }
    20% {
      background-color: purple;
    }
    40% {
      background-color: plum;
    }
    60% {
      background-color: purple;
    }
    80% {
      background-color: plum;
    }
    100% {
        background-color: purple;
    }
  }


/* Help itme */
#help {
    display:none;
    position:absolute;
    right:20px;
    top:46px;
    width:70vw;
    background:white;
    z-index: 10;
    font-size:min(3vmin, 24px);
    color: black;
    font-weight:normal;
    border: purple 2px solid;
    padding: 5px;
}
#helpLink.open ~ #help {
    display:block;
}
#help ul {
    padding-left: min(25px, 5vw);
    margin-bottom:5px;
}
#help li {
    padding-bottom: 6px;
}
#help li.indented {
    margin-left:4vw;
}
#help img {
    height:25px;
    max-height:4vmin;
    transform:translateY(5px);
}
#help #closeHelp {
    float:right;
}

#videoHelp {
    padding:3px;
}



/* Top banner */

#logo {
    height:min(100px, 7vh);
    height: clamp(50px, calc(50px + ((100vh - 700px) / 4)), 100px);
    padding-right:min(25px, 2vw);
    float:left;
    margin-bottom:10px;
    margin-left:2px;
}

h2#topHeader {
    margin-top:5px;
    padding-top:5px;
    margin-bottom:0;
}


/*  Modal dialog replaces alert, confirm, prompt */

custom-modal button[value="OK"], 
cancel-reservation-modal button[value="cancel"],
view-emails-modal button[value="OK"] {
    float:right;
}
view-emails-modal .message {
    overflow-y:scroll;
    max-height:85vh;
}
custom-modal.confirm .inputDiv, custom-modal.alert .inputDiv {
    display:none;
}
custom-modal.alert button[value="cancel"] {
    display:none;
}



/* Table showing upcoming games */
table {
    border-spacing:0;
    border-color:lightgray;
    border-style:solid;
    border-width:thin 0 thin thin;
    margin-top:10px;
    width:100%;
}
tr:nth-child(odd) {
    background-color:#eef;
}
tr[data-special="No game"] td{
    opacity:0.25;
}
tr[data-special="No game"] td:last-child * {
    display:none;
}

table[data-day="1"] tr[data-day]:not([data-day="1"]),
table[data-day="2"] tr[data-day]:not([data-day="2"]),
table[data-day="3"] tr[data-day]:not([data-day="3"]),
table[data-day="4"] tr[data-day]:not([data-day="4"]),
table[data-day="5"] tr[data-day]:not([data-day="5"]),
table[data-day="6"] tr[data-day]:not([data-day="6"]),
table[data-day="7"] tr[data-day]:not([data-day="0"]),
table[data-day="sectional"] tr[data-day]:not(.sectional)
 {
    display:none;
}



/* Table cells */
td {
    border:solid lightgray;
    border-width: thin thin 0 0;
    padding:1vw;
}
td:not(:nth-child(3)) {
    text-wrap:nowrap;
}
td:nth-child(3) div:nth-child(2) {
    text-wrap: nowrap;
}
.director td:nth-child(3) {
    padding-right:30px;
}


/* Date cell */
.dow {
    font-size:larger;
    font-weight: bold;
}


/* Game description cell */
.special {
    color:purple;
}

/* Final cell, contains "Reserve" button */
#gameList tr td:last-child {
    position:relative;
    text-wrap: nowrap;
 }



/* Container for edit-game icon */
.editDiv {
    float:right;
    transform: scaleX(-1) translateX(-30px);
    cursor:pointer;
    visibility:hidden;
}
edit-game-button::after {
    content:"✎";
}
.director .editDiv {
    visibility:visible;
}


/* Icon for viewing reservations, different for directors */
view-reservations-button img {
    height:clamp(20px, 6vh, 50px);
    cursor:pointer;
    vertical-align: middle;
}
.director view-reservations-button img:not(.director) {
    display:none;
}
body:not(.director) view-reservations-button img.director {
    display:none;
}


/* Reserve button, shows checkmark after reserving, different for phones */
@media (min-width:1000px) {
    reserve-button button:after {
        content: "Reserve";
    }
    reserve-button.reserved button:after {
        content: "✓Reserved";
    }
}
@media (max-width:1000px) {
    reserve-button button:after {
        content: "✚";
    }
    reserve-button.reserved button:after {
        content: "✓";
    }
}
partner-finder-button {
    cursor:pointer;
}
partner-finder-button::after {
    content: "👥";
}



/* Contact director icon */
contact-button {
    position: relative;
    cursor:pointer;
}
contact-button img,
player-looking-contact-button img {
    width:50px;
    max-width: 8vw;
    vertical-align: middle;
    cursor:pointer;
}


/* reservation list */
.resList {
    border:solid gray 2px;
    border-bottom-width:4px;
    border-right-width:4px;
    padding:1vw;
    background:white;
    z-index:5;
    color:black;
    width:fit-content;
    white-space:nowrap;
}
.resList:not([popover]) {
    display:none;
    position:absolute;
    top:90%;
    right:15px;
    padding:0;
}
.resList:not([popover]) .empty {
    display:none;
}
td.open .resList {
    display:block;
}

.resList h3 {
    display:none;   /* only shows on print */
}


/* The chart is just a holder for the sections and section-names */
@media screen {
    .director .chart {
         overflow-y:scroll;
         max-height:85vh;
     }
 }
 /* @media print {
    .body {
        max-height: none;
        height:auto !important;
    }
    .director .chart {
        overflow-y:visible;
        max-height: none;
        height:auto !important;
    }
    .director .chart * {
        overflow-y: visible;
        height:auto;
    }
    .director section-names {
        display:block !important;
    }
 } */
 
 


/* section names */
body:not(.director) .sectionNames:not(:has(reservation-div))::after {
    content:"None yet";
    color:lightgray;
    padding: 0 8px;
}
.resList .section {
    padding-left:15px;
    color:gray;
    background-color: #eee;
    text-align: center;
    position:relative
}
.director .section {
    cursor:pointer;
}
 .deletedSection ,
[data-section="Deleted"] {
    display:none;
}
.director  .deletedSection,
.director [data-section="Deleted"] {
    display:block;
    background-color: #eee;
}
.resList:not([popover]) .seatingButtons {
    display:none;
}



/* section name lists */
.sectionNames {
    min-height: 20px;
    --letter: "";
}
.director .sectionNames {
    grid-template-columns:auto auto;
    display:grid;
    column-gap:15px;
}
.director tr[data-special="Swiss teams"] .sectionNames,
.director tr.sectional .sectionNames {
    grid-template-columns:auto;
}

reservation-div.dragover, .sectionNames.dragover, .sectionNames.dragover > reservation-div {
    background-color:plum !important;
}


/* individual reservations */
reservation-div {
    --row:"0";  /* illegitimate value but the CSS will gripe if it's undefined */
    --row-num: 0;
    display:block;
    position:relative;
    grid-row-start: var(--row-num); /* sets the location in the grid */
}
body:not(.director) reservation-div {
    padding: 0 8px;
}
/* .director .sectional reservation-div[data-id] {
    display:none;
} */
body:not(.director) .sectional reservation-div:not([data-id]) {
    display:none;
}
.director reservation-div.NS {
    padding-left:40px;
}
.director reservation-div:not(.empty) {
    cursor:pointer;
}
.NS {
    grid-column: 1;
}
.EW {
    grid-column: 2;
}
.director .showMPs .sectionNames > reservation-div:not(.empty)::after {
    content: " (" attr(data-mps) ")";
    color: gray;
}


/* background colors of reservations */
.director reservation-div.dragging {
    background-color: white;
}
reservation-div.touched, .contextMenu div.touched {
    background-color: #fcc !important;
}
.sectionNames:not([data-section="Deleted"]):not(.dragover) reservation-div:not(.dragover) {
    background-color: white;
}
.director .sectionNames:not([data-section="Deleted"]) .NS.E-W:not(.dragover), 
.director .sectionNames:not([data-section="Deleted"]) .EW.N-S:not(.dragover) {
    background-color: #fee !important; 
}
[popover] .sectionNames > reservation-div {
    background: white;
    cursor:pointer;
    min-width:300px;
}
[popover] .sectionNames[data-section="Deleted"] > reservation-div {
    background-color: #eee;
}


/*  show table numbers in left column for non-empty res, but not in deleted section and not while dragging */
.director .sectionNames:not([data-section="Deleted"]) reservation-div.NS:not(.empty):not(.dragging):before {
    content: var(--letter) var(--row);
    position: absolute;
    left: 0px;
}



/* newReservation dialog */
div.headerDiv {
    text-align:center;
    font-weight:bold;
    font-size:larger;

}
#dateDiv {
    color:purple;
    font-size:smaller;
    text-align: center;
}
#newReservation .nameDiv {
    text-align: right;
}
#newReservation:not(.swiss) .teammate {
    display:none;
}
#newReservation.swiss #needPartnerDiv, 
.swiss #directionDiv,
.sectional #directionDiv,
.sectional #needPartnerDiv {
    display:none;
}
#newReservation.regulars #needPartnerDiv, #newReservation.regulars #dateDiv {
    display:none;
}
#saveDiv {
    text-align:center;
}
#playerContact, #partnerContact {
    display:none;
}
#playerContact > div:has([name="playerEmail"].hideText)::after,
#addPlayerLooking > div:has([name="playerLookingEmail"].hideText)::after {
    content: "Email on file";
    color: purple;
}
#playerContact > div:has([name="playerPhone"].hideText)::after,
#addPlayerLooking > div:has([name="playerLookingPhone"].hideText)::after {
    content: "Phone on file";
    color: purple;
}
#playerContact img,
#addPlayerLooking img {
    width: min(25px, 5vw);
    vertical-align: middle;
}

#newReservation.waiting {
    cursor:wait;
    div,button,input {cursor:wait;}
}


/* Dropdowns are used in various dialogs */
.dropdown {
    position:absolute;
    white-space:nowrap;
    width:auto;
    max-height:200px;
    overflow-y:scroll;
    overflow-x:hidden;
    z-index:25;
    background:white;
    margin-top:0;
    padding-left:0;
    border:solid thin black;

    li {
        list-style-type: none;
        margin: 0;
        padding: 5px 15px; 
        border:solid thin black;
        border-width:1px 1px 0 0;
    }

    li:hover {
        background-color:#fdf;
        cursor:pointer;
    }
}


#gameDetails div {
    padding:10px;
}
#needPartnerDiv {
    text-align: right;
    font-size:70%;
}

/* Items in the New Game / Edit Game dialog */

#newGame #addRegularsSpan {
    display:none;
}
#newGame.new #addRegularsSpan {
    display:inline;
}
#otherGameType {
    display:none;
}
#deleteButton {
    /* display:none; */
    background-color: red;
    float:right;
}
#newGame.new #deleteButton {
    display:none;
}


/* Items in the findPlayer dialog */

#findPlayer:not(.updating)  #editPlayerInfo {
    display: none;
}
#findPlayer.updating #updatePlayerInfo, #findPlayer.updating #playerInfo {
    display:none;
}
#findPlayer div:has(input[name="playerName"][data-id=""]) ~ div #updatePlayerInfo {
    display: none;
}



/*  Items in the Edit Club dialog */
#regulars > div {
    position:relative;
}
#clubSections > div {
    position: relative;
}



.reservationsText {
    display:none;
}



/* partner finder dialog */
#partnerFinder div.day {
    color:gray;
    background-color: #eee;
}

#partnerFinder #playerLookingContact {
    display:none;
}
#partnerFinder #playerLookingDetails {
    display: none;
}
#partnerFinder button.addPlayerLooking {
    font-size:75%;
    padding:6px;
}
#partnerFinder .close {
    float:right;
}
#partnerFinder .partners > div:not(:has(button)) {
    cursor:pointer;
    position:relative;
}
#partnerFinderListing {
    max-height: 85vh;
    overflow: scroll;
    border: thin gray solid;
}

#addPlayerLooking.waiting {
    cursor:wait;

    div,button,input {cursor:wait;}
}



@media print {
 * {
    transition: none !important;
}
   div, td, td *, th, h2, img {display:none;}
    table {border:0;}
    td {border:0}
    #body,
    tr:not(.sectional) td:has(:popover-open),
    :popover-open, 
    :popover-open div, 
    reservation-div {
        display:block;
    }
    reservation-div * {
        display:inline;
    }
    .reservationsText {
        display:block;
    }
    .reservationsText div {
        display:block;
        font-size:70%;
    }
    .reservationsText div * {
        display:inline;
        overflow-y:visible;
    }
    :popover-open > div {font-size:70%;}
    :popover-open {border:0;margin-top:0;}
    .director div.deletedSection, .director .sectionNames[data-section="Deleted"] {
        display:none;
    }
    .resList h3 {
        display:block;
        text-align: center;
    }
    .resList .section {
        color:black;
        background-color:white;
    }
    .chart {
        max-height: initial;
        overflow-y: initial;
    }
    .director .NS.E-W:not(.dragover), .director .EW.N-S:not(.dragover) {
        background-color: white !important; 
    }
    
    .director .showMPs .sectionNames > reservation-div:not(.empty)::after {
        content:"";
    }
}