/* 
   Saudi Olympic & Paralympic Committee - O&M Digital Manual Stylesheet
   Premium, responsive design featuring a green/gold athletic recovery aesthetic,
   light/dark modes, custom controls, and print-media optimization.
*/

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

:root {
  /* HSL Color System */
  --primary-hue: 158;
  --primary-sat: 72%;
  --primary-light: 21%;
  
  --primary: hsl(var(--primary-hue), var(--primary-sat), var(--primary-light)); /* Deep Emerald */
  --primary-hover: hsl(var(--primary-hue), var(--primary-sat), 15%);
  --primary-rgb: 15, 91, 62;
  
  --secondary: hsl(46, 65%, 52%); /* Olympic Gold */
  --secondary-hover: hsl(46, 65%, 45%);
  
  --bg-primary: #fcfdfe;
  --bg-secondary: #f3f6f4;
  --bg-tertiary: #e9efe9;
  
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --border-color: #cbd5e1;
  --border-light: #e2e8f0;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --sidebar-width: 320px;
  --header-height: 70px;
  --footer-height: 45px;
}

[data-theme="dark"] {
  --bg-primary: #121413;
  --bg-secondary: #181d1a;
  --bg-tertiary: #1f2723;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --border-color: #334155;
  --border-light: #1e293b;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  line-height: 1.6;
}

/* ==========================================
   APP SHELL LAYOUT
   ========================================== */

/* Sidebar */
aside.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-primary);
  border-right: 1px solid var(--border-color);
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

aside.sidebar.collapsed {
  transform: translateX(-100%);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  height: 45px;
  width: auto;
  border-radius: var(--radius-sm);
}

.sidebar-title-wrap h2 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--primary);
  text-transform: uppercase;
}

.sidebar-title-wrap p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.sidebar-nav-container {
  flex: 1;
  overflow-y: auto;
  padding: 15px 10px;
}

/* Navigation List */
.nav-menu {
  list-style: none;
}

.nav-item {
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background-color: var(--bg-secondary);
  color: var(--primary);
}

.nav-item.active > .nav-link {
  background-color: var(--bg-tertiary);
  color: var(--primary);
  font-weight: 600;
}

.nav-link-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link-content i {
  width: 16px;
  text-align: center;
  color: var(--text-muted);
}

.nav-item.active > .nav-link .nav-link-content i {
  color: var(--primary);
}

.sub-menu {
  list-style: none;
  padding-left: 36px;
  margin-top: 4px;
  display: none;
}

.nav-item.open .sub-menu {
  display: block;
}

.sub-menu li {
  margin-bottom: 2px;
}

.sub-menu a {
  display: block;
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.sub-menu a:hover {
  color: var(--primary);
  background-color: var(--bg-secondary);
}

.sub-menu li.active a {
  color: var(--primary);
  font-weight: 600;
  background-color: var(--bg-tertiary);
}

/* Theme Toggle inside Sidebar Footer */
.sidebar-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-secondary);
}

.theme-toggle-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.toggle-switch-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
}

.toggle-switch-btn:hover {
  color: var(--primary);
}

/* Main Content Panel */
main.main-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Main Top Header */
header.top-header {
  height: var(--header-height);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 90;
}

.header-left-box {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-sidebar-toggle {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 6px;
  border-radius: var(--radius-sm);
}

.btn-sidebar-toggle:hover {
  background-color: var(--bg-secondary);
  color: var(--primary);
}

/* Breadcrumbs */
.breadcrumbs-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.breadcrumbs-container span.separator {
  color: var(--border-color);
}

.breadcrumbs-container a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumbs-container a:hover {
  color: var(--primary);
}

.breadcrumbs-container span.active-node {
  color: var(--text-primary);
  font-weight: 600;
}

/* Header Utilities */
.header-actions-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Search Box Container */
.search-wrapper {
  position: relative;
  width: 280px;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
  background-color: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

/* Utility Action Buttons */
.btn-action-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Base Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-outline {
  border-color: var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: var(--bg-secondary);
}

.btn-outline.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-dark {
  background-color: #1e293b;
  color: white;
}

.btn-dark:hover {
  background-color: #0f172a;
}

/* Main Inner Content Body */
.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 30px;
  display: flex;
  justify-content: center;
}

/* Paper Binder effect */
.page-paper-container {
  width: 100%;
  max-width: 950px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: 45px;
  min-height: calc(100vh - var(--header-height) - var(--footer-height) - 60px);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Watermark */
.page-paper-container::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 250px;
  height: 250px;
  opacity: 0.025;
  background-image: url('../logos/owner-logo.jpg');
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  pointer-events: none;
}

/* Pagination Footer */
footer.navigation-footer {
  height: var(--footer-height);
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 90;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================
   PAGE-SPECIFIC STYLING DETAILS
   ========================================== */

/* Title Cover Page */
.cover-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 700px;
  text-align: center;
}

.cover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 1px;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 10px;
}

.confidential-badge {
  color: #dc2626;
}

.doc-code {
  color: var(--text-muted);
}

.cover-project-logo {
  margin: 30px 0;
  display: flex;
  justify-content: center;
}

.owner-logo-box {
  border: 1px solid var(--border-color);
  padding: 15px;
  border-radius: var(--radius-md);
  max-width: 320px;
  background-color: white;
}

.logo-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.owner-logo-box img {
  max-height: 70px;
  width: auto;
}

.fallback-logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  padding: 10px;
}

.cover-main-title {
  margin: 40px 0;
}

.cover-main-title h2 {
  font-size: 1.15rem;
  color: var(--secondary);
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.cover-main-title h1 {
  font-size: 2.1rem;
  color: var(--primary);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 12px;
}

.cover-main-title h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 1px;
}

.cover-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  text-align: left;
  background-color: var(--bg-secondary);
  padding: 24px;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--primary);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
}

.meta-item strong {
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.5px;
}

.meta-item span {
  color: var(--text-primary);
  font-weight: 600;
}

.logo-meta-wrap {
  display: flex;
  align-items: center;
  height: 40px;
}

.logo-meta-wrap img {
  max-height: 35px;
  width: auto;
}

.cover-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  margin-top: 30px;
}

.revision-box {
  text-align: left;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.rev-line {
  margin-bottom: 2px;
}

.qr-codes-container {
  display: flex;
  gap: 24px;
}

.qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.qr-item img {
  width: 75px;
  height: 75px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px;
  background-color: white;
}

.qr-link {
  font-size: 0.72rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.qr-link:hover {
  text-decoration: underline;
}

/* Document Approval Sheet */
.document-approval-wrap h2,
.transmittal-sheet-wrap h2,
.revision-history-wrap h2,
.project-info-wrap h2,
.scope-work-wrap h2,
.system-overview-wrap h2,
.system-desc-jacuzzi h2,
.system-desc-sauna h2,
.system-desc-sauna-heater h2,
.op-jacuzzi-prestart h2,
.op-jacuzzi-startup h2,
.op-jacuzzi-normal h2,
.op-jacuzzi-shutdown h2,
.op-jacuzzi-emergency h2,
.op-sauna-prestart h2,
.op-sauna-startup h2,
.op-sauna-normal h2,
.op-sauna-shutdown h2,
.op-sauna-emergency h2,
.op-general-safety h2,
.op-hydrotherapy-guidelines h2,
.op-water-chemistry h2,
.op-dosing-calculator h2,
.maint-jacuzzi-daily h2,
.maint-jacuzzi-weekly h2,
.maint-jacuzzi-monthly h2,
.maint-jacuzzi-quarterly h2,
.maint-jacuzzi-annual h2,
.maint-sauna-daily h2,
.maint-sauna-weekly h2,
.maint-sauna-monthly h2,
.maint-sauna-quarterly h2,
.maint-sauna-annual h2,
.trouble-jacuzzi-flow h2,
.trouble-jacuzzi-temp h2,
.trouble-jacuzzi-water h2,
.trouble-jacuzzi-noise h2,
.trouble-jacuzzi-leaks h2,
.trouble-sauna-power h2,
.trouble-sauna-heating h2,
.trouble-sauna-sensors h2,
.trouble-sauna-wood h2,
.trouble-sauna-corrective h2,
.pm-jacuzzi-wrap h2,
.pm-sauna-wrap h2,
.equipment-list-wrap h2,
.tech-data-wrap h2,
.submittal-wrap h2,
.submittal-detail h2,
.shop-dwg-wrap h2,
.shop-dwg-detail h2,
.method-statement-wrap h2,
.tc-report-wrap h2,
.ir-wrap h2,
.ir-detail h2,
.certificates-wrap h2,
.spares-policy-wrap h2,
.spares-list-wrap h2,
.mfr-manuals-wrap h2,
.warranty-wrap h2,
.asbuilt-wrap h2,
.handover-wrap h2,
.emergency-wrap h2,
.contact-directory-wrap h2,
.training-wrap h2,
.appendix-wrap h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.section-intro {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.approval-matrix {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 35px;
}

.approval-card {
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 250px;
}

.approval-badge {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.status-approved {
  background-color: #d1fae5;
  color: #065f46;
}

.status-pending {
  background-color: #fef3c7;
  color: #92400e;
}

.approval-card h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 15px;
  letter-spacing: 0.5px;
}

.approval-field {
  font-size: 0.8rem;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.signature-box {
  margin-top: 15px;
  height: 60px;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-primary);
}

.signature-box.signed {
  border-style: solid;
  border-color: rgba(var(--primary-rgb), 0.3);
  background-color: rgba(var(--primary-rgb), 0.02);
}

.sig-font {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.15rem;
  font-weight: 700;
  font-style: italic;
  color: #0369a1;
}

.sig-line {
  font-size: 0.58rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 0.85rem;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.data-table th {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tbody tr:nth-child(even) {
  background-color: var(--bg-secondary);
}

.data-table tbody tr:hover {
  background-color: var(--bg-tertiary);
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.status-pill.green {
  background-color: #d1fae5;
  color: #065f46;
}

.status-pill.orange {
  background-color: #fef3c7;
  color: #92400e;
}

.status-pill.red {
  background-color: #fee2e2;
  color: #991b1b;
}

/* Transmittal sheet signoffs */
.transmittal-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  background-color: var(--bg-secondary);
  padding: 20px;
  border-radius: var(--radius-md);
  margin-bottom: 25px;
  font-size: 0.85rem;
}

.transmittal-message {
  font-size: 0.9rem;
  margin-bottom: 25px;
  color: var(--text-secondary);
}

.transmittal-signoffs {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  gap: 40px;
}

.sign-block {
  flex: 1;
}

.sign-block .label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 45px;
}

.sig-line-blank {
  border-top: 1px solid var(--text-primary);
  padding-top: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Table of Contents */
.toc-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toc-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background-color: var(--bg-secondary);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.88rem;
}

.toc-item-row:hover {
  background-color: var(--bg-tertiary);
  color: var(--primary);
  transform: translateX(4px);
  transition: transform 0.2s ease;
}

.toc-label-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toc-page-num {
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-mono);
}

/* Project Info blocks */
.info-blocks-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 30px;
}

.info-block {
  border: 1px solid var(--border-light);
  background-color: var(--bg-primary);
  padding: 20px;
  border-radius: var(--radius-md);
}

.info-block h3 {
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 12px;
  font-weight: 700;
  border-left: 3px solid var(--secondary);
  padding-left: 10px;
}

.info-block ul {
  list-style: none;
}

.info-block ul li {
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.system-summary-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 20px;
  border-radius: var(--radius-md);
  margin-top: 24px;
}

.system-summary-card h4 {
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 15px;
  text-align: center;
}

.system-summary-card.green-theme {
  border-left: 5px solid #10b981;
  background-color: rgba(16, 185, 129, 0.05);
}

.stats-row {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 15px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stat-box strong {
  font-size: 1.5rem;
  color: var(--primary);
  font-weight: 800;
}

.stat-box span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Bullet list standard */
.content-body ul {
  padding-left: 20px;
  margin-bottom: 18px;
}

.content-body ul li {
  margin-bottom: 6px;
  font-size: 0.88rem;
}

.content-body ol {
  padding-left: 20px;
  margin-bottom: 18px;
}

.content-body ol li {
  margin-bottom: 8px;
  font-size: 0.88rem;
}

/* Warnings and Alerts */
blockquote {
  border-left: 4px solid var(--primary);
  background-color: var(--bg-secondary);
  padding: 16px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 0.88rem;
  margin: 20px 0;
  color: var(--text-secondary);
}

.danger-alert-box {
  background-color: #fef2f2;
  border-left: 5px solid #ef4444;
  color: #991b1b;
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 20px 0;
  font-size: 0.88rem;
}

.danger-alert-box i {
  font-size: 1.5rem;
}

.warning-alert-box {
  background-color: #fffbeb;
  border-left: 5px solid #f59e0b;
  color: #92400e;
  padding: 16px;
  border-radius: var(--radius-md);
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 20px 0;
  font-size: 0.88rem;
}

.warning-alert-box i {
  font-size: 1.5rem;
}

/* Diagnostic Troubleshoot Cards */
.interactive-troubleshoot {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.t-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-primary);
  cursor: pointer;
  overflow: hidden;
}

.t-question {
  padding: 16px 20px;
  background-color: var(--bg-secondary);
  font-size: 0.88rem;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.t-question::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-muted);
}

.t-card.active .t-question::after {
  content: "-";
}

.t-answer {
  padding: 20px;
  border-top: 1px solid var(--border-light);
  display: none;
}

.t-card.active .t-answer {
  display: block;
  animation: slideDown 0.2s ease-out;
}

/* Steps Flow */
.steps-flow {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.step-card {
  display: flex;
  gap: 16px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 16px;
  align-items: flex-start;
  position: relative;
}

.step-num {
  background-color: var(--primary);
  color: white;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.step-card strong {
  font-size: 0.9rem;
  margin-bottom: 4px;
  display: block;
}

.step-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* PM Matrix Badges */
.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.badge-daily {
  background-color: #e0f2fe;
  color: #0369a1;
}

.badge-weekly {
  background-color: #f3e8ff;
  color: #6b21a8;
}

.badge-monthly {
  background-color: #ffedd5;
  color: #c2410c;
}

.pm-interactive-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

/* Spares Requisition Tool */
.interactive-spares-cart {
  background-color: var(--bg-secondary);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.cart-summary-box {
  margin-top: 20px;
  background-color: var(--bg-primary);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.cart-summary-box h4 {
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 12px;
}

.cart-summary-box pre {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  white-space: pre-wrap;
  background-color: var(--bg-secondary);
  padding: 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

/* As-Built viewer layout */
.viewer-layout-box {
  display: flex;
  gap: 20px;
  height: 500px;
}

.viewer-sidebar {
  width: 250px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.viewer-sidebar h4 {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 700;
}

.dwg-select-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dwg-select-list li {
  padding: 8px 12px;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  font-weight: 500;
}

.dwg-select-list li:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.dwg-select-list li.active {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
}

.viewer-main-canvas {
  flex: 1;
  border: 1px solid var(--border-color);
  background-color: #0f172a;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-img-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  transition: transform 0.2s cubic-bezier(0.1, 0.8, 0.3, 1);
  cursor: grab;
}

.viewer-img-container img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.fallback-canvas {
  color: white;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.viewer-controls {
  position: absolute;
  bottom: 15px;
  right: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(15, 23, 42, 0.8);
  padding: 6px 12px;
  border-radius: var(--radius-full);
}

.zoom-label {
  font-size: 0.72rem;
  color: white;
  font-weight: 600;
}

/* Upload portals */
.upload-portal-card {
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 24px;
}

.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 30px;
  text-align: center;
  cursor: pointer;
  background-color: var(--bg-primary);
}

.upload-zone:hover {
  border-color: var(--primary);
}

.upload-zone i {
  font-size: 2.5rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.uploaded-files-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item-mock {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
}

/* Chemical balance calculator styles */
.calc-panel {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 30px;
  background-color: var(--bg-secondary);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.calc-inputs {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.input-group input {
  padding: 8px 12px;
  font-size: 0.88rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.calc-results {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  padding: 20px;
  border-radius: var(--radius-md);
}

.calc-results h4 {
  font-size: 0.9rem;
  color: var(--primary);
  margin-bottom: 12px;
}

.result-placeholder {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chemical-alert-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chem-alert-item {
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
}

.chem-alert-item.alert-danger {
  background-color: #fee2e2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

.chem-alert-item.alert-warning {
  background-color: #fffbeb;
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

.chem-alert-item.alert-success {
  background-color: #d1fae5;
  color: #065f46;
  border-left: 4px solid #10b981;
}

/* ==========================================
   SEARCH RESULTS PANEL
   ========================================== */
.search-results-overlay {
  position: absolute;
  top: 80px;
  right: 24px;
  width: 400px;
  max-height: 450px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 150;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.search-results-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.82rem;
}

.search-results-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 8px 0;
}

.search-result-item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
}

.search-result-item:hover {
  background-color: var(--bg-secondary);
}

.search-result-item h5 {
  font-size: 0.85rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.search-result-item p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================
   RESPONSIVE DESIGN SCREEN BREAKPOINTS
   ========================================== */
@media (max-width: 1024px) {
  aside.sidebar {
    position: absolute;
    transform: translateX(-100%);
  }
  aside.sidebar.mobile-open {
    transform: translateX(0);
  }
  :root {
    --sidebar-width: 280px;
  }
}

@media (max-width: 768px) {
  .info-blocks-grid,
  .approval-matrix {
    grid-template-columns: 1fr;
  }
  .cover-meta-grid {
    grid-template-columns: 1fr;
  }
  .cover-footer-row {
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
  }
  .cover-meta-grid {
    text-align: center;
  }
  .calc-panel {
    grid-template-columns: 1fr;
  }
  .viewer-layout-box {
    flex-direction: column;
    height: auto;
  }
  .viewer-sidebar {
    width: 100%;
  }
  .viewer-main-canvas {
    height: 350px;
  }
  .page-paper-container {
    padding: 24px;
  }
}

/* ==========================================
   PRINT MEDIA RULES (OPTIMIZED FOR PDF & A4)
   ========================================== */
@media print {
  /* Hide all app wrapper UI chrome elements */
  aside.sidebar,
  header.top-header,
  footer.navigation-footer,
  .btn-action-group,
  .btn,
  .search-wrapper,
  .search-results-overlay,
  .viewer-controls,
  .viewer-sidebar,
  .upload-zone,
  #warranty-upload-zone,
  .calc-inputs,
  input[type="checkbox"],
  button {
    display: none !important;
  }

  /* Reset layout constraints */
  body, main.main-viewport {
    background-color: white !important;
    color: black !important;
    overflow: visible !important;
    height: auto !important;
    display: block !important;
  }

  .content-body {
    padding: 0 !important;
    overflow: visible !important;
  }

  .page-paper-container {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important;
    min-height: auto !important;
    background-color: white !important;
  }

  /* Ensure page breaks */
  h2, h3, table, blockquote, .danger-alert-box, .warning-alert-box {
    page-break-inside: avoid;
  }

  /* Adjust fonts for printing */
  body {
    font-size: 11pt !important;
    line-height: 1.5 !important;
  }

  .data-table th {
    background-color: #f1f5f9 !important;
    color: black !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
