/* ---------------------- General Background ---------------------- */
body {
  background-image: url('/static/images/create_leaderboard_background.png');
  background-size: cover;
  background-position: center;
}

/* ---------------------- Form Title ---------------------- */
.form-title {
  text-align: center;
  font-size: clamp(24px, 3vw, 42px);
  font-weight: bold;
  color: #ff0000;
  margin-bottom: 2vh;
}

/* ---------------------- Form Container ---------------------- */
.general-form {
  background-color: rgba(192, 192, 192, 0.75);
  padding: 2vw;
  max-width: 90%;
  width: 90%;
  margin: auto;
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  gap: 2vh;
}

/* ---------------------- Row Layout ---------------------- */
.filter-row {
  display: flex;
  justify-content: center;
  gap: 1vw;
  flex-wrap: wrap;
}

.row-1 {
  display: flex;
  justify-content: center;
  align-items: center;
}

.row-1 .dropdown-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  margin-bottom: 0;
  padding-bottom: 0;
  line-height: 1;
  height: 44px;
  box-sizing: border-box;
}

.row-2,
.row-3 {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5vw;
  align-items: flex-start;
}

.row-2 > div,
.row-3 > div {
  flex: 1 1 24%;
  min-width: 180px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.centered-single {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 300px;
}

.row-4,
.row-5 {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* ---------------------- Fields ---------------------- */
.numeric-filter-group,
.dropdown-group,
.faction-box,
.input-wrapper,
.main-stat-box {
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  max-width: 300px;
  margin-bottom: 0;
}

.numeric-filter-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  position: relative;
  width: 100%;
}

.numeric-filter-group label,
.dropdown-group label,
.faction-box label {
  font-weight: bold;
  margin-bottom: 4px;
}

input,
select {
  text-align: center;
  justify-content: center;
}

.dropdown-group:last-child,
.faction-box:last-child,
.input-wrapper:last-child,
.main-stat-box:last-child {
  margin-bottom: 0;
}

/* ---------------------- Dropdown List ---------------------- */
.dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0;
  max-height: 150px;
  overflow-y: auto;
  background-color: white;
  border: 1px solid #ccc;
  border-radius: 0 0 6px 6px;
  display: none;
  z-index: 100;
}

.dropdown-list.show {
  display: block;
}

.dropdown-list div {
  padding: 8px;
  cursor: pointer;
}

.dropdown-list div:hover {
  background-color: #f0f0f0;
}

/* ---------------------- Toggle Buttons ---------------------- */
.toggle-operator {
  display: none;
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 1rem !important;
  font-family: inherit;
  line-height: 1 !important;
  border: none;
  border-radius: 6px;
  background-color: #1976d2;
  color: white;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  vertical-align: middle;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  margin-top: 20px !important;
}

.toggle-operator.show {
  display: flex !important;
}


/* ---------------------- Get rid of Arrows in Input ---------------------- */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type=number] {
  -moz-appearance: textfield;
}

/* ---------------------- Faction Selector ---------------------- */
.faction-box {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  width: 100%;
  min-width: 180px;
  max-width: 300px;
  height: auto;
  box-sizing: border-box;
  margin-bottom: 0;
}

.faction-selector {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 6px;
  background-color: white;
  position: relative;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  width: 100%;
}

.faction-box label {
  font-weight: bold;
  margin-bottom: 4px;
  text-align: center;
  width: 100%;
}

.faction-tags {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 26px;
  padding-top: 5px;
  width: 100%;
  text-align: center;
}

.faction-placeholder {
  color: #999;
}

.faction-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ccc;
  border-radius: 0 0 6px 6px;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.faction-dropdown.hidden {
  display: none;
}

.faction-option {
  padding: 8px;
  cursor: pointer;
}

.faction-option:hover {
  background-color: #f0f0f0;
}

.faction-tag {
  background-color: #1976d2;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
}
/* ---------------------- Server Selector ---------------------- */

.server-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 300px;
}

.server-group label {
  font-weight: bold;
  margin-bottom: 4px;
  text-align: center;
}

.server-input-container {
  display: flex;
  align-items: center;
  position: relative;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: white;
  padding: 0 6px; /* tighter */
  gap: 5px;
  min-height: 42px;
  height: 42px; /* prevent growing */
  max-width: 300px;
  overflow: hidden;
  padding-bottom: 0;
  margin-bottom: 0;
  line-height: 1;
}

#server-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: 50%;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  white-space: nowrap;
  align-items: center;
}

.server-tag {
  background-color: #1976d2;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
}

#server-input {
  border: none;
  outline: none;
  width: 50%;
  font-size: 1rem;
  margin: 0;        
  padding: 0;        
  line-height: 1;      
  height: 100%;          
  box-sizing: border-box; 
}

#server-dropdown {
  border: none;
  margin-top: 0;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

#server-dropdown.show {
  display: block;
}

#server-dropdown div {
  padding: 8px;
  cursor: pointer;
}

#server-dropdown div:hover {
  background-color: #f0f0f0;
}

#server-operator {
  align-self: flex-start !important;
  margin-top: 23px !important;  /* adjust this until perfectly centered */
  height: 42px !important;
  min-height: 42px !important;
}

#server-dropdown,
.dropdown-list {
  top: 100%;
  margin-top: -1px;        /* ← Force dropdown to overlap 1px upward */
  padding: 0;
  border-top: none;        /* Optional: smooth connection */
}


#server-input::placeholder {
  white-space: pre-line;
  line-height: 1.2;
  position: relative;
  top: -8px;   /* move placeholder text up a bit */
}



/* ---------------------- Main Stat ---------------------- */
.main-stat-box label {
  font-weight: bold;
  display: block;
  margin-bottom: 5px;
}

.main-stat-box select {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

/* ---------------------- Submit ---------------------- */
.general-form button {
  background-color: #1976d2;
  color: white;
  font-size: 1rem;
  padding: 10px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  width: 200px;
  align-self: center;
  transition: background-color 0.2s ease;
}

.general-form button:hover {
  background-color: #0d56a1;
}

/* ---------------------- Floating ID + Power ---------------------- */
.row-2-floating {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 360px;
  margin-bottom: -5px;
  z-index: 1;
}

.float-id,
.float-power {
  max-width: 300px;
  width: 100%;
}

.form-box {
  height: 44px;
  width: 100%;
  max-width: 300px;
  font-size: 1rem;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

input, select {
  margin-bottom: 0 !important;
}
/* ---------------------- Warning ---------------------- */
.floating-warning {
  margin-top: 25vh;
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background-color: #ffcccc;
  color: #a40000;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.floating-warning.show {
  opacity: 1;
  pointer-events: auto;
}

/* ---------------------- Mobile ---------------------- */
@media (max-width: 768px) {
  .row-2-floating {
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 0;
  }

  .general-form {
    gap: 20px;
  }

  .input-wrapper,
  .dropdown-group,
  .faction-box,
  .main-stat-box {
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .input-wrapper > *,
  .dropdown-group > *,
  .faction-box > *,
  .main-stat-box > * {
    margin-bottom: 10px;
  }
    #server-dropdown,
  .dropdown-list {
    margin-top: -11px;
  }
}
