/* ============================================================
   ads.css — Ad System Styles for PDF.EDIT (Light Theme)
   ============================================================ */

/* ===== Ad Placeholder (dev/no-AdSense mode) ===== */
.ad-placeholder {
  width: 100%; height: 100%;
  min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(59, 130, 246, 0.06);
  border: 1px dashed rgba(59, 130, 246, 0.35);
  border-radius: 8px;
  color: rgba(59, 130, 246, 0.5);
  font-size: 11px; font-family: Inter, sans-serif;
  letter-spacing: 0.05em; text-transform: uppercase;
  user-select: none;
}

/* ===== Side Panels (Home — Desktop only) ===== */
.ad-side {
  position: fixed;
  top: 80px;
  width: 160px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ad-side-left  { left: 12px; }
.ad-side-right { right: 12px; }

.ad-side-slot {
  width: 160px;
  min-height: 600px;
  border-radius: 10px;
  overflow: hidden;
}
.ad-side-slot .ad-placeholder { min-height: 600px; }

/* hide side ads when viewport is too narrow */
@media (max-width: 1099px) {
  .ad-side { display: none !important; }
}

/* ===== Mobile Bottom Sticky Banner ===== */
.ad-mobile-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  height: 60px;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid rgba(59, 130, 246, 0.15);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(12px);
}
.ad-mobile-banner .ad-placeholder { min-height: 50px; width: 320px; max-width: 100%; }
/* Only on mobile */
@media (min-width: 769px) {
  .ad-mobile-banner { display: none !important; }
}
/* Push landing content up on mobile */
@media (max-width: 768px) {
  #view-landing { padding-bottom: 60px; }
}

/* ===== Editor Sidebar Ad Slot (Left sidebar) ===== */
.ad-sidebar-box {
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  width: 100%;
}
.ad-sidebar-box .ad-placeholder {
  min-height: 200px;
  font-size: 10px;
}

/* Hide on mobile (editor sidebar is hidden anyway) */
@media (max-width: 768px) {
  .ad-sidebar-box { display: none !important; }
}

/* ===== Process Modal (PDF Generation) ===== */
.process-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(239, 246, 255, 0.97);
  backdrop-filter: blur(16px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}
.process-overlay.hidden { display: none !important; }

.process-card {
  width: 100%; max-width: 520px;
  display: flex; flex-direction: column;
  align-items: center; gap: 24px;
  text-align: center;
}

.process-logo {
  display: flex; align-items: center; gap: 10px;
  opacity: 0.8;
}
.process-logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: white;
}
.process-logo-text { font-size: 18px; font-weight: 800; color: #1F2937; }
.process-logo-accent { color: #3B82F6; }

.process-heading {
  font-size: 22px; font-weight: 700; color: #1F2937;
  margin: 0;
}

.process-bar-wrap {
  width: 100%;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 6px; height: 6px; overflow: hidden;
}
.process-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #3B82F6, #60A5FA);
  border-radius: 6px;
  transition: width 0.4s ease;
}
@keyframes processBarAnim {
  0%   { width: 0%; }
  15%  { width: 40%; }
  50%  { width: 70%; }
  80%  { width: 88%; }
  100% { width: 100%; }
}
.process-bar-fill.running {
  animation: processBarAnim 5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.process-status-text {
  font-size: 13px; color: #6B7280;
  min-height: 20px;
  transition: opacity 0.3s;
}

/* Large ad in process center */
.ad-process-slot {
  width: 100%; max-width: 480px;
  min-height: 260px;
  border-radius: 12px; overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.ad-process-slot.ad-visible {
  opacity: 1;
  transform: translateY(0);
}
.ad-process-slot .ad-placeholder { min-height: 260px; }

.process-privacy-note {
  font-size: 11px; color: rgba(107, 114, 128, 0.6);
  margin-top: -8px;
}

/* Hide process ad on mobile (full screen UX priority) */
@media (max-width: 768px) {
  .ad-process-slot { display: none; }
  .process-card { max-width: 100%; }
}

/* ===== Download Modal ===== */
.download-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(239, 246, 255, 0.98);
  backdrop-filter: blur(20px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  /* ต้องการให้ side ads ใช้ position: absolute อ้างอิงจาก overlay นี้ */
  overflow: hidden;
}
.download-overlay.hidden { display: none !important; }

.download-card {
  width: 100%; max-width: 480px;
  display: flex; flex-direction: column;
  align-items: center; gap: 20px;
  text-align: center;
}

.download-success-ring {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(16, 185, 129, 0.1);
  border: 2px solid rgba(16, 185, 129, 0.35);
  display: flex; align-items: center; justify-content: center;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.download-check { font-size: 32px; color: #10B981; }

.download-heading {
  font-size: 24px; font-weight: 800; color: #1F2937; margin: 0 0 6px;
}
.download-sub {
  font-size: 14px; color: #6B7280; margin: 0;
}

/* ===== Download Page Side Ads ===== */
.dl-side-ad {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 160px;
}
.dl-side-left  { left: 20px; }
.dl-side-right { right: 20px; }
.dl-side-ad .ad-placeholder { min-height: 400px; }

@media (max-width: 1099px) {
  .dl-side-ad { display: none !important; }
}

.download-btn-wrap { width: 100%; }
.btn-download-main {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 15px 24px;
  background: linear-gradient(135deg, #059669, #10b981);
  color: white; border: none; border-radius: 10px;
  font-size: 16px; font-weight: 700; font-family: inherit;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-download-main:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(16, 185, 129, 0.4);
}

/* Small banner ad below download */
.ad-download-banner {
  width: 100%; max-width: 480px;
  min-height: 90px; border-radius: 8px; overflow: hidden;
}
.ad-download-banner .ad-placeholder { min-height: 90px; }

/* Upsell section */
.ad-upsell {
  width: 100%;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 10px;
  text-align: left;
}
.upsell-icon { font-size: 24px; flex-shrink: 0; }
.upsell-copy { flex: 1; min-width: 0; }
.upsell-copy strong {
  display: block; font-size: 13px; font-weight: 700;
  color: #1F2937; margin-bottom: 2px;
}
.upsell-copy span { font-size: 12px; color: #6B7280; }
.upsell-cta { flex-shrink: 0; }

.download-footer {
  display: flex; align-items: center; gap: 16px;
}
.download-stats { font-size: 12px; color: #6B7280; }
.download-stats strong { color: #4B5563; }

/* ===== Ad Label (top corner) ===== */
.ad-label {
  font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.08em; color: rgba(107, 114, 128, 0.6);
  text-align: center; padding: 0 2px 4px;
  user-select: none;
}
