:root {
    --blue: #2f5d86;
    --light-blue: #eaf1f7;
    --orange: #f28c28;
    --gray: #f5f6f8;
    --border: #dcdfe3;
}

* {
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

body {
    margin: 0;
    background: #eef2f6;
    color: #333;
}

/* =========================
   CARD
========================= */
.card {
    background: #fff;
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,.05);
    height: 82vh; /* fixed height for scrollable panels */
    width: 97vw;
    display: flex;
    flex-direction: column;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 12px;
}

label {
    font-size: 13px;
    color: #555;
    margin-bottom: 4px;
    display: block;
}

select,
input {
    width: 100%; /* take full width of parent flex container */
    padding: 8px;
    border: 1px solid var(--border, #ccc); /* fallback color if --border not defined */
    border-radius: 4px;
    box-sizing: border-box; /* include padding in width */
}

.form-row {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.form-row > div {
    flex: 1; /* each child takes equal space */
}


.select-wrapper {
    position: relative;
    margin-bottom: 12px;
}

.select-wrapper button.remove-select {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    padding: 0;
}

.select-wrapper button.remove-select:hover {
    background: #c0392b;
}


/* =========================
   ASSESSMENT LAYOUT
========================= */
.assessment-layout {
    display: flex;
    flex: 1;
    gap: 30px;
    overflow: hidden;
}

/* =========================
   LEFT PANEL
========================= */
.assessment-left {
    flex: 1.25;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
}

/* Scrollable content inside left */
.left-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

/* =========================
   STICKY ACTIONS (ALL BUTTONS IN ONE)
========================= */
.sticky-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 2px solid var(--border);
    padding: 12px 10px;
    display: flex;
    justify-content: space-between; /* left group vs right group */
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    z-index: 10;
}

/* Flex containers inside sticky-actions */
.sticky-actions .left-group,
.sticky-actions .right-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Optional: ensure buttons don’t shrink too small */
.sticky-actions button {
    white-space: nowrap;
}

/* =========================
   RIGHT PANEL
========================= */
.assessment-right {
    flex: 0.75;
    display: flex;
    flex-direction: column;
    padding-left: 20px;
    border-left: 1px solid var(--border);
    overflow: hidden;
    position: relative;
}

.assessment-right h2 {
    position: Sticky;
    top: 0;
    background: #fff;
    text-align: center;
    border: 2px solid gray;
    padding: 3px 0 3px 0;
}

/* Scrollable summary content */
.right-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

/* Sticky total at bottom right */
.sticky-total {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 2px solid var(--border);
    padding: 12px 0;
    font-size: 18px;
    font-weight: bold;
    text-align: right;
    color: var(--blue);
    z-index: 10;
}

/* =========================
   SUMMARY
========================= */
.summary-block {
    margin-bottom: 6px;
}

.summary-block h3 {
    margin: 10px 0;
    font-weight: bold;
    color: #444;
}

.subtotal {
    text-align: right;
    font-weight: bold;
    margin-top: 8px;
}

/* =========================
   BUTTONS
========================= */
button {
    padding: 8px 14px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 13px;
}

.btn-primary { background: var(--blue); color: #fff; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-outline { background: #fff; border: 1px solid var(--border); }
.btn-red { background-color: #e74c3c; color: white; }
.btn-red:hover { background-color: #c0392b; }

.btn-primary {
    background: var(--blue);
    color: #fff;
}

.btn-orange {
    background: var(--orange);
    color: #fff;
}

.btn-outline {
    background: #fff;
    border: 1px solid var(--border);
}

.btn-red {
    background-color: #e74c3c;
    color: white;
}

.btn-red:hover {
    background-color: #c0392b;
}

#removeBtn {
    display: none !important;
}


/* =========================
   TABLES
========================= */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}
th, td {
    padding: 10px;
    border: 1px solid var(--border);
    font-size: 13px;
    text-align: center;
}
th { background: var(--light-blue); }

/* =========================
   HEADERS
========================= */
h2 { font-size: 18px; margin-bottom: 16px; color: var(--blue); }

/* =========================
   SCROLLBAR STYLE
========================= */
.left-scroll::-webkit-scrollbar,
.right-scroll::-webkit-scrollbar {
    width: 6px;
}

.left-scroll::-webkit-scrollbar-thumb,
.right-scroll::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* =========================
   PDF MODAL
========================= */

.pdf-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 101vh;
    background-color: rgba(0,0,0,0.6);
    overflow: auto;
}

.pdf-modal-content {
    position: relative;
    margin: 2% auto;
    width: 90%;
    max-width: 1000px;
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0px 4px 15px rgba(0,0,0,0.3);
}

/* Buttons container */
.pdf-buttons {
    width: 100%;
    height: 5vh;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 6px;
}

/* Download button */
.pdf-buttons a#pdfDownload {
    padding: 8px 12px;
    background-color: royalblue;
    color: white;
    text-decoration: none;
    border-radius: 5px;
}

.pdf-buttons a#pdfDownload:hover {
    background-color: darkblue;
}

/* Close button */
.pdf-buttons .pdf-close {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
}

.pdf-buttons .pdf-close:hover {
    color: royalblue;
}

/* Base layout */
.sample-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 10px;
}

.sample-row .field label {
    font-size: 14px;
    margin-bottom: 4px;
    display: block;
}

.sample-row .field input {
    width: 100%;
    box-sizing: border-box;
}

/* Tablet and up */
@media (min-width: 768px) {
    .sample-row {
        grid-template-columns: repeat(4, 1fr);
        gap: 15px;
    }
}



/* =========================
   MOBILE RESPONSIVE
========================= */
@media (max-width: 900px) {
    .assessment-layout { flex-direction: column; height: auto; }
    .assessment-left, .assessment-right { flex: unset; height: auto; }
    .sticky-actions, .sticky-total { position: relative; }
    .left-scroll, .right-scroll { overflow: visible; }
}


@media (max-width: 900px) {

  /* ===== KILL VH HEIGHT TRAPS ===== */
  .card {
    height: auto !important;
    min-height: unset !important;
    width: 100%;
    margin-bottom: 20px;
  }

  /* ===== PREVENT SIDEWAYS + EMPTY SCROLL ===== */
  body {
    overflow-x: hidden;
  }

  /* ===== STACK PANELS ===== */
  .assessment-layout {
    flex-direction: column;
    gap: 20px;
  }

  .assessment-left,
  .assessment-right {
    border: none;
    padding: 0;
  }

  /* ===== REMOVE NESTED SCROLL (BIG FIX) ===== */
  .left-scroll,
  .right-scroll {
    overflow: visible !important;
    max-height: unset !important;
  }

  /* ===== STICKY → NORMAL FLOW ===== */
  .sticky-actions,
  .sticky-total {
    position: relative !important;
    bottom: auto;
  }

  /* ===== PDF MODAL MOBILE FIX ===== */
  .pdf-modal-content {
    margin: 10px;
    width: calc(100% - 20px);
    max-height: 95vh;
    overflow: hidden;
  }

  .pdf-buttons {
    height: auto;
    flex-wrap: wrap;
  }

  iframe#pdfIframe {
    height: 70vh !important;
  }

}
