:root {
  --color-primary: #88c273;
  --color-secondary: #889eaf;
  --color-tertiary: #f96666;
  --color-primary-darker: #729763;
  --color-secondary-darker: #506d84;
  --color-tertiary-darker: #dd5353;
  --color-primary-opacity: rgb(136, 194, 115, 0.4);
  --color-secondary-opacity: #ffcd0331;
  --color-tertiary-opacity: rgb(249, 102, 102, 0.4);
  --color-temporary: #ffcb03;
  --color-temporary-darker: #ffbb00;
  --gradient-primary: linear-gradient(to top left, #39b385, #9be15d);
  --gradient-secondary: linear-gradient(to top left, #ffb003, #ffcb03);
}

/* MODAL WINDOW */
.register-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 60rem;
  background-color: #f3f3f3;
  padding: 5rem 6rem;
  box-shadow: 0 4rem 6rem rgba(0, 0, 0, 0.3);
  z-index: 2000;
  /* transition: all 0.5s; */
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1999;
  /* transition: all 0.5s; */
}

/* Rekisteröintilomakkeen tyylit */

.register-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  max-width: 35rem;
  margin: 0 auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 1.6rem;
  font-weight: 500;
  color: #444;
}

.register-input {
  padding: 1rem;
  font-size: 1.6rem;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  transition: all 0.3s;
}

.register-input:focus {
  outline: none;
  border-color: #888;
}

.password-info {
  font-size: 1.2rem;
  color: #777;
  margin-top: 0.4rem;
}

.register-btn {
  margin-top: 1.5rem;
  padding: 1.2rem;
  font-size: 1.8rem;
  font-weight: 500;
  background-color: var(--color-primary);
  color: #333;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s;
}

.register-btn:hover,
.register-btn:active {
  background-color: var(--color-primary-darker);
}

.modal__header {
  margin-bottom: 2.5rem;
  text-align: center;
}

.modal__form .btn:hover {
  background-color: var(--color-primary-darker);
}

.btn--close-modal {
  font-family: inherit;
  color: inherit;
  position: absolute;
  top: 0.5rem;
  right: 2rem;
  font-size: 4rem;
  cursor: pointer;
  border: none;
  background: none;
}

.hidden {
  display: none !important;
}

/* Force visibility when not hidden */
.register-modal:not(.hidden),
.overlay:not(.hidden) {
  display: block !important;
}

.register-form button[type='submit']:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.register-input:invalid {
  border-color: #ff7675;
}

.register-input:valid {
  border-color: #00b894;
}

/* .register-form button[type='submit']:not(:disabled):hover {
  background-color: #2d3436;
  transform: translateY(-2px);
} */

/* Lomakkeen ryhmittely */
.form-group {
  margin-bottom: 1rem;
}

/* Salasanan vahvuusmittari */
.password-strength {
  width: 100%;
  margin-top: 5px;
}

.password-strength__bar {
  height: 6px;
  background-color: #ddd;
  position: relative;
}

.password-strength__bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  transition: width 0.3s, background-color 0.3s;
}

.password-strength__bar.weak::before {
  width: 25%;
  background-color: #ff585f;
}

.password-strength__bar.medium::before {
  width: 50%;
  background-color: #ffcb03;
}

.password-strength__bar.strong::before {
  width: 75%;
  background-color: #8fd87d;
}

.password-strength__bar.very-strong::before {
  width: 100%;
  background-color: #5ec576;
}

.password-strength__text {
  font-size: 0.8rem;
  color: #666;
  display: block;
  margin-top: 2px;
}

/* Salasanan näyttö/piilotus */
.password-container {
  position: relative;
  display: flex;
  width: 100%;
}

.password-input,
.password-confirm {
  flex-grow: 1;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  user-select: none;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.password-toggle:hover {
  opacity: 1;
}

/* Virheviestit */
.error-message {
  color: #ff585f;
  font-size: 0.8rem;
  margin-top: 4px;
  display: none;
}

.register-input.invalid {
  border: 1px solid #ff585f;
}
