@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&family=Prompt:wght@300;400;500;600;700&family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  --primary-blue: #1e6cb8;
  --header-blue: #2374b8;
  --light-blue-bg: #cde6fa;
  --box-blue-bg: #bfe1fb;
  --header-orange: #f59e0b;
  --box-orange-bg: #fed7aa;
  --card-shadow: 0 4px 15px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -2px rgba(0, 0, 0, 0.04);
}

body {
  font-family: 'Prompt', 'Sarabun', sans-serif;
  background-color: #f1f5f9;
  color: #1e293b;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* A4 Sheet Spec: 210mm x 297mm (Ratio: ~1:1.414) */
.poster-page-wrapper {
  background: #f8fafc;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px;
  min-height: calc(100vh - 120px);
}

.poster-canvas {
  width: 210mm;
  min-height: 297mm;
  height: 297mm;
  max-height: 297mm;
  background-color: #fdf2e2; /* Warm pastel cream background like the original */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 0 1px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  padding: 20px 26px 16px 26px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Thai Typography & Line Formatting */
.thai-headline {
  font-family: 'Prompt', 'Kanit', sans-serif;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.thai-narrative {
  font-family: 'Sarabun', 'Prompt', sans-serif;
  text-align: left;
  line-break: loose;
  word-break: break-word;
  line-height: 1.75;
  color: #1e293b;
  letter-spacing: 0.005em;
}

.thai-narrative p {
  text-indent: 2rem;
  margin-bottom: 0.4rem;
}

.thai-narrative p:last-child {
  margin-bottom: 0;
}

/* Image Slots Styling */
.slot-photo {
  object-fit: cover;
  width: 100%;
  height: 100%;
  transition: transform 0.2s ease;
}

.slot-container {
  position: relative;
  overflow: hidden;
  background-color: #e2e8f0;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slot-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  backdrop-filter: blur(2px);
  z-index: 2;
}

/* Tabular figures for numbers alignment */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Header Logo & Medical Banner Styling */
#poster-logo-container {
  overflow: hidden;
  position: relative;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 9999px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  border: 2px solid rgba(186, 230, 253, 0.8);
  transition: width 0.15s ease, height 0.15s ease;
}

#poster-logo {
  width: 100%;
  height: 100%;
  transition: transform 0.15s ease-out;
}

#poster-illustration-container {
  overflow: hidden;
  position: relative;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  height: 135px;
  border-radius: 14px;
  transition: height 0.2s ease;
}

#poster-illustration {
  width: 100%;
  height: 100%;
  object-fit: fill;
  transition: transform 0.15s ease-out;
}

/* Print Specific Rules */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }
  
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .no-print {
    display: none !important;
  }
  
  .poster-page-wrapper {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    min-height: auto !important;
  }
  
  .poster-canvas {
    width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    box-shadow: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
    position: absolute;
    top: 0;
    left: 0;
  }

  #poster-zoom-container, #poster-zoom-wrapper {
    transform: none !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    position: static !important;
  }
}

#poster-zoom-container {
  position: relative;
  overflow: visible;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), height 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#poster-zoom-wrapper {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: top center;
  width: 210mm;
}

/* Interactive animations */
.transition-smooth {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.badge-pulse {
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.04); }
}

/* Drag and Drop visual indicator */
.drag-over {
  border: 2px dashed #2563eb !important;
  background-color: rgba(219, 234, 254, 0.7) !important;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.35) !important;
  transform: scale(1.02);
}

.poster-canvas .drag-over {
  outline: 3px dashed #2563eb !important;
  outline-offset: -3px;
  background-color: rgba(191, 219, 254, 0.5) !important;
}

/* Poster hover overlay for direct click-to-upload (Only visible on hover) */
.poster-hover-overlay {
  opacity: 0 !important;
  pointer-events: none;
  transition: opacity 0.2s ease, background-color 0.2s ease;
  backdrop-filter: blur(1.5px);
  z-index: 25;
}

.group:hover .poster-hover-overlay {
  opacity: 1 !important;
  pointer-events: auto;
}

/* Completion banner glow & animation */
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 4px 18px rgba(16, 185, 129, 0.3); }
  50% { box-shadow: 0 6px 24px rgba(16, 185, 129, 0.6); transform: translateY(-1px); }
}

.completion-glow {
  animation: glow-pulse 3s infinite ease-in-out;
}

/* Modal Preview styling */
#modal-onepage-preview {
  z-index: 100;
}

#modal-preview-viewport::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
#modal-preview-viewport::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

