/* Dysrhythmia Quick Reference Handbook - Print Styles */

:root {
  --ink: #0b0f1a;
  --navy: #0f234d;
  --blue: #1f4db8;
  --cyan: #13c2c2;
  --light-blue: #e8f0ff;
  --border: #c5d4e8;
  --bg: #ffffff;
  --gray: #5a6782;
  --red: #d32f2f;
  --green: #2e7d32;
}

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

body {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 11pt;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
}

/* Print Controls (hidden when printing) */
.print-controls {
  padding: 24px 32px;
  background: linear-gradient(135deg, #f0f5ff 0%, #e8f4ff 100%);
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.print-controls h1 {
  font-size: 24px;
  color: var(--navy);
  margin: 0;
}

.print-controls p {
  color: var(--gray);
  flex: 1;
}

.print-controls button {
  background: var(--blue);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.print-controls button:hover {
  background: var(--navy);
}

.print-controls a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 500;
}

.print-controls a:hover {
  text-decoration: underline;
}

/* Page Structure */
.page {
  width: 100%;
  max-width: 8.5in;
  min-height: 11in;
  margin: 0 auto;
  padding: 0.4in 0.5in;
  background: white;
  position: relative;
  page-break-after: always;
}

.page:last-child {
  page-break-after: auto;
}

.page-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--blue);
}

.page-header h1 {
  font-size: 28pt;
  color: var(--navy);
  margin-bottom: 4px;
}

.page-header .tagline {
  font-size: 14pt;
  color: var(--blue);
  font-weight: 500;
}

.section-title {
  font-size: 18pt;
  color: var(--navy);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--blue);
}

.page-number {
  position: absolute;
  bottom: 0.3in;
  right: 0.5in;
  font-size: 10pt;
  color: var(--gray);
}

/* Cards */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 14px;
}

.card.full {
  width: 100%;
}

.card.highlight {
  background: var(--light-blue);
  border-color: var(--blue);
}

.card h2 {
  font-size: 14pt;
  color: var(--navy);
  margin-bottom: 10px;
}

.card h3 {
  font-size: 12pt;
  color: var(--navy);
  margin-bottom: 8px;
}

.card h4 {
  font-size: 11pt;
  color: var(--blue);
  margin-bottom: 6px;
}

.card p {
  margin-bottom: 6px;
}

.card ul {
  margin-left: 18px;
  margin-bottom: 6px;
}

.card li {
  margin-bottom: 3px;
}

.note {
  font-size: 10pt;
  color: var(--gray);
  font-style: italic;
  margin-top: 8px;
}

/* Two Column Layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10pt;
}

th, td {
  padding: 6px 10px;
  text-align: left;
  border: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: var(--light-blue);
  font-weight: 600;
  color: var(--navy);
}

.rhythm-table th {
  font-size: 9pt;
}

.rhythm-table td {
  font-size: 9.5pt;
}

.rhythm-table.blocks td {
  font-size: 9pt;
}

.data-table {
  margin-bottom: 10px;
}

.data-table.dosing td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

.compare-table {
  font-size: 9.5pt;
}

.compare-table th:first-child {
  width: 25%;
}

/* 5-Step Table */
.steps-table {
  border: none;
}

.steps-table td {
  border: none;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.steps-table tr:last-child td {
  border-bottom: none;
}

.step-num {
  width: 40px;
  text-align: center;
  font-size: 18pt;
  font-weight: 700;
  color: var(--blue);
  vertical-align: middle;
}

.step-name {
  width: 100px;
  font-weight: 600;
  color: var(--navy);
  vertical-align: middle;
}

.step-desc {
  color: var(--ink);
}

/* Conduction Pathway */
.pathway {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 12px 0;
  font-size: 10pt;
}

.pathway .node {
  background: var(--light-blue);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--blue);
  font-weight: 500;
}

.pathway .node.slow {
  background: #fff3cd;
  border-color: #ffc107;
}

.pathway .arrow {
  color: var(--blue);
  font-size: 14pt;
  font-weight: bold;
}

/* Algorithm Styling */
.card.algorithm {
  padding: 14px;
}

.algo-flow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.algo-flow.horizontal {
  flex-direction: row;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.algo-box {
  background: var(--light-blue);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  text-align: center;
  font-size: 9.5pt;
  max-width: 280px;
}

.algo-box.highlight-box {
  background: #e3f2fd;
  border-color: var(--blue);
  border-width: 2px;
}

.algo-box.full-width {
  max-width: 100%;
  width: 100%;
  margin-top: 12px;
  text-align: left;
}

.algo-arrow {
  font-size: 16pt;
  color: var(--blue);
  font-weight: bold;
}

.algo-arrow-h {
  font-size: 18pt;
  color: var(--blue);
  font-weight: bold;
}

.algo-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
  margin-top: 8px;
}

.algo-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.algo-branch ul {
  text-align: left;
  font-size: 9pt;
  margin-left: 16px;
}

.algo-branch li {
  margin-bottom: 2px;
}

.branch-header {
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 10pt;
  text-align: center;
}

.branch-header.shockable {
  background: #ffebee;
  color: var(--red);
  border: 2px solid var(--red);
}

.branch-header.non-shockable {
  background: #e8f5e9;
  color: var(--green);
  border: 2px solid var(--green);
}

.algo-split-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.algo-mini {
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font-size: 9pt;
  text-align: center;
}

/* Inline list for PVC patterns */
.inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.inline-list li {
  background: var(--light-blue);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 10pt;
}

/* Screen-only styling for preview */
@media screen {
  body {
    background: #e8eef5;
    padding: 20px 0;
  }

  .page {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 20px;
  }
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: white;
    padding: 0;
  }

  .page {
    margin: 0;
    padding: 0.35in 0.45in;
    box-shadow: none;
    min-height: auto;
    page-break-inside: avoid;
  }

  .card {
    break-inside: avoid;
  }

  table {
    break-inside: avoid;
  }

  .algo-split {
    break-inside: avoid;
  }

  /* Ensure colors print */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Slightly reduce font sizes for print */
  .rhythm-table {
    font-size: 9pt;
  }

  .data-table {
    font-size: 9pt;
  }
}

/* Page-specific adjustments */
@page {
  size: letter;
  margin: 0;
}
