
body, input,td,th,button, select, textarea {
    font-size:min(5.2vmin - 0.5rem, 1.8rem);
    font-family:sans-serif;
}
body {
    margin:0;
    padding:0;
}
p {
    font-size:14px;
}

button {
    padding: min(8px, 1.5vmin);
    background:purple;
    border:0;
    color:white;
    cursor:pointer;
    position:relative;
    border-radius: min(12px, 3vmin);
    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: 2px solid #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding-left: 1%;
    padding-right: 1%;
}


/* general pop-up menu behavor */
/* usage: <menu-frame><select>...</select></menu-frame> */
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;
}
.gray {
    opacity:.5;
}
.hidden {
    display:none !important;
}
@media (max-width:1000px) {
    .nophone {
        display:none;
    }
}
.director .nodirector,
body:not(.director) .directorOnly {
    display:none;
}

/* Hide overflow games (beyond 7 days) until "Show more" is clicked */
table:not(.show-all) tr.overflow {
    display:none;
}
#showMore {
    /* margin: 20px auto; */
    display: block;
    width: 100%;
    margin: 0;
    padding: 2px;
    border-radius: 0;
    background-color: rgba(128,0,128,0.05);
    color: gray;
    font-size: 60%;
}
table.show-all + #showMore {
    display: none;
}


/* General input appearance */
input {
    background-color: #fffbff;
    border:thin solid;
    padding-left:5px;
    color:purple;
    font-size:clamp(16px, -.5rem + 5.333vmin, 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;
}
input:not([type]):disabled {
    opacity:0.5;
    outline-color:gray;
    border-color:gray;
}

/* Checkbox scaling */
input[type="checkbox"] {
    --scaling-factor: clamp(
        1,                                            /* minimum (when width < 500px) */
        calc((100vmin - 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: -100px;
    width:calc(90vw - 50px);
    left:5vw;
    z-index:25;
    padding:25px;
    text-align: center;
    box-shadow: 0 0 5px 2px purple;
    background-color: white;
    color:purple;
    border:solid purple thin;
    border-radius: 12px;
    opacity: 1;
    transition: top 0.3s ease-out, opacity 0.8s ease;
}
.notification-slide-in {
    top: 20px;
}
.notification-fade-out {
    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;
    &:hover {
        background-color: #eee;
    }
    @media (max-width:500px) {
         font-size:larger;
       padding: 2px 8px;
    }
}




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

/* Update warning indicator */
#updateWarning {
    font-size: clamp(12px, 6vmin, 32px);
    padding:1px 1vmin;
    float:right;
    opacity: 0;
    transition: opacity 0.5s ease-in;
    transition-delay: 60s;
    cursor: default;
    pointer-events: none;
}
#updateWarning.active {
    opacity: 1;
}
#updateWarning[title] {
    cursor: help;
    pointer-events: auto;
}
#updateWarning.reset {
    opacity: 0;
    transition: none;
}

#lastUpdated {
    font-size: clamp(10px, 3vmin, 14px);
    color: gray;
    float: right;
    padding: 4px 1vmin;
    clear: right;
}
@media (max-width: 600px) {
    #lastUpdated {
        display: none;
    }
}

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



/* Menu items */
#menuItems {
    position:absolute;
    top:60px;
    right:0;
    display:none;
    border:thin solid gray;
    z-index:10;
}
#menuLink.open ~ #menuItems {
    display:block;
}
#menuItems a {
    text-decoration: none;
    color:white;
}
#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:clamp(9px, 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:30px;
    max-height:6vmin;
    transform:translateY(5px);
}
#help #closeHelp {
    float:right;
}

#videoHelp {
    padding:3px;
    max-height:80vh;
    overflow-y: scroll;
}
video {
    max-height: 75vh;
}




/* Top banner */

#logo {
    height:min(100px, 7vh);
    height: clamp(50px, calc(50px + ((100vh - 700px) / 4)), 100px);
    padding-right:min(25px, 2vmin);
    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"],
section-time-modal button[value="OK"] {
    float:right;
    margin-left:3px;
}
custom-modal .message,
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: rgba(128,0,128,0.05);
}
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),
table[data-day="my"] tr[data-day]:not([data-my="1"])
 {
    display:none;
}



/* Table cells */
td {
    border:solid lightgray;
    border-width: thin thin 0 0;
    padding:1vmin;
    vertical-align: middle;
}
td:first-child {
    /* background-color: rgba(128, 0, 128, 0.08);
    font-weight: 500; */
    border-left: 4px solid transparent;
}
tr:hover td:first-child {
    border-left-color: purple;
}
tr:not(:first-child) td {
    border-top: 1px solid rgba(128, 0, 128, 0.15);
}
td:not(:nth-child(3)) {
    text-wrap:nowrap;
}
td:first-child div:last-child { /* time of game */
    color:purple;
    margin-right:1vw;
    text-align: right;
    @media (min-width:600px) {
        display:none;
    }
}
td:nth-child(2) {
    color:purple;
    font-size: 80%;
}
@media (max-width:600px) {
    td:nth-child(2), th:nth-child(2) {
        display:none;
}
}
.director td:nth-child(3) {
    padding-right:0;
}

table:not([data-day="my"]) .sameDate div:first-child {
    display:none;
}

/* Make day of week more prominent */
.dow {
    font-size:larger;
    font-weight: bold;
}


/* Game description cell */
.gameName {
    display:flex;
    flex-direction: column;
    justify-content: center;
    height:100%;
    position: relative;
    > div:first-child {
        position:absolute;
        right:0;
    }
}
.special {
    color:purple;
}

.tableFee {
    color: #888;
    font-size: 0.85em;
    margin-left: 0.5em;
    float:right;
}
body:not(.director) .tableFee {
    display:none;
}
.director .gameName > div:not(:first-child) {
    padding-right:clamp(24px, 4vw, 60px);
}


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



/* Container for edit-game icon */
.editDiv {
    cursor:pointer;
    display:none;
}
.director .editDiv {
    display:block;
}



new-view-reservations img {
    cursor:pointer;
    vertical-align: middle;
}
.director new-view-reservations img:not(.director) {
    display:none;
}
body:not(.director) new-view-reservations img.director {
    display:none;
}


new-reserve-button, partner-finder-button, new-view-reservations,contact-button,edit-game-button {
    font-size:small;
    color:black;

    display:inline-block;
    cursor:pointer;
    text-align:center;
    vertical-align: bottom;

    padding:min(5px,1vw);
    width:50px;
    max-width:10vw;
    margin:calc(1px + .2vmin);

    transition:background-color 0.7s ease;
    background-color: rgba(128,0,128,0);
    border-radius: 12px;

    @media (max-width:500px) {
        font-size:x-small;
    }
    &.reserved .not-reserved,
    &:not(.reserved) .reserved {
        display:none;
    }
    &:hover {
        background-color:rgba(128,0,128,0.2);
    }
    img {
        width:min(45px,7vw);
    }
    div:first-child {
        line-height:0;
    }
}
@media (max-width:600px) {
    edit-game-button {
        padding:0;
        margin:0;
        width:fit-content;
        div:last-child {
            display:none;
        }
    }
}
tr:nth-child(even) {
    new-reserve-button, partner-finder-button, new-view-reservations,contact-button {
        background-color: rgba(128,0,128,0.1);
        &:hover {
            background-color:rgba(128,0,128,0.2);
        }
    
    }
}
new-view-reservations img {
    transform: translateX(1px);
}
partner-finder-button img {
    transform: translateY(-2px);
}


new-view-reservations.updated {
    background: linear-gradient(0deg, rgba(128,0,128,0), rgba(128,0,128,0.2), rgba(128,0,128,0), rgba(128,0,128,0.2));
    background-size: 100% 300%;
    animation: gradient 3s linear infinite;
}

@keyframes gradient {
	0% {
		background-position: 0% 0%;
	}
	100% {
		background-position: 0% 100%;
	}
}



/* reservation list */
.resList {
    border:solid gray 2px;
    border-bottom-width:4px;
    border-right-width:4px;
    padding:1vmin;
    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;
    max-width:90vw;
}

.resList h3 {
    display:none;   /* only shows on print */
}
.resList .NSEW {
    display:none;
    font-weight:bold;
}

.rightClickMessage {
    color:gray;
    text-align: right;
    font-size: 60%;
    font-style: italic;
    background-color: #eee;
    padding-right:5px;
}
.director .rightClickMessage  {
    display:none;
}
@media (max-width:1000px)  {
    .rightClickMessage #rightclick {
        display:none;
    }
}
@media (min-width:1000px) {
    .rightClickMessage #mobiletap {
        display:none;
    }
}

/* The chart is just a holder for the sections and section-names */
@media screen {
    .director .chart {
         overflow-y:scroll;
         max-height:85vh;
     }
 }

.directionKey {
    display:inline-block;
}
.swiss .directionKey {
    display:none;
}
.directionKey .N-S {
    background-color: #eef;
    padding-left:2px;
    padding-right:2px;
}
.directionKey .E-W {
    background-color: #efe;
    padding-left:2px;
    padding-right:2px;
}
@media print {
    .directionKey {
        display:none;
    }
}


/* buttons in seating dialog */
reservation-list, sectional-reservation-list {

    @media (max-width:2600px) {
        .print, .clipboard, .emails, .newsection {
            --button-size: clamp(20px, calc(20px + (100vw - 600px) / 100), 38px);
            display: inline-flex;
            align-items: center;
            justify-content: center;    

            &::after {
                content: "" !important;
                background-repeat:no-repeat;
                background-position: center;
                background-size: var(--button-size) var(--button-size);
                height: var(--button-size);
                width: calc(var(--button-size) * 1.25);
                display: inline-block; 
                vertical-align: bottom;
                padding-bottom:3px;
            }
        }

    }

    .print::after {
        content: "Print";
        @media (max-width:2600px) {
            background-image: url('images/print.png');
        }
    }
    .clipboard::after {
        content: "Copy";
        @media (max-width:2600px) {
            background-image: url('images/copy.png');
        }
    }
    .emails::after {
        content: "View emails";
        @media (max-width:2600px) {
            background-image: url('images/mail.png');
        }
    }
    .newsection::after {
        content: "New section";
        @media (max-width:2600px) {
            background-image: url('images/plus.png');
        }
    }

}




/* section names */
body:not(.director) .sectionNames:not(:has(reservation-div)):not([data-section="Singles"])::after {
    content:"None yet";
    color:lightgray;
    padding: 0 8px;
}
.resList .section {
    padding-left:15px;
    color:gray;
    background-color: #eee;
    text-align: center;
    position:relative
}
.resList .section.singles:has(+ .sectionNames.empty) {
    display:none;
}
.director .section {
    cursor:context-menu;
}
 .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:not([data-section="Singles"]) {
    min-height: 20px;
    --letter: "";
    --section-letter-width:0px;
}
.director tr[data-seating="1"] .sectionNames:not([data-section="Singles"]) {  
    grid-template-columns:auto auto;
    display:grid;
    column-gap:15px;
}
.director tr.swiss .sectionNames {
    grid-template-columns:auto !important;
}

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

.chart:has(.printing) > *:not(.printing) {
    display:none !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 */
    /* user-select: none; */
    /* -webkit-user-select: none; */
}
reservation-div {
    --res-bg: transparent;
}
reservation-div.N-S {
    --res-bg: #eef;
}
reservation-div.E-W {
    --res-bg: #efe;
}
reservation-div.just-updated {
    animation: highlight-change 3s ease-out forwards;
}
@keyframes highlight-change {
    0% { background-color: rgba(128, 0, 128, 0.25); }
    100% { background-color: var(--res-bg); }
}
body:not(.director) reservation-div {
    padding: 0 8px;
}
.director reservation-div.NS {
    padding-left:40px;
    padding-left: calc(var(--section-letter-width) + clamp(30px, 20px + ((100vw - 1000px) * .04), 40px));
}
.director section-names:has(reservation-div:nth-child(22)) reservation-div.NS {
    padding-left: calc(15px + var(--section-letter-width) + clamp(30px, 20px + ((100vw - 1000px) * .04), 40px));
}
.director [data-section="Singles"] reservation-div {
    padding-left:clamp(30px, 20px + ((100vw - 1000px) * .04), 40px);
}
.director .sectionNames:not([data-section="Singles"]) reservation-div:not(.empty) { 
    cursor:pointer;
}
.NS {
    grid-column: 1;
}
.EW {
    grid-column: 2;
}
@media screen {
    .director .showMPs .sectionNames:not([data-section="Deleted"]) > reservation-div:not(.empty) .nameDiv::after {
        content: " (" attr(data-mps) ")";
        color: gray;
    }    
}

reservation-div .nameDiv {
    pointer-events: none;
    padding:0;
    text-overflow: ellipsis;
    overflow:hidden;
}


/* background colors of reservations */
.director reservation-div.dragging {
    background-color: white;
}
/* .sectionNames:not([data-section="Deleted"]):not(.dragover) reservation-div:not(.dragover) {
    background-color: var(--res-bg, white);
} */
@media screen {
    .director tr:not(.swiss) .sectionNames:not([data-section="Deleted"]):not([data-section="Singles"]):not(.dragover) reservation-div.N-S:not(.dragover),
    .director tr:not(.swiss) .sectionNames:not([data-section="Deleted"]):not([data-section="Singles"]):not(.dragover) reservation-div.E-W:not(.dragover) {
        background-color: var(--res-bg);
    }
}
.director .sectionNames:not([data-section="Deleted"]) reservation-div.NS.E-W:not(.dragover), 
.director .sectionNames:not([data-section="Deleted"]) reservation-div.EW.N-S:not(.dragover) {
    background-color: #fee !important; 
}
[popover] .sectionNames > reservation-div {
    background: white;
    min-width:300px;
}
@media (max-width:1000px) {
    [popover] .sectionNames > reservation-div {
        min-width:40vw;
    }
}
[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(.dragging):before {
    content: var(--letter) var(--row); 
    position: absolute;
    left: 0px;
}
.director .sectionNames:has(.empty.lastRow.EW) .empty.lastRow.NS:before,
.director tr.swiss .empty.lastRow.NS:before {
    content: "";
}



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

}
#newReservation.editing .new,
#newReservation.regulars .new,
#newReservation:not(.editing) .editing {
    display:none;
}
#dateDiv {
    color:purple;
    font-size:smaller;
    text-align: center;
}
#newReservation .nameDiv {
    text-align: right;
}
#newReservation:not(.swiss) .teammate,
#newReservation:not(.swiss) .swiss {
    display:none;
}
/* #newReservation.swiss #needPartnerDiv,  */
.swiss #directionDiv,
.swiss .notSwiss,
.sectional #directionDiv    {
/* .sectional #needPartnerDiv { */
    display:none;
}
#newReservation:not(.sectional) #sectionalNeedPartnerDiv,
#newReservation.swiss #sectionalNeedPartnerDiv {
    display:none;
}
#newReservation.regulars #needPartnerDiv, #newReservation.regulars #dateDiv {
    display:none;
}
#newReservation:not(.regulars) #backfillDiv {
    display:none;
}
#newReservation:not(.regulars) .regularsOnly {
    display:none;
}
#newReservation.regulars .notRegulars {
    display:none;
}
#saveDiv {
    text-align:center;
}
#playerContact, #partnerContact {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}
#playerContact > *, #partnerContact > * {
    overflow: hidden;
}
#playerContact.show, #partnerContact.show {
    grid-template-rows: 1fr;
    opacity: 1;
}
#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 div:has(> [name="playerACBL"].hideText)::after {
    content: "ACBL on file";
    color: purple;
}

#playerContact img,
#addPlayerLooking img {
    width: min(25px, 5vmin);
    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;
    box-shadow: #606 1px 1px 2px;
    display:none;

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

    li:hover:not(.dropdown-header) {
        background-color:#fdf;
        cursor:pointer;
    }

    .dropdown-header {
        background-color: #f5f5f5;
        color: #666;
        font-size: 0.85em;
        font-size: 70%;
        font-weight: 500;
        cursor: default;
        border:0;
        padding:2px 15px;
    }
    .dropdown-header:hover {
        background-color: #f5f5f5;
    }
    .dropdown-header + li {
        border-top:0;
    }

    .highlighted {
        background-color: #fdf;
    }

    li.add-new {
        border-top: 2px solid purple;
        background-color: #f8f0f8;
    }
}

input:invalid {
    border-color:red;
    outline-color:red;
}


#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 {
    background-color: red;
    float:right;
}
#newGame.new #deleteButton {
    display:none;
}
#customizeGame {
    padding:10px;
    menu-frame {
        margin-top:5px;
    }
}


/* Items in the findPlayer dialog */

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



#contactSingle:not(.swiss) .swiss {
    display:none;
}



/*  Items in the Edit Club dialog */
#regulars > div {
    position:relative;
}
#clubSections > div {
    position: relative;
}
#regulars div.N-S {
    background-color: #eef;
}
#regulars div.E-W {
    background-color: #efe;
}
#regulars > div:after {
    color:gray;
    content: " (" attr(data-section) ")";
}




.reservationsText {
    display:none;
}




#resHistoryList {
    overflow-y: scroll;
    max-height:80vh;

    > div {
        position:relative;
    }
}



@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),
    .resList:popover-open, 
    .resList:popover-open div:not(.directionKey):not(.rightClickMessage):not(.deletedSection):not([popover]):not(.NSEW):not(.singles), 
    reservation-div {
        display:block;
    }
    reservation-div * {
        display:inline;
    }
    .reservationsText {
        display:block;
    }
    .reservationsText div {
        display:block;
        font-size:70%;
        padding-left:30px;
        text-indent:-30px;
    }
    .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"],
    .director div.deletedSection, .director .sectionNames[data-section="Singles"]
    {
        display:none !important;
    }
    .resList {
        box-shadow: none;
    }
    .resList h3 {
        display:block;
        text-align: center;
    }
    .resList .NSEW {
        display:flex;
        justify-content: space-evenly;
        text-align:center;
    }
    .resList .section {
        color:black;
        background-color:white;
        padding-top:20px;
    }
    .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:"";
    }
}

/* ── Merge duplicate players ─────────────────────────────────────────────── */
#mergeNames {
    max-width: min(1200px, 95vw);
    min-width: min(800px, 90vw);
    min-height: 500px;
    max-height: 90vh;
    overflow: auto;
    position: relative;   /* positioning context for .dropdown and #recentNames */

    .merge-titlebar {
        display: flex;
        align-items: center;
        margin-bottom: 16px;
        position: relative;
        h3 {
            flex: 1;
            margin: 0;
            font-size: 1.1em;
            font-weight: bold;
            text-align: center;
        }
        #mergeHelp {
            font-size: 0.85em;
            width: 1.6em;
            height: 1.6em;
            border-radius: 50%;
            padding: 0;
            cursor: pointer;
            flex-shrink: 0;
        }
        #mergeHelpDropdown {
            display: none;
            position: absolute;
            top: calc(100% + 4px);
            right: 0;
            background: white;
            border: 1px solid #ccc;
            border-radius: 4px;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
            padding: 10px 14px;
            min-width: 220px;
            max-width: 400px;
            text-wrap:auto;
            z-index: 10;
            &.show { display: block; }
        }
    }

    #recent {
        padding: 3px min(8px, 1.5vmin);
    }

    .player-grid {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        gap: 20px;
        align-items: start;
    }

    .player {
        min-width: 0;   /* prevent grid cell overflow */
        > div:first-child { min-height: 2em; }
    }

    .merge-buttons {
        align-self: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    /* Desktop: horizontal arrows */
    #_adopt::before { content: '← '; }
    #adopt_::after  { content: ' →'; }

    /* Merge buttons hidden by default; CSS :has() shows them when both panels have a player */
    #_adopt, #adopt_ { visibility: hidden; pointer-events: none; }
    &:has(#merge .playerInfo[data-player]:not([data-player="0"])):has(#merge2 .playerInfo[data-player]:not([data-player="0"])) {
        #_adopt, #adopt_ { visibility: visible; pointer-events: auto; }
    }

    .edit {
        color: purple;
        display: inline-block;
        transform: scaleX(-1);
        cursor: pointer;
    }

    .playerInfo input { max-width: 100%; box-sizing: border-box; }
    .playerInfo > div:not(.editing) > input { display: none; }
    .editing {
        .edit, .value { display: none; }
    }
    .playerInfo:not([data-player]),
    .playerInfo[data-player="0"] { display: none; }

    .nicknames, .email, .phone, .acbl {
        height: 45px;
        position: relative;
        padding-left: 10px;
        margin-bottom: 18px;
        &::before {
            content: attr(data-cat);
            color: white;
            background-color: purple;
            font-size: medium;
            padding: 2px 4px;
            position: absolute;
            top: -17px;
            left: -10px;
        }
    }

    .value::before { content: none; }
    .value:empty::before {
        content: "None listed ";
        color: lightgray;
    }

    #recentNames {
        position: absolute;   /* positioned via JS getBoundingClientRect() in clickRecent */
        background: white;
        border: 1px solid #ccc;
        border-radius: 4px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        min-width: 200px;
        max-height: 300px;
        overflow-y: auto;
        z-index: 1000;
        display: none;
        &.show { display: block; }
        .dropdown-item {
            padding: 8px 12px;
            cursor: pointer;
            border-bottom: 1px solid #eee;
            &:last-child { border-bottom: none; }
            &:hover { background-color: #f0f0f0; }
        }
    }

    @media (max-width: 600px) {
        .player-grid {
            grid-template-columns: 1fr;
            gap:0;
        }
        .merge-buttons {
            flex-direction: row;
            justify-content: center;
        }
        .player > div:first-child {margin-bottom:1.3vh;}
        /* Mobile: vertical arrows (↑ = top panel survives, ↓ = bottom panel survives) */
        #_adopt::before { content: '↑ '; }
        #adopt_::after  { content: ' ↓'; }
        .nicknames, .email, .phone, .acbl {
            height: 32px;
            margin-bottom: 0.5vh;
            &::before { font-size: x-small; top:-12px;}
        }
    }
}