/* ═══════════════════════════════════════════════════
   NC Analyzer Popup — popup.css
   Full-screen app-like overlay with smooth animations
   ═══════════════════════════════════════════════════ */

/* ── OVERLAY ── */
#nc-analyzer-popup {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  background: transparent;

  /* Hidden state */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#nc-analyzer-popup.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

/* Backdrop blur */
#nc-analyzer-popup::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 56, 40, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 0;
}

/* ── POPUP PANEL ── */
.nc-popup-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #faf9f5;

  /* Slide up on open */
  transform: translateY(40px) scale(0.97);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

#nc-analyzer-popup.is-open .nc-popup-panel {
  transform: translateY(0) scale(1);
}

/* Desktop: constrained width with rounded corners */
@media (min-width: 768px) {
  #nc-analyzer-popup {
    align-items: center;
    justify-content: center;
    padding: 2rem;
  }
  .nc-popup-panel {
    max-width: 920px;
    max-height: calc(100vh - 4rem);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
  }
}

/* Mobile: true full screen */
@media (max-width: 767px) {
  #nc-analyzer-popup { padding: 0; }
  .nc-popup-panel {
    border-radius: 0;
    max-height: 100vh;
    max-height: 100dvh;
  }
}

/* ── POPUP HEADER BAR ── */
.nc-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
  min-height: 56px;
  background: #0a3828;
  flex-shrink: 0;
  gap: 1rem;
}

.nc-popup-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(255,255,255,0.8);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.nc-popup-back:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.nc-popup-back svg { flex-shrink: 0; }

.nc-popup-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.nc-popup-title span { color: #2ec27e; }

.nc-popup-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nc-popup-analyze-again {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1fa868;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 50px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
}
.nc-popup-analyze-again:hover {
  background: #17865a;
  transform: translateY(-1px);
}
.nc-popup-analyze-again.nc-hidden { display: none !important; }

.nc-popup-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.nc-popup-close:hover {
  background: rgba(239,68,68,0.25);
  border-color: rgba(239,68,68,0.4);
  color: #fff;
}

/* ── POPUP BODY (scrollable content) ── */
.nc-popup-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  /* Custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #d4f0e0 transparent;
}
.nc-popup-body::-webkit-scrollbar { width: 4px; }
.nc-popup-body::-webkit-scrollbar-track { background: transparent; }
.nc-popup-body::-webkit-scrollbar-thumb { background: #d4f0e0; border-radius: 4px; }

/* ── Adjust nca-app inside popup ── */
.nc-popup-body #nca-app {
  max-width: 100% !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  min-height: calc(100vh - 56px) !important;
}

@media (min-width: 768px) {
  .nc-popup-body #nca-app {
    min-height: auto !important;
  }
}

/* ── BODY SCROLL LOCK ── */
body.nc-popup-open {
  overflow: hidden !important;
  /* Prevent layout shift on scrollbar disappear */
  padding-right: var(--scrollbar-width, 0px);
}

/* ── PRELOAD CONTAINER (hidden on page, moved to popup on open) ── */
#nc-analyzer-preload {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* ── TRIGGER BUTTONS (on main site) ── */
.nc-analyzer-trigger {
  cursor: pointer;
}

/* ── MOBILE TITLE HIDE ── */
@media (max-width: 480px) {
  .nc-popup-title { display: none; }
  .nc-popup-back span { display: none; }
  .nc-popup-analyze-again span { display: none; }
  .nc-popup-analyze-again { padding: 6px 10px; }
  .nc-popup-back { padding: 6px 10px; }
  .nc-popup-header { padding: 0 1rem; }
}
