/* مودال استاندارد (پاپ‌آپ در دسکتاپ، full-screen در موبایل) */
.modal-overlay {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease;
}
.modal-overlay.active { 
  display: flex; 
  opacity: 1;
}

.modal-content {
  background: #fff;
  width: 90%;
  max-width: 400px;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-overlay.active .modal-content {
  transform: scale(1);
}

.close-modal {
  position: absolute;
  right: 15px; top: 15px;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  z-index: 1;
  transition: color 0.2s;
}
.close-modal:hover { color: #333; }

/* دکمه هدر (استاندارد مثل سایت‌های معتبر) */
.login-trigger {
  background-color: #F21A1A !important;
  color: #d63638;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,115,170,0.2);
  min-height: 44px; /* حداقل برای touch targets */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.login-trigger:hover {
  background-color: #aa0606 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}
.login-trigger.user-logged-in {
  background: linear-gradient(135deg, #e60000, #cc0000);
  box-shadow: 0 2px 8px rgba(230,0,0,0.2);
}
.login-trigger.user-logged-in:hover {
  background: linear-gradient(135deg, #cc0000, #a60000);
}

/* فرم استاندارد */
.popup-login-container {
  text-align: center;
}
.modal-title {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
}
.popup-login-container p {
  font-size: 14px;
  color: #666;
  margin-bottom: 15px;
}

#otp-login-form input,
#otp-login-form button {
  width: 100%;
  padding: 14px;
  margin: 10px 0;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 16px;
  box-sizing: border-box;
  transition: border-color 0.3s, box-shadow 0.3s;
  min-height: 44px; /* touch-friendly */
}
#otp-login-form input:focus {
  border-color: #0073aa;
  box-shadow: 0 0 0 2px rgba(0,115,170,0.1);
  outline: none;
}
#otp-login-form input::placeholder {
  color: #999;
}

#otp-login-form button {
  background: #f5f5f5;
  color: #999;
  cursor: not-allowed;
  border: none;
  font-weight: 500;
}
#otp-login-form button.enabled {
  background: linear-gradient(135deg, #F21A1A, #aa0606);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,115,170,0.2);
}
#otp-login-form button.enabled:hover {
  background: linear-gradient(135deg, #F21A1A, #aa0606);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,115,170,0.3);
}

/* دکمه ثانویه برای resend */
.secondary-btn {
  background: #f8f9fa;
  color: #F21A1A;
  border: 1px solid #F21A1A;
  font-size: 14px;
  padding: 10px;
  margin: 10px 0;
  min-height: 44px;
}
.secondary-btn:hover {
  background: #e9ecef;
}

/* خطاها و تایمر */
.error-text {
  display: none;
  color: #e60000;
  font-size: 14px;
  margin: 5px 0;
}
#otp-timer {
  display: block;
  color: #F21A1A;
  font-size: 14px;
  font-weight: 500;
  margin: 10px 0;
}

/* ریسپانسیو: در موبایل full-screen مودال */
@media (max-width: 768px) {
  .modal-content {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    padding: 20px;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .close-modal {
    right: 10px;
    top: 10px;
    font-size: 20px;
  }
  .login-trigger {
    width: 100%;
    margin: 10px 0;
    padding: 16px;
    font-size: 18px;
  }
  .modal-title {
    font-size: 22px;
    margin-bottom: 25px;
  }
  #otp-login-form input,
  #otp-login-form button {
    padding: 16px;
    font-size: 18px;
    margin: 12px 0; /* فضای بیشتر */
  }
  .secondary-btn {
    font-size: 16px;
    padding: 14px;
  }
}

/* تاریک مود (اختیاری، برای سایت‌های مدرن) */
@media (prefers-color-scheme: dark) {
  .modal-content {
    background: #1a1a1a;
    color: #fff;
  }
  .modal-title,
  .popup-login-container p {
    color: #ddd;
  }
  #otp-login-form input {
    background: #333;
    border-color: #555;
    color: #fff;
  }
  #otp-login-form input::placeholder {
    color: #888;
  }
}