/* -----------------------------------------------------------
   1. الأساسيات والمتغيرات (The Foundation)
----------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
  /* الهوية البصرية الأساسية */
  --primary: #ff6b35;
  --primary-light: #ff8c5f;
  --secondary: #1a936f;
  --secondary-light: #2bb58d;
  --accent: #114b5f;
  
  /* ألوان النظام (iOS States) */
  --ios-success: #34C759;
  --ios-error: #FF3B30;
  --ios-blue: #007AFF;
  
  /* ألوان الخلفيات والأسطح */
  --light: #f9f7f3;
  --dark: #2a2d34;
  --white: #ffffff;
  --gray-bg: #F2F2F7;
  --gray-text: #8E8E93;
  
  /* Utilities */
  --shadow-lg: 0 15px 35px rgba(255, 107, 53, 0.15);
  --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.1);
  --gradient: linear-gradient(135deg, var(--primary), var(--primary-light));
  --transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --radius: 18px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column; /* تغيير الاتجاه ليسمح بالتمرير */
    justify-content: flex-start; /* يبدأ من الأعلى */
    align-items: center;
    background: radial-gradient(circle at top right, #fff5f0 0%, #ffffff 50%, #f2f2f7 100%);
    padding: 40px 20px; /* زيادة التباعد العلوي والسفلي */
    overflow-y: auto; /* السماح بالتمرير عند الحاجة */
    -webkit-overflow-scrolling: touch; /* تمرير ناعم على آيفون */
}

.auth-layout {
    width: 100%;
    max-width: 600px;
    margin-top: auto; /* دفع المحتوى للمنتصف إذا كان قصيراً */
    margin-bottom: auto; /* دفع المحتوى للمنتصف إذا كان قصيراً */
    animation: fadeInContainer 0.8s ease-out;
    flex-shrink: 0; /* منع انكماش الحاوية */
}
/* تحسين شكل السكرول بار ليختفي مثل التطبيقات */
::-webkit-scrollbar {
    display: none;
}
html, body {
    overscroll-behavior-y: none; /* يمنع المتصفح من عمل تحديث تلقائي عند السحب */
    height: 100%;
    overflow-x: hidden;
}
/* -----------------------------------------------------------
   2. تنبيهات النظام (Flash Notifications)
----------------------------------------------------------- */
.flash-container {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%); /* التوسيط في المنتصف علوياً */
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 380px;
    pointer-events: none;
}

.flash-box {
    width: fit-content;
    min-width: 200px;
    max-width: 90%;
    padding: 8px 16px; /* أنحف وأكثر أناقة */
    border-radius: 40px; /* شكل الكبسولة الأيفوني */
    background: rgba(255, 255, 255, 0.85); /* لون داكن شفاف (Dark Mode iOS) */
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    color: #2bb58d;
    font-size: 14px;
    font-weight: 600;
    pointer-events: auto;
    border: 0.5px solid rgba(255, 255, 255, 0.15);
    
    /* حركة دخول مطاطية (Spring Animation) */
    animation: iosBounceIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
/* أيقونة الحالة داخل الإشعار */
.flash-box::before {
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
}
.flash-container.error .flash-box i { color: var(--ios-error); font-size: 20px; }
.flash-container.success .flash-box i { color: var(--ios-success); font-size: 20px; }
.flash-box span { color: var(--dark); font-size: 14px; font-weight: 500; }

@keyframes ios-slide-in {
  0% { transform: translateY(-100px) translateX(-50%); opacity: 0; }
  100% { transform: translateY(0) translateX(-50%); opacity: 1; }
}

/* -----------------------------------------------------------
   3. الهيكل الرئيسي (Auth Layout)
----------------------------------------------------------- */

.auth-form-container {
  width: 100%;
  background: var(--white);
  border-radius: 28px;
  padding: 35px 30px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.auth-brand-header {
  text-align: center;
  margin-bottom: 25px;
}

.brand-logo {
  width:70px;
  height: 70px;
  margin: 0 auto 15px;
  background: var(--white);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 30px rgba(255, 107, 53, 0.15);
  transition: var(--transition);
}

.brand-logo img { width: 70%; height: 70%; object-fit: contain; }

.brand-title { font-size: 24px; font-weight: 700; color: var(--dark); margin-bottom: 8px; }
.brand-subtitle { font-size: 15px; color: var(--gray-text); line-height: 1.5; }

/* -----------------------------------------------------------
   4. نموذج الإدخال والشبكة (Form & Grid)
----------------------------------------------------------- */
.form-section-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 20px;
  text-align: right;
  border-right: 4px solid var(--primary);
  padding-right: 12px;
}

.auth-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* عمودين افتراضياً */
  gap: 15px 20px;
  margin-bottom: 25px;
}

.auth-form-group.floating {
  position: relative;
  background: var(--light);
  border-radius: 16px;
  transition: var(--transition);
  border: 1.5px solid transparent;
}

.auth-form-group.floating:focus-within {
  background: var(--white);
  border-color: var(--primary);
  box-shadow: 0 5px 15px rgba(255, 107, 53, 0.08);
}

.auth-form-group input {
  width: 100%;
  padding: 24px 45px 10px 15px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  color: var(--dark);
  font-weight: 500;
}

.auth-form-group label {
  position: absolute;
  right: 45px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-text);
  font-size: 13px;
  pointer-events: none;
  transition: all 0.3s ease;
}

.auth-form-group input:focus ~ label,
.auth-form-group input:not(:placeholder-shown) ~ label {
  top: 15px;
  font-size: 10px;
  color: var(--primary);
  font-weight: 600;
}

.auth-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-text);
  font-size: 16px;
}

.auth-password-toggle {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-text);
  cursor: pointer;
  z-index: 10;
}

/* -----------------------------------------------------------
   5. الأزرار والعناصر التفاعلية (Actions)
----------------------------------------------------------- */
.auth-btn-register {
  width: 100%;
  background: var(--gradient);
  color: white;
  border: none;
  padding: 16px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.auth-btn-register:active { transform: scale(0.97); }

.auth-divider {
  margin: 25px 0;
  text-align: center;
  position: relative;
}

.auth-divider::before {
  content: ""; position: absolute; top: 50%; left: 0; width: 100%; height: 1px; background: #e5e5ea;
}

.auth-divider span {
  background: var(--white); padding: 0 15px; position: relative; color: var(--gray-text); font-size: 12px;
}

.social-auth-options { display: flex; gap: 15px; }

.social-btn {
  flex: 1; height: 50px; border-radius: 14px; border: 1.5px solid #e5e5ea; background: white;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition);
}
.fake-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.social-btn.apple { background: #000; border: none; color: white; font-size: 20px; }
.social-btn.google img { width: 22px; }

.auth-security-info {
  margin-top: 25px; display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--secondary); font-size: 11px; background: rgba(26, 147, 111, 0.05); padding: 10px; border-radius: 12px;
}

.auth-footer-navigation { margin-top: 25px; text-align: center; font-size: 14px; }
.auth-footer-navigation a { color: var(--ios-blue); text-decoration: none; font-weight: 600; }

/* -----------------------------------------------------------
   6. التوافق مع الهواتف (Responsive)
----------------------------------------------------------- */
@media (max-width: 500px) {
  .auth-form-grid {
    grid-template-columns: 1fr; /* عمود واحد في الهاتف */
  }
  
  .auth-form-container {
    padding: 25px 20px;
  }

  .brand-title { font-size: 24px; }
  
  /* جعل حقل الاسم يأخذ السطر كاملاً في كل الأحوال */
  #auth_full_name { grid-column: auto; }
}

@keyframes fadeInContainer {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
/* الخلفية الضبابية - Glassmorphism */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4); /* تعتيم خفيف */
    backdrop-filter: blur(10px); /* تأثير الضباب الشهير في iOS */
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

/* حاوية المودل */
.modal-content {
    background: rgba(255, 255, 255, 0.94); /* أبيض مائل للشفافية */
    width: 100%;
    max-width: 350px; /* عرض مناسب للهواتف */
    border-radius: 20px; /* زوايا دائرية كبيرة وناعمة */
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    animation: ios-slide-up 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* العناوين */
.modal-header h3 {
    font-size: 19px;
    font-weight: 600;
    color: #000;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.modal-header p {
    font-size: 14px;
    color: #8E8E93; /* لون الرمادي الخاص بـ iOS */
    margin-bottom: 24px;
    line-height: 1.4;
}

/* حقول الإدخال */
.input-field {
    background: #F2F2F7; /* لون الخلفية للحقول في iOS */
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    transition: all 0.2s;
}

.input-field:focus-within {
    background: #E5E5EA;
}

.country-code {
    font-weight: 500;
    color: #000;
    margin-inline-end: 12px;
    padding-inline-end: 12px;
    border-inline-end: 1px solid #D1D1D6;
}

#purePhone, .otp-box {
    background: transparent;
    border: none;
    outline: none;
    font-size: 17px;
    width: 100%;
    color: #000;
}

/* الأزرار (أزرار iOS الزرقاء) */
.btn-primary, .btn-success {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-primary {
    background-color: #007AFF; /* Apple Blue */
    color: #fff;
}

.btn-success {
    background-color: #34C759; /* Apple Green */
    color: #fff;
}

.btn-primary:active, .btn-success:active {
    opacity: 0.8;
    transform: scale(0.98); /* تأثير الضغط اللمسي */
}

/* صناديق الـ OTP */
.otp-inputs {
    margin-bottom: 20px;
}

.otp-box {
    text-align: center;
    letter-spacing: 10px;
    font-size: 24px;
    font-weight: bold;
}

/* نص إعادة الإرسال */
.resend-text {
    margin-top: 16px;
    font-size: 13px;
    color: #8E8E93;
}

.resend-text a {
    color: #007AFF;
    text-decoration: none;
    font-weight: 500;
}

/* أنيميشن الظهور من الأسفل للأعلى */
@keyframes ios-slide-up {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}