/* =====================================================
   XAI Contact Us Module - Attractive Dynamic Styles
   Author: xAI-Han | Version: 8.0.0
   Modern gradient design with smooth animations
   ===================================================== */

:root {
  --xai-primary: #667eea;
  --xai-primary-dark: #5a6fd6;
  --xai-secondary: #764ba2;
  --xai-accent: #f093fb;
  --xai-success: #10b981;
  --xai-error: #ef4444;
  --xai-bg: #f0f4ff;
  --xai-card: #ffffff;
  --xai-text: #1e293b;
  --xai-muted: #64748b;
  --xai-border: #e2e8f0;
  --xai-radius: 16px;
  --xai-shadow: 0 20px 60px -15px rgba(102, 126, 234, 0.25);
  --xai-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Wrapper */
.xai-contact-wrapper {
  max-width: 680px;
  margin: 40px auto 60px;
  padding: 0 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Card */
.xai-contact-card {
  background: var(--xai-card);
  border-radius: var(--xai-radius);
  box-shadow: var(--xai-shadow);
  overflow: hidden;
  position: relative;
  animation: xaiFadeInUp 0.6s ease-out;
}

@keyframes xaiFadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header with animated gradient */
.xai-contact-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  background-size: 200% 200%;
  animation: xaiGradientShift 8s ease infinite;
  padding: 36px 32px 32px;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}

@keyframes xaiGradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.xai-contact-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
  animation: xaiPulse 6s ease-in-out infinite;
}

@keyframes xaiPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.xai-icon-circle {
  width: 72px;
  height: 72px;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  border: 2px solid rgba(255,255,255,0.3);
  position: relative;
  z-index: 1;
}

.xai-icon-circle svg {
  color: #fff;
}

.xai-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 1;
}

.xai-subtitle {
  font-size: 15px;
  opacity: 0.9;
  margin: 0;
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

/* Alerts */
.xai-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  margin: 24px 28px 0;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  animation: xaiFadeIn 0.4s ease;
}

@keyframes xaiFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.xai-alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.xai-alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.xai-alert ul {
  margin: 0;
  padding-left: 18px;
}

.xai-alert svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* Form */
.xai-form {
  padding: 28px 28px 32px;
}

.xai-form-row {
  margin-bottom: 20px;
}

.xai-two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 560px) {
  .xai-two-cols {
    grid-template-columns: 1fr;
  }
}

.xai-form-group {
  display: flex;
  flex-direction: column;
}

.xai-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--xai-text);
  margin-bottom: 8px;
}

.xai-label-icon {
  font-size: 15px;
}

.xai-required {
  color: var(--xai-error);
  font-weight: 700;
}

.xai-input,
.xai-textarea {
  width: 100%;
  padding: 13px 16px;
  font-size: 15px;
  border: 2px solid var(--xai-border);
  border-radius: 12px;
  background: #fafbff;
  color: var(--xai-text);
  transition: var(--xai-transition);
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
}

.xai-input:focus,
.xai-textarea:focus {
  border-color: var(--xai-primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.xai-input::placeholder,
.xai-textarea::placeholder {
  color: #94a3b8;
}

.xai-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.55;
}

.xai-char-count {
  text-align: right;
  font-size: 12px;
  color: var(--xai-muted);
  margin-top: 6px;
}

/* Captcha - complex image version */
.xai-captcha-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 100%);
  border: 2px dashed #c7d2fe;
  border-radius: 12px;
  padding: 14px 16px;
  flex-wrap: wrap;
}

.xai-captcha-img {
  border-radius: 8px;
  border: 1px solid #c7d2fe;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
  flex-shrink: 0;
  background: #fff;
}

.xai-captcha-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 140px;
}

.xai-captcha-hint {
  font-size: 12.5px;
  color: var(--xai-muted);
  font-weight: 500;
}

.xai-captcha-question {
  font-size: 16px;
  font-weight: 700;
  color: var(--xai-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.xai-captcha-input {
  max-width: 160px;
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

/* Submit Button */
.xai-submit-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 28px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--xai-transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 25px -5px rgba(102, 126, 234, 0.5);
}

.xai-submit-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
  transition: left 0.5s ease;
}

.xai-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px -5px rgba(102, 126, 234, 0.6);
  background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

.xai-submit-btn:hover::before {
  left: 100%;
}

.xai-submit-btn:active {
  transform: translateY(0);
}

.xai-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.xai-btn-icon {
  transition: transform 0.3s ease;
}

.xai-submit-btn:hover .xai-btn-icon {
  transform: translateX(3px);
}

/* Spinner */
.xai-spinner {
  width: 22px;
  height: 22px;
  animation: xaiRotate 1s linear infinite;
}

.xai-spinner circle {
  stroke: #fff;
  stroke-linecap: round;
  animation: xaiDash 1.5s ease-in-out infinite;
}

@keyframes xaiRotate {
  100% { transform: rotate(360deg); }
}

@keyframes xaiDash {
  0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
  100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

/* Privacy note */
.xai-privacy-note {
  text-align: center;
  font-size: 12.5px;
  color: var(--xai-muted);
  margin: 18px 0 0;
  line-height: 1.5;
}

/* Honeypot - completely hidden */
.xai-honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

/* Responsive tweaks */
@media (max-width: 480px) {
  .xai-contact-header {
    padding: 28px 20px 24px;
  }
  .xai-title {
    font-size: 24px;
  }
  .xai-form {
    padding: 22px 18px 26px;
  }
  .xai-alert {
    margin: 18px 18px 0;
  }
  .xai-captcha-box {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .xai-captcha-input {
    max-width: 100%;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  .xai-contact-card {
    background: #1e1e2f;
  }
  .xai-label {
    color: #e2e8f0;
  }
  .xai-input,
  .xai-textarea {
    background: #2a2a3d;
    border-color: #3f3f5a;
    color: #e2e8f0;
  }
  .xai-input:focus,
  .xai-textarea:focus {
    background: #32324a;
  }
  .xai-privacy-note {
    color: #94a3b8;
  }
  .xai-char-count {
    color: #94a3b8;
  }
}

/* =====================================================
   Success Modal Popup
   ===================================================== */
.xai-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: xaiModalFadeIn 0.3s ease;
  padding: 20px;
}

@keyframes xaiModalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.xai-modal {
  background: #ffffff;
  border-radius: 20px;
  padding: 40px 36px 32px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.3);
  animation: xaiModalScaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

@keyframes xaiModalScaleIn {
  from { opacity: 0; transform: scale(0.85) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.xai-modal-icon {
  margin-bottom: 18px;
  display: flex;
  justify-content: center;
}

.xai-modal-icon svg {
  animation: xaiCheckPop 0.5s ease 0.2s both;
}

@keyframes xaiCheckPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.xai-modal-title {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 10px;
  letter-spacing: -0.3px;
}

.xai-modal-text {
  font-size: 15px;
  color: #64748b;
  line-height: 1.55;
  margin: 0 0 24px;
}

.xai-modal-btn {
  display: inline-block;
  padding: 12px 40px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 6px 20px -4px rgba(16, 185, 129, 0.5);
}

.xai-modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -4px rgba(16, 185, 129, 0.6);
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.xai-modal-btn:active {
  transform: translateY(0);
}

.xai-modal-overlay.xai-modal-hide {
  animation: xaiModalFadeOut 0.25s ease forwards;
}

@keyframes xaiModalFadeOut {
  to { opacity: 0; }
}




/* =====================================================
   Captcha INVALID state – strong red styling
   ===================================================== */
.xai-captcha-box.xai-captcha-invalid {
  border: 2px solid #ef4444 !important;
  border-style: solid !important;
  background: #fef2f2 !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2) !important;
  animation: xaiCaptchaShake 0.45s ease;
}

@keyframes xaiCaptchaShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.xai-captcha-box.xai-captcha-invalid .xai-captcha-input,
.xai-input.xai-invalid,
#captcha_answer.xai-invalid {
  border-color: #ef4444 !important;
  background: #fff5f5 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.xai-captcha-error-msg {
  display: block !important;
  color: #dc2626 !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  margin-top: 8px !important;
}

.xai-alert-error {
  border-left: 4px solid #ef4444 !important;
  background: #fef2f2 !important;
  color: #991b1b !important;
}
