*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    cursor: url("images/tennisballcursor.png") 12 12, auto; /* custom tennis ball cursor */
    font-family: "Roboto Condensed", sans-serif;
}

/* page layout */
body{
    width: 100vw;
    height: 100vh;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;

    background-image: url("images/tenniscourthard.png"); /* background image */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* title */
h1{
    font-size: 8vh;
    font-weight: bold;
    color: #073763;
    margin-top: 8vh;
    margin-bottom: 1vh;
    text-align: center;
}

/* court area (main content container) */
.court-area{
    width: 68vw;
    height: 58vh;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 2vh 2vw;
}

/* "+ Add New Player" button */
.add-btn{
    background: white;
    border: 2px solid #073763;
    padding: 2vh 2vw;
    font-size: 2vh;
    font-family: "Roboto Condensed", sans-serif;
    color: #073763;
    margin-top: 2vh;
    margin-bottom: 0.5vh;
    width: fit-content;
}

.add-btn:hover{
    background: #f0f0f0;
}

/* scrollable cards row that contains all the player cards */
.cards-row{
    display: flex;
    flex-direction: row;
    gap: 3vw;
    overflow-x: auto; /* horizontal scroll when cards overflow */
    overflow-y: hidden;
    padding-bottom: 1vh;
    height: 100%;
    align-items: flex-start;
}

/* custom scrollbar */
.cards-row::-webkit-scrollbar{
    height: 1vh;
}

.cards-row::-webkit-scrollbar-track{
    background: #ddd;
}

.cards-row::-webkit-scrollbar-thumb{
  background: #073763;
}

/* player card */
.player-card{
    background: #c9daf8;
    border: 2px solid #073763;
    min-width: 20vw;
    max-width: 20vw;
    height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 2vh 1.5vw;
    flex-shrink: 0; /* prevents cards from shrinking when the row is full */
}

.player-card .player-name{
    font-size: 2.2vh;
    font-weight: bold;
    color: #073763;
    text-align: center;
    word-break: break-word;
}

/* player photo displayed on the card (not the one in the popup) */
.player-photo{
    background: #A4C2F4;
    width: 80%;
    height: 22vh;
    object-fit: cover;
    border: 2px solid #073763;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8vh;
    text-align: center;
    color: #073763;
}

/* makes sure the photo fills the entire photo container */
.player-photo img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* "View More" button on each player card */
.view-more-btn{
    background: transparent;
    border: none;
    font-size: 2vh;
    color: #073763;
    font-family: 'Roboto Condensed', sans-serif;
}

.view-more-btn:hover{
    color: #3d85c6;
}

/* message displayed when there are no players on the roster */
.empty-msg{
    color: white;
    font-size: 2.2vh;
    margin-top: 1vh;
}

/* bottom bar containing the "Back" and "Information" buttons */
.bottom-bar{
    width: 88%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5vh 2vw;
    margin-top: auto;
    margin-bottom: 6.5vh;
}

.bottom-btn{
    background: white;
    border: 2px solid #073763;
    padding: 1vh 2.5vw;
    font-size: 1.8vh;
    font-family: 'Roboto Condensed', sans-serif;
    color: #073763;
}

.bottom-btn:hover{
    background: #f0f0f0;
}

/* popups */
/* darkened backdrop behind popups */
.overlay{
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

/* popup is visible when the open class is added through javascript */
.overlay.open{
    display: flex;
}

.popup-box{
    background: white;
    border: 2px solid #073763;
    padding: 3vh 3vw;
    width: 40vw;
    min-width: 300px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto; /* enables scrolling if the popup content overflows vertically */
}

.popup-box h2{
    font-size: 2.5vh;
    font-weight: bold;
    margin-bottom: 2vh;
    color: #073763;
}

.close-btn{
    position: absolute;
    top: 1vh;
    right: 1vw;
    background: none;
    border: none;
    font-size: 2.2vh;
    color: #073763;
}

/* "+ Add New Player" popup*/
/* refers to each individual input field inside the "+ Add New Player" and "Change Stats/Name" popups */
.form-row{
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5vh;
}

.form-row label{
    font-size: 1.8vh;
    color: black;
    margin-bottom: 0.5vh;
}

.form-row input[type="text"], .form-row input[type="number"]{
    border: 1.5px solid black;
    padding: 0.8vh 0.8vw;
    font-size: 1.8vh;
    font-family: 'Roboto Condensed', sans-serif;
    width: 100%;
}

/* photo upload area */
.photo-upload-area{
    border: 2px dashed black;
    padding: 2vh 1vw;
    text-align: center;
    font-size: 1.8vh;
    color: black;
    margin-bottom: 1.5vh;
    position: relative;
}

#add-photo-label{
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-bottom: -0.03vh;
}

.photo-upload-area:hover{
    background: #f5f5f5;
}

/* styles the image preview */
#add-photo-preview{
    width: 100%;
    max-height: 15vh;
    object-fit: contain;
    display: none;
}

/* a three column grid for the nine stat inputs */
.stats-grid{
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1vh 1.5vw;
    margin-bottom: 1.5vh;
}

/* displayed when a form submission fails */
.error-msg{
    color: red;
    font-size: 1.7vh;
    margin-bottom: 1vh;
    display: none;
}

/* submit button */
.submit-btn{
    background: #c9daf8;
    border: 2px solid #073763;
    padding: 1vh 2vw;
    font-size: 1.8vh;
    font-family: 'Roboto Condensed', sans-serif;
    color: #073763;
    width: 100%;
}

.submit-btn:hover{
    background: #A4C2F4;
}

/* "View More" popup */
.stats-list{
    margin: 1.5vh 0;
}

/* one row for each stat showing its label, bar, and value */
.stat-row{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6vh 0;
    border-bottom: 2px solid #eee;
    font-size: 1.8vh;
    color: black;
}

/* the unfilled parts of the stats bar */
.stat-bar-wrap{
    width: 50%;
    background: #ddd;
    height: 1.2vh;
}

/* the filled parts of the stats bar */
.stat-bar-fill{
    height: 100%;
    background: #3c78d8;
}

.stat-val{
    width: 2.5vw;
    text-align: right;
    font-size: 1.8vh;
}

/* action button rows (rows containing the "Change ..." buttons */
.view-more-actions{
    display: flex;
    gap: 1vw;
    margin-top: 2vh;
}

/* remove player button */
.danger-btn{
    background: #e05555;
    border: 2px solid #a03030;
    padding: 1vh 1.5vw;
    font-size: 1.7vh;
    font-family: 'Roboto Condensed', sans-serif;
    color: white;
    flex: 1;
}

.danger-btn:hover{
    background: #c04040;
}

/* change player photo button (the file input is overlaid invisibly on top) */
.change-photo-btn{
    background: white;
    border: 2px solid #073763;
    padding: 1vh 1.5vw;
    font-size: 1.7vh;
    font-family: 'Roboto Condensed', sans-serif;
    color: #073763;
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* an invisible file input covers the button area so the file picker opens on a click */
.change-photo-btn input[type="file"]{
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
}

.change-photo-btn:hover{
    background: #f0f0f0;
}

/* undo button */
.undo-btn{
  background: white;
  border: 2px solid #073763;
  padding: 2vh 2vw;
  font-size: 2vh;
  font-family: 'Roboto Condensed', sans-serif;
  color: #073763;
  margin-top: 2vh;
  margin-bottom: 0.5vh;
}

.undo-btn:hover{
    background: #f0f0f0;
}

/* greyed out when no undoable actions exist */
.undo-btn:disabled{
    opacity: 0.4; background: #ddd;
}

/* "Change ..." buttons */
.edit-btn{
    background: white;
    border: 2px solid #073763;
    padding: 1vh 1.5vw;
    font-size: 1.7vh;
    font-family: 'Roboto Condensed', sans-serif;
    color: #073763;
    flex: 1;
    margin-top: 2vh;
}

.edit-btn:hover{
    background: #f0f0f0;
}

/* play style displayed below each player's name */
.play-style{
    font-size: 1.7vh;
    color: black;
    font-style: italic;
    margin-bottom: 2vh;
}
