/* src/styles/cv-print.css */
/* Styles for print mode */
@media print {
  /* Page setup */
  @page {
    margin: 1cm;
    size: A4;
  }
  
  /* Force light mode for printing */
  :root {
    color-scheme: light !important;
  }
  
  html {
    /* Force light mode for print */
    background-color: white !important;
    filter: none !important;
  }
  
  /* Custom print wrapper */
  .cv-print-wrapper {
    background-color: white !important;
    color: black !important;
  }
  
  /* All content within print wrapper should use light theme */
  .cv-print-wrapper * {
    color: black !important;
    background-color: white !important;
    border-color: #ddd !important;
  }
  
  /* Basic body styling with consistent fonts */
  body {
    font-size: 9pt;
    line-height: 1.25;
    color: #000 !important;
    background-color: #fff !important;
    font-family: 'Inconsolata', monospace !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  
  /* Ensure consistent font family throughout */
  * {
    font-family: 'Inconsolata', monospace !important;
  }
  
  /* Remove dark mode entirely */
  .dark {
    background-color: #fff !important;
    color: #000 !important;
  }
  
  /* Force background colors and images to print */
  html {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  
  /* Container adjustments */
  .max-w-4xl {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    background-color: #fff !important;
    color: #000 !important;
  }
  
  /* Make sure all wrappers use light theme */
  .bg-white.dark\:bg-slate-800 {
    background-color: #fff !important;
    color: #000 !important;
  }
  
  /* Typography and headings */
  h1, h2, h3, h4 {
    page-break-after: avoid !important;
    break-after: avoid !important;
    margin-top: 0 !important;
    color: #000 !important;
  }
  
  /* Keep section headers with at least some of their content */
  h2 {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }
  
  h2 + * {
    page-break-before: avoid !important;
    break-before: avoid !important;
  }
  
  /* Standard typographic scale for print */
  h1 {
    font-size: 14pt !important;
    margin-bottom: 0.2cm !important;
    color: #000 !important;
    font-family: 'Inconsolata', monospace !important;
  }
  
  h2 {
    font-size: 12pt !important;
    margin-bottom: 0.15cm !important;
    border-bottom: 1pt solid #000 !important;
    padding-bottom: 0.08cm !important;
    color: #000 !important;
    font-family: 'Inconsolata', monospace !important;
  }
  
  h3 {
    font-size: 10pt !important;
    margin-bottom: 0.1cm !important;
    color: #000 !important;
    font-family: 'Inconsolata', monospace !important;
  }
  
  h4 {
    font-size: 9pt !important;
    margin-bottom: 0.1cm !important;
    color: #000 !important;
    font-family: 'Inconsolata', monospace !important;
  }
  
  /* Force all text elements to use black text */
  p, span, div, li, a {
    color: #000 !important;
  }
  
  /* Contact links styling for print */
  .cv-print-wrapper a[href] {
    display: inline-flex !important;
    align-items: center !important;
    color: #000 !important;
    text-decoration: none !important;
  }
  
  /* Put contacts on one line in print */
  .mt-3.flex.flex-wrap {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    gap: 0.2cm !important;
    margin-top: 0.1cm !important;
    margin-bottom: 0.1cm !important;
    width: 100% !important;
  }
  
  /* Size and space the contact items evenly */
  .mt-3.flex.flex-wrap a {
    flex: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: 8pt !important;
  }
  
  /* Force work experience to be more compact */
  h2#experience {
    page-break-before: auto !important;
    break-before: auto !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
    font-size: 11pt !important;
    margin-bottom: 0.1cm !important;
    padding-bottom: 0.05cm !important;
  }
  
  h2#experience + * {
    page-break-before: avoid !important;
    break-before: avoid !important; 
  }

  h2#skills {
    page-break-before: always !important;
    break-before: page !important;
    margin-top: 1cm !important;
    padding-top: 0.5cm !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
  }
  
  h2#languages, h2#education {
    page-break-before: always !important;
    break-before: page !important;
    margin-top: 0.5cm !important;
    padding-top: 0.5cm !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
  }
  
  /* Keep section elements with their section headings */
  h2 + div, section > h2 + div {
    page-break-before: avoid !important;
    break-before: avoid !important;
  }
  
  /* Ensure work experience section and first three positions stay on first page */
  #experience {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }
  
  .first-company-wrapper {
    page-break-before: avoid !important;
    break-before: avoid !important;
  }
  
  /* Keep first three positions together on first page */
  .first-page-positions {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  
  /* Make the first three positions more compact */
  .first-page-positions .job-section {
    padding-bottom: 0.1cm !important;
    margin-bottom: 0.1cm !important;
  }
  
  /* Job titles and dates formatting */
  h3 .job-title {
    font-weight: bold !important;
  }
  
  .date-range {
    font-style: italic !important;
  }
  
  .first-page-positions ul {
    margin-top: 0.05cm !important;
    margin-bottom: 0.1cm !important;
    padding-left: 0.3cm !important;
  }
  
  .first-page-positions li {
    margin-bottom: 0.02cm !important;
    font-size: 9pt !important;
  }
  
  .first-page-positions li strong {
    font-weight: bold !important;
  }
  
  /* List formatting */
  ul {
    margin-top: 0.05cm !important;
    margin-bottom: 0.1cm !important;
    padding-left: 0.3cm !important;
  }
  
  /* Make nested lists compact */
  li ul {
    margin-top: 0.05cm !important;
    margin-bottom: 0.05cm !important;
  }
  
  /* Standard page breaks for companies and positions */
  .company-wrapper > .company-section {
    margin-top: 0.3cm !important;
    margin-bottom: 0.2cm !important;
  }
  
  .job-section {
    margin-top: 0.15cm !important;
    margin-bottom: 0.15cm !important;
  }
  
  /* Special handling for skills-languages-education section */
  .skills-languages-education {
    page-break-before: always !important;
    break-before: page !important;
  }
  
  .skills-languages-education section {
    margin-bottom: 0.6cm !important;
  }
  
  /* Adjust spacing for sections */
  .skills-languages-education h2 {
    margin-bottom: 0.15cm !important;
    padding-bottom: 0.05cm !important;
  }
  
  .skills-languages-education #languages {
    margin-top: 0.3cm !important;
  }
  
  .skills-languages-education #education {
    margin-top: 0.3cm !important;
  }
  
  /* Add a tiny bit of spacing after paragraphs */
  p {
    margin-bottom: 0.15cm !important;
  }
  
  /* Hide UI elements - more comprehensive */
  header, 
  nav, 
  footer,
  [aria-label*="nav"],
  [id*="toggle"],
  [class*="toggle"],
  [class*="nav"],
  [class*="header"],
  [class*="footer"],
  [class*="button"],
  button, 
  .cv-nav, 
  .print\\:hidden,
  [id="print-cv"],
  [id="mobile-nav-toggle"],
  [id="theme-toggle"],
  [id="nav-toggle-icon"],
  [id="section-links"],
  .fixed,
  .absolute,
  .group,
  [class*="dark:"],
  button svg,
  .hidden,
  .sticky,
  [aria-label="Toggle theme"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    position: absolute !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }
  
  /* Selectively show contact icons in print */
  a svg {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    height: 0.4cm !important;
    width: 0.4cm !important;
    overflow: visible !important;
    color: #000 !important;
  }
  
  /* Contact information and header styling */
  .bg-slate-100, .dark\:bg-slate-700, .dark\:bg-slate-800, .bg-white {
    background-color: #fff !important;
    padding: 0 !important;
    margin-bottom: 0.5cm !important;
    color: #000 !important;
  }

  /* Make sure name and job title appear */
  .text-2xl, .text-3xl, .text-base, .text-lg, .uppercase {
    display: block !important;
    color: #000 !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    font-weight: bold !important;
    font-size: 18pt !important;
  }

  /* Optimize header spacing for print */
  .bg-slate-100 {
    padding-top: 0.3cm !important;
    padding-bottom: 0.3cm !important;
  }
  
  /* Make the header more compact */
  .space-y-2 {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }
  
  /* Make name more prominent but compact */
  h1.text-2xl, h1.text-3xl, h1.uppercase {
    margin-bottom: 0.1cm !important;
    padding-bottom: 0 !important;
  }
  
  /* Hide the description line in print */
  /* Only hide description in print mode */
  @media print {
    .space-y-2 > p {
      display: none !important;
      visibility: hidden !important;
      height: 0 !important;
      margin: 0 !important;
      padding: 0 !important;
    }
  }
  
  /* Make the header super compact */
  .bg-slate-100 {
    padding: 0.1cm !important;
    margin: 0 !important;
  }
  
  .space-y-2 {
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* Name small and compact */
  h1.text-2xl, h1.text-3xl {
    font-size: 14pt !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
  }
  
  /* Force light theme for all content */
  .dark\:text-slate-100,
  .dark\:text-slate-200,
  .dark\:text-slate-300,
  .dark\:text-slate-400 {
    color: #000 !important;
  }
  
  .dark\:bg-slate-800,
  .dark\:bg-slate-700,
  .dark\:bg-slate-900 {
    background-color: #fff !important;
  }
  
  /* Contact links special handling for print */
  a[rel="noopener noreferrer"], .contact-item a {
    color: #000 !important;
    text-decoration: none !important;
    display: inline-block !important;
    margin-right: 0.5cm !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    font-size: 10pt !important;
  }
  
  /* Special override for the email, LinkedIn and GitHub links */
  a[href*="mailto"], a[href*="linkedin"], a[href*="github"] {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    color: #000 !important;
    text-decoration: none !important;
    font-size: 10pt !important;
    margin-right: 0.5cm !important;
  }
  
  /* Make the hidden span with the full URL visible */
  a[rel="noopener noreferrer"] span.hidden,
  a[href*="mailto"] span.hidden,
  a[href*="linkedin"] span.hidden,
  a[href*="github"] span.hidden {
    display: inline !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
  }
  
  /* Ensure all contact values are visible in print */
  a[rel="noopener noreferrer"] span.hidden {
    display: inline !important;
  }
  
  /* Company and job sections */
  .company-section {
    margin-top: 0.25cm !important;
    margin-bottom: 0.2cm !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  
  .job-section, .education-section {
    margin-top: 0.15cm !important;
    margin-bottom: 0.15cm !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  
  /* Text formatting */
  .company-name, .school-name {
    color: #000 !important;
    font-weight: bold !important;
  }
  
  .job-title {
    color: #000 !important;
    font-weight: 600 !important;
  }
  
  .date-range {
    color: #333 !important;
    font-style: italic !important;
    font-size: 8pt !important;
    font-family: 'Inconsolata', monospace !important;
  }
  
  .degree {
    color: #000 !important;
    font-weight: 500 !important;
  }
  
  /* Improved list formatting */
  ul {
    margin-top: 0.1cm !important;
    margin-bottom: 0.15cm !important;
    padding-left: 0.4cm !important;
  }
  
  li {
    page-break-inside: auto !important;
    break-inside: auto !important;
    orphans: 2 !important;
    widows: 2 !important;
    margin-bottom: 0.05cm !important;
    font-size: 9pt !important;
    font-family: 'Inconsolata', monospace !important;
  }
  
  /* Nested lists */
  li ul {
    margin-top: 0.03cm !important;
    margin-bottom: 0.03cm !important;
  }
  
  /* Hide visual elements */
  .job-section::before, .job-section::after,
  .job-content::before, .education-section::before,
  .education-section::after, .company-section::before,
  .education-timeline::before, .date-range::before,
  .education-section::after {
    display: none !important;
  }

  /* Skills visualization - improved for print */
  .skills-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 0.15cm !important;
    margin-top: 0.15cm !important;
    padding-left: 0 !important;
    list-style-type: none !important;
  }
  
  .skills-grid > * {
    border: 1px solid #ccc !important;
    background-color: #fff !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  
  .skill-item {
    border: 1px solid #ccc !important;
    background-color: #fff !important;
    padding: 0.15cm !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  
  /* Skill name and level - consistent fonts */
  .skill-item .font-medium {
    font-weight: bold !important;
    font-size: 9pt !important;
    color: #000 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: block !important;
    font-family: 'Inconsolata', monospace !important;
  }
  
  .skill-item .text-xs {
    font-size: 8pt !important;
    color: #333 !important;
    white-space: nowrap !important;
    text-align: right !important;
    font-family: 'Inconsolata', monospace !important;
  }
  
  /* Improved grid layout in print */
  .skill-item > div:first-child {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 0.08cm !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 0.3cm !important;
  }
  
  /* Skill bar */
  .skill-item .h-2,
  .dark .skill-item .h-2 {
    background-color: #eee !important;
    height: 0.08cm !important;
    margin-top: 0.05cm !important;
  }
  
  .skill-item .h-2 div,
  .dark .skill-item .h-2 div,
  .skill-item .h-2 div[class*="bg-"],
  .dark .skill-item .h-2 div[class*="bg-"] {
    background-color: #333 !important;
    height: 100% !important;
  }
  
  /* Professional page header/footer */
  @page {
    @top-center {
      content: "Erfi Anugrah | Curriculum Vitae";
      font-family: 'Inconsolata', monospace;
      font-size: 9pt;
      color: #666;
    }
    @bottom-center {
      content: "Page " counter(page) " of " counter(pages);
      font-family: 'Inconsolata', monospace;
      font-size: 9pt;
      color: #666;
    }
    @bottom-right {
      content: "www.erfianugrah.com/cv";
      font-family: 'Inconsolata', monospace;
      font-size: 8pt;
      color: #666;
    }
    @bottom-left {
      content: "Updated: " attr(data-updated-date);
      font-family: 'Inconsolata', monospace;
      font-size: 8pt;
      color: #666;
    }
  }
  
  /* Job section separators */
  .job-section:not(:last-child) {
    border-bottom: 1px dotted #ccc !important;
    padding-bottom: 0.2cm !important;
  }
  
  /* Job section specific print styles */
  .job-section {
    margin-bottom: 0.2cm !important;
    padding-left: 0 !important;
    position: relative !important;
  }
  
  /* Duration indicator styling for print */
  .duration-indicator::after {
    width: 0.15cm !important;
    height: 0.15cm !important;
    border: 1px solid #666 !important;
    background-color: white !important;
    display: inline-block !important;
    margin-left: 0.1cm !important;
  }
  
  /* Expand any truncated text */
  .line-clamp-2, .line-clamp-3 {
    -webkit-line-clamp: unset !important;
    display: block !important;
    overflow: visible !important;
    text-overflow: unset !important;
    white-space: normal !important;
  }
  
  /* CV content area padding */
  #cv-content {
    padding: 0 0.5cm !important;
    margin: 0 !important;
  }

  /* Fix footer overflow */
  #cv-content .prose {
    padding: 0 !important;
    margin: 0 !important;
  }
  
  /* Fix flex layouts in print */
  .flex {
    display: block !important;
  }
  
  /* Fix color legend display */
  .duration-legend {
    display: none !important;
  }
  
}