/* static/css/register_page/form.css */
/* form.css_1.4 */

#register-form {
  display: flex;
  flex-direction: column;
  /* Form grupları (input + label) arası boşluk */
  gap: 1.25rem;
}

/* YENİ: Ana Hata Mesajı Kutusu (#register-error-message)
   JS'in hataları yazdığı ana kutuyu stillendir.
*/
#register-error-message {
  padding: 0.85rem 1rem;
  border-radius: 0.5rem; /* 8px */
  background-color: rgba(229, 62, 62, 0.15);
  border: 1px solid rgba(229, 62, 62, 0.6);
  color: #f07f88;
  font-size: 0.9rem;
  font-weight: 500;
  display: none; /* JS tarafından 'block' yapılacak */
  margin-bottom: 0.25rem; /* Formun geri kalanından ayır */
  text-align: center;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Ekran genişlediğinde şifre alanlarını yan yana getir.
   Not: Alanlar dar kalırsa sıkışmak yerine alta geçer. */
@media (min-width: 600px) {
  .form-row {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .form-row .form-group {
    flex: 1 1 16rem;
    min-width: min(100%, 16rem);
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  /* Label ve input arası boşluk */
  gap: 0.4rem;
}

/* YENİ: JS'in hata/güç stilleri için ihtiyaç duyduğu wrapper
   (Bu sınıf HTML'de .form-group veya .password-wrapper ile birlikte kullanılır)
*/
.form-control-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary, #a0a0a0);
}

.form-control {
  width: 100%;
  min-width: 0;
  padding: 0.85rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;

  /* Tema uyumlu renkler */
  color: var(--text-primary, #e0e0e0);
  background-color: var(--input-bg, #1e1e1e);
  border: 1px solid var(--border-color, #2e2e2e);

  border-radius: 0.5rem; /* 8px */
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
  appearance: none; /* iOS için düzeltme */
}

/* Focus/Focus-visible: arka planın beyaza dönmesini engelle */
.form-control:focus,
.form-control:focus-visible {
  background-color: var(--input-bg, #1e1e1e);
  border-color: var(--sidebar-accent, #b29655);
  box-shadow: 0 0 0 3px var(--focus-ring-color, rgba(216, 182, 106, 0.28));
  outline: none;
}

.form-control::placeholder {
  color: var(--text-placeholder, var(--text-secondary, #a0a0a0));
  opacity: 1;
}

/* --- ŞİFRE ALANI VE GÖZ İKONU DÜZELTMESİ --- */
.password-wrapper {
  position: relative;
}

.password-wrapper .form-control {
  padding-right: 3.75rem;
  min-width: 0;
  overflow-x: auto;
  text-overflow: clip;
  white-space: nowrap;
}

.password-wrapper .form-control.is-invalid {
  padding-right: 5.5rem;
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);

  width: 2rem;
  height: 2rem;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  background-color: var(--input-bg, #1e1e1e);
  color: var(--icon-color, var(--text-secondary, #a0a0a0));
  border-radius: var(--border-radius-md, 6px);

  cursor: pointer;
  z-index: 3;
}

.toggle-password:hover {
  color: var(--sidebar-accent, #b29655);
}

/* --- YENİ: Şifre Gücü Stilleri ---
   JS bu sınıfları doğrudan .form-control'e ekler
   NOT: Hata stillerinden ÖNCE tanımlanmalı ki is-invalid üzerine yazabilsin
*/

/* Zayıf (Kırmızı) */
.form-control.strength-weak {
  border-color: #ff5c5c;
  box-shadow: 0 0 0 3px rgba(255, 92, 92, 0.4);
}

.form-control.strength-weak:focus {
  border-color: #ff5c5c;
  box-shadow: 0 0 0 3px rgba(255, 92, 92, 0.5);
}

/* Orta Güç (Turuncu/Sarı) */
.form-control.strength-medium {
  border-color: #f5a623;
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.4);
}

.form-control.strength-medium:focus {
  border-color: #f5a623;
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.5);
}

/* Güçlü (Yeşil/Mavi) */
.form-control.strength-strong {
  border-color: #50e3c2;
  box-shadow: 0 0 0 3px rgba(80, 227, 194, 0.4);
}

.form-control.strength-strong:focus {
  border-color: #50e3c2;
  box-shadow: 0 0 0 3px rgba(80, 227, 194, 0.5);
}

/* --- YENİ: Hata Durumu Stilleri (Doğrudan input'a göre) --- */

/* DEĞİŞTİ: JS artık doğrudan input'a (.form-control) sınıf ekliyor 
   NOT: Hata ikonunu göstermek için background-image kullanıyoruz,
   ancak border-color'ı şifre gücü stillerine bırakıyoruz
*/
.form-control.is-invalid {
  background-color: var(--input-bg, #1e1e1e);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23e53e3e'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23e53e3e' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-size: 1rem;
  background-position: right 1rem center;
}

/* Eğer şifre gücü sınıfı YOKSA, hata border'ını göster */
.form-control.is-invalid:not(.strength-weak):not(.strength-medium):not(
    .strength-strong
  ) {
  border-color: #e53e3e; /* Hata Kırmızısı */
}

.form-control.is-invalid:not(.strength-weak):not(.strength-medium):not(
    .strength-strong
  ):focus {
  border-color: #e53e3e;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.4);
}

/* DEĞİŞTİ: Hata ikonunu şifre alanında "göz" ikonunun SOLUNA taşı */
.password-wrapper .form-control.is-invalid {
  background-position: right 3.25rem center;
}

/* YENİ: Hata Mesajı Stilleri (data-for ile kullanılan) */
.error-message {
  display: none;
  color: #e53e3e;
  font-size: 0.875rem;
  margin-top: 0.35rem;
  font-weight: 500;
}

.error-message:not(:empty) {
  display: block;
}

/* Erişilebilirlik için (ekran okuyucular) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================
   AUTOFILL (Kopyalandı)
   ============================ */
input.form-control:-webkit-autofill,
input.form-control:-webkit-autofill:focus,
textarea.form-control:-webkit-autofill,
textarea.form-control:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-primary, #e0e0e0);
  caret-color: var(--text-primary, #e0e0e0);
  -webkit-box-shadow: 0 0 0px 1000px var(--input-bg, #1e1e1e) inset;
  box-shadow: 0 0 0px 1000px var(--input-bg, #1e1e1e) inset;
  transition: background-color 9999s ease-in-out 0s;
}

input.form-control:-moz-autofill,
textarea.form-control:-moz-autofill {
  box-shadow: 0 0 0px 1000px var(--input-bg, #1e1e1e) inset;
  -moz-text-fill-color: var(--text-primary, #e0e0e0);
}
