/* ============================================================
   ZEELCHEM™ Ultra-Professional Document Viewer (TDS, MSDS 16-Section, COA)
   Watermark Background + Complete High-Contrast Visibility + Print Engine
   ============================================================ */

.doc-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(3, 7, 18, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.25s ease-in-out;
}

.doc-modal-overlay.active {
  display: flex;
  opacity: 1;
}

.doc-modal-container {
  background: #ffffff;
  color: #0f172a;
  width: 100%;
  max-width: 1080px;
  height: 94vh;
  max-height: 94vh;
  border-radius: 12px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Modal Header Bar */
.doc-modal-header {
  background: #091322;
  color: #ffffff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #0284c7;
  flex-shrink: 0;
}

.doc-modal-title-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.doc-modal-logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
  background: #ffffff;
  padding: 2px 6px;
  border-radius: 6px;
}

.doc-modal-tabs {
  display: flex;
  gap: 8px;
  background: #f1f5f9;
  padding: 10px 24px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  overflow-x: auto;
}

.doc-tab-btn {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid transparent;
  background: transparent;
  color: #475569;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.doc-tab-btn:hover {
  color: #0284c7;
  background: #e2e8f0;
}

.doc-tab-btn.active {
  background: #ffffff;
  color: #0284c7;
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.doc-tab-btn.tab-tds.active { color: #0284c7; border-top: 3px solid #0284c7; }
.doc-tab-btn.tab-msds.active { color: #dc2626; border-top: 3px solid #dc2626; }
.doc-tab-btn.tab-coa.active { color: #16a34a; border-top: 3px solid #16a34a; }

.doc-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.doc-modal-body {
  padding: 24px 32px 40px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  background: #f8fafc;
  color: #1e293b;
  line-height: 1.6;
}

/* ============================================================
   OFFICIAL DOCUMENT PAPER SHEET & WATERMARK BACKGROUND
   ============================================================ */
.doc-sheet {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 36px 44px;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  min-height: 100%;
  color: #0f172a;
}

/* Authentic Central Watermark Logo */
.doc-sheet::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 500px;
  background-image: url('../images/watermark-logo.png'), url('../images/logo.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
}

.doc-sheet > * {
  position: relative;
  z-index: 1;
}

/* Document Header Section */
.doc-header-block {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2.5px solid #0284c7;
  padding-bottom: 18px;
  margin-bottom: 22px;
}

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

.doc-header-logo {
  height: 60px;
  width: auto;
  object-fit: contain;
}

.doc-brand-title {
  font-size: 24px;
  font-weight: 800;
  color: #0a1628;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin: 0;
}

.doc-brand-subtitle {
  font-size: 11px;
  color: #0284c7;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

.doc-company-details {
  font-size: 11px;
  color: #475569;
  margin-top: 4px;
  line-height: 1.4;
}

.doc-meta-badge-group {
  text-align: right;
  flex-shrink: 0;
}

.doc-type-pill {
  display: inline-block;
  background: #0284c7;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.doc-type-pill.msds-pill { background: #b91c1c; }
.doc-type-pill.coa-pill { background: #15803d; }

.doc-ref-text {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
}

/* Document Section Headings */
.doc-section-heading {
  font-size: 14.5px;
  font-weight: 800;
  color: #0a1628;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1.5px solid #cbd5e1;
  padding-bottom: 6px;
  margin-top: 22px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-section-badge {
  background: #0f172a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
}

.doc-section-badge.badge-msds {
  background: #b91c1c;
}

.doc-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #0f172a;
}

.doc-overview-item strong {
  color: #475569;
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.doc-overview-item span {
  font-weight: 700;
  color: #0a1628;
}

/* ============================================================
   HIGH CONTRAST FULLY VISIBLE DOCUMENT TABLES
   ============================================================ */
.doc-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 12px 0 20px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  color: #0f172a;
  text-align: left;
}

.doc-table th, .doc-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  vertical-align: middle;
}

.doc-table th:last-child, .doc-table td:last-child {
  border-right: none;
}

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

.doc-table th {
  background: #f1f5f9;
  font-weight: 800;
  color: #091322;
  text-transform: uppercase;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #cbd5e1;
}

.doc-table tr:nth-child(even) td {
  background: #f8fafc;
}

.doc-table tr:hover td {
  background: #f1f5f9;
}

.param-name {
  font-weight: 700;
  color: #0a1628;
}

.param-spec {
  color: #0369a1;
  font-weight: 700;
}

.param-result {
  color: #0284c7;
  font-weight: 800;
}

.param-status-pass {
  color: #15803d;
  font-weight: 800;
  background: #dcfce7;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-block;
  font-size: 11px;
}

/* GHS MSDS Warning Boxes */
.doc-ghs-box {
  background: #fef2f2;
  border-left: 4px solid #dc2626;
  border-top: 1px solid #fecaca;
  border-right: 1px solid #fecaca;
  border-bottom: 1px solid #fecaca;
  padding: 14px 18px;
  margin: 14px 0;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  color: #1e293b;
  line-height: 1.5;
}

.doc-ghs-title {
  font-weight: 800;
  color: #991b1b;
  font-size: 14px;
  margin-bottom: 6px;
}

/* Document Signature / Stamp Block */
.doc-stamp-area {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1.5px solid #cbd5e1;
}

.doc-sign-box {
  text-align: center;
  min-width: 180px;
}

.doc-sign-line {
  border-top: 1.5px solid #0f172a;
  margin-top: 36px;
  padding-top: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
}

.doc-qr-seal {
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-seal-badge {
  border: 2px dashed #0284c7;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 10px;
  color: #0284c7;
  font-weight: 800;
  text-transform: uppercase;
  text-align: center;
}

/* ============================================================
   HIGH-PRECISION PRINT MEDIA RULES (PDF DOWNLOAD)
   ============================================================ */
@media print {
  body * {
    visibility: hidden !important;
  }
  .doc-modal-overlay,
  .doc-modal-overlay.active {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: auto !important;
    background: transparent !important;
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .doc-modal-container {
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  .doc-modal-header,
  .doc-modal-tabs,
  .doc-modal-actions,
  .floating-cta,
  .site-header,
  .site-footer,
  .security-alert-toast,
  .admin-toolbar {
    display: none !important;
  }
  .doc-modal-body {
    padding: 0 !important;
    background: #ffffff !important;
    overflow: visible !important;
  }
  .doc-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 10mm 15mm !important;
    visibility: visible !important;
  }
  .doc-sheet * {
    visibility: visible !important;
  }
  .doc-sheet::before {
    opacity: 0.08 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .doc-table th {
    background: #f1f5f9 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
