/* Login Page - iOS App Style */

/* Login Body - App Container Style */
.login-body {
  margin: 0;
  padding: 0;
  font-family: 'Cairo', 'Vazir Variable', 'Poppins', 'Tahoma', sans-serif;
  background: #1a1d29;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
}

.login-container {
  width: 100%;
  max-width: 428px;
  min-height: 100vh;
  background: #1a1d29;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
  margin: 0 auto;
}

/* iOS Header Style - Same as App */
.login-header {
  background: linear-gradient(135deg, #97afd7 0%, #3b425c 50%, #a99bc6 100%);
  padding: calc(env(safe-area-inset-top) + 60px) 20px 50px;
  color: #fdf7f0;
  position: relative;
  overflow: hidden;
  border-radius: 0 0 32px 32px;
  box-shadow: 0 8px 32px rgba(59, 66, 92, 0.2);
  min-height: 280px;
  display: flex;
  align-items: center;
}

.logo-section {
  text-align: center;
  animation: fadeInDown 0.8s ease-out;
  width: 100%;
}

.app-logo {
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  backdrop-filter: blur(20px);
  border: 3px solid rgba(255, 255, 255, 0.3);
  padding: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.app-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.app-name {
  font-family: 'Cairo', 'Vazir Variable', 'Poppins', 'Tahoma', sans-serif;
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: 1.5px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #ffffff 0%, #f0f8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-subtitle {
  font-size: 16px;
  opacity: 0.95;
  font-weight: 500;
  margin-bottom: 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Main Content - Same as App Style */
.login-form-container {
  flex: 1;
  padding: 32px 20px 24px;
  background: #1a1d29;
  margin-top: -16px;
  position: relative;
  z-index: 2;
}

.form-header {
  text-align: center;
  margin-bottom: 40px;
  background: #2a2f42;
  padding: 24px;
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(151, 175, 215, 0.2);
}

.form-header h2 {
  font-size: 26px;
  font-weight: 700;
  color: #fdf7f0;
  margin-bottom: 12px;
  font-family: 'Cairo', 'Vazir Variable', sans-serif;
  position: relative;
}

.form-header h2::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, #97afd7, #3b425c);
  border-radius: 2px;
}

.form-header p {
  font-size: 16px;
  color: #a99bc6;
  margin-bottom: 0;
  line-height: 1.4;
}

/* Error Message */
.error-message {
  background: rgba(255, 59, 48, 0.1);
  border: 1px solid rgba(255, 59, 48, 0.3);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #d70015;
  font-size: 14px;
  font-weight: 500;
  animation: shake 0.5s ease-in-out;
}

.error-message i {
  font-size: 18px;
  flex-shrink: 0;
}

/* Form Groups - iOS Card Style */
.form-group {
  margin-bottom: 24px;
  background: #2a2f42;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  border: 1px solid rgba(151, 175, 215, 0.2);
  transition: all 0.3s ease;
  position: relative;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px 8px;
  font-size: 14px;
  font-weight: 600;
  color: #fdf7f0;
  font-family: 'Cairo', 'Vazir Variable', sans-serif;
  margin-bottom: 0;
}

.form-group label i {
  font-size: 16px;
  color: #97afd7;
}

.form-group input {
  width: 100%;
  padding: 12px 20px 16px;
  border: none;
  font-size: 16px;
  font-family: 'Cairo', 'Vazir Variable', sans-serif;
  background: transparent;
  color: #fdf7f0;
  transition: all 0.3s ease;
}

.form-group input:focus {
  outline: none;
}

.form-group input::placeholder {
  color: #a99bc6;
  opacity: 0.7;
}

.form-group:focus-within {
  border-color: #97afd7;
  box-shadow: 0 0 0 4px rgba(151, 175, 215, 0.15), 0 8px 32px rgba(59, 66, 92, 0.12);
  transform: translateY(-2px);
}

/* Password Input */
.password-input {
  position: relative;
}

.password-input input {
  padding-left: 50px;
}

.toggle-password {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #a99bc6;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.toggle-password:hover {
  color: #97afd7;
}

/* Login Button - iOS Style */
.login-btn {
  width: 100%;
  padding: 20px;
  background: linear-gradient(135deg, #97afd7 0%, #3b425c 50%, #a99bc6 100%);
  color: #fdf7f0;
  border: none;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
  font-family: 'Cairo', 'Vazir Variable', sans-serif;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px rgba(59, 66, 92, 0.25);
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.login-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: all 0.5s;
}

.login-btn:hover::before {
  left: 100%;
}

.login-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(59, 66, 92, 0.35);
}

.login-btn:active {
  transform: translateY(-1px);
}

.login-btn i {
  font-size: 18px;
}

.login-btn.loading {
  pointer-events: none;
  opacity: 0.8;
}



/* Footer */
.login-footer {
  text-align: center;
  padding: 24px 20px;
  color: #a99bc6;
  font-size: 13px;
  background: #2a2f42;
  border-top: 1px solid rgba(151, 175, 215, 0.2);
  border-radius: 24px 24px 0 0;
  margin-top: auto;
}

.login-footer p {
  margin: 0;
  font-weight: 500;
}

.login-footer a {
  color: #ffffff;
  text-decoration: none;
  transition: all 0.3s ease;
}

.login-footer a:hover {
  color: #97afd7;
}

/* Animations */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes shake {
  0%, 20%, 40%, 60%, 80%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(151, 175, 215, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(151, 175, 215, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(151, 175, 215, 0);
  }
}

/* Add animations to elements */
.form-header {
  animation: slideInUp 0.6s ease-out 0.2s both;
}

.form-group:nth-child(1) {
  animation: slideInUp 0.6s ease-out 0.4s both;
}

.form-group:nth-child(2) {
  animation: slideInUp 0.6s ease-out 0.5s both;
}

.login-btn {
  animation: slideInUp 0.6s ease-out 0.6s both;
}

.login-footer {
  animation: fadeIn 0.6s ease-out 0.7s both;
}

/* Responsive Design */
@media (max-width: 480px) {
  .login-container {
    max-width: 100%;
    box-shadow: none;
    background: #1a1d29;
    min-height: 100vh;
  }
  
  .login-header {
    padding: calc(env(safe-area-inset-top) + 40px) 16px 30px;
    border-radius: 0 0 24px 24px;
    min-height: auto;
  }
  
  .login-form-container {
    padding: 24px 16px;
    margin-top: -12px;
    background: #1a1d29;
  }
  
  .app-logo {
    width: 80px;
    height: 80px;
  }
  
  .app-name {
    font-size: 28px;
  }
  
  .form-header {
    padding: 20px 16px;
    border-radius: 16px;
    margin-bottom: 32px;
  }
  
  .form-header h2 {
    font-size: 22px;
  }
  
  .form-group {
    border-radius: 12px;
  }
  
  .login-btn {
    padding: 18px;
    border-radius: 12px;
    font-size: 17px;
  }
  
  .demo-accounts {
    padding: 20px 16px;
    border-radius: 16px;
  }
  
  .demo-account {
    padding: 14px 16px;
    border-radius: 10px;
  }
  
  .login-footer {
    padding: 20px 16px;
    border-radius: 20px 20px 0 0;
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .login-header {
    padding: calc(env(safe-area-inset-top) + 30px) 12px 24px;
  }
  
  .login-form-container {
    padding: 20px 12px;
    margin-top: -8px;
  }
  
  .form-group input {
    font-size: 16px; /* منع zoom في Safari على iOS */
  }
  
  .app-logo {
    width: 60px;
    height: 60px;
    margin-bottom: 16px;
  }
  
  .app-name {
    font-size: 22px;
    letter-spacing: 1px;
  }
  
  .app-subtitle {
    font-size: 14px;
  }
  
  .form-header h2 {
    font-size: 20px;
  }
  
  .form-header {
    padding: 16px 12px;
  }
}

/* Focus States for Accessibility */
.login-btn:focus,
.demo-account:focus,
.form-group input:focus,
.toggle-password:focus {
  outline: 2px solid #97afd7;
  outline-offset: 2px;
}

/* Loading State */
.login-btn.loading {
  pointer-events: none;
  opacity: 0.8;
  position: relative;
}

.login-btn.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid #fdf7f0;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Form Options Styling */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding: 0 4px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #fdf7f0;
  font-weight: 500;
}

.remember-me input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border: 2px solid #97afd7;
  border-radius: 4px;
  background: #2a2f42;
  cursor: pointer;
  margin: 0;
}

.remember-me input[type="checkbox"]:checked {
  background: #97afd7;
  border-color: #97afd7;
}

.remember-me .checkmark {
  display: none;
}

.remember-me .label-text {
  font-size: 14px;
  color: #fdf7f0;
  font-weight: 500;
  cursor: pointer;
}

.forgot-password {
  color: #97afd7;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.forgot-password:hover {
  color: #a99bc6;
  text-decoration: underline;
}

/* Background Decoration */
.login-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(151, 175, 215, 0.1) 0%, transparent 50%);
  border-radius: 50%;
  animation: float 6s ease-in-out infinite;
}

.login-header::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(169, 155, 198, 0.08) 0%, transparent 50%);
  border-radius: 50%;
  animation: float 8s ease-in-out infinite reverse;
}

/* Dark Mode Body Background Effects */
.login-body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 80%, rgba(151, 175, 215, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(169, 155, 198, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(10deg);
  }
}

/* Very small devices */
@media (max-width: 320px) {
  .login-header {
    padding: calc(env(safe-area-inset-top) + 20px) 8px 20px;
    min-height: 240px;
  }
  
  .app-logo {
    width: 50px;
    height: 50px;
    margin-bottom: 12px;
  }
  
  .app-name {
    font-size: 18px;
    margin-bottom: 8px;
  }
  
  .app-subtitle {
    font-size: 12px;
  }
  
  .login-form-container {
    padding: 16px 8px;
  }
}
