/* =============================================================================
   HappyCoders Popup — Frontend Styles
   Requires: modern browser (CSS custom properties, backdrop-filter)
   ============================================================================= */

/* Custom property fallbacks (overridden by inline PHP vars) */
:root {
  --hc-accent-start: #014E4E;
  --hc-accent-end:   #F9D67B;
  --hc-btn-text:     #ffffff;
}

/* =============================================================================
   1. Overlay
   ============================================================================= */

.hc-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 12, 30, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);

  /* hidden state */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

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

/* Prevent body scroll when popup is open */
body.hc-popup-open {
  overflow: hidden;
}

/* =============================================================================
   2. Container / Card
   ============================================================================= */

.hc-popup-container {
  position: relative;
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.32);

  /* entrance animation */
  transform: scale(0.88) translateY(24px);
  transition: transform 0.38s cubic-bezier(0.34, 1.5, 0.64, 1);

  /* thin scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

.hc-popup-container::-webkit-scrollbar        { width: 5px; }
.hc-popup-container::-webkit-scrollbar-track  { background: transparent; }
.hc-popup-container::-webkit-scrollbar-thumb  { background: #d1d5db; border-radius: 4px; }

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

/* =============================================================================
   3. Header (gradient banner)
   ============================================================================= */

.hc-popup-header {
  position: relative;
  height: 108px;
  background: linear-gradient(
    135deg,
    var(--hc-accent-start),
    var(--hc-accent-end)
  );
  border-radius: 20px 20px 0 0;
}

/* =============================================================================
   4. Floating icon circle
   ============================================================================= */

.hc-popup-header__icon {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 56px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.14);
  z-index: 2;
}

.hc-popup-header__icon svg {
  width: 26px;
  height: 26px;
  stroke: var(--hc-accent-start);
  display: block;
}

/* =============================================================================
   5. Close button
   ============================================================================= */

.hc-popup-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0 !important;
  transition: background 0.2s ease, transform 0.2s ease;
  line-height: 1;
}

.hc-popup-close:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: rotate(90deg);
}

.hc-popup-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.hc-popup-close svg {
  width: 16px;
  height: 16px;
  stroke: #ffffff;
  display: block;
}

/* =============================================================================
   6. Body
   ============================================================================= */

.hc-popup-body {
  padding: 50px 36px 36px;
  text-align: center;
}

.hc-popup-title {
  margin: 0 0 10px;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
  color: #111827;
  letter-spacing: -0.01em;
}

.hc-popup-subtitle {
  margin: 0 0 28px;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: #6b7280;
}

/* =============================================================================
   7. Form wrapper
   ============================================================================= */

.hc-popup-form {
  text-align: left;
}

/* =============================================================================
   8. Contact Form 7 overrides
   ============================================================================= */

.hc-popup-form .wpcf7 {
  padding: 0;
}

.hc-popup-form .wpcf7-form p {
  margin: 0 0 14px;
}

.hc-popup-form .wpcf7-form label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  color: #374151;
}

/* Text inputs, email, tel, number, url, date, select, textarea */
.hc-popup-form .wpcf7-form input[type="text"],
.hc-popup-form .wpcf7-form input[type="email"],
.hc-popup-form .wpcf7-form input[type="tel"],
.hc-popup-form .wpcf7-form input[type="number"],
.hc-popup-form .wpcf7-form input[type="url"],
.hc-popup-form .wpcf7-form input[type="date"],
.hc-popup-form .wpcf7-form select,
.hc-popup-form .wpcf7-form textarea {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #111827;
  background: #f9fafb;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-sizing: border-box;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.hc-popup-form .wpcf7-form select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 36px;
}

.hc-popup-form .wpcf7-form input:focus,
.hc-popup-form .wpcf7-form select:focus,
.hc-popup-form .wpcf7-form textarea:focus {
  border-color: var(--hc-accent-start);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.16);
}

.hc-popup-form .wpcf7-form textarea {
  min-height: 96px;
  resize: vertical;
}

/* Radio & checkbox */
.hc-popup-form .wpcf7-form input[type="radio"],
.hc-popup-form .wpcf7-form input[type="checkbox"] {
  accent-color: var(--hc-accent-start);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Submit button */
.hc-popup-form .wpcf7-form input[type="submit"],
.hc-popup-form .wpcf7-form .wpcf7-submit {
  display: block;
  width: 100%;
  padding: 13px 24px;
  margin-top: 6px;
  background: linear-gradient(135deg, var(--hc-accent-start), var(--hc-accent-end));
  color: var(--hc-btn-text);
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.025em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.38);
  transition: opacity 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.hc-popup-form .wpcf7-form input[type="submit"]:hover,
.hc-popup-form .wpcf7-form .wpcf7-submit:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 7px 22px rgba(102, 126, 234, 0.48);
}

.hc-popup-form .wpcf7-form input[type="submit"]:active,
.hc-popup-form .wpcf7-form .wpcf7-submit:active {
  transform: translateY(0);
  opacity: 1;
}

.hc-popup-form .wpcf7-form input[type="submit"]:disabled,
.hc-popup-form .wpcf7-form .wpcf7-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Spinner (CF7 loading state) */
.hc-popup-form .wpcf7-spinner {
  margin-left: 8px;
  vertical-align: middle;
}

/* Validation tip */
.hc-popup-form .wpcf7-not-valid-tip {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: #dc2626;
}

.hc-popup-form .wpcf7-not-valid {
  border-color: #dc2626 !important;
  background: #fff5f5 !important;
}

/* Response output messages */
.hc-popup-form .wpcf7-response-output {
  margin: 16px 0 0;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.875rem;
  border: none !important;
  text-align: left;
}

.hc-popup-form .wpcf7-mail-sent-ok {
  background: #f0fdf4;
  color: #15803d;
  border-left: 4px solid #4ade80 !important;
}

.hc-popup-form .wpcf7-mail-sent-ng,
.hc-popup-form .wpcf7-aborted {
  background: #fef2f2;
  color: #b91c1c;
  border-left: 4px solid #f87171 !important;
}

.hc-popup-form .wpcf7-spam-blocked {
  background: #fffbeb;
  color: #92400e;
  border-left: 4px solid #fbbf24 !important;
}

.hc-popup-form .wpcf7-validation-errors {
  background: #fef3c7;
  color: #92400e;
  border-left: 4px solid #f59e0b !important;
}

/* =============================================================================
   9. No-form placeholder (shown in Elementor editor when no CF7 is selected)
   ============================================================================= */

.hc-popup-no-form {
  text-align: center;
  padding: 16px 0 8px;
  font-size: 0.875rem;
  color: #9ca3af;
  font-style: italic;
}

/* =============================================================================
   10. Trigger button (shortcode / widget)
   ============================================================================= */

.hc-popup-trigger-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 34px;
  background: linear-gradient(135deg, var(--hc-accent-start), var(--hc-accent-end));
  color: var(--hc-btn-text) !important;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.38);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  text-decoration: none;
  -webkit-appearance: none;
  appearance: none;
}

.hc-popup-trigger-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(102, 126, 234, 0.5);
  opacity: 0.93;
}

.hc-popup-trigger-btn:active {
  transform: translateY(0);
}

.hc-popup-trigger-btn:focus-visible {
  outline: 3px solid var(--hc-accent-start);
  outline-offset: 3px;
}

/* =============================================================================
   10. Responsive
   ============================================================================= */

@media (max-width: 600px) {
  .hc-popup-container {
    max-height: 96vh;
    border-radius: 16px;
  }

  .hc-popup-header {
    height: 88px;
    border-radius: 16px 16px 0 0;
  }

  .hc-popup-body {
    padding: 44px 20px 24px;
  }

  .hc-popup-title {
    font-size: 1.25rem;
  }

  .hc-popup-subtitle {
    font-size: 0.875rem;
  }
}
