/* Print Stylesheet for Growth Track Assessment Results */

/* Optimized margins for print */
@page {
  margin: 0.5in;
  size: letter;
}

/* Hide interactive elements and non-essential UI */
#btn-logout,
.progress-pill,
.sticky-footer,
#phone-step,
#match-results,
#no-match,
.manual-inputs,
#instructions,
#recaptcha-container,
button,
input,
select,
label:has(input),
label:has(select),
.section-title .pill {
  display: none !important;
}

/* Header: Logo and title on same line */
header.card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 0 !important;
  page-break-after: avoid;
}

.logo-gt {
  width: auto;
  height: 48px;
  flex-shrink: 0;
  margin: 0 !important;
}

header.card h1 {
  font-size: 1.5rem;
  margin: 0;
  flex: 1;
  text-align: left;
}

/* Profile section: Avatar 64x64px */
.profile {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  margin-top: 0;
  page-break-after: avoid;
}

/* Reduce spacing after profile card */
#your-info.card {
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.profile .avatar {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  object-fit: cover;
  background: #e5e7eb;
  flex-shrink: 0;
}

.profile .right {
  display: none;
}

/* Sections: Prevent page breaks within sections */
.card {
  page-break-inside: avoid;
  break-inside: avoid;
  margin-bottom: 10px;
  padding: 10px 0;
  overflow: visible;
}

/* Add page break before major assessment sections */
#disc,
#gifts {
  page-break-before: auto;
}

/* Suggestions section can start on same page if space allows */
#suggestions {
  page-break-before: auto;
}

/* Ensure sections don't split across pages */
#disc-questions,
#gift-questions {
  page-break-inside: avoid;
  break-inside: avoid;
  overflow: visible;
}

/* Prevent orphaned content - keep questions together */
.q {
  page-break-inside: avoid;
  break-inside: avoid;
  orphans: 3;
  widows: 3;
}

/* Ensure result boxes don't split */
.result {
  page-break-inside: avoid;
  break-inside: avoid;
  overflow: visible;
}

/* Hide progress indicators */
.header-with-progress,
.sticky-header {
  display: block;
}

.header-with-progress .progress-pill,
.sticky-header .progress-pill {
  display: none;
}

/* Ensure section titles stay with content */
.section-title {
  page-break-after: avoid;
  margin-bottom: 0;
  margin-top: 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
}

/* Fix spacing for section headers - remove duplicate border since section-title already has one */
.header-with-progress,
.sticky-header {
  margin-bottom: 0;
  margin-top: 0;
  padding-bottom: 0;
  border-bottom: none !important;
}

/* Ensure proper spacing between section title and content - consistent 10px */
#disc .section-title,
#gifts .section-title,
#suggestions .section-title {
  margin-bottom: 0;
  padding-bottom: 10px;
}

/* Ensure content after section titles has consistent spacing */
#disc .muted,
#gifts .muted,
#disc .result:first-of-type,
#gifts .result:first-of-type,
#suggestions .result {
  margin-top: 10px;
}

/* Ensure results have proper spacing from titles */
#disc .result,
#gifts .result {
  margin-top: 10px !important;
  margin-bottom: 10px;
  page-break-before: avoid;
  clear: both;
}

/* Prevent overlap - ensure section titles and headers don't overlap with results */
#gifts .sticky-header {
  position: relative;
  z-index: 1;
}

#gifts .section-title {
  position: relative;
  z-index: 1;
}

#gifts #gift-result {
  position: relative;
  z-index: 0;
  margin-top: 10px !important;
}

/* Override inline styles for print */
#disc-result[style*="margin-top"],
#gift-result[style*="margin-top"],
#disc-defs[style*="margin-top"],
#gift-defs[style*="margin-top"] {
  margin-top: 10px !important;
}

/* Ensure no negative margins or positioning issues */
#gifts .sticky-header,
#gifts .header-with-progress {
  margin-bottom: 10px !important;
  padding-bottom: 0;
}

/* Prevent any absolute positioning issues in print */
.sticky-header,
.header-with-progress {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
}

/* Print-friendly colors */
body {
  background: white;
  color: #0f172a;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.card {
  background: white;
  box-shadow: none;
  border: none;
  border-radius: 0 !important;
}

/* Ensure text is readable */
* {
  color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

/* Remove shadows and transitions for print */
.card,
button,
.profile,
.pill,
.result {
  box-shadow: none !important;
  transition: none !important;
}

/* Ensure links are visible */
a {
  color: #2A7982;
  text-decoration: underline;
}

/* Optimize spacing for print */
p {
  margin: 8px 0;
}

.muted {
  color: #475569;
}

/* Ensure tags/pills are visible */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Result pills should be visible (instruction pills are hidden above) */
.result .pill,
.result span.pill {
  display: inline-block !important;
  background: #e2f0f2;
  color: #0b3a40;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
}

/* Prevent empty sections from taking space */
.card:empty,
.result:empty {
  display: none;
}

/* Ensure proper spacing between sections */
section.card + section.card {
  margin-top: 10px;
}

/* Consistent spacing for muted text after section titles */
#disc .muted,
#gifts .muted {
  margin-top: 10px;
  margin-bottom: 10px;
}

/* Hide any overflow indicators */
.container {
  max-width: 100%;
  padding: 0;
  overflow: visible;
}

