
.login-container {
  width: 100%;
  max-width: 440px;
  margin: 20px;
  perspective: 1000px;
}

.login-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  animation: cardEntry 0.6s ease-out;
}

@keyframes cardEntry {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--primary-dark),
    var(--primary),
    var(--primary-light)
  );
  opacity: 0.8;
}

.logo-section {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(
    135deg,
    var(--primary-dark) 0%,
    var(--primary) 100%
  );
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  position: relative;
  box-shadow: 0 10px 30px rgba(139, 60, 69, 0.3),
    inset 0 2px 4px rgba(255, 255, 255, 0.2);
  transition: transform var(--transition-normal),
    box-shadow var(--transition-normal);
}

.logo-icon:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 40px rgba(139, 60, 69, 0.35),
    inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.logo-icon i {
  font-size: 32px;
  color: white;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.logo-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 28px;
  height: 28px;
  background: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.logo-badge i {
  font-size: 12px;
  color: white;
}

h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

@media (prefers-color-scheme: dark) {
  h1 {
    color: var(--primary-light);
  }
}

.subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 400;
  margin: 0;
}

/* ===== نظام الرسائل - الإصلاح هنا ===== */
.message-container {
  margin-bottom: 24px;
  min-height: 60px; /* ارتفاع ثابت لمنع القفز */
}

.message {
  display: none; /* مخفي افتراضياً */
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  animation: messageSlide 0.4s ease;
  border: 1px solid transparent;
  line-height: 1.5;
}

/* هذا الكلاس يجعل الرسالة تظهر */
.message.show {
  display: flex !important; /* !important للتأكد من الظهور */
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message i {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ===== أنواع الرسائل ===== */
.message.error {
  background-color: var(--error-light) !important;
  color: var(--error) !important;
  border-color: rgba(198, 40, 40, 0.3) !important;
  display: none; /* مخفي افتراضياً */
}

.message.success {
  background-color: var(--success-light) !important;
  color: var(--success) !important;
  border-color: rgba(46, 125, 50, 0.3) !important;
  display: none;
}

.message.warning {
  background-color: var(--warning-light) !important;
  color: #f57f17 !important;
  border-color: rgba(249, 168, 37, 0.4) !important;
  display: none;
}

.message.info {
  background-color: var(--info-light) !important;
  color: var(--info) !important;
  border-color: rgba(21, 101, 192, 0.3) !important;
  display: none;
}

/* ===== النموذج ===== */
.form-group {
  margin-bottom: 24px;
  position: relative;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  transition: color var(--transition-fast);
}

.form-label i {
  color: var(--primary);
  font-size: 14px;
  opacity: 0.8;
}

.input-wrapper {
  position: relative;
}

.form-input {
  width: 100%;
  padding: 14px 44px 14px 16px;
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: "Tajawal", sans-serif;
  font-size: 15px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.form-input:hover {
  border-color: rgba(139, 60, 69, 0.3);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.input-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
  transition: all var(--transition-fast);
  pointer-events: none;
}

.form-input:focus ~ .input-icon {
  color: var(--primary);
}

.toggle-password {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-password:hover {
  color: var(--primary);
  background: rgba(139, 60, 69, 0.08);
}

.toggle-password:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.form-input.error {
  border-color: var(--error);
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.validation-hint {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--error);
  animation: fadeIn 0.3s ease;
}

.validation-hint.show {
  display: flex;
}

.validation-hint i {
  font-size: 14px;
}

.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  font-size: 13px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.remember-me:hover {
  color: var(--text-primary);
}

.checkbox-wrapper {
  position: relative;
  width: 20px;
  height: 20px;
}

.checkbox-wrapper input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  background: var(--card-bg);
}

.checkbox-wrapper input:checked ~ .checkbox-custom {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-custom i {
  color: white;
  font-size: 12px;
  opacity: 0;
  transform: scale(0);
  transition: all var(--transition-fast);
}

.checkbox-wrapper input:checked ~ .checkbox-custom i {
  opacity: 1;
  transform: scale(1);
}

.forgot-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  position: relative;
  transition: color var(--transition-fast);
}

.forgot-link::after {
  content: "";
  position: absolute;
  bottom: -2px;
  right: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width var(--transition-fast);
}

.forgot-link:hover {
  color: var(--primary-dark);
}

.forgot-link:hover::after {
  width: 100%;
}

.btn-login {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(
    135deg,
    var(--primary-dark) 0%,
    var(--primary) 100%
  );
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: "Tajawal", sans-serif;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 12px rgba(139, 60, 69, 0.3),
    0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(139, 60, 69, 0.4),
    0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-login.loading .btn-text {
  opacity: 0;
}

.btn-login.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: rippleEffect 0.6s ease-out;
  pointer-events: none;
}

@keyframes rippleEffect {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

.footer-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding: 6px 12px;
  background: rgba(139, 60, 69, 0.05);
  border-radius: 20px;
}

.security-badge i {
  color: var(--success);
}

.copyright {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  text-align: center;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(139, 60, 69, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

.loader-text {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.input-focus-line {
  position: absolute;
  bottom: 0;
  right: 50%;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: all var(--transition-normal);
}

.form-input:focus ~ .input-focus-line {
  right: 0;
  width: 100%;
}

@media (max-width: 480px) {
  .login-card {
    margin: 16px;
    padding: 36px 24px;
  }

  h1 {
    font-size: 22px;
  }

  .logo-icon {
    width: 70px;
    height: 70px;
  }
}

@media (prefers-contrast: high) {
  .form-input {
    border-width: 3px;
  }

  .btn-login {
    border: 2px solid currentColor;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}