/* ==============================================================================
   Project Khoj Ghor — Official Terms of Service & Escrow Governance Stylesheet
   Theme: 2015 Classic Web Trust & Editorial Clarity (Crisp Boxed Panels, Solid Borders)
   Zero Glassmorphism / Zero Fluorescent Glows / Authentic Legal Document Presentation
============================================================================== */

:root {
  --doc-bg: #f4f6f8;
  --panel-bg: #ffffff;
  --panel-border: #cbd5e1;
  --panel-border-dark: #94a3b8;
  --text-main: #1f2937;
  --text-muted: #4b5563;
  --text-heading: #0f2b48;
  --brand-navy: #1e3a5f;
  --brand-blue: #1d4ed8;
  --brand-emerald: #047857;
  --brand-amber: #b45309;
  --brand-red: #b91c1c;
}

body {
  background-color: var(--doc-bg);
  color: var(--text-main);
  font-family: 'Hind Siliguri', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.65;
}

/* 2015 Hero Document Header */
.legal-hero-section {
  background: #ffffff;
  border-bottom: 2px solid #e2e8f0;
  padding: 2.25rem 0 1.75rem;
  margin-bottom: 2rem;
}

.legal-breadcrumb-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.legal-breadcrumb {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.legal-breadcrumb a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.legal-breadcrumb a:hover {
  text-decoration: underline;
}

.legal-breadcrumb-sep {
  color: #94a3b8;
}

.legal-breadcrumb-current {
  color: var(--text-heading);
  font-weight: 700;
}

/* Action Buttons (2015 Solid Bevel & Crisp Outline) */
.legal-hero-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn-pdf-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  background: #0f2b48;
  color: #ffffff !important;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid #0a1f33;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: background 0.15s ease-in-out;
}

.btn-pdf-download:hover {
  background: #1e3a5f;
  color: #ffffff !important;
}

.btn-print-doc {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  background: #ffffff;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.15s ease;
}

.btn-print-doc:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

/* Document Title Header */
.legal-doc-badge {
  display: none !important;
}

.legal-main-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-heading);
  line-height: 1.3;
  margin: 0 0 0.5rem 0;
}

.legal-main-title span {
  color: #047857;
}

.legal-main-subtitle {
  font-size: 1.02rem;
  color: #475569;
  margin: 0 0 1.25rem 0;
  max-width: 860px;
}

/* 2015 Boxed Metadata Stamp Table */
.legal-meta-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 0.85rem 1.15rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem 1.5rem;
  font-size: 0.84rem;
  color: #334155;
}

.legal-meta-item strong {
  color: #0f172a;
  font-weight: 700;
  display: block;
}

/* 4 Trust Highlights Grid */
.legal-highlights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.legal-hl-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 1.1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.legal-hl-card.emerald { border-top: 3.5px solid #059669; }
.legal-hl-card.blue    { border-top: 3.5px solid #2563eb; }
.legal-hl-card.amber   { border-top: 3.5px solid #d97706; }
.legal-hl-card.red     { border-top: 3.5px solid #dc2626; }

.legal-hl-title {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-heading);
  margin: 0 0 0.4rem 0;
}

.legal-hl-desc {
  font-size: 0.84rem;
  color: #475569;
  line-height: 1.55;
  margin: 0;
}

/* Sticky Toolbar & Search */
.legal-toolbar-section {
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  border-bottom: 2px solid #cbd5e1;
  padding: 0.65rem 0;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.legal-toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.legal-tabs-wrapper {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 2px;
}

.legal-tab-btn {
  padding: 0.45rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.legal-tab-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.legal-tab-btn.active {
  background: #0f2b48;
  color: #ffffff;
  border-color: #0f2b48;
}

.legal-tab-btn .badge-count {
  font-size: 0.72rem;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.1);
  margin-left: 0.25rem;
}

.legal-tab-btn.active .badge-count {
  background: rgba(255, 255, 255, 0.2);
}

.legal-search-box {
  display: flex;
  align-items: center;
  position: relative;
  min-width: 260px;
}

.legal-search-input {
  width: 100%;
  padding: 0.45rem 2rem 0.45rem 2.2rem;
  font-size: 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #f8fafc;
  color: #0f172a;
  outline: none;
}

.legal-search-input:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.legal-search-icon {
  position: absolute;
  left: 0.65rem;
  color: #94a3b8;
  pointer-events: none;
}

.legal-search-clear {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
  display: none;
}

.legal-search-clear.visible {
  display: block;
}

/* Main Layout (2-Column Classic Layout) */
.legal-layout-container {
  display: grid;
  grid-template-columns: 270px 1fr;
  gap: 1.75rem;
  align-items: start;
  margin-top: 1.5rem;
  margin-bottom: 3.5rem;
}

@media (max-width: 900px) {
  .legal-layout-container {
    grid-template-columns: 1fr;
  }
}

/* Left Table of Contents */
.legal-toc-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 1rem 1.15rem;
  position: sticky;
  top: 60px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.legal-toc-header {
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.6rem;
  margin-bottom: 0.85rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f2b48;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legal-toc-group {
  margin-bottom: 1rem;
}

.legal-toc-group-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.5px;
  margin-bottom: 0.35rem;
}

.legal-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.legal-toc-item {
  margin-bottom: 0.25rem;
}

.legal-toc-link {
  display: block;
  font-size: 0.83rem;
  color: #334155;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  line-height: 1.4;
  border-left: 2px solid transparent;
  transition: all 0.12s ease;
}

.legal-toc-link:hover {
  background: #f1f5f9;
  color: #0f2b48;
  border-left-color: #2563eb;
}

.legal-toc-link.active {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
  border-left-color: #1d4ed8;
}

.legal-toc-hotline-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 0.75rem;
  margin-top: 1.25rem;
  font-size: 0.78rem;
  color: #475569;
}

.legal-toc-hotline-card strong {
  color: #0f172a;
  display: block;
  margin-bottom: 0.25rem;
}

.legal-toc-hotline-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #047857;
  font-weight: 700;
  text-decoration: none;
  margin-top: 0.4rem;
}

/* Right Content Panels */
.legal-content-main {
  min-width: 0;
}

.legal-section-block {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  margin-bottom: 1.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.legal-section-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.9rem 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.legal-section-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f2b48;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legal-section-tag {
  font-size: 0.74rem;
  font-weight: 700;
  color: #475569;
  background: #e2e8f0;
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  text-transform: uppercase;
}

.legal-section-body {
  padding: 1.35rem;
}

/* Individual Clause Cards */
.legal-clause-card {
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  scroll-margin-top: 80px;
}

.legal-clause-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.legal-clause-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.legal-clause-title {
  font-size: 1.02rem;
  font-weight: 800;
  color: #0f2b48;
  margin: 0;
}

.legal-clause-copy-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.35rem;
  border-radius: 2px;
  transition: all 0.12s ease;
}

.legal-clause-copy-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.legal-clause-p {
  font-size: 0.94rem;
  color: #334155;
  line-height: 1.7;
  margin: 0 0 0.85rem 0;
}

.legal-clause-p:last-child {
  margin-bottom: 0;
}

/* Callouts (2015 Classic Solid Left Accent Box) */
.legal-callout {
  border-radius: 3px;
  padding: 0.85rem 1.15rem;
  margin: 0.85rem 0;
  font-size: 0.88rem;
  line-height: 1.6;
}

.legal-callout.blue {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4.5px solid #1d4ed8;
  color: #1e3a8a;
}

.legal-callout.emerald {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-left: 4.5px solid #047857;
  color: #064e3b;
}

.legal-callout.amber {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4.5px solid #d97706;
  color: #78350f;
}

.legal-callout.red {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4.5px solid #dc2626;
  color: #7f1d1d;
}

.legal-callout strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.2rem;
}

/* Bullet list inside clause */
.legal-bullet-list {
  margin: 0.5rem 0 0.85rem 1.25rem;
  padding: 0;
}

.legal-bullet-list li {
  font-size: 0.92rem;
  color: #334155;
  margin-bottom: 0.4rem;
  line-height: 1.6;
}

/* 2015 Classic Comparison Table */
.legal-table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  border: 1px solid #cbd5e1;
}

.legal-table th,
.legal-table td {
  padding: 0.65rem 0.85rem;
  border: 1px solid #cbd5e1;
  text-align: left;
  line-height: 1.5;
}

.legal-table th {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 800;
}

.legal-table tr:nth-child(even) {
  background: #fcfdfe;
}

.legal-table .highlight-green {
  background: #f0fdf4;
  color: #14532d;
  font-weight: 700;
}

.legal-table .highlight-red {
  background: #fef2f2;
  color: #7f1d1d;
  font-weight: 700;
}

/* Highlight Pulse for Anchor Jumps */
@keyframes legalHighlightPulse {
  0%   { background-color: rgba(254, 240, 138, 0.4); }
  100% { background-color: transparent; }
}

.highlighted {
  animation: legalHighlightPulse 2.5s ease-out;
}

/* No Results State */
.legal-no-results {
  display: none;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 3rem 1.5rem;
  text-align: center;
  color: #64748b;
}

.legal-no-results.visible {
  display: block;
}

/* Print Stylesheet (Clean Black & White Paper Optimization) */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .navbar, .top-notice-banner, .legal-toolbar-section, .legal-toc-card,
  .legal-hero-actions, .legal-clause-copy-btn, .mobile-bottom-bar, footer {
    display: none !important;
  }
  .legal-layout-container {
    display: block !important;
    margin: 0 !important;
  }
  .legal-section-block {
    border: 1px solid #666666 !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    margin-bottom: 1.5rem !important;
  }
  .legal-clause-card {
    border-bottom: 1px solid #999999 !important;
  }
  .legal-callout {
    border-left: 3px solid #333333 !important;
    background: #f5f5f5 !important;
  }
}
