/* ==========================================================================
   AR Educational Poster Styling - Human Heart Anatomy
   Optimized for Screen Display & A4 Color Printing (300 DPI layout)
   ========================================================================== */

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

:root {
  --bg-main: #0b1120;
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-card-border: rgba(255, 255, 255, 0.12);
  --primary-red: #ef4444;
  --primary-red-glow: rgba(239, 68, 68, 0.35);
  --primary-cyan: #06b6d4;
  --primary-cyan-glow: rgba(6, 182, 212, 0.35);
  --accent-gold: #f59e0b;
  --text-white: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --marker-border: #38bdf8;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Prompt', 'Sarabun', sans-serif;
  background: #050811;
  color: var(--text-white);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 12px;
  -webkit-font-smoothing: antialiased;
}

/* Control Navigation Bar (For browsing & printing) */
.poster-toolbar {
  width: 100%;
  max-width: 820px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 12px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
}

.poster-toolbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  color: #38bdf8;
}

.poster-toolbar .actions {
  display: flex;
  gap: 12px;
}

.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: 'Prompt', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-nav-primary {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #ffffff;
  border: none;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.btn-nav-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.btn-nav-outline {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-white);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-nav-outline:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #38bdf8;
}

/* ==========================================================================
   A4 Poster Container (210mm x 297mm ratio: 1:1.414)
   ========================================================================== */
.poster-page {
  width: 794px;
  min-height: 1123px;
  height: 1123px;
  background: radial-gradient(circle at 50% 15%, #1e1b4b 0%, #0c1222 45%, #050811 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 40px rgba(56, 189, 248, 0.1);
  padding: 32px 36px 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

/* Decorative background elements */
.poster-page::before {
  content: '';
  position: absolute;
  top: -120px;
  right: -120px;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.18), transparent 70%);
  pointer-events: none;
}

.poster-page::after {
  content: '';
  position: absolute;
  bottom: -100px;
  left: -100px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.18), transparent 70%);
  pointer-events: none;
}

/* ---------------- Header Section ---------------- */
.poster-header {
  position: relative;
  z-index: 2;
}

.header-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-ar {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.badge-ar span.pulse-dot {
  width: 8px;
  height: 8px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
}

.course-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.poster-title {
  font-size: 1.95rem;
  font-weight: 800;
  line-height: 1.25;
  background: linear-gradient(135deg, #ffffff 30%, #e2e8f0 70%, #93c5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.poster-subtitle {
  font-size: 0.95rem;
  color: #cbd5e1;
  font-weight: 400;
  letter-spacing: 0.2px;
}

/* ---------------- Statistics Strip ---------------- */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 14px 0 16px;
  position: relative;
  z-index: 2;
}

.stat-box {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.icon-red {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.icon-blue {
  background: rgba(6, 182, 212, 0.2);
  color: #06b6d4;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.icon-gold {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.stat-info .stat-num {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.1;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

.stat-info .stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ---------------- Main AR Target Section ---------------- */
.ar-target-section {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.75) 0%, rgba(10, 15, 29, 0.9) 100%);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 16px;
  padding: 16px 20px 14px;
  box-shadow: inset 0 0 30px rgba(56, 189, 248, 0.05);
}

.target-header-cue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 12px;
}

.target-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
}

.target-instruction {
  font-size: 0.8rem;
  color: #38bdf8;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Marker Frame with Corner Brackets */
.marker-wrapper {
  position: relative;
  width: 250px;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #020617;
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.25);
}

.marker-wrapper img, .marker-wrapper svg {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 8px;
}

/* Target Corner Brackets */
.corner-bracket {
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: #38bdf8;
  border-style: solid;
  pointer-events: none;
}

.corner-bracket.tl { top: -4px; left: -4px; border-width: 3px 0 0 3px; }
.corner-bracket.tr { top: -4px; right: -4px; border-width: 3px 3px 0 0; }
.corner-bracket.bl { bottom: -4px; left: -4px; border-width: 0 0 3px 3px; }
.corner-bracket.br { bottom: -4px; right: -4px; border-width: 0 3px 3px 0; }

.marker-caption {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

.marker-caption strong {
  color: #ffffff;
}

/* ---------------- 4 Chambers Anatomical Grid ---------------- */
.anatomy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0 12px;
  position: relative;
  z-index: 2;
}

.chamber-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}

.chamber-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.card-deox::before {
  background: linear-gradient(180deg, #06b6d4, #0284c7);
}

.card-ox::before {
  background: linear-gradient(180deg, #ef4444, #b91c1c);
}

.chamber-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.chamber-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
}

.chamber-latin {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-style: italic;
}

.chamber-desc {
  font-size: 0.75rem;
  color: #cbd5e1;
  line-height: 1.35;
}

.chamber-tag {
  align-self: flex-start;
  margin-top: 2px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.tag-blue {
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
}

.tag-red {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* ---------------- Footer & How to Scan Guide ---------------- */
.poster-footer {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: relative;
  z-index: 2;
}

.footer-steps {
  flex: 1;
}

.footer-steps-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.steps-list {
  display: flex;
  gap: 14px;
}

.step-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.step-num {
  width: 18px;
  height: 18px;
  background: #38bdf8;
  color: #090d16;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-text {
  font-size: 0.73rem;
  color: #cbd5e1;
  line-height: 1.25;
}

.step-text strong {
  color: #ffffff;
  display: block;
}

.qr-section {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(2, 6, 23, 0.6);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.qr-box {
  width: 64px;
  height: 64px;
  background: #ffffff;
  border-radius: 6px;
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-box svg, .qr-box img {
  width: 100%;
  height: 100%;
}

.qr-label {
  display: flex;
  flex-direction: column;
}

.qr-label-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #38bdf8;
}

.qr-label-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ---------------- Print Media Optimization ---------------- */
@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  body {
    background: #000000 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .poster-toolbar {
    display: none !important;
  }

  .poster-page {
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 24mm 20mm 18mm !important;
    page-break-inside: avoid;
  }
}
