/* --- تنظیمات کلی و فونت --- */
:root {
  --primary-color: #3d5af1;
  --secondary-color: #a855f7;
  --text-color: #e2e8f0;
  --bg-color: #0f172a;
  --card-bg: rgba(255, 255, 255, 0.1);
  --border-color: rgba(255, 255, 255, 0.2);
  --shadow-color: rgba(0, 0, 0, 0.2);
  --success-color: #22c55e;
  --error-color: #ef4444;
}

body {
  font-family: 'Vazirmatn', sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow: hidden;
  direction: rtl;
  text-align: right;
}

/* --- پس زمینه متحرک --- */
.background-blobs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.6;
}

.blob1 {
  width: 400px;
  height: 400px;
  background: var(--primary-color);
  top: -150px;
  left: -150px;
  animation: moveBlob1 20s infinite alternate;
}

.blob2 {
  width: 300px;
  height: 300px;
  background: var(--secondary-color);
  bottom: -100px;
  right: -100px;
  animation: moveBlob2 25s infinite alternate;
}

.blob3 {
  width: 250px;
  height: 250px;
  background: #f59e0b;
  bottom: 20%;
  left: 30%;
  animation: moveBlob3 15s infinite alternate;
}

@keyframes moveBlob1 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(200px, 300px) scale(1.2); }
}
@keyframes moveBlob2 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-300px, -200px) scale(0.8); }
}
@keyframes moveBlob3 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(100px, -100px) scale(1.1); }
}


/* --- ساختار اصلی --- */
/* --- ساختار اصلی (اصلاح شده) --- */
.main-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  /* align-items: stretch; تغییر کلیدی: این دستور کارت‌ها را هم‌قد می‌کند */
  align-items: center; 
  gap: 2rem;
  min-height: 100vh;
  padding: 1rem;
}

/* --- استایل کارت شیشه‌ای (Glassmorphism) --- */
.glass-card {
  background: var(--card-bg);
  border-radius: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 32px 0 var(--shadow-color);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 35px;
  box-sizing: border-box;
  width: 100%; /* اضافه شد: تا تمام عرض والد خود را بگیرد */
  height: 100%; /* اضافه شد: تا تمام ارتفاع والد خود را بگیرد */
  display: flex; /* اضافه شد: برای چیدمان محتوای داخلی */
  flex-direction: column; /* اضافه شد: محتوا زیر هم قرار می‌گیرد */
  overflow-y: auto;
}

/* --- کارت نماینده --- */
/* --- استایل‌های مشترک برای هر دو کارت (بخش جدید) --- */
.agent-card,
.flip-card {
    width: 400px; /* عرض یکسان برای هر دو کارت */
  max-width: 95vh;
  max-height: 95vh;
  height: auto;
    display: flex; /* این کمک می‌کند تا glass-card داخل آن به درستی کش بیاید */
    animation: fadeInUp 0.8s ease-out; /* انیمیشن یکسان */
     align-items: center;
     justify-content: center; /* محتوای کارت نماینده را در مرکز قرار می‌دهد */
    text-align: center;
}

/* --- کارت نماینده (اصلاح شده) --- */


.agent-logo-wrapper {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 55px;
}
#agent-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.agent-card h2 {
    margin: 0 0 10px 0;
    font-size: 1.5rem;
}
.agent-info p {
    margin: 5px 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* --- کارت ورود چرخشی --- */
.flip-card {
  background-color: transparent;
  width: 400px;
  height: 480px;
  perspective: 1500px;
  animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s;
  transform-style: preserve-3d;
}

.flip-card.is-flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.flip-card-back {
  transform: rotateY(180deg);
}

.card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  height: 100%;
}

.card-icon {
  margin-bottom: 20px;
  color: var(--text-color);
}
.card-content h2 {
  margin: 0 0 10px 0;
  font-size: 1.8rem;
}
.subtitle {
  margin: 0 0 30px 0;
  opacity: 0.8;
  font-size: 1rem;
}
.subtitle strong {
    font-weight: 500;
    direction: ltr;
    display: inline-block;
}

/* --- فرم‌ها و دکمه‌ها --- */
form {
  width: 100%;
}

.form-group {
  margin-bottom: 20px;
}

input[type="tel"], input[type="text"] {
  width: 100%;
  padding: 15px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-color);
  font-size: 1.1rem;
  text-align: center;
  box-sizing: border-box;
  transition: all 0.3s ease;
}

input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(61, 90, 241, 0.4);
}
input#otp {
    font-size: 1.5rem;
    letter-spacing: 10px;
}

.btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  font-size: 1.1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}
.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}
.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 20px;
    margin-top: -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.resend-timer {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 20px;
    font-size: 0.9rem;
}
.resend-timer a {
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s;
}
.resend-timer a:hover { opacity: 1; }

.status-message {
    margin-top: 15px;
    font-size: 0.9rem;
    height: 20px;
}
.status-message.error { color: var(--error-color); }
.status-message.success { color: var(--success-color); }

/* --- کارت خطا --- */
.error-card {
    max-width: 500px;
    text-align: center;
    animation: popIn 0.5s ease-out;
}
.error-card h2 {
    color: var(--error-color);
}

/* --- کلاس‌های کمکی و انیمیشن‌ها --- */
.hidden { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }

/* --- واکنش‌گرایی --- */
@media (max-width: 768px) {
    .flip-card {
        width: 90vw;
        max-width: 380px;
        height: 460px;
    }
    .agent-card {
        width: 90vw;
        max-width: 380px;
        height: 300px;
    }
    .agent-logo-wrapper {
        width: 100px; /* اندازه کوچک‌تر برای موبایل */
        height: 100px; /* اندازه کوچک‌تر برای موبایل */
        margin-bottom: 25px; /* فاصله کمتر برای موبایل */
    }
}