/* Zalo Group Registration Form Styles - Synchronized Version */

/* Open Button */
.zalo-open-btn {
  background: linear-gradient(135deg, #0068ff, #0050cc);
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 104, 255, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.zalo-open-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 104, 255, 0.4);
  background: linear-gradient(135deg, #0050cc, #003c99);
}

.zalo-open-btn:active {
  transform: translateY(0);
}

/* Popup Overlay */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

.popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Popup Container */
.popup {
  background: white;
  border-radius: 20px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.7) translateY(-50px);
  transition: all 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.popup-overlay.active .popup {
  transform: scale(1) translateY(0);
}

/* Popup Header */
.popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

.popup-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #333;
  margin: 0;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.close-btn:hover {
  background: #f5f5f5;
  color: #333;
}

/* Popup Content */
.popup-content {
  color: #666;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* Form Styles - Synchronized with JS IDs */
#zalo-register-form {
  max-width: 100%;
  margin: 0;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

#zalo-register-form h2 {
  display: none;
  /* Hidden because we use popup header */
}

#zalo-register-form .form-group {
  margin-bottom: 18px;
}

#zalo-register-form label {
  display: block;
  font-size: 0.95em;
  margin-bottom: 6px;
  font-weight: 500;
  color: #333;
}

/* Input Fields - Using exact IDs from JS */
#zalo-name,
#zalo-phone {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  font-size: 1em;
  transition: all 0.3s ease;
  box-sizing: border-box;
  background: #fff;
}

#zalo-name:focus,
#zalo-phone:focus {
  outline: none;
  border-color: #0068ff;
  box-shadow: 0 0 0 3px rgba(0, 104, 255, 0.1);
}

#zalo-name::placeholder,
#zalo-phone::placeholder {
  color: #adb5bd;
  font-style: italic;
}

/* Submit Button - Using exact ID from JS */
#zalo-submit-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #0068ff, #0050cc);
  color: white;
  font-weight: bold;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#zalo-submit-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #0050cc, #003c99);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 104, 255, 0.3);
}

#zalo-submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

#zalo-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Button Loading State - Exact classes from JS */
.btn-text,
.btn-loading {
  transition: all 0.3s ease;
}

.btn-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Success and Error Messages - Using exact IDs from JS */
#zalo-success,
#zalo-error {
  display: none;
  margin-top: 20px;
  padding: 15px;
  border-radius: 8px;
  font-size: 0.95em;
  animation: fadeIn 0.4s ease;
  word-wrap: break-word;
}

#zalo-success {
  background: rgba(0, 104, 255, 0.1);
  border: 1px solid #0068ff;
  color: #0068ff;
}

#zalo-success a {
  display: inline-block;
  margin-top: 12px;
  padding: 10px 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0068ff, #0050cc);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  opacity: 0;
}

#zalo-success.show a {
  opacity: 1;
}

#zalo-success a:hover {
  background: linear-gradient(135deg, #0050cc, #003c99);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 104, 255, 0.3);
}

#zalo-error {
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid #dc3545;
  color: #dc3545;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInTop {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInBottom {
  from {
    opacity: 0;
    transform: translateY(50px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-top .popup {
  animation: slideInTop 0.3s ease;
}

.slide-bottom .popup {
  animation: slideInBottom 0.3s ease;
}

/* Pulse effect for success */
@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.02);
  }

  100% {
    transform: scale(1);
  }
}

#zalo-success.show {
  animation:
    fadeIn 0.4s ease,
    pulse 0.6s ease 0.4s;
}

/* Form validation states - Applied to exact IDs */
#zalo-name.error,
#zalo-phone.error {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

#zalo-name.success,
#zalo-phone.success {
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* Legacy generic selectors for compatibility */
.zalo-register-form input.error {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.zalo-register-form input.success {
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.zalo-register-form .success-message,
.zalo-register-form .error-message {
  display: none;
  margin-top: 20px;
  padding: 15px;
  border-radius: 8px;
  font-size: 0.95em;
  animation: fadeIn 0.4s ease;
  word-wrap: break-word;
}

.zalo-register-form .success-message {
  background: rgba(0, 104, 255, 0.1);
  border: 1px solid #0068ff;
  color: #0068ff;
}

.zalo-register-form .error-message {
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid #dc3545;
  color: #dc3545;
}

/* Responsive Design */
@media (max-width: 768px) {
  .popup {
    width: 95%;
    padding: 20px;
    margin: 10px;
  }

  .popup-title {
    font-size: 1.3rem;
  }

  #zalo-name,
  #zalo-phone {
    padding: 14px 16px;
    font-size: 16px;
    /* Prevent zoom on iOS */
  }

  .zalo-open-btn {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .popup {
    width: 98%;
    padding: 15px;
    border-radius: 15px;
  }

  .popup-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
  }

  #zalo-register-form .form-group {
    margin-bottom: 15px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  #zalo-name,
  #zalo-phone {
    border-width: 3px;
  }

  #zalo-submit-btn {
    border: 2px solid #fff;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .popup-overlay,
  .popup {
    transition: none;
  }
}

/* Print styles */
@media print {
  .popup-overlay,
  .zalo-open-btn {
    display: none !important;
  }
}

/* Wrapper class from PHP */
.zalo-register-form-wrapper {
  display: inline-block;
}
