@font-face {
  font-family: 'Ramabhadra';
  src: url('../../fonts/Ramabhadra-Regular.woff2') format('woff2'),
       url('../../fonts/Ramabhadra-Regular.ttf') format('truetype');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

.pdg-body {
  background: #f2f3f5;
  font-family: 'Ramabhadra', 'Noto Sans Telugu', sans-serif;
  margin: 0;
  padding: 0;
}

.pdg-wrap {
  max-width: 640px;
  margin: 30px auto 60px;
  padding: 0 16px;
}

.pdg-header-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(120deg, #1e3a8a, #3949ab 55%, #5c6bc0);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 24px;
  box-shadow: 0 6px 20px rgba(30, 58, 138, 0.35);
}
.pdg-header-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}
.pdg-heading {
  color: #fff;
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-align: center;
}

.pdg-dashboard {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 24px;
}

.pdg-field { margin-bottom: 22px; }

.pdg-field label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  color: #333;
}

.pdg-photo-box {
  width: 100%;
  height: 180px;
  border: 2px dashed #bbb;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fafafa;
  margin-bottom: 10px;
}
.pdg-photo-box img { width: 100%; height: 100%; object-fit: cover; }
.pdg-photo-box span { color: #999; }

.pdg-input, .pdg-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
}

.pdg-swatch-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.pdg-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s;
}
.pdg-swatch:hover { transform: scale(1.1); }
.pdg-swatch.active { border-color: #222; transform: scale(1.15); }

.pdg-custom-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.pdg-color-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid #ccc;
  cursor: pointer;
  padding: 0;
}
.pdg-custom-label {
  font-size: 13px;
  color: #666;
}

.pdg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 8px;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.pdg-btn-icon { width: 20px; height: 20px; flex-shrink: 0; }
.pdg-btn-primary { background: #1e3a8a; color: #fff; width: 100%; }
.pdg-btn-outline { background: #fff; color: #1e3a8a; border: 2px solid #1e3a8a; }
.pdg-generate-btn { margin-top: 6px; }

.pdg-char-counter {
  text-align: right;
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}
.pdg-char-counter.pdg-limit-near { color: #d17d00; }
.pdg-char-counter.pdg-limit-full { color: #d32f2f; font-weight: 700; }

/* ============ POSTER (exact Eenadu-reference proportions, 2x resolution: 2160x2700) ============ */
/* Table-based layout on purpose (not flexbox) — dom-to-image renders this
   DOM into an SVG <foreignObject>, and flexbox layouts (text wrapping
   inside flex items, flex:1 sizing) can render incorrectly there.
   All sizes below are exactly 2x the original 1080x1350 design so the
   output is sharp when zoomed in (retina-style rendering). Section
   heights sum to exactly 2700: 16 (border) + 1184 (photo) + 208 (title)
   + 1182 (content) + 110 (footer) = 2700. */
.pdg-poster {
  width: 2160px;
  height: 2700px;
  background: #fff;
  overflow: hidden;
  font-family: 'Ramabhadra', 'Noto Sans Telugu', sans-serif;
  border-top: 16px solid #7fd6f2;
}

.pdg-poster-photo {
  position: relative;
  width: 2160px;
  height: 1184px;
  background: linear-gradient(135deg, #1a1a2e, #232946);
  overflow: hidden;
}
.pdg-poster-photo img#pdg_poster_photo_img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pdg-poster-logo {
  position: absolute;
  top: 36px;
  right: 36px;
  max-height: 190px;
  max-width: 460px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.4);
  padding: 16px 28px;
  border-radius: 20px;
}

.pdg-poster-title-bar {
  width: 2160px;
  height: 208px;
  display: table;
}
.pdg-poster-title {
  display: table-cell;
  vertical-align: middle;
  width: 2160px;
  padding: 16px 90px;
  color: #fff;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: break-word;
  /* font-size is set dynamically by JS (auto-fit to box) */
}

.pdg-poster-content {
  width: 2160px;
  height: 1182px;
  display: table;
}
.pdg-poster-content-text {
  display: table-cell;
  vertical-align: middle;
  width: 2160px;
  padding: 48px; /* 0.2cm at 300dpi, scaled 2x */
  color: #fff;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  text-align: center;
  letter-spacing: 0.4px;
  /* No text-shadow/stroke on purpose — keeps letters crisp and sharp */
  /* font-size is set dynamically by JS (auto-fit to box) */
}

.pdg-poster-footer {
  width: 2160px;
  height: 110px;
  display: table;
  background: #14141a;
}
.pdg-footer-left,
.pdg-footer-right {
  display: table-cell;
  vertical-align: middle;
  color: #fff;
  font-size: 44px;
}
.pdg-footer-left { text-align: left; padding-left: 70px; }
.pdg-footer-right { text-align: right; padding-right: 60px; white-space: nowrap; }
.pdg-follow-label { margin-right: 16px; }
.pdg-icon-badge { display: inline-block; width: 56px; height: 56px; vertical-align: middle; margin-left: 10px; }
.pdg-icon-badge svg { width: 52px; height: 52px; display: block; }
.pdg-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  align-items: center;
  justify-content: center;
}
.pdg-modal.open { display: flex; }
.pdg-modal-inner {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  max-width: 92vw;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  text-align: center;
}
.pdg-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  color: #333;
  z-index: 5;
}
.pdg-modal-preview-wrap { margin-bottom: 16px; }
.pdg-result-img {
  max-width: 100%;
  max-height: 65vh;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.pdg-modal-actions { display: flex; gap: 12px; justify-content: center; }
.pdg-modal-actions .pdg-btn { width: auto; min-width: 140px; }

/* ---- Preview & Customize modal ---- */
.pdg-preview-modal-inner { max-width: 420px; padding-top: 40px; }
.pdg-preview-viewport {
  position: relative;
  width: 100%;
  max-width: 340px;
  aspect-ratio: 2160 / 2700;
  margin: 0 auto 20px;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 2px 14px rgba(0,0,0,0.25);
  background: #ddd;
}
.pdg-preview-viewport .pdg-poster {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
}
.pdg-preview-controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 18px;
  text-align: left;
}
.pdg-preview-color-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  color: #333;
  font-size: 14px;
}

.pdg-loading {
  position: fixed;
  z-index: 10000;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #1e3a8a;
}
