/* ===== TheMailBD Photocard Generator — Public Styles (Mobile-first) ===== */

.tmbd-pcg-public {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Bengali", Arial, sans-serif;
  color: #1a1a2e;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
  box-sizing: border-box;
}

/* ── Template selector ────────────────────────────────────────── */
.tmbd-pcg-pub-field--template {
  margin-bottom: 20px;
}
.tmbd-pcg-pub-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: .9rem;
  color: #444;
}
.tmbd-pcg-pub-select {
  width: 100%;
  max-width: 340px;
  padding: 9px 12px;
  border: 1.5px solid #d0d0d0;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ── Grid layout ──────────────────────────────────────────────── */
.tmbd-pcg-pub-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 768px) {
  .tmbd-pcg-pub-grid {
    grid-template-columns: 360px 1fr;
    align-items: start;
  }
}

@media (min-width: 1024px) {
  .tmbd-pcg-pub-grid {
    grid-template-columns: 400px 1fr;
  }
}

/* ── Inputs column ────────────────────────────────────────────── */
.tmbd-pcg-pub-col--inputs {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.tmbd-pcg-pub-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Drop zone ────────────────────────────────────────────────── */
.tmbd-pcg-drop-zone {
  position: relative;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  overflow: hidden;
  outline: none;
}
.tmbd-pcg-drop-zone:hover,
.tmbd-pcg-drop-zone:focus,
.tmbd-pcg-drop-zone.is-over {
  border-color: #3b82f6;
  background: #eff6ff;
}
.tmbd-pcg-drop-zone.is-over { border-style: solid; }

.tmbd-pcg-drop-placeholder {
  text-align: center;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  pointer-events: none;
}
.tmbd-pcg-drop-placeholder p    { margin: 0; font-size: .95rem; color: #64748b; }
.tmbd-pcg-drop-hint { font-size: .8rem; }

.tmbd-pcg-drop-preview {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  display: block;
  border-radius: 10px;
}

.tmbd-pcg-file-input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}

/* ── Textarea ─────────────────────────────────────────────────── */
.tmbd-pcg-pub-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #d0d0d0;
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  font-family: inherit;
  transition: border-color .2s;
  box-sizing: border-box;
}
.tmbd-pcg-pub-textarea:focus { border-color: #3b82f6; outline: none; }
.tmbd-pcg-char-count { font-size: .8rem; color: #94a3b8; text-align: right; }

/* ── Buttons ──────────────────────────────────────────────────── */
.tmbd-pcg-pub-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.tmbd-pcg-btn-primary,
.tmbd-pcg-btn-secondary,
.tmbd-pcg-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .18s, transform .1s;
  font-family: inherit;
}
.tmbd-pcg-btn-primary {
  background: #1565c0;
  color: #fff;
}
.tmbd-pcg-btn-primary:hover:not(:disabled) { background: #0d47a1; }
.tmbd-pcg-btn-primary:disabled { background: #90a4ae; cursor: not-allowed; }

.tmbd-pcg-btn-secondary {
  background: #00897b;
  color: #fff;
}
.tmbd-pcg-btn-secondary:hover { background: #00695c; }

.tmbd-pcg-btn-outline {
  background: transparent;
  color: #e53935;
  border: 1.5px solid #e53935;
  padding: 6px 14px;
  font-size: .85rem;
  border-radius: 6px;
}
.tmbd-pcg-btn-outline:hover { background: #fff5f5; }

.tmbd-pcg-btn-icon { display: inline-flex; align-items: center; }

.tmbd-pcg-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tmbd-spin .7s linear infinite;
}
@keyframes tmbd-spin { to { transform: rotate(360deg); } }

/* ── Notice ───────────────────────────────────────────────────── */
.tmbd-pcg-pub-notice {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: .9rem;
}
.tmbd-pcg-pub-notice--error   { background: #fff0f0; border-left: 4px solid #e53935; color: #7f0000; }
.tmbd-pcg-pub-notice--info    { background: #e3f2fd; border-left: 4px solid #1565c0; color: #003c6e; }
.tmbd-pcg-pub-notice--success { background: #e8f5e9; border-left: 4px solid #2e7d32; color: #1b5e20; }

/* ── Canvas area ──────────────────────────────────────────────── */
.tmbd-pcg-pub-col--preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.tmbd-pcg-canvas-wrap {
  position: relative;
  width: 100%;
  background: #e9ecef;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
}

.tmbd-pcg-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.tmbd-pcg-canvas-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #94a3b8;
  font-size: .95rem;
  pointer-events: none;
}

.tmbd-pcg-pub-hint {
  font-size: .8rem;
  color: #94a3b8;
  text-align: center;
  margin: 0;
}

/* ── Responsive tweaks ────────────────────────────────────────── */
@media (max-width: 600px) {
  .tmbd-pcg-public { padding: 0 12px; }
  .tmbd-pcg-pub-actions { flex-direction: column; }
  .tmbd-pcg-btn-primary,
  .tmbd-pcg-btn-secondary { justify-content: center; width: 100%; }
}
