/* ---------- Global Styles ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}



body {
    font-family: 'Roboto Condensed', sans-serif;
}


label {
    display: flex;
    align-items: center;
    gap: 4px;
}


button {
    font-family: 'Outfit', sans-serif;
    padding: 10px;
    margin: 5px;
    cursor: pointer;
    border: none;
    font-size: 14px;
    border-radius: 25px;
	transition: background-color 0.2s ease; /* added */
}


button:hover {
    background-color: #F9E3ED;
}


.button-icon {
    height: 30px; /* Set the desired height */
    width: auto;  /* Maintain aspect ratio */
    display: block; /* Prevent extra space below inline images */
    margin: 0;    /* Reset any default image margins */
    padding: 0;   /* Reset any default image padding */
	vertical-align: middle; /* Vertically align the image within the button */
}


.image-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}


/* ---------- Header Styles ---------- */
header {
    border: 3px dashed #FBFDFE;
    padding: 20px;
    width: 100%;
    box-sizing: border-box; /* consider removal */
    text-align: center; /* Center elements horizontally by default */
}


header h1 {
    margin: 0 0 10px 0;
}


#navContainer {
    display: flex;
    justify-content: center; /* Center buttons horizontally */
    gap: 10px;
    width: 100%; /* Make sure navContainer takes full width */
}


/* ---------- Modal Styles ---------- */
.modal {
    display: none; /* Hidden by default */
}


.modal.modal--auth {
    display: grid;
    grid-template-rows: auto; /* Allow rows to grow */
    grid-template-columns: 1fr;
    justify-items: center; /* Center horizontally */
    align-items: center; /* Center vertically */
    position: fixed;
    top: 50%; /* Initial vertical centering */
    left: 50%; /* Initial horizontal centering */
    transform: translate(-50%, -50%); /* Adjust for true centering */
    z-index: 105;
    background-color: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    width: 90%; /* Take up most of the width */
    max-width: 400px; /* Limit maximum width */
    padding: 20px;
}


.modal.modal--auth.active {
    display: grid; /* Use grid display for active state */
}


.modal--auth .modal-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    width: 100%; /* Full width within the modal */
}


.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}


.close-modal:hover {
    opacity: 1;
}


.close-modal::before,
.close-modal::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 4px;
    background-color: #666;
    border-radius: 2px;
}


.close-modal::before {
    transform: rotate(45deg);
}


.close-modal::after {
    transform: rotate(-45deg);
}


.close-modal:hover::before,
.close-modal::hover::after {
    background-color: #FF6721;
}


.modal--auth .close-modal {
    justify-self: end; /* check to remove or consolidate */
}


.modal.filter-popup-modal {
    position: absolute;
    width: 160px;
    height: auto;
    background-color: transparent;
    border: 2px dashed #FFE0E1;
    border-radius: 10px;
    box-sizing: border-box;
}


.modal.filter-popup-modal.active {
    display: block;
}


.modal.filter-popup-modal .modal-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    border: 2px dashed #D6FFEF;
    border-radius: 10px;
    box-sizing: border-box;
    flex-direction: row;
}


.modal.filter-popup-modal .modal-content label {
    display: block;
    flex-basis: 0;
    flex-grow: 1;
    text-align: center;
}


.modal.filter-popup-modal .modal-content label img {
    display: block;
    width: auto;
    height: auto;
    max-width: 50%;
    object-fit: contain;
    margin: 0 auto;
}


.modal.filter-popup-modal .modal-content label input[type="radio"] {
    opacity: 0;
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
}


.modal.filter-popup-modal .modal-content label:hover {
    transform: scale(1.05);
}


.modal.filter-popup-modal .modal-content label input[type="radio"]:checked + img {
    border: 2px solid #4DC3FF;
    border-radius: 4px;
}


/* Modal container styling */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.8); /* dark overlay */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* Image inside modal */
.modal-image {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  box-shadow: 0 0 10px #fff;
  border-radius: 4px;
}

/* Close button */
.close-button {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 2em;
  color: white;
  cursor: pointer;
}

/* ---------- Auth Styles ---------- */
#authModal {
    display: none; /* Hidden by default */
}


#authModal input[type="text"],
#authModal input[type="email"],
#authModal input[type="password"] {
    border: none;
    border-bottom: 2px solid #ccc;
    outline: none;
    padding: 0.75rem 0;
    font-size: 1rem;
    background: transparent;
    transition: border-color 0.3s ease;
    width: 100%;
    margin-bottom: 1.5rem;
}


#authModal input:focus {
    border-bottom-color: #0077ff;
}


#authModal button[type="submit"] {
    background-color: #0077ff;
    color: #fff;
    padding: 1rem 1.5rem;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    width: 100%;
    margin-top: 1rem;
    transition: background-color 0.3s ease;
    border-radius: 5px;
}


#authModal button[type="submit"]:hover {
    background-color: #005fcc;
}


#registerBtn,
#signInBtn,
#logoutBtn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    /* Add margin for spacing between buttons if needed */
}


#signInBtn {
    margin-left: 10px; /* Example for spacing between buttons */
}


#registerFormContainer,
#signInFormContainer {
    display: grid;
    gap: 15px;
}


#registerFormContainer label,
#signInFormContainer label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}


#registerFormContainer select,
#signInFormContainer select {
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 1.5rem;
}


#registerFormContainer input,
#signInFormContainer input {
    /* Inheriting styles */
}


#submitRegister,
#submitSignIn {
    /* Inheriting styles */
    margin-top: 1.5rem;
}


#registerSuccessMessage {
    text-align: center;
}


#registerSuccessMessage h3 {
    margin-bottom: 1rem;
}


#registerSuccessMessage p {
    margin-bottom: 1.5rem;
}


#registerSuccessMessage button {
    padding: 0.75rem 1.25rem;
    margin: 0 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
}


#loginAfterRegisterBtn {
    background-color: #28a745;
    color: white;
    border: none;
}


#loginAfterRegisterBtn:hover {
    background-color: #1e7e34;
}


#closeAfterRegisterBtn {
    background-color: #dc3545;
    color: white;
    border: none;
}


#closeAfterRegisterBtn:hover {
    background-color: #c82333;
}


.input-error {
	color: red;
	font-size: 12px;
	margin-top: 4px;
}

.input-invalid {
	border-color: red;
}


/* ---------- Filters and Inputs Styles ---------- */
#filters {
    grid-row: 1;
    grid-column: 1;
    margin-bottom: 20px;
    display: flex; /* Make #filters a flex container */
    flex-direction: row; /* Arrange children in a row */
    gap: 10px; /* Spacing between the main filter groups */
    align-items: center; /* Vertically center items */
    padding: 10px 20px;
    box-sizing: border-box;
    width: 100%;
	align-self: start;
}


.filter-row-1,
.filter-row-2,
.filter-row-3 {
    display: flex; /* Make each row a flex container */
    flex-direction: row; /* Arrange items within each row horizontally */
    align-items: center; /* Vertically center items within each row */
    gap: 5px; /* Spacing between elements within each row */
}


.reset-icon {
    height: 25px;
    width: auto;
    display: block;
}


.reset-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    margin-left: 5px;
}


#locationFilterInput {
    border: 2px solid #dcdcdc;
    padding: 5px;
    border-radius: 4px;
}


#availabilityFilterToggle {
    display: none;
}


#availabilityFilterToggle:checked + .custom-checkbox::after {
    content: "";
    width: 5px;
    height: 5px;
    background-color: #FF6721;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}


.custom-checkbox {
    width: 20px;
    height: 20px;
    border: 5px solid #000000;
    border-radius: 50%;
    display: inline-block;
    position: relative;
    margin-right: 8px;
    flex-shrink: 0;
}


.surface-image {
    width: 33px;
    height: auto;
}


#filterOptions {
    margin-top: 10px;
}


/* ---------- Main Layout Styles ---------- */
main {
    display: grid;
  grid-template-columns: minmax(auto, 768px) minmax(auto, 384px); /* Example: Adjust max widths as needed */
  grid-template-rows: auto 1fr;
  grid-auto-rows: min-content; /* <- ensures rows collapse to fit content */
  margin: 0 auto; /* Center the entire main container */
  padding: 0 20px; /* Add some padding inside main if needed */

}



/* ---------- User Interaction Tabs ---------- */
#userInteractionTabs {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
    height: auto; /* Important: let content decide height */
	display: none; /* Hide by default until JS confirms login */

  width: 100%;
}



/* Styles for the tab buttons container */
.tab-buttons {
    display: flex;
    background-color: #f0f0f0; /* Light background for the tabs */
}


/* Styles for individual tab buttons */
.tab-button {
    flex-grow: 1;
    font-weight: bold;
    text-align: center;
    background-color: transparent; /* Optional: override base if needed */
}


.tab-button.active {
    border: 3px solid #FA74AA; /* Highlight for the active tab */
}


.tab-content {
    padding: 15px;
    display: none; /* Initially hide all content areas */
}

.tab-content.active {
    display: block; /* Show the active content area */
}


/* ---------- Profile Styles ---------- */
#userProfile {
    /* grid-row: 2; Removed as we're not using grid here */
    /* grid-column: 1; Removed as we're not using grid here */
    padding-left: 20px;
    padding-right: 20px;
    width: 100%; /* Make it take full width within the tab */
    box-sizing: border-box;
}


#userProfile h2 {
    margin-bottom: 15px;
}


#userProfile fieldset input[type="radio"],
#userProfile fieldset input[type="checkbox"] {
    margin-right: 5px;
}


#userProfile fieldset {
    border: none;
    padding: 0;
    margin-bottom: 10px;
    display: block;
}


#userProfile fieldset legend {
    font-size: 1em;
    font-weight: bold;
    padding: 0;
    margin-bottom: 5px;
    display: block;
}


#userProfile fieldset:nth-child(1) label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px; /* More bottom margin to separate from the row below */
    position: relative; /* For positioning the custom indicator */
    padding-left: 30px; /* Make space for our custom indicator */
    cursor: pointer;
}





/* Style for the Surface and Rank fieldsets to be in a row */
#userProfile fieldset:nth-child(2), /* Surface */
#userProfile fieldset:nth-child(3)    /* Rank */
{
    display: flex;
    justify-content: space-between; /* Distribute labels evenly */
    align-items: center; /* Vertically align labels */
    margin-bottom: 10px; /* Add some bottom margin for spacing */
}


#userProfile fieldset:nth-child(2) label,
#userProfile fieldset:nth-child(3) label {
    display: flex; /* Arrange input and text in a row within each label */
    align-items: center;
    gap: 5px; /* Space between radio button and text */
    text-align: center; /* Center the label text */
    flex: 1; /* Distribute available space equally among labels */
    margin: 0; /* Remove default label margins */
}


/* Style for the Location fieldset (input) */
#userProfile fieldset:nth-child(4) {
    /* No flex display here, will stack below Surface/Rank */
}


#userProfile fieldset:nth-child(4) label {
    display: block;
    margin-bottom: 5px;
}


#userProfile fieldset:nth-child(4) input[type="text"] {
    width: 100%; /* Make the input take full width of its fieldset */
    padding: 8px;
    box-sizing: border-box;
    margin-top: 5px;
    border: 2px solid #000000;
    border-radius: 4px;
    background-color: transparent;
}


#userProfile input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #000000;
    border-radius: 50%;
    background-color: white;
    position: relative;
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
}


#userProfile input[type="radio"]:checked::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #FF6721;
}


#updateProfileForm button[type="submit"] {
    padding: 10px 20px;
    font-size: 1em;
    border-radius: 5px;
    background-color: #007bff; /* Example button color */
    color: white;
    border: none;
    cursor: pointer;
    margin-top: 15px; /* Add some space above the button */
}


#commentSystem {
    /* grid-row: 3; Removed as we're not using grid here */
    /* grid-column: 1; Removed as we're not using grid here */
    padding-left: 20px;
    padding-right: 20px;
    width: 100%; /* Make it take full width within the tab */
    box-sizing: border-box;
}


#commentSystem h2 {
    margin-bottom: 15px;
}


#commentInputWrapper {
    display: flex;
    flex-direction: column;
    gap: 6px; /* Space between buttons and input */
    margin-bottom: 16px; /* Optional: spacing below the whole comment box */
}


.editor-toolbar {
    display: flex;
    gap: 6px;
    align-items: center;
}



#boldBtn,
#italicBtn,
#underlineBtn,
#strikeBtn {
    background: none;
    border: none;
    outline: none;
    padding: 12px; /* Adjust padding to make the button larger */
    cursor: pointer;
    font-size: 16px;
    border-radius: 50%; /* Ensures a circular shape */
    transition: background-color 0.2s ease;
    width: 40px; /* Set width */
    height: 40px; /* Set height equal to width to create a perfect circle */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


#boldBtn:hover,
#italicBtn:hover,
#underlineBtn:hover,
#strikeBtn:hover {
    color: #007bff; /* Change color on hover */
}


#boldBtn.active,
#italicBtn.active,
#underlineBtn.active,
#strikeBtn.active {
    background-color: #d0d0d0; /* Light gray highlight when active */
    border-radius: 50%;
}


#boldBtn i,
#italicBtn i,
#underlineBtn u,
#strikeBtn s {
    font-size: 20px; /* Adjust icon size inside button */
}


#colorPicker {
    appearance: none;
    background: none;
    border: none;
    outline: none;
    padding: 12px;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0; /* Remove margin to match other buttons */
}


/* Style the swatch color fill */
#colorPicker::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 50%;
}


#colorPicker::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}


/* Firefox support */
#colorPicker::-moz-color-swatch {
    border: none;
    border-radius: 50%;
}


#commentInput {
    outline: none; /* Removes the default focus outline */
    border: 2px solid transparent; /* Set a transparent border to avoid layout shift */
    padding: 10px; /* Adds some padding for inner space */
    min-height: 100px; /* Minimum height for the input area */
    width: 100%; /* Ensures it fills the container width */
    border-radius: 4px; /* Optional: makes the edges slightly rounded */
    font-size: 16px; /* Font size */
    line-height: 1.5; /* Line height for readability */
    color: #333; /* Text color */
    overflow-y: auto; /* Ensures scrolling when content exceeds height */
}


#commentInput:focus {
    border-color: #007bff; /* Focused border color */
    outline: none;
}


/* Placeholder for contenteditable */
#commentInput:empty:before {
    content: attr(data-placeholder);
    color: #888;
    font-style: italic;
    pointer-events: none;
}


/* ---------- Player Container ---------- */
#playerContainer {
    grid-row: 2;
    grid-column: 1;
    padding: 15px; /* Adjust padding for mobile */
    width: 100%;
    box-sizing: border-box;
    transition: margin-top 0.4s ease;
	align-self: start;
	margin-top: 0; 
}


.player-card {
    display: flex; /* Use flexbox for layout */
    flex-direction: column; /* Stack items vertically on mobile by default */
    align-items: flex-start; /* Align items to the start on mobile */
    gap: 10px; /* Adjust spacing for mobile */
    margin-bottom: 15px;
    padding: 10px;
    border-bottom: 1px solid #eee;
}


.player-card:last-child {
    border-bottom: none;
}


.player-card h2 {
    font-size: 1.2rem; /* Adjust font size for mobile */
    margin-bottom: 0.5rem; /* Add some margin below heading */
    width: 100%; /* Ensure heading takes full width on mobile */
}


.player-card .details {
    display: flex;
    flex-direction: column; /* Stack details vertically on mobile */
    gap: 0.5rem; /* Adjust spacing for mobile */
    width: 100%; /* Make details full width on mobile */
}


.player-card .details p {
    margin: 0;
    white-space: nowrap;
    text-align: left; /* Align all text to the left on mobile */
}


.availability-marker img {
    width: 24px; /* Adjust image size for mobile */
    height: auto;
}





/* Media Query for Smaller Screens (Max Width: 768px) */
@media (max-width: 768px) {
    /* Header */
    header {
        display: flex;
        flex-direction: column;
        align-items: center;
    }


    header h1 {
        order: 1;
        margin-bottom: 10px;
    }


    #navContainer {
        order: 2;
        justify-content: center;
    }


    main {
		grid-template-columns: 1fr;
		grid-template-rows: auto auto auto; /* or auto auto 1fr */
	}

	#filters {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        padding: 10px;
        margin-bottom: 10px;
        max-width: 100%;
        overflow-x: hidden;
		grid-row: 2; /* 👈 comes after tabs */
    }

    .filter-row-1,
    .filter-row-2,
    .filter-row-3 {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        width: 100%;
    }

    .filter-row-3 {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    #locationFilterInput {
        max-width: 80%;
        margin: 0 auto;
    }

    .custom-checkbox {
        margin: 0 auto;
    }

	#userInteractionTabs {
		grid-column: 1;
		grid-row: 2;
		justify-self: center;
		width: 100%;
		grid-row: 1; /* 👈 move to top */
	}

	#playerContainer {
		grid-column: 1;
		grid-row: 3;
		grid-row: 3; /* 👈 players at the bottom */
	}


    /* Modals */
    .modal.modal--auth {
        top: 0;
        left: 0;
        transform: none;
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
        box-shadow: none;
        padding: 20px;
        display: grid;
        grid-template-rows: minmax(auto, 1fr) auto minmax(auto, 1fr);
        align-items: center;
        justify-items: center;
    }


    .modal--auth .modal-content {
        width: 95%;
        max-width: none;
    }


    .modal--auth .close-modal {
        position: absolute;
        top: 20px;
        right: 20px;
        z-index: 106;
    }


    /* Player Card */
    .player-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 15px;
        padding: 10px;
    }
}


/* Media Query for Larger Screens (Min Width: 769px) */
@media (min-width: 769px) {
	#authModal {
        height: auto; /* Allow content to determine height */
        max-height: 90vh; /* Limit maximum height to 90% of viewport */
        overflow-y: auto; /* Enable vertical scrolling if content exceeds max-height */
    }


    main {
        display: grid;
        grid-template-columns: 70% 30%;
        grid-template-rows: auto 1fr;
        grid-auto-rows: min-content; /* Prevents unnecessary stretching */
        gap: 20px;
		width: 100%; /* Ensure main does not exceed viewport width */
        overflow-x: hidden; /* Prevent horizontal overflow */
    }

    #filters {
        grid-column: 1;
        grid-row: 1;
    }

    #playerContainer {
        grid-column: 1;
        grid-row: 2;
    }

    #userInteractionTabs {
        grid-column: 2;
        grid-row: 1 / span 2;
        align-self: start;
        height: auto;
		width: 100%; /* Ensure tabs do not exceed their container */
        overflow-x: hidden; /* Prevent horizontal overflow */
        box-sizing: border-box; /* Include padding and border in width calculation */
    }


    /* Player Card */
    .player-card {
        flex-direction: row;
        align-items: center;
        grid-template-columns: auto 1fr;
        gap: 20px;
    }


    .player-card h2 {
        font-size: 1.5em;
    }


    .player-card .details {
        flex-direction: row;
        grid-template-columns: auto auto auto;
        gap: 20px;
        justify-self: end;
    }


    .player-card .details p:first-child {
        text-align: left;
    }


    .player-card .details p {
        text-align: right;
    }
}















