/**
 * ============================================================
 * LOGIN PAGE STYLES - تصميم صفحة تسجيل الدخول الاحترافي
 * ============================================================
 *
 * Layer Farm - Authentication System
 * Version: 2.0.0
 * Based on: cash.css design system
 *
 * ============================================================
 */

/* ==========================================
   ROOT VARIABLES - استخدام المتغيرات الموحدة من theme.css
   ========================================== */

:root {
  /* Login page - Primary theme with unified shadows */
  --login-primary: var(--lf-primary-from, #667eea);
  --login-success: var(--lf-success, #22c55e);
  --login-danger: var(--lf-danger, #ef4444);
  --login-gradient-primary: var(--lf-gradient-primary);
  --login-gradient-bg: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  --login-shadow-sm: var(--lf-shadow-sm);
  --login-shadow-md: var(--lf-shadow-md);
  --login-shadow-lg: var(--lf-shadow-lg);
  --login-transition: var(--lf-transition);
}

/* ==========================================
   BODY & LAYOUT - الجسم والتخطيط
   ========================================== */

html:has(body.login-page),
body.login-page {
  margin: 0 !important;
  padding: 0 !important;
  height: 100vh; /* Fixed height instead of min-height */
  overflow: hidden !important; /* Prevent all scrolling */
  overflow-x: hidden !important;
}

body.login-page {
  background: var(--login-gradient-bg);
  position: relative;
  /* Flex container to keep footer at bottom */
  display: flex !important;
  flex-direction: column !important;
}

body.login-page::before {
  content: '';
  position: fixed;
  top: -25%;
  right: -25%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.15) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body.login-page::after {
  content: '';
  position: fixed;
  bottom: -25%;
  left: -25%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, rgba(118, 75, 162, 0.15) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body.login-page main {
  margin: 0 !important;
  padding: 0 !important;
  flex: 1; /* Take remaining space, push footer to bottom */
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative;
  z-index: 1;
}

body.login-page .container-narrow {
  max-width: 420px;
  width: 100%;
  padding: 2rem 1rem;
  margin: 0 auto !important;
}

/* Force hide sidebar and header elements on login page */
body.login-page .app-sidebar,
body.login-page #app-sidebar,
body.login-page .sidebar-overlay,
body.login-page .sidebar-mobile-toggle,
body.login-page #app-header,
body.login-page .topnav,
body.login-page .navbar {
  display: none !important;
}

/* ==========================================
   LOGIN CARD - بطاقة تسجيل الدخول
   ========================================== */

body.login-page .card {
  border: none;
  border-radius: 20px;
  box-shadow: var(--login-shadow-lg);
  overflow: hidden;
  background: white;
}

body.login-page .card-body {
  padding: 40px;
}

body.login-page .card h1,
body.login-page .card .h5 {
  color: #1f2937;
  font-weight: 700;
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 24px;
  position: relative;
}

body.login-page .card h1::after,
body.login-page .card .h5::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  background: var(--login-gradient-primary);
  border-radius: 2px;
}

/* ==========================================
   FORM STYLES - تنسيقات النموذج
   ========================================== */

body.login-page .form-label {
  font-weight: 600;
  color: #495057;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

body.login-page .form-control {
  border-radius: 12px;
  border: 2px solid #e9ecef;
  padding: 14px 18px;
  font-size: 1rem;
  transition: var(--login-transition);
  background: #f8f9fa;
}

body.login-page .form-control:focus {
  border-color: var(--login-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
  background: white;
}

body.login-page .form-control::placeholder {
  color: #868e96; /* Fixed: was #adb5bd (2.7:1) - now 4.0:1 contrast */
}

body.login-page .vstack.gap-3 > div {
  margin-bottom: 0;
}

/* ==========================================
   CHECKBOX - خانة الاختيار
   ========================================== */

body.login-page .form-check {
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 10px;
  margin: 16px 0;
}

body.login-page .form-check-input {
  width: 20px;
  height: 20px;
  margin-top: 0;
  cursor: pointer;
}

body.login-page .form-check-input:checked {
  background-color: var(--login-primary);
  border-color: var(--login-primary);
}

body.login-page .form-check-label {
  font-size: 0.9rem;
  color: #6c757d;
  cursor: pointer;
  padding-right: 8px;
}

/* ==========================================
   BUTTONS - الأزرار
   ========================================== */

body.login-page .btn-primary {
  background: var(--login-gradient-primary);
  border: none;
  border-radius: 12px;
  padding: 14px 24px;
  font-weight: 600;
  font-size: 1rem;
  transition: var(--login-transition);
  box-shadow: var(--login-shadow-sm);
}

body.login-page .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--login-shadow-md);
}

body.login-page .btn-primary:active {
  transform: translateY(0);
}

body.login-page .btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

body.login-page .d-grid {
  margin-top: 24px;
}

/* ==========================================
   ALERTS - التنبيهات
   ========================================== */

body.login-page .alert {
  border-radius: 12px;
  border: none;
  padding: 14px 18px;
  font-size: 0.9rem;
}

body.login-page .alert-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
  border-right: 4px solid var(--login-danger);
  color: #991b1b;
}

/* ==========================================
   2FA MODAL - نافذة التحقق الثنائي
   ========================================== */

body.login-page .modal-content {
  border: none;
  border-radius: 20px;
  box-shadow: var(--login-shadow-lg);
}

body.login-page .modal-header {
  background: var(--login-gradient-primary);
  border: none;
  border-radius: 20px 20px 0 0;
  padding: 20px 24px;
}

body.login-page .modal-title {
  color: white;
  font-weight: 700;
  font-size: 1.2rem;
}

body.login-page .modal-body {
  padding: 32px 24px;
}

body.login-page .modal-body p {
  color: #6c757d;
  font-size: 1rem;
  margin-bottom: 20px;
}

body.login-page #twofa-code-input {
  font-size: 1.75rem !important;
  letter-spacing: 0.75rem !important;
  text-align: center;
  padding: 16px;
  border-radius: 12px;
  border: 2px solid #e9ecef;
  font-weight: 600;
}

body.login-page #twofa-code-input:focus {
  border-color: var(--login-primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

body.login-page .modal-footer {
  border-top: 2px solid #f8f9fa;
  padding: 16px 24px;
  gap: 12px;
}

body.login-page .modal-footer .btn {
  border-radius: 10px;
  padding: 10px 24px;
  font-weight: 600;
}

body.login-page .modal-footer .btn-secondary {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  color: #6c757d;
}

body.login-page .modal-footer .btn-secondary:hover {
  background: #e9ecef;
}

/* ==========================================
   FOOTER - التذييل
   ========================================== */

body.login-page #app-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #6c757d;
  font-size: 0.9rem;
  flex-shrink: 0; /* Don't shrink */
  padding: 1rem 0;
}

body.login-page #app-footer hr {
  border-color: rgba(0,0,0,0.1);
  margin-bottom: 16px;
}

/* ==========================================
   RESPONSIVE DESIGN - التصميم المتجاوب
   ========================================== */

@media (max-width: 991px) {
  /* Override main.css padding-bottom for mobile nav */
  body.login-page {
    padding-bottom: 0 !important;
    height: 100vh !important;
    height: 100dvh !important; /* Dynamic viewport height for mobile */
    min-height: -webkit-fill-available !important; /* iOS Safari fix */
    overflow: hidden !important;
  }

  /* Fixed footer at bottom on mobile */
  body.login-page #app-footer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    margin: 0 !important;
    padding: 0.75rem 1rem !important;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  }

  body.login-page #app-footer hr {
    display: none !important;
  }

  /* Add padding to main to account for fixed footer */
  body.login-page main {
    padding-bottom: 60px !important;
  }
}

@media (max-width: 576px) {
  body.login-page .container-narrow {
    padding: 1rem;
  }

  body.login-page .card-body {
    padding: 28px 20px;
  }

  body.login-page .form-control {
    padding: 12px 14px;
    font-size: 0.95rem;
  }

  body.login-page .btn-primary {
    padding: 12px 20px;
  }

  body.login-page .modal-body {
    padding: 24px 16px;
  }

  body.login-page #twofa-code-input {
    font-size: 1.5rem !important;
    letter-spacing: 0.5rem !important;
  }
}

@media (prefers-color-scheme: dark) {
  body.login-page {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  }

  body.login-page .card {
    background: #1f2937;
  }

  body.login-page .card h1,
  body.login-page .card .h5 {
    color: #f3f4f6;
  }

  body.login-page .form-label {
    color: #d1d5db;
  }

  body.login-page .form-control {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
  }

  body.login-page .form-control:focus {
    background: #374151;
    border-color: var(--login-primary);
  }

  body.login-page .form-check {
    background: #374151;
  }

  body.login-page .form-check-label {
    color: #d1d5db;
  }

  body.login-page .modal-content {
    background: #1f2937;
  }

  body.login-page .modal-body p {
    color: #9ca3af;
  }

  body.login-page #twofa-code-input {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
  }

  body.login-page .modal-footer {
    border-color: #374151;
  }

  body.login-page .modal-footer .btn-secondary {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
  }

  body.login-page #app-footer {
    color: #9ca3af;
  }
}

/* ==========================================
   PRINT STYLES - أنماط الطباعة
   ========================================== */

@media print {
  body.login-page {
    background: white;
  }

  body.login-page .btn,
  body.login-page .modal,
  body.login-page #app-footer {
    display: none !important;
  }
}
