/* ==========================================================================
   ReproBridge · 好孕桥 - Clinical Genetics & PGT-M Counseling Platform
   Theme: 粉紫色 / 玫瑰粉 (Rose-Pink & Amethyst-Plum Medical Genetics Theme)
   Optimized for Desktop & Mobile Reading (适用于手机端流畅阅读与触控)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --color-primary-pink: #ec4899;
  --color-primary-rose: #db2777;
  --color-primary-purple: #9333ea;
  --color-deep-plum: #701a75;
  --color-wine: #831843;
  --color-dark-bg: #2b0833;
  --color-page-bg: #fdf6f9;
  --color-card-border: #f3d5ea;
  --color-card-hover: #fae8f3;
  --shadow-pink: 0 4px 14px rgba(219, 39, 119, 0.25);
  --shadow-purple: 0 4px 14px rgba(147, 51, 234, 0.25);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--color-page-bg);
  color: #1e293b;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

code, .font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Hide scrollbar while preserving smooth swipe */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ==========================================================================
   Top Navigation Header & Tabs (Strict single-line, zero wrap, touch scroll)
   ========================================================================== */
.main-header {
  background: linear-gradient(135deg, #2b0833 0%, #4a0d4c 35%, #701a75 70%, #831843 100%);
  border-bottom: 1px solid rgba(244, 114, 182, 0.28);
  box-shadow: 0 4px 20px rgba(43, 8, 51, 0.35);
}

.nav-tabs-wrapper {
  display: flex;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  gap: 0.35rem;
  padding: 0.25rem 0;
}

.nav-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  word-break: keep-all !important;
  padding: 0.45rem 0.85rem !important;
  font-size: 0.825rem !important;
  line-height: 1.25rem !important;
  font-weight: 500 !important;
  border-radius: 0.6rem !important;
  color: #f3e8ff !important;
  background-color: transparent !important;
  border: 1px solid transparent !important;
  transition: all 0.18s ease-in-out !important;
  cursor: pointer !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(244, 114, 182, 0.3) !important;
}

.nav-btn.active {
  color: #ffffff !important;
  background: linear-gradient(135deg, #db2777 0%, #9333ea 100%) !important;
  box-shadow: 0 2px 12px rgba(219, 39, 119, 0.45) !important;
  border-color: #f472b6 !important;
  font-weight: 600 !important;
}

.nav-btn i, .nav-btn svg {
  width: 1rem !important;
  height: 1rem !important;
  margin-right: 0.375rem !important;
  flex-shrink: 0 !important;
}

/* Button & Card Aesthetics in Pink-Purple Palette */
button, .btn {
  white-space: nowrap;
}

.btn-primary-gradient {
  background: linear-gradient(135deg, #db2777 0%, #9333ea 100%);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(219, 39, 119, 0.3);
  transition: all 0.2s ease;
}
.btn-primary-gradient:hover {
  background: linear-gradient(135deg, #be185d 0%, #7e22ce 100%);
  box-shadow: 0 4px 14px rgba(219, 39, 119, 0.45);
  transform: translateY(-1px);
}

.btn-secondary-pink {
  background-color: #fdf2f8;
  color: #be185d;
  border: 1px solid #fbcfe8;
  transition: all 0.18s ease;
}
.btn-secondary-pink:hover {
  background-color: #fce7f3;
  border-color: #f472b6;
  color: #9d174d;
}

/* Cards & Panels */
.pink-card {
  background-color: #ffffff;
  border: 1px solid #f3d5ea;
  border-radius: 0.85rem;
  box-shadow: 0 2px 10px rgba(112, 26, 117, 0.04);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.pink-card:hover {
  border-color: #f472b6;
  box-shadow: 0 4px 16px rgba(112, 26, 117, 0.08);
}

/* Criteria tag active states */
.criteria-item {
  transition: all 0.15s ease-in-out;
  cursor: pointer;
  border-radius: 0.5rem;
  padding: 0.65rem;
  border: 1px solid #f3d5ea;
}
.criteria-item:hover {
  border-color: #db2777;
  background-color: #fdf2f8;
}
.criteria-item.selected-pathogenic {
  background-color: #fdf2f8;
  border-color: #db2777;
  box-shadow: 0 0 0 1px #db2777;
}
.criteria-item.selected-benign {
  background-color: #f0fdf4;
  border-color: #22c55e;
  box-shadow: 0 0 0 1px #22c55e;
}

/* ==========================================================================
   Pedigree Chart Workspace (家系图绘制工作台样式)
   ========================================================================== */
.pedigree-canvas-box {
  background-color: #220828;
  background-image: radial-gradient(rgba(244, 114, 182, 0.12) 1px, transparent 1px);
  background-size: 20px 20px;
  position: relative;
  overflow: auto;
  border-radius: 0.75rem;
  border: 1px solid rgba(219, 39, 119, 0.35);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.4);
}

.pedigree-svg {
  display: block;
  min-width: 100%;
  min-height: 520px;
  shape-rendering: geometricPrecision;
  text-rendering: geometricPrecision;
}

.pedigree-person-node:hover rect,
.pedigree-person-node:hover circle,
.pedigree-person-node:hover polygon {
  filter: drop-shadow(0 0 8px rgba(219, 39, 119, 0.85));
}

.pedigree-person-node text {
  user-select: none;
}

.pedigree-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap !important;
  word-break: keep-all !important;
  flex-shrink: 0 !important;
  border-radius: 0.5rem;
  border: 1px solid rgba(219, 39, 119, 0.4);
  background-color: rgba(64, 12, 75, 0.85);
  color: #fce7f3;
  transition: all 0.15s ease-in-out;
  cursor: pointer;
}

.pedigree-tool-btn:hover:not(:disabled) {
  background-color: #701a75;
  border-color: #ec4899;
  color: #ffffff;
  transform: translateY(-1px);
}

.pedigree-tool-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pedigree-report-svg-box {
  background: #ffffff;
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid #f3d5ea;
  box-shadow: 0 4px 12px rgba(112, 26, 117, 0.05);
  margin: 1.5rem 0;
  overflow-x: auto;
}

.pedigree-report-svg-box svg {
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  display: block;
}

/* ==========================================================================
   Mobile Reading & Responsive Layout Optimizations (手机阅读优化)
   ========================================================================== */
.mobile-reading-container {
  font-size: 15px;
  line-height: 1.75;
  color: #1e293b;
}

.mobile-reading-container h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-deep-plum);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.mobile-reading-container h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-wine);
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.mobile-reading-container p {
  margin-bottom: 0.9rem;
  text-align: justify;
}

/* Accordion details styling for mobile skim & deep read */
details.portal-accordion {
  border: 1px solid #f3d5ea;
  border-radius: 0.75rem;
  background-color: #ffffff;
  margin-bottom: 0.85rem;
  overflow: hidden;
  transition: all 0.2s ease;
}

details.portal-accordion[open] {
  border-color: #f472b6;
  box-shadow: 0 4px 14px rgba(219, 39, 119, 0.08);
}

details.portal-accordion > summary {
  padding: 0.95rem 1.15rem;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  color: #701a75;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  background: #fdf5f9;
  outline: none;
  min-height: 48px; /* Touch-friendly tap target */
}

details.portal-accordion > summary:hover {
  background: #fae8f3;
  color: #831843;
}

details.portal-accordion > summary::-webkit-details-marker {
  display: none;
}

details.portal-accordion .accordion-body {
  padding: 1.15rem;
  border-top: 1px solid #f3d5ea;
  background-color: #ffffff;
  font-size: 0.925rem;
  line-height: 1.75;
}

/* Mobile Table Horizontal Scroll with Touch Scrolling */
.mobile-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
  border-radius: 0.6rem;
  border: 1px solid #f3d5ea;
}

.mobile-table-scroll table {
  min-width: 600px;
  width: 100%;
  border-collapse: collapse;
}

.mobile-table-scroll th {
  background-color: #fdf2f8;
  color: #701a75;
  font-weight: 700;
  font-size: 0.825rem;
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid #f3d5ea;
}

.mobile-table-scroll td {
  padding: 0.65rem 0.85rem;
  font-size: 0.825rem;
  border-bottom: 1px solid #f8e8f2;
}

/* Responsive Media Queries for Smart Phones (< 768px) */
@media (max-width: 768px) {
  body {
    font-size: 14.5px;
  }

  main {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    padding-top: 0.75rem !important;
  }

  .nav-btn {
    padding: 0.4rem 0.65rem !important;
    font-size: 0.78rem !important;
  }

  .nav-btn i, .nav-btn svg {
    width: 0.875rem !important;
    height: 0.875rem !important;
    margin-right: 0.25rem !important;
  }

  .pedigree-canvas-box {
    border-radius: 0.5rem;
  }

  .pedigree-svg {
    min-height: 440px;
  }

  /* Make mobile buttons easy to tap */
  button, .btn {
    min-height: 38px;
  }
}

/* Print Styles for Clinical Reports */
@media print {
  header, footer, nav, button, .no-print {
    display: none !important;
  }
  body, main {
    background: white !important;
    color: black !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }
  #printable-report {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }
  .tab-content {
    display: none !important;
  }
  #tab-report {
    display: block !important;
  }
}
