.warnings-list {
  color: #c00;
  font-weight: bold;
  margin: 6px 0 0 18px;
  padding: 0;
}
.warnings-list li {
  margin-bottom: 2px;
}
.warnings-list li.almost {
  color: #e67e22; /* orange */
}
/* Shared semantic utility classes for status coloring */
.exceed { color: #c00; font-weight: 700; }
.loose { color: #c00; font-weight: 700; }
.almost { color: #e67e22; font-weight: 700; }
body, html {
  height: 100%;
  margin: 0;
  padding: 0;
  background: #f4f6fa;
  overflow: hidden; /* prevent page-level vertical scroll */
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  display: flex;
  height: 100vh;
}

.layout {
  display: flex;
  flex-direction: row;
  height: 100vh;
  width: 100vw;
}

/* Sidebar */
.sidebar {
  width: 380px;
  min-width: 300px;
  background: #fff;
  padding: 28px 22px 18px 32px;
  box-sizing: border-box;
  border-right: 1px solid #e0e3e8;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sidebar h2 {
  font-size: 1rem;
  font-weight: 400;
  margin: 6px 0 6px 0;
  color: #222;
  letter-spacing: 0.5px;
}

.sidebar .sidebar-logo {
  display: block;
  width: 120px;
  max-width: 100%;
  height: auto;
  margin-bottom: 4px;
}

.sidebar label {
  font-size: 1rem;
  color: #444;
  margin-top: 6px;
  margin-bottom: 2px;
  display: block;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.sidebar select {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid #d0d4db;
  background: #fff !important;
  font-size: 1rem;
  margin-bottom: 10px;
  margin-top: 2px;
  transition: border 0.2s;
}
.sidebar select:focus {
  border: 1.5px solid #4b9fff;
  outline: none;
  background: #fff;
}

/* Big label for angle */
.angle-label {
  font-size: 1.15rem;
  font-weight: 600;
  color: #222;
  display: block;
  margin-top: 6px;
  margin-bottom: 4px;
}
.angle-readout {
  font-size: 12px;
  color: #555;
  margin-top: 2px;
}

/* Config cards scroll area */
.configs-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  margin-top: 6px;
  padding-right: 2px;
  width: 100%;
  max-width: 400px;
}

/* Config card */
.object-config {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  margin: 4px 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 7px;
  font-size: 14px;
  min-width: 0;
  max-width: 360px;
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s;
}

/* Hover effect restored */
.object-config:hover {
  background: #eef5ff;
  border-color: #cfe3ff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Index styling */
.object-config .obj-index {
  background: #f8f9fa;
  color: #222;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 7px;
  font-size: 12px;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.06);
  margin-right: 6px;
  min-width: 20px;
  max-width: 28px;
}

/* Model select styling */
.object-config .type-select {
  flex: 1 1 120px;
  min-width: 100px;
  max-width: 180px;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid #e0e0e0;
  background: #fff;
  font-size: 14px;
  margin: 0;
}
.object-config .type-select:focus {
  border: 1.5px solid #4b9fff;
  outline: none;
}

/* Angle select styling */
.object-config .angle-select {
  flex: 0 0 60px;
  width: 60px;
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid #e0e0e0;
  background: #fff;
  font-size: 14px;
  text-align: center;
  margin: 0;
  margin-left: 4px;
}
.object-config .angle-select:focus {
  border: 1.5px solid #4b9fff;
  outline: none;
}

/* Main area */
.main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: #f4f6fa;
  padding: 0;
  min-width: 0;
  min-height: 0;
  position: relative;
}

canvas {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  margin: 24px 0 6px 0;
  display: block;
  max-width: 100%;
}

/* Results panel */
.results {
  width: 270px;
  min-width: 200px;
  background: #f8f8f8;
  padding: 24px 18px 18px 18px;
  box-sizing: border-box;
  border-left: 1px solid #e0e3e8;
  font-size: 1rem;
  color: #222;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* keep page stable; inner content scrolls */
}

.results hr {
  border: none;
  border-top: 1px solid #e0e3e8;
  margin: 12px 0;
}

.results-title {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: #222;
}

/* Ensure bold text in the right results panel is dark grey (but preserve status colors) */
.results b, .results strong { color: #222; font-weight: 600; }

/* Status colors inside the results panel must override generic bold colouring */
.results .exceed, .results b.exceed, .results strong.exceed { color: #c00; font-weight: 700; }
.results .loose, .results b.loose, .results strong.loose { color: #c00; font-weight: 700; }
.results .almost, .results b.almost, .results strong.almost { color: #e67e22; font-weight: 700; }
/* Low safety factor (warning) in orange */
.results .low, .results b.low, .results strong.low { color: #e67e22; font-weight: 700; }
.warnings-list li.low { color: #e67e22; }

/* Action bar below canvas */
.action-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 12px 24px 24px 24px;
  background: transparent;
}
.action-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Modern button style */
.btn-modern {
  appearance: none;
  border: 1px solid rgba(0,0,0,0.08);
  background: linear-gradient(180deg,#ffffff,#f3f6fb);
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 600;
  color: #16324a;
  box-shadow: 0 2px 6px rgba(19,42,66,0.06);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.btn-modern:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(19,42,66,0.10); }
.btn-modern:active { transform: translateY(0); }
.btn-modern.primary {
  background: linear-gradient(180deg,#1f78ff,#0f62ff);
  color: #fff;
  border: none;
  box-shadow: 0 6px 18px rgba(15,98,255,0.18);
}

/* small variant for compact file chooser */
.btn-modern.small {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  background: linear-gradient(180deg,#ffffff,#f6f8fc);
  box-shadow: 0 1px 4px rgba(19,42,66,0.04);
}

.btn-modern.small.disabled,
.btn-modern.small[disabled],
.btn-modern.small[aria-disabled="true"]{
  opacity: 0.5;
  cursor: default;
  transform: none;
  box-shadow: none;
}

/* General disabled appearance for full-size buttons */
.btn-modern[disabled],
.btn-modern[aria-disabled="true"],
.btn-modern.disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
  filter: grayscale(20%);
}

.import-name {
  font-size: 0.95rem;
  color: #556677;
  padding-left: 6px;
}

/* Small screens: make sidebar narrower and buttons wrap */
@media (max-width: 900px) {
  .sidebar { width: 320px; }
  .action-controls { flex-wrap: wrap; justify-content: flex-end; }
}

.results p {
  margin: 6px 0;
}

/* Make results content scrollable and pin footer controls */
#resultsContent {
  flex: 1 1 auto;
  overflow-y: auto;
}

/* Pin the export button row to the bottom of the results panel */
.results > .import-row {
  margin-top: auto;
}

/* Pickup row */
.pickup-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 4px;
}
.pickup-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.pickup-col label {
  font-size: 13px;
  margin-bottom: 2px;
}
.pickup-col select {
  font-size: 12px;
}

/* Reduce font size for the number-of-boxes dropdown */
#count {
  font-size: 12px;
}

/* Inline count row - stacked vertically for clearer alignment */
.count-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}
.count-row .count-label { margin: 0 0 10px 0; font-size: 0.95rem; display: block; flex: 1 1 auto; white-space: normal; overflow: visible; }
.count-select { flex: 0 0 96px; width: 96px; padding: 6px 8px; font-size: 0.95rem; border-radius: 6px; }

@media (max-width: 480px) {
  .count-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .count-select { width: 100%; }
}

@media (max-width: 700px) {
  .pickup-row {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
}

/* Footer pinned to bottom of results panel */
.results-footer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.results-footer .site-label {
  font-size: 12px;
  color: #6b7a8a;
}
.results-footer .site-label a {
  color: #4b9fff;
  text-decoration: none;
}
.results-footer .site-label a:hover { text-decoration: underline; }

.results-footer .site-line {
  font-size: 12px;
  color: #5f6d7a;
  margin-bottom: 4px;
}
.results-footer .disclosure-line {
  font-size: 11px;
  color: #7b8793;
  line-height: 1.25;
  text-align: center;
}

/* Side-by-side for System and Bumper selectors */
.select-row {
  display: flex;
  gap: 12px;
  width: 100%;
  align-items: flex-start;
  margin-bottom: 6px;
}
.select-col {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
}
.select-col label { margin-bottom: 4px; }

@media (max-width: 480px) {
  .select-row { flex-direction: column; gap: 6px; }
}

/* Compact file uploader */
#xglcImport {
  width: 100%;
  max-width: 220px;
  padding: 6px 8px;
  font-size: 0.95rem;
  border-radius: 6px;
  border: 1px solid #d0d4db;
  background: #fff;
  margin-top: 6px;
}
.dropzone { padding: 8px 10px; font-size: 0.95rem; }

/* Import row compact styles */
.import-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.import-row .import-label { font-size: 0.85rem; color: #444; margin: 0; white-space: nowrap; }
.import-row .import-btn { padding: 5px 6px; font-size: 0.85rem; border-radius: 6px; border: 1px solid #d0d4db; background: #fff; }
.import-row .import-name { font-size: 0.85rem; color: #556; }

/* Responsive */
@media (max-width: 900px) {
  .sidebar, .results {
    width: 320px;
    min-width: 220px;
    padding: 12px 8px 12px 8px;
    font-size: 0.95rem;
  }
  .sidebar .sidebar-logo {
    width: 110px;
    margin-bottom: 4px;
  }
  .object-config {
    padding: 7px 6px;
    margin: 6px 0;
  }
  .object-config .obj-index {
    font-size: 12px;
    padding: 3px 6px;
    min-width: 18px;
  }
  .object-config .type-select {
    min-width: 60px;
    font-size: 0.95rem;
    padding: 4px 5px;
  }
  .object-config .angle-select {
    width: 40px;
    font-size: 0.95rem;
    padding: 4px 5px;
  }
  .results {
    font-size: 0.95rem;
    padding: 10px 6px 10px 6px;
  }
}

@media (max-width: 600px) {
  .layout {
    flex-direction: column;
  }
  .sidebar, .results {
    width: 100vw;
    min-width: 0;
    border: none;
    border-bottom: 1px solid #e0e3e8;
    border-radius: 0;
    padding: 10px 4vw;
  }
  .results {
    border-top: 1px solid #e0e3e8;
    border-left: none;
    border-radius: 0;
  }
}
