/* continas the following in no specific order
1. comparison
2. summary modal
3. timeline modal
4. pdf viewing modal


*/


.compare-container {
  --compare-gap: 16px;
  --duplicate-compare-width: min(620px, calc(50vw - 32px));
  --compare-panel-width: min(620px, calc(50vw - 32px));
  --compare-total-width: calc(var(--duplicate-compare-width) + var(--compare-gap) + var(--compare-panel-width));
  --compare-left-start: calc(50vw - (var(--compare-total-width) / 2));
  --compare-right-start: calc(var(--compare-left-start) + var(--duplicate-compare-width) + var(--compare-gap));
  position: fixed;
  inset: 0;
  display: none;
  height: 0;
  pointer-events: none;
  z-index: 10000;

  isolation: isolate; /* ✅ prevents stacking conflicts */
}

.compare-container.open {
  display: block;
  height: auto;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  pointer-events: auto;
  overflow: hidden;
  overscroll-behavior: none;
}

.compare-left {
  pointer-events: none;
}
#duplicate-modal {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
  z-index: auto;
}

#compare-modal {
  background: transparent;
  backdrop-filter: none;
  justify-content: initial;
  pointer-events: none;
  z-index: auto;
}

#duplicate-modal .modal-box,
#compare-modal .modal-box {
  pointer-events: auto;
  height: 88vh;
  max-height: 88vh;
}

#compare-modal .modal-box {
  position: fixed;
  top: 50%;
  left: var(--compare-right-start);
  transform: translateY(-50%);
  width: var(--compare-panel-width);
  max-width: var(--compare-panel-width);
  height: 88vh;
  max-height: 88vh;
  z-index: 1;
}

#compare-modal.open .modal-box {
  animation: compareSlideRight 0.32s ease both;
}

#compare-modal .modal-body {
  padding: 0px 24px 20px;   /* ✅ reduce top padding */
  min-height: 240px;
}

/* Keep the duplicate and comparison modals centered as a pair. */
#duplicate-modal.compare-mode .modal-box {
  position: fixed;
  top: 50%;
  left: var(--compare-left-start);
  transform: translate(-50%, -50%);  
  width: var(--duplicate-compare-width) !important;
  max-width: var(--duplicate-compare-width) !important;
  height: 88vh;
  max-height: 88vh;
  animation: duplicateSlideLeft 0.32s ease both;
  z-index: 2;
}

#duplicate-modal.compare-mode {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
  z-index: 10020;
}

#duplicate-modal.closing .modal-box {
  animation: duplicateBackCenter 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: left, transform, opacity;
}

body[data-page="reports"] .page:has(.compare-container.open) {
  z-index: 20000;
}

@keyframes duplicateSlideLeft {
  from {
    left: 50%;
    transform: translate(-50%, -50%);
  }
  to {
    left: var(--compare-left-start);
    transform: translateY(-50%);
  }
}

@keyframes compareSlideRight {
  from {
    left: var(--compare-left-start);
    transform: translateY(-50%);
  }
  to {
    left: var(--compare-right-start);
    transform: translateY(-50%);
  }
}

@keyframes duplicateBackCenter {
  from {
    left: var(--compare-left-start);
    transform: translateY(-50%);
    opacity: 1;
  }
  to {
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

@keyframes compareSlideOut {
  from {
    left: var(--compare-right-start);
    transform: translateY(-50%);
    opacity: 1;
  }
  to {
    left: calc(var(--compare-right-start) + 100px);
    opacity: 0;
  }
}

#duplicate-modal .modal-box {
  transition: left 0.28s ease;
}

#compare-modal .modal-box {
  transition: left 0.28s ease, transform 0.28s ease, opacity 0.28s ease;
}

#compare-modal.closing {
  pointer-events: none;
}

#compare-modal.switching .modal-box {
  animation: compareSwitchIn 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: transform, opacity;
}

#comparison-body {
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#comparison-body .compare-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

#comparison-body.is-switching > :not(.compare-loading) {
  opacity: 0;
  pointer-events: none;
}

#comparison-body.is-switching .spinner {
  display: inline-block;
}

/* ✅ closing effect */
#compare-modal.closing .modal-box {
  animation: compareSlideBack 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: left, transform, opacity;
}

@keyframes compareSlideBack {
  from {
    left: var(--compare-right-start);
    transform: translateY(-50%);
    opacity: 1;
  }
  to {
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.2;
  }
}


/* make comparison wider */
#comparison-modal .modal-box {
  width: min(1100px, 96vw);
  max-width: min(1100px, 96vw);
}

.compare-header-left {
  display: flex;
  flex-direction: column;
}

/* second row under title */
.compare-subrow {
  display: grid;
  grid-template-columns: 160px 1fr 1fr;  /* ✅ SAME as cmp-grid */
  column-gap: 24px;

  top: 0;
  position: sticky;
  z-index:30;
/*  border-bottom: 1px solid #e5e7eb; */

  padding-top: 8px;
  padding-bottom: 8px;

  
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}


/* align headers nicely */
.compare-subrow span {
  text-align: left;
}


.cmp-grid {
  display: grid;
  grid-template-columns: 160px 1fr 1fr;
  column-gap: 16px;
  row-gap:6px;
  margin-top: -19px;
}

.cmp-label {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.cmp-value {
  font-size: 13px;
  color: var(--page-title-color);

  white-space: pre-wrap;
  overflow-wrap: anywhere;

  min-height: 18px;   /* ✅ keeps rows aligned even if empty */
}

.cmp-section {
  grid-column: 1 / -1;
  background: var(--form-card-bg);
  transform: translateZ(0); /* prevents jitter */

  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;

  color: var(--teal);
  text-transform: uppercase;

  margin: 0px 0 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--teal-border);

  position: sticky;
  top: 7px; /* height of header above */
  z-index: 20;
}

.cmp-value.cmp-exact {
  background-color: #fdecea; /* 🔴 red */
  border-radius: 4px;
  padding: 2px 6px;
}

.cmp-value.cmp-fuzzy-strong {
  background-color: #fff7d6; /* 🟡 yellow */
  border-radius: 4px;
  padding: 2px 6px;
}
.cmp-value.cmp-fuzzy {
  background-color: #fffbe6; /* 🟡 yellow */
  border-radius: 4px;
  padding: 2px 6px;
}



.modal-field-value .btn-sm {
  padding: 6px 12px;
  font-size: 11.5px;
  border-radius: 6px;
}

.missing {
  color: var(--danger);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.modal-grid-2 .modal-field {
  align-items: flex-start;
  justify-content: center;
/* Improve spacing consistency inside modal grid */
  margin-bottom: 6px;
}

.modal-field-value .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.modal-field-label {
  margin-bottom: 2px;
}

.modal-section-label + .modal-grid-2 {
  padding-top: 4px;
}

.modal-field-value button {
  min-width: 0;
  justify-content: center;
}


  .pdf-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10000;
  }
  .pdf-modal {
    width: min(96vw, 960px);
    height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 32px 96px rgba(0,0,0,0.3);
  }
  .pdf-modal-body {
    width: 100%;
    flex: 1;
    min-height: 0;
    background: #000;
  }
  .pdf-modal-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
  }
  .pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    background: var(--field-input-bg);
    border-bottom: 1px solid var(--border);
  }
  .pdf-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--page-title-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .pdf-modal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  }
  .pdf-modal-body {
    width: 100%;
    flex: 1;
    background: #000;
    min-height: 60vh;
  }
  .pdf-modal-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
  }

  .pdf-modal {
    width: min(96vw, 960px);
    height: calc(100vh - 48px);
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 32px 96px rgba(0,0,0,0.3);
    min-width: 0;
  }
  .pdf-modal-header { flex: 0 0 auto; }
  .pdf-modal-body {
    width: 100%;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    overflow: auto;
    background: #000;
  }
  /* Ensure any direct children inside body cannot force overflow */
  .pdf-modal-body > * { min-width: 0; }
  .pdf-modal-iframe {
    width: 100%;
    flex: 1 1 0;
    border: 0;
    background: #fff;
    min-height: 0;
    display: block;
  }

  

/* ── DOCUMENT PANEL ── *//* ── DOCUMENT PANEL-card {
  background: var(--form-card-bg);
  border: 1px solid var(--form-card-border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 18px;
}

/* Header */

.doc-inline .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  background: rgba(16,185,129,0.12);
  color: #0f766e;
  border: 1px solid rgba(16,185,129,0.25);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.doc-inline .btn-primary:hover {
  background: rgba(16,185,129,0.2);
  border-color: rgba(16,185,129,0.35);
  transform: translateY(-0.5px);
}

/* Inline row (status + button on same line) */
.doc-inline {
  display: flex; 
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  flex-wrap: wrap;
}

/* Status badges (match your system) */
.doc-status {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.doc-status.available {
  color: #065f46;
  border-color: #10b981;
  background: #ecfdf5;
}

.doc-status.missing {
  color: #7f1d1d;
  border-color: #ef4444;
  background: #fff5f5;
}

.doc-status.goodToHave {
  color: #ca8a04;
  border-color: #f59e0b;
  background: #fff7ed;
}

/* Keep buttons compact */
.doc-inline .btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 6px;
}


  .duplicate-top-row {
    display: flex;
    align-items: center;       /* ✅ anchors to same vertical line */
    justify-content: space-between;
    gap: 12px;
  }

  .duplicate-badge {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .summary-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;

    background: rgba(49,131,161,0.1);
    border: 1px solid rgba(49,131,161,0.25);
    color: var(--teal);

    cursor: pointer;
    white-space: nowrap;

    transition: all 0.15s ease;
  }

  .summary-pill:hover {
    background: rgba(49,131,161,0.2);
  }


  

  /* Detail modal */
  .modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 999;
    background: rgba(0,0,0,0.45); backdrop-filter: blur(4px);
    align-items: center; justify-content: center;
  }
  #project-modal,
  #submit-summary-modal { z-index: 10000; }
  .modal-overlay.open { display: flex; }
  .modal-box {
    background: var(--form-card-bg); border: 1px solid var(--form-card-border);
    border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow-y: auto;
    animation: fadeUp 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #project-modal .modal-box,
  #submit-summary-modal .modal-box,
  #reports-detail-modal .modal-box {
    width: min(780px, 94vw) ;
    max-width: min(780px, 94vw);
    max-height: 88vh !important;
  }
  #duplicate-modal .modal-box,
  #compare-modal .modal-box {
    width: min(680px, 94vw);
    max-width: min(680px, 94vw);
    max-height: 88vh;
  }



  .modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 16px; border-bottom: 1px solid var(--form-card-border);
    position: sticky; top: 0; background: var(--form-card-bg); z-index: 1;
  }
  .modal-title { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700; color: var(--page-title-color); }
  .modal-awarded {
      margin-top: 2px;
      font-size: 13px;
      color: var(--page-title-color);;
      font-weight: 700;
  }
  .modal-close {
    width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border);
    background: transparent; color: var(--muted); cursor: pointer; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
  }
  .modal-close:hover { color: var(--danger); border-color: rgba(220,38,38,0.3); }
  .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto !important;
    padding: 10px 24px 24px;
    overscroll-behavior: contain;
  }

  body.modal-open {
    overflow: hidden;
  }

  body.modal-open .main {
    overflow: hidden !important;
  }

  body.modal-open .compare-container {
    overflow: hidden;
  }

  .modal-section-label {
    font-size: 10px; font-weight: 600; letter-spacing: 0.14em; color: var(--teal);
    text-transform: uppercase; margin: 16px 0 10px;
    padding-bottom: 6px; border-bottom: 1px solid var(--teal-border);
  }
  .modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px }
  .modal-grid-2 { display: grid; grid-template-columns: 1fr 1fr; }
  .modal-grid-spacer {
    grid-column: 1 / -1;
    height: 0;
    min-height: 0;
    padding: 0;
    margin: 2px 0;
    overflow: hidden;
    pointer-events: none;
  }
  .modal-field-full { grid-column: 1 / -1; }
  .submit-summary-group {
    padding: 10px 0;
    border-bottom: 1px solid var(--form-card-border);
  }
  .submit-summary-group:last-of-type { border-bottom: none; }

  .modal-field { display: flex; flex-direction: column; gap: 2px; }
  .modal-field-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; }
  .modal-field-value {
    font-size: 13px;
    color: var(--page-title-color);
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }
  .modal-field-value.empty { color: var(--muted); font-style: italic; }
  .modal-footer {
    display: flex; gap: 10px; justify-content: flex-end;
    padding: 16px 24px; border-top: 1px solid var(--form-card-border);
    position: sticky; bottom: 0; background: var(--form-card-bg);
    flex-shrink: 0;
  }





  /* expand this later to other than reports */
 /* side panel stuff */
  .reports-modal-box.with-sidepanel{
    width: min(620px, calc(50vw - 32px)) !important;
  }

 .reports-modal-shell{
    display:flex;
    align-items:stretch;
    gap:12px;
}

.reports-side-panel{
    display:flex;
    align-items:stretch;
    animation: fadeUp 0.2s ease;
}

.reports-side-nav{
    width:56px;
    background:var(--form-card-bg);
    border:1px solid var(--form-card-border);
    border-radius:16px;
    display:flex;
    flex-direction:column;
    padding:8px;
    gap:8px;
    animation: fadeUp 0.2s ease;
}

.side-nav-btn{
    width:40px;
    height:40px;
    border-radius:10px;
    border:none;
    cursor:pointer;
}

.reports-side-content{
    width:0;
    overflow:hidden;
    transition:width 0.25s ease;
}

.reports-side-content.open{
    width:420px;
}

.side-page{
    display:none;
    width:420px;
    height:88vh;
    max-height:88vh;
    min-height: 240px;

    background:var(--form-card-bg);
    border:1px solid var(--form-card-border);
    border-radius:16px;

    overflow:hidden;

    flex-direction:column;
}

.side-page.active{
    display:flex;
}

.timeline-page {
    position: relative;
    padding: 4px 16px 20px 20px;
    overflow-y: auto;
}

.timeline-line {
  padding-top:20px;
  position: relative;
}
/* center line */
.timeline-line::before {
    content: "";
    position: absolute;
    left: 22px;
    top: 20px;
    bottom: 20px;

    width: 2px;
    border-radius: 999px;
    background: var(--form-card-border);
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
}

.timeline-card {
    background: var(--field-input-bg);
    border: 1px solid var(--form-card-border);

    border-radius: 12px;
    padding: 0px 14px;
}

/*  copy past ended here */


