/* ==========================================================================
   Harsh Verma Portfolio - Executive Blog Newsletter Subscription Modal
   "The Agentic Systems & AI Dispatch"
   ========================================================================== */

/* Modal Backdrop Overlay */
.hv-newsletter-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1070;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
}

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

/* Modal Card */
.hv-newsletter-card {
  position: relative;
  background: #ffffff;
  width: 100%;
  max-width: 520px;
  border-radius: 20px;
  box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(226, 232, 240, 0.9);
  overflow: hidden;
  transform: translateY(28px) scale(0.96);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
  will-change: transform, opacity;
  color: #0f172a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.hv-newsletter-overlay.active .hv-newsletter-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Accent Top Gradient Bar */
.hv-newsletter-top-bar {
  height: 4px;
  background: linear-gradient(90deg, #2563eb 0%, #4f46e5 45%, #7c3aed 80%, #06b6d4 100%);
}

/* Close Button */
.hv-newsletter-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
  z-index: 10;
  outline: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.hv-newsletter-close-btn:hover {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(255, 255, 255, 0.6);
  color: #ffffff;
  transform: scale(1.08);
}

.hv-newsletter-close-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.5);
}

/* Newsletter Hero Thumbnail Banner */
.hv-newsletter-thumbnail-wrap {
  position: relative;
  width: 100%;
  height: 155px;
  background: linear-gradient(135deg, #090e1a 0%, #1e1b4b 100%);
  overflow: hidden;
}

.hv-newsletter-thumbnail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.4s ease;
}

.hv-newsletter-card:hover .hv-newsletter-thumbnail-img {
  transform: scale(1.02);
}

.hv-newsletter-thumbnail-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.05) 0%, rgba(15, 23, 42, 0.3) 45%, rgba(15, 23, 42, 0.82) 100%);
  pointer-events: none;
}

.hv-newsletter-thumbnail-content {
  position: absolute;
  bottom: 10px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  z-index: 2;
  pointer-events: none;
}

.hv-newsletter-thumbnail-badge {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #38bdf8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.hv-newsletter-thumbnail-meta {
  font-size: 11.5px;
  font-weight: 600;
  color: #e2e8f0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

/* Content Container */
.hv-newsletter-body {
  padding: 20px 24px 22px;
}

/* Header Badge & Title */
.hv-newsletter-header-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 14px;
  padding-right: 32px;
}

.hv-newsletter-icon-wrap {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(79, 70, 229, 0.18) 100%);
  border: 1px solid rgba(79, 70, 229, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563eb;
  font-size: 24px;
  flex-shrink: 0;
  margin-right: 14px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.18);
  padding: 2px;
}

.hv-newsletter-header-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 11px;
  display: block;
}

.hv-newsletter-meta-label {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #4f46e5;
  margin-bottom: 4px;
}

.hv-newsletter-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  margin-right: 6px;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: hvPulse 2s infinite;
}

@keyframes hvPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.hv-newsletter-title {
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.3;
  color: #0f172a;
  margin: 0;
}

.hv-newsletter-subtitle {
  font-size: 13.5px;
  color: #475569;
  line-height: 1.55;
  margin-bottom: 16px;
}

.hv-newsletter-author-ref {
  font-weight: 600;
  color: #1e293b;
}

/* Feature Bullets (Clean & Unboxed) */
.hv-newsletter-perks {
  list-style: none;
  padding: 0;
  margin: 0 0 18px 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hv-newsletter-perk-item {
  display: flex;
  align-items: center;
  font-size: 12.5px;
  color: #334155;
}

.hv-newsletter-perk-icon {
  color: #10b981;
  font-size: 15px;
  margin-right: 8px;
  flex-shrink: 0;
}

/* Form Controls */
.hv-newsletter-form {
  margin-top: 12px;
}

.hv-newsletter-input-group {
  position: relative;
  margin-bottom: 12px;
}

.hv-newsletter-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 18px;
  pointer-events: none;
}

.hv-newsletter-input {
  width: 100%;
  height: 48px;
  padding: 10px 14px 10px 42px;
  border-radius: 12px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  font-size: 14px;
  transition: all 0.2s ease;
  outline: none;
}

.hv-newsletter-input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.hv-newsletter-input.is-invalid {
  border-color: #ef4444;
  background: #fef2f2;
}

.hv-newsletter-input-error {
  font-size: 12px;
  color: #dc2626;
  margin-top: 4px;
  display: none;
  align-items: center;
}

.hv-newsletter-input-error.active {
  display: flex;
}

/* Topics Preference Chips */
.hv-newsletter-topics-wrap {
  margin-bottom: 16px;
}

.hv-newsletter-topics-label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-bottom: 6px;
  display: block;
}

.hv-newsletter-topics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hv-newsletter-topic-btn {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.hv-newsletter-topic-btn:hover {
  border-color: #cbd5e1;
  color: #0f172a;
}

.hv-newsletter-topic-btn.selected {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.35);
  color: #1d4ed8;
  font-weight: 600;
}

.hv-newsletter-topic-btn i {
  font-size: 13px;
  margin-right: 4px;
}

/* Submit Action Button */
.hv-newsletter-submit-btn {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px -2px rgba(37, 99, 235, 0.35);
  transition: all 0.22s ease;
  outline: none;
}

.hv-newsletter-submit-btn:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 8px 22px -2px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

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

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

/* Footer Meta / Anti-Spam & Dismiss */
.hv-newsletter-footer {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
}

.hv-newsletter-trust-badge {
  display: flex;
  align-items: center;
}

.hv-newsletter-trust-badge i {
  color: #10b981;
  margin-right: 4px;
}

.hv-newsletter-later-link {
  color: #64748b;
  text-decoration: underline;
  text-underline-offset: 2px;
  background: transparent;
  border: none;
  padding: 0;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s ease;
}

.hv-newsletter-later-link:hover {
  color: #0f172a;
}

/* Success View */
.hv-newsletter-success-pane {
  display: none;
  text-align: center;
  padding: 20px 10px 10px;
}

.hv-newsletter-success-pane.active {
  display: block;
  animation: hvFadeIn 0.35s ease;
}

.hv-newsletter-success-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #ecfdf5;
  border: 2px solid #a7f3d0;
  color: #10b981;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  animation: hvScaleBounce 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hv-newsletter-success-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #065f46;
  margin-bottom: 6px;
}

.hv-newsletter-success-msg {
  font-size: 13.5px;
  color: #475569;
  line-height: 1.6;
  max-width: 400px;
  margin: 0 auto 18px;
}

.hv-newsletter-success-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 9999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  color: #334155;
  font-weight: 500;
  margin-bottom: 14px;
}

.hv-newsletter-success-badge i {
  color: #2563eb;
  margin-right: 6px;
}

@keyframes hvScaleBounce {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

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

/* On-Page Trigger Pill (in Toolbar / Header) */
.btn-newsletter-trigger-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  background: #ffffff;
  border: 1.5px solid rgba(79, 70, 229, 0.3);
  color: #4338ca;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.08);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-newsletter-trigger-pill:hover {
  background: #f5f3ff;
  border-color: #6366f1;
  color: #3730a3;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.15);
}

.btn-newsletter-trigger-pill i {
  font-size: 14px;
  margin-right: 5px;
  color: #4f46e5;
}

/* ==========================================================================
   Dark Mode Overrides
   ========================================================================== */
html.dark-mode .hv-newsletter-card,
body.dark-mode .hv-newsletter-card {
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 25px 65px -15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(148, 163, 184, 0.15);
  color: #f8fafc;
}

html.dark-mode .hv-newsletter-close-btn,
body.dark-mode .hv-newsletter-close-btn {
  background: #1e293b;
  border-color: #334155;
  color: #94a3b8;
}

html.dark-mode .hv-newsletter-close-btn:hover,
body.dark-mode .hv-newsletter-close-btn:hover {
  background: #334155;
  color: #ffffff;
}

html.dark-mode .hv-newsletter-title,
body.dark-mode .hv-newsletter-title {
  color: #f8fafc;
}

html.dark-mode .hv-newsletter-icon-wrap,
body.dark-mode .hv-newsletter-icon-wrap {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.25) 0%, rgba(124, 58, 237, 0.35) 100%);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

html.dark-mode .hv-newsletter-subtitle,
body.dark-mode .hv-newsletter-subtitle {
  color: #cbd5e1;
}

html.dark-mode .hv-newsletter-author-ref,
body.dark-mode .hv-newsletter-author-ref {
  color: #e2e8f0;
}

html.dark-mode .hv-newsletter-perk-item,
body.dark-mode .hv-newsletter-perk-item {
  color: #cbd5e1;
}

html.dark-mode .hv-newsletter-input,
body.dark-mode .hv-newsletter-input {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

html.dark-mode .hv-newsletter-input:focus,
body.dark-mode .hv-newsletter-input:focus {
  border-color: #3b82f6;
  background: #0f172a;
}

html.dark-mode .hv-newsletter-topic-btn,
body.dark-mode .hv-newsletter-topic-btn {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

html.dark-mode .hv-newsletter-topic-btn:hover,
body.dark-mode .hv-newsletter-topic-btn:hover {
  border-color: #64748b;
  color: #ffffff;
}

html.dark-mode .hv-newsletter-topic-btn.selected,
body.dark-mode .hv-newsletter-topic-btn.selected {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
  color: #93c5fd;
}

html.dark-mode .hv-newsletter-footer,
body.dark-mode .hv-newsletter-footer {
  color: #94a3b8;
}

html.dark-mode .hv-newsletter-later-link,
body.dark-mode .hv-newsletter-later-link {
  color: #94a3b8;
}

html.dark-mode .hv-newsletter-later-link:hover,
body.dark-mode .hv-newsletter-later-link:hover {
  color: #e2e8f0;
}

html.dark-mode .hv-newsletter-success-title,
body.dark-mode .hv-newsletter-success-title {
  color: #34d399;
}

html.dark-mode .hv-newsletter-success-msg,
body.dark-mode .hv-newsletter-success-msg {
  color: #cbd5e1;
}

html.dark-mode .hv-newsletter-success-icon-wrap,
body.dark-mode .hv-newsletter-success-icon-wrap {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
}

html.dark-mode .hv-newsletter-success-badge,
body.dark-mode .hv-newsletter-success-badge {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

html.dark-mode .btn-newsletter-trigger-pill,
body.dark-mode .btn-newsletter-trigger-pill {
  background: #1e293b;
  border-color: rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
}

html.dark-mode .btn-newsletter-trigger-pill:hover,
body.dark-mode .btn-newsletter-trigger-pill:hover {
  background: #312e81;
  color: #e0e7ff;
}

/* Responsive adjustments */
@media (max-width: 576px) {
  .hv-newsletter-overlay {
    padding: 12px;
    align-items: flex-end; /* Slide in from bottom on small mobile screens */
  }

  .hv-newsletter-card {
    border-radius: 18px 18px 14px 14px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .hv-newsletter-body {
    padding: 20px 18px 18px;
  }

  .hv-newsletter-title {
    font-size: 1.15rem;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hv-newsletter-overlay,
  .hv-newsletter-card,
  .hv-newsletter-submit-btn,
  .hv-newsletter-success-pane {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
}
