/* ============================
   CORE LAYOUT
   ============================ */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&display=swap');

body.tm-dark {
  margin: 0; padding: 0;
  background: #02040a;
  font-family: 'Montserrat', sans-serif;
  height: 100vh;
  width: 100%;
  overflow: hidden; 
  color: #fff;
}

#tm-bg-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }

.split-layout { 
  display: flex; 
  width: 100%; 
  height: 100%; 
  position: relative; 
  z-index: 1; 
  align-items: center; 
  justify-content: center;
}

/* ============================
   FIXED HEADER
   ============================ */
.auth-top-nav {
  position: absolute; top: 0; left: 0; width: 100%;
  padding: 30px 50px; display: flex; justify-content: space-between; align-items: flex-start;
  z-index: 100; pointer-events: none;
  opacity: 0;
  animation: fadeInDown 0.8s ease-out forwards;
}

.nav-brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: #fff;
  font-weight: 800; font-size: 1.5rem; letter-spacing: 1px;
  pointer-events: auto; 
  
  /* FIXED: Remove uppercase to allow 'iTRUEMATCH' */
  text-transform: none; 
}
.nav-brand img { width: 40px; height: auto; }
.nav-back-btn {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; border-radius: 50px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff; text-decoration: none; font-size: 0.8rem; font-weight: 700;
  letter-spacing: 1px; white-space: nowrap; backdrop-filter: blur(10px); 
  transition: all 0.3s ease; 
}
.nav-back-btn svg { width: 18px; height: 18px; stroke-width: 3; }
.nav-back-btn:hover { 
  background: rgba(100, 233, 238, 0.1); border-color: #64E9EE; color: #64E9EE;
  box-shadow: 0 0 20px rgba(100,233,238,0.2); transform: translateY(-2px);
}

/* ============================
   THE UNIFIED CARD
   ============================ */
.unified-card {
  display: flex;
  width: 100%;
  max-width: 1000px;
  height: 720px;
  background: rgba(13, 20, 35, 0.85);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(100, 233, 238, 0.3);
  border-radius: 40px;
  box-shadow: 0 0 40px rgba(100, 233, 238, 0.15), inset 0 0 30px rgba(100, 233, 238, 0.05);
  animation: breatheBorder 4s infinite alternate, cardEntrance 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  position: relative;
  overflow: hidden;
  opacity: 0; 
  transform: scale(0.95);
}

@keyframes breatheBorder {
  0% { border-color: rgba(100, 233, 238, 0.3); box-shadow: 0 0 30px rgba(100, 233, 238, 0.1); }
  100% { border-color: rgba(100, 233, 238, 0.7); box-shadow: 0 0 60px rgba(100, 233, 238, 0.25); }
}

@keyframes cardEntrance {
  to { opacity: 1; transform: scale(1); }
}

.unified-card::after {
  content: ''; position: absolute; left: 50%; top: 10%; bottom: 10%; width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.1), transparent);
}

/* ============================
   LEFT SIDE: CHAT INTERFACE
   ============================ */
.auth-visual-side {
  width: 50%; 
  position: relative; 
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  perspective: 1000px;
  opacity: 0;
  animation: slideInLeft 1s ease-out 0.2s forwards;
}

.visual-content { position: relative; z-index: 5; text-align: center; width: 100%; padding: 0; }

.chat-interface-wrapper {
  position: relative; z-index: 10;
  width: 360px;
  height: 620px;
  transition: transform 0.1s ease-out;
  margin: 0 auto;
}

.chat-phone-body {
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.4); 
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 40px; 
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  display: flex; flex-direction: column; overflow: hidden; position: relative;
}

.chat-header-ui {
  padding: 20px 25px; border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex; align-items: center; gap: 15px; background: rgba(255,255,255,0.02);
}
.chat-avatar { width: 40px; height: 40px; border-radius: 50%; background: #222; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid rgba(100,233,238,0.3); }
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.online-dot { width: 10px; height: 10px; background: #10b981; border-radius: 50%; position: absolute; bottom: 0; right: 0; border: 2px solid #0a0f19; }
.chat-info { display: flex; flex-direction: column; text-align: left; }
.chat-name { font-weight: 700; font-size: 1rem; color: #fff; }
.chat-status { font-size: 0.75rem; color: #64E9EE; font-weight: 500; }

.chat-messages-area {
  flex: 1; padding: 25px;
  display: flex; flex-direction: column; gap: 15px; justify-content: flex-end; position: relative;
}

.chat-bubble {
  max-width: 85%; padding: 12px 18px; border-radius: 18px;
  font-size: 0.9rem; line-height: 1.4; opacity: 0; transform: translateY(10px); text-align: left;
  animation: msgPopIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes msgPopIn { to { opacity: 1; transform: translateY(0); } }
.chat-bubble.received { align-self: flex-start; background: rgba(255,255,255,0.08); color: #e2e8f0; border-bottom-left-radius: 4px; border: 1px solid rgba(100,233,238,0.1); }
.chat-bubble.sent { align-self: flex-end; background: linear-gradient(135deg, #64E9EE 0%, #29a3ff 100%); color: #000; font-weight: 600; border-bottom-right-radius: 4px; box-shadow: 0 5px 15px rgba(100,233,238,0.2); }

.typing-bubble { width: 60px; height: 35px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.dot { width: 6px; height: 6px; background: rgba(255,255,255,0.5); border-radius: 50%; animation: typeBounce 1.4s infinite; }
.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typeBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); background: #64E9EE; } }

.reaction-layer { position: absolute; bottom: 0; right: 20px; width: 50px; height: 100%; pointer-events: none; }
.floating-heart { position: absolute; bottom: 80px; font-size: 1.8rem; animation: floatHeart 2s ease-out forwards; }
@keyframes floatHeart { 0% { transform: translateY(0) scale(0.5); opacity: 0; } 20% { opacity: 1; transform: translateY(-20px) scale(1.2); } 100% { transform: translateY(-150px) scale(1); opacity: 0; } }

.floating-badge {
  position: absolute; padding: 10px 20px; border-radius: 50px;
  background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(10px); font-weight: 700; font-size: 0.8rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5); animation: floatBadge 4s ease-in-out infinite;
}
.badge-1 { top: 15%; left: -20px; color: #ff4757; animation-delay: 0s; }
.badge-2 { bottom: 20%; right: -25px; color: #2ed573; animation-delay: 2s; }
@keyframes floatBadge { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }


/* ============================
   RIGHT SIDE: LOGIN FORM & FLIP FIX
   ============================ */
.auth-form-side {
  width: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; 
  background: transparent;
}
.mobile-header { display: none; margin-bottom: 30px; }

/* ---- FLIP CARD LAYERING FIX ---- */
.flip-wrapper {
  perspective: 2000px; 
  width: 100%; 
  max-width: 420px; 
  height: 600px; 
  position: relative; 
  z-index: 10; 
}

.flip-card { 
  width: 100%; 
  height: 100%; 
  position: relative; 
  transform-style: preserve-3d; 
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}
.flip-card.flipped { transform: rotateY(180deg); }

.card-face {
  position: absolute; 
  inset: 0; 
  backface-visibility: hidden; 
  -webkit-backface-visibility: hidden;
  background: transparent; 
  border: none;
  box-shadow: none;
  padding: 20px 30px;
  display: flex; 
  flex-direction: column; 
  justify-content: center;
  cursor: auto;
  
  /* CRITICAL FIX: Z-index transition ensures buttons are clickable */
  z-index: 5;
  transition: z-index 0.4s step-end; 
}

/* Front Face (Login) */
.card-face.front {
  transform: rotateY(0deg);
  z-index: 10; /* Default: Top */
}

/* Back Face (Signup) */
.card-face.back { 
  transform: rotateY(180deg); 
  z-index: 1; /* Default: Bottom */
}

/* --- THE MAGIC LOGIC --- 
   When flipped, swap the Z-indexes so the BACK face receives clicks 
*/
.flip-card.flipped .card-face.front {
  z-index: 1;
  pointer-events: none; /* Ignore clicks on invisible front */
}

.flip-card.flipped .card-face.back {
  z-index: 10;
  pointer-events: auto; /* Catch clicks on visible back */
}
/* ------------------------------- */

/* --- STAGGERED ENTRANCE ANIMATIONS FOR FORM --- */

/* Keyframes for Staggered Entrance */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Staggered Delays for Login/Signup Contents */
/* Header */
.face-content .auth-header {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.3s forwards;
}

/* Input Fields Sequence */
.face-content form .input-group:nth-child(1) {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.4s forwards;
}
.face-content form .input-group:nth-child(2) {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.5s forwards;
}
.face-content form .input-group:nth-child(3) {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.6s forwards;
}

/* Actions Row (Remember me / Forgot) */
.face-content .actions-row {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.65s forwards;
}

/* Main Button */
.face-content .btn-primary {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.7s forwards;
}

/* Terms Micro text */
.face-content .terms-micro {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.75s forwards;
}

/* Divider */
.face-content .divider {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.8s forwards;
}

/* OAuth Button */
.face-content .btn-oauth {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 0.9s forwards;
}

/* Switch Area (Bottom Link) */
.face-content .switch-area {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out 1s forwards;
}


/* FORM STYLING (Existing) */
.auth-header { text-align: center; margin-bottom: 30px; }
.auth-header h1 { font-size: 2.2rem; margin: 0 0 8px; color: #fff; text-shadow: 0 0 15px rgba(100,233,238,0.5); font-weight: 800; }
.auth-header p { color: #94a3b8; font-size: 1rem; margin: 0; font-weight: 500; }
form { display: flex; flex-direction: column; gap: 18px; width: 100%; }
.input-group { position: relative; width: 100%; }
.input-group input {
  width: 100%; padding: 16px; background: rgba(0, 0, 0, 0.4); 
  border: 1px solid rgba(100, 233, 238, 0.2); border-radius: 12px; 
  color: #fff; font-size: 1rem; font-family: 'Montserrat', sans-serif; font-weight: 500;
  transition: all 0.3s; cursor: text;
}
.input-group input:focus { border-color: #64E9EE; background: rgba(100,233,238,0.08); box-shadow: 0 0 15px rgba(100, 233, 238, 0.2); outline: none; }
.input-group label { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 0.9rem; pointer-events: none; transition: 0.3s; padding: 0 4px; background: transparent; font-weight: 500; }
.input-group input:focus + label, .input-group input:not(:placeholder-shown) + label { top: 0; font-size: 0.8rem; color: #64E9EE; background: #0b1120; font-weight: 700; }
.btn-primary { width: 100%; padding: 16px; border-radius: 50px; border: none; background: #64E9EE; color: #000; font-weight: 800; font-size: 1.1rem; cursor: pointer; margin-top: 10px; font-family: 'Montserrat', sans-serif; text-transform: uppercase; letter-spacing: 1px; box-shadow: 0 0 20px rgba(100, 233, 238, 0.4); transition: transform 0.2s, box-shadow 0.2s; }
.btn-primary:hover { transform: translateY(-3px); background: #fff; box-shadow: 0 0 40px rgba(100, 233, 238, 0.8); }
.actions-row { display: flex; justify-content: space-between; font-size: 0.9rem; color: #94a3b8; font-weight: 500; cursor: default; }
.forgot-link { color: #64E9EE; text-decoration: none; font-weight: 600; cursor: pointer; }
.divider { text-align: center; border-bottom: 1px solid rgba(255,255,255,0.1); line-height: 0.1em; margin: 15px 0; }
.divider span { background: #0b1120; padding: 0 15px; color: #64748b; font-size: 0.8rem; font-weight: 600; }
.btn-oauth { width: 100%; padding: 14px; border-radius: 50px; border: 1px solid rgba(255,255,255,0.15); background: #fff; color: #000; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; font-family: 'Montserrat', sans-serif; }
.btn-oauth:hover { filter: brightness(0.95); transform: translateY(-1px); }
.btn-oauth img { width: 22px; }
.switch-area { margin-top: 25px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.05); text-align: center; width: 100%; position: relative; z-index: 20; }
.switch-area p { display: inline; color: #94a3b8; margin-right: 8px; font-size: 0.95rem; font-weight: 500; }
.btn-switch { display: inline-block; background: none; border: none; padding: 5px; color: #64E9EE; font-weight: 800; font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer; text-decoration: none; transition: all 0.2s; pointer-events: auto; }
.btn-switch:hover { color: #fff; text-shadow: 0 0 15px #64E9EE; transform: scale(1.05); }
.simple-footer { position: absolute; bottom: 15px; color: #334155; font-size: 0.8rem; font-weight: 600; }

/* RESPONSIVE */
@media (max-width: 1000px) {
  .unified-card { flex-direction: column; height: auto; max-width: 500px; padding: 40px 0; }
  .auth-top-nav { padding: 15px 20px; }
  .auth-visual-side { width: 100%; height: 600px; }
  .auth-form-side { width: 100%; padding: 20px; }
  .flip-wrapper { height: 650px; }
  .unified-card::after { display: none; } /* Hide vertical divider on mobile */
}

/* MODAL STYLES (EXISTING & FORGOT PASSWORD) */
#dlgVerify, #dlgForgot { background: #0f172a; border: 1px solid #64E9EE; color: #fff; border-radius: 16px; padding: 24px; width: 90%; max-width: 400px; }
.code-input { width: 100%; background: #000; color: #fff; border: 1px solid #334155; padding: 12px; font-size: 1.5rem; text-align: center; letter-spacing: 5px; margin: 15px 0; border-radius: 8px; font-family: 'Montserrat', sans-serif; font-weight: 700; cursor: text; }

/* FIX FOR FORGOT PASSWORD INPUTS TO LOOK NORMAL (NOT OTP STYLE) */
.code-input.full-text {
    font-size: 1rem !important;
    text-align: left !important;
    letter-spacing: normal !important;
    padding: 16px !important;
}

.modal-actions { display: flex; gap: 10px; margin-top: 15px; }
.btn-ghost { background: transparent; border: 1px solid #334155; color: #fff; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-family: 'Montserrat', sans-serif; font-weight: 600; flex: 1; }

/* OTP verification status */
.verify-msg{
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.35;
  min-height: 18px;
}
.verify-msg.is-ok{ color: rgba(100, 233, 238, 0.95); }
.verify-msg.is-error{ color: rgba(255, 120, 120, 0.95); }
/* ============================
   END OF FILE
   ============================ */