/* ============================================
   FINLY CHAT — AUTH (FC v2.5) | Premium SaaS Style
   - Modüler Yapı: Her bölümün kendi içinde Desktop ve Mobile ayarları bulunur.
   ============================================ */

/* ============================================
   1. KÖK DEĞİŞKENLER VE SAYFAYI DONDURMA (GLOBAL)
   ============================================ */
:root {
  --bg: #ffffff;
  --txt: #202124;
  --brand: #1d3e2f;

  --cardWidth: 400px;
  --innerPad: 40px;
  --radius: 24px;

  --fs-base: 15.5px;
  --fs-sm: 13.5px;
  --fs-auth-link-m: 0.85rem;
  --lh-auth-link-m: 1.2;

  --cardBg: #ffffff;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
  --border: 1px solid rgba(0, 0, 0, 0.05);
}

html,
body {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* ============================================
   2. MODAL & KAPSAYICI DÜZENİ (LAYOUT & CONTAINERS)
   ============================================ */
/* --- Masaüstü --- */
#loginModal.login-mode,
#loginModal.signup-mode {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 24px 10vw 24px 24px;
  box-sizing: border-box;
  z-index: 999999;
}

/* --- Mobil --- */
@media (max-width: 820px) {
  #loginModal,
  #loginModal.login-mode,
  #loginModal.signup-mode {
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 0 !important;
    margin: 0 !important;
    justify-content: center !important;
    align-items: flex-start !important;
    touch-action: none !important;
    background-color: #ffffff !important; /* Dış alandaki gri boşluğu engeller */
  }
}

/* ============================================
   3. ARKA PLAN VE PROMO GÖRSELİ
   ============================================ */
/* --- Masaüstü --- */
#loginModal .fc-auth-promo {
  position: fixed;
  inset: 0;
  z-index: -1;
}

#loginModal .fc-auth-promo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- Mobil --- */
@media (max-width: 820px) {
  #loginModal .fc-auth-promo {
    display: block !important;
    position: absolute !important;
    top: 75vh !important; /* Form alanına daha fazla yer bırakmak için aşağı çekildi */
    left: 0 !important;
    width: 100% !important;
    height: 25vh !important; /* Görsel yüksekliği azaltıldı */
    background-color: #ffffff !important;
    overflow: hidden !important;
    z-index: 1 !important;
  }

  #loginModal .fc-auth-promo img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    padding: 10px;
    box-sizing: border-box;
  }
}

/* ============================================
   4. SLOGAN METİNLERİ (PROMO OVERLAY TEXTS)
   ============================================ */
/* --- Masaüstü --- */
#fcPromoHeader {
  font-family: 'Crimson Pro', 'TeX Gyre Bonum', serif;
  position: absolute;
  top: 40px;
  right: 50px;
  color: #1d3e2f !important;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.8px;
  z-index: 10;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 0 6px rgba(255, 255, 255, 1), 0 0 14px rgba(255, 255, 255, 0.9), 0 0 26px rgba(255, 255, 255, 0.8);
}

#fcPromoSubtitle {
  font-family: 'Crimson Pro', 'TeX Gyre Bonum', serif;
  position: absolute;
  bottom: 35px;
  right: 40px;
  color: #1d3e2f !important;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  z-index: 10;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 0 5px rgba(255, 255, 255, 1), 0 0 12px rgba(255, 255, 255, 0.9), 0 0 22px rgba(255, 255, 255, 0.8);
}

/* --- Mobil --- */
@media (max-width: 820px) {
  #fcPromoHeader {
    display: block !important;
    position: absolute !important;
    top: auto !important;
    bottom: 15% !important; 
    right: 10% !important; 
    left: auto !important;
    width: 45% !important; /* Metnin daha rahat sığması için genişletildi */
    font-size: 12px !important;
    line-height: 1.3 !important;
    white-space: normal !important;
    text-align: center !important;
    color: #ffffff !important;
    text-shadow: none !important;
    z-index: 10 !important;
  }

  #fcPromoSubtitle {
    display: none !important;
  }
}

/* ============================================
   5. BAŞLIK, LOGOLAR VE YEŞİL BANT
   ============================================ */
/* --- Masaüstü --- */
#loginModal .fc-auth-header {
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

#loginModal .auth-logo-link {
  position: fixed;
  top: 40px;
  left: 50px;
  margin: 0;
  cursor: pointer;
  transition: transform 0.2s ease;
  z-index: 999999;
}

#loginModal .auth-logo-link:hover {
  transform: translateY(-2px);
}

#loginModal .auth-logo-link img {
  height: 75px;
  width: auto;
  display: block;
}

.finly-logo-link {
  display: block;
  order: -1;
  margin-bottom: 20px;
}

.finly-logo-link img {
  height: 48px;
  width: auto;
  display: block;
  border-radius: 6px;
}

#loginModal #authTitle,
#loginModal #fa-authTitle {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--brand);
}

/* --- Mobil --- */
@media (max-width: 820px) {
  .auth-logo-link {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 85px !important;
    min-height: 85px !important;
    background-color: #1D3E2F !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999 !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    box-sizing: border-box !important;
  }

  .auth-logo-link img {
    height: 78px !important;
    min-height: 78px !important;
    width: auto !important;
    margin: 0 !important;
    filter: none !important;
    display: block !important;
  }

  #loginModal .fc-auth-header {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    margin-bottom: 20px !important; /* Başlık altı boşluğu biraz artırıldı */
  }

  #loginModal #authTitle,
  #loginModal #fa-authTitle {
    font-size: 30px !important;
    font-weight: 800 !important;
    margin: 0 !important;
    margin-bottom: 12px !important;
    text-align: left !important;
    color: var(--brand) !important;
  }

  .finly-logo-link {
    display: block !important;
  }

  .finly-logo-link img {
    height: 44px !important;
    width: auto !important;
    border-radius: 0px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
  }
}

/* ============================================
   6. ANA KART (LOGIN BOX)
   ============================================ */
/* --- Masaüstü --- */
#loginModal .login-box {
  width: var(--cardWidth);
  min-width: var(--cardWidth);
  padding: var(--innerPad);
  box-sizing: border-box;

  background: var(--cardBg);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);

  display: flex;
  flex-direction: column;
}

#loginModal .login-box>*,
#loginModal #loginForm,
#loginModal #registerForm,
#loginModal .login-box input,
#loginModal .login-box button {
  width: 100% !important;
  box-sizing: border-box;
}

/* --- Mobil --- */
@media (max-width: 820px) {
  #loginModal .login-box {
    position: absolute !important;
    top: 95px !important;
    left: 0 !important;
    right: 0 !important;
    margin: 0 auto !important;
    transform: none !important;

    width: 94% !important;
    max-width: 400px !important;
    min-width: 0 !important;
    height: auto !important;
    max-height: calc(75vh - 110px) !important; /* Ferahlık için daha fazla yükseklik tanındı */
    padding: 30px 24px !important; /* İç boşluklar artırıldı */

    background: #ffffff !important;
    border: none !important; 
    border-radius: 16px !important;
    box-shadow: none !important;
    z-index: 10 !important;

    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    touch-action: pan-y !important;
  }
}

/* ============================================
   7. GİRİŞ FORMU ELEMANLARI
   ============================================ */
/* --- Masaüstü --- */
#loginModal .login-box input {
  height: 50px;
  padding: 0 16px;
  margin-bottom: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f9fafb;
  font-size: var(--fs-base);
  transition: all 0.2s;
}

#loginModal .login-box input:focus {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(29, 62, 47, 0.1);
  outline: none;
}

#loginModal .auth-button,
#loginModal .login-box button {
  height: 50px;
  border-radius: 12px;
  border: none;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

#loginModal .auth-button:hover {
  opacity: 0.95;
}

#loginModal #googleLoginButton {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  margin-top: 0;
  font-weight: 600;
  gap: 12px;
}

#loginModal #googleLoginButton img {
  display: block;
}

#loginModal .separator {
  display: flex;
  align-items: center;
  margin: 20px 0;
}

#loginModal .separator::before,
#loginModal .separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #f3f4f6;
}

#loginModal .separator span {
  padding: 0 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #9ca3af;
}

#loginModal.login-mode #loginForm,
#loginModal.signup-mode #registerForm {
  display: block;
}

#loginModal.login-mode #registerForm,
#loginModal.signup-mode #loginForm {
  display: none;
}

#loginModal #resetPasswordLink {
  text-align: right;
  margin-bottom: 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: #6b7280;
}

#loginModal .switch-text {
  text-align: center;
  font-size: 14.5px;
  margin-top: 40px; 
  color: #6b7280;
}

#loginModal .link {
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  cursor: pointer;
}

#loginModal .link,
#loginModal .switch-text,
#loginModal .auth-button,
#loginModal .login-box button {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* --- Mobil Geliştirilmiş Denge Ayarları --- */
@media (max-width: 820px) {

  /* 1. YÜKSEKLİK VE FERAHLIK EŞİTLEME */
  #loginModal .login-box input,
  #loginModal .auth-button,
  #loginModal .login-box button,
  #loginModal #googleLoginButton {
    height: 52px !important; /* Dokunmatik hedefler için biraz daha yükseltildi */
    box-sizing: border-box !important;
    font-size: 16px !important;
    border-radius: 10px !important;
    margin-bottom: 16px !important; /* Inputlar arası boşluk ferahlatıldı */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* 2. BEYAZ ZEMİN BÜTÜNLÜĞÜ (INPUT ALANLARI) */
  #loginModal .login-box input {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
  }

  /* 3. GOOGLE BUTONUNA ÖZEL DOKUNUŞ */
  #loginModal #googleLoginButton {
    gap: 12px !important;
    margin-bottom: 0 !important; 
    padding: 0 !important;
    border: 1px solid #d1d5db !important; /* Border'ın mobilde de görünmesi tasarımı toparlar */
  }

  #loginModal #googleLoginButton img {
    height: 18px !important;
    width: auto !important;
  }

  /* 4. AYRAÇ (SEPARATOR) */
  #loginModal .separator {
    margin: 28px 0 !important; /* Ayracın üstten ve alttan bıraktığı boşluk nefes aldırıldı */
  }

  /* 5. ALT METİNLER (H3 ETKİSİ) */
  #loginModal #resetPasswordLink {
    margin-bottom: 20px !important; /* Şifremi unuttum ile buton arasındaki boşluk açıldı */
    display: block;
  }

  #loginModal #resetPasswordLink,
  #loginModal .separator span,
  #loginModal .switch-text,
  #loginModal .link {
    font-size: 13.5px !important; /* Okunabilirlik için bir tık büyütüldü */
    line-height: 1.2 !important;
  }
}

/* ============================================
   8. ALERT BİLDİRİM BALONLARI (FLOATING ALERTS)
   ============================================ */
/* --- Masaüstü --- */
#fc-alert,
#fc-alert-signup,
#fa-alert,
#fa-alert-signup {
  display: none;
  position: fixed !important;
  bottom: 90px !important;
  right: 40px !important;
  width: 400px !important;
  padding: 22px 26px !important;
  border-radius: 20px !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 14.5px !important;
  font-weight: 700 !important;
  line-height: 1.5 !important;
  z-index: 1000000 !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 25px 50px -12px rgba(0, 0, 0, 0.2), 0 0 0 1000vw rgba(0, 0, 0, 0.22) !important;
  background: #ffffff !important;
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  transform: scale(0.95);
}

.fa-alert::before,
.fc-alert::before {
  content: "";
  display: block;
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  background-size: contain;
  background-repeat: no-repeat;
}

.fa-alert-info,
.fc-alert-info {
  border-left: 10px solid #1D3E2F !important;
  color: #1D3E2F !important;
}

.fa-alert-info::before,
.fc-alert-info::before {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%231D3E2F"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/></svg>');
}

.fa-alert-error,
.fc-alert-error {
  border-left: 10px solid #d32f2f !important;
  color: #b71c1c !important;
}

.fa-alert-error::before,
.fc-alert-error::before {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23d32f2f"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/></svg>');
}

.fa-alert--show,
.fc-alert--show {
  display: block !important;
  animation: fcPopOutPremium 0.12s cubic-bezier(0.15, 0.9, 0.2, 1) forwards !important;
}

@keyframes fcPopOutPremium {
  0% {
    opacity: 0;
    transform: scale(0.75) translateY(30px);
    filter: blur(8px);
  }

  100% {
    opacity: 1;
    transform: scale(0.95) translateY(0);
    filter: blur(0);
  }
}

/* --- Mobil --- */
@media (max-width: 820px) {
  #fc-alert,
  #fc-alert-signup,
  #fa-alert,
  #fa-alert-signup {
    right: 16px !important;
    left: 16px !important;
    bottom: 20px !important;
    width: auto !important;
    padding: 18px !important;
    transform: scale(0.95) !important;
  }
}

/* =========================================================
   9. YÜKLEME (ULTIMATE AUTH SPINNER)
   ========================================================= */
#finly-chat-mount.is-loading .spinner,
#finly-chat-mount.is-loading .loader,
#finly-chat-mount.is-loading>svg {
  display: none !important;
}

#finly-chat-mount.is-loading::before {
  content: "" !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(255, 255, 255, 0.8) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  z-index: 9999998 !important;
  margin: 0 !important;
  padding: 0 !important;
}

#finly-chat-mount.is-loading::after {
  content: "" !important;
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  width: 44px !important;
  height: 44px !important;
  margin-top: -22px !important;
  margin-left: -22px !important;
  border: 4px solid rgba(29, 62, 47, 0.15) !important;
  border-left-color: #1D3E2F !important;
  border-radius: 50% !important;
  animation: fc-professional-spin 0.8s linear infinite !important;
  z-index: 9999999 !important;
  box-sizing: border-box !important;
}

@keyframes fc-professional-spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}