/* ============================================================
   CUT SETTINGS SECTION (v2)
   ============================================================ */

/* ------------------------------------------------------------
   MAIN SECTION CONTAINER
   ------------------------------------------------------------ */
.cut-heading {
  text-align: center;
  margin: 20px 0 16px 0;
  font-size: 1.1rem;
  opacity: 0.85;
}

#cutSection {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: system-ui, sans-serif;
}

/* ------------------------------------------------------------
   THUMBNAIL PANEL
   ------------------------------------------------------------ */
#cutThumbnailsPanel {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 1rem;
  margin: 1rem 0 1.5rem 0;
  padding: 0.5rem;
}

#cutSection .cut-thumb {
  flex: 0 1 22%;
  max-width: 260px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#cutSection .cut-thumb:hover {
  transform: scale(1.04);
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.15);
}

#cutSection .cut-thumb img {
  width: 100%;
  height: auto;
  max-height: 140px;
  object-fit: contain;
  border-radius: 6px 6px 0 0;
}

/* Responsive thumbnails */
@media (max-width: 900px) {
  #cutSection .cut-thumb {
    flex: 0 1 45%;
  }
}
@media (max-width: 500px) {
  #cutSection .cut-thumb {
    flex: 0 1 90%;
  }
}

/* ------------------------------------------------------------
   DEVICE PANELS WRAPPER
   ------------------------------------------------------------ */
#cutDevicePanelsWrapper {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  margin-bottom: 1.5rem;
}

/* ------------------------------------------------------------
   GENERAL + DEVICE FLEX WRAPPER (v2)
   ------------------------------------------------------------ */
#cutDetailsFlexWrapper {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 2rem; /* slightly more spacing between the two panels */
  width: 95%; /* use 95% of screen width instead of fixed max */
  max-width: 1600px; /* still cap it a bit for ultra-wide monitors */
  margin: 0 auto 1.5rem auto;
  box-sizing: border-box;
}

/* General section (left) */
#cutGeneralPanel {
  flex: 1 1 30%;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  box-sizing: border-box;
}

/* Device section (right) */
#cutDeviceData {
  flex: 1 1 70%;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  box-sizing: border-box;
}

/* Shared panel aesthetics */
#cutGeneralPanel .cut-constants,
#cutGeneralPanel .trim-allowances,
#cutDeviceData .cut-constants,
#cutDeviceData .trim-allowances {
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 1rem;
}

#cutGeneralPanel h4,
#cutDeviceData h4 {
  margin-top: 0;
  border-bottom: 1px solid #ddd;
  padding-bottom: 0.3rem;
  font-size: 1rem;
  font-weight: 600;
}

#cutGeneralPanel label,
#cutDeviceData label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0.3rem 0;
  font-size: 0.9rem;
  color: #333;
}

#cutGeneralPanel input,
#cutDeviceData input {
  width: 80px;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.25rem;
  font-size: 0.9rem;
}

/* Responsive stacking for narrow screens */
@media (max-width: 900px) {
  #cutDetailsFlexWrapper {
    flex-direction: column;
    align-items: center;
  }
  #cutGeneralPanel,
  #cutDeviceData {
    width: 95%;
  }
}

/* ------------------------------------------------------------
   DEVICE PANEL INNER FLEX (image + data side by side)
   ------------------------------------------------------------ */
.device-panel-wrapper {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  gap: 1.5rem;
}

.device-image-area {
  flex: 1 1 45%;
  text-align: center;
}

.device-image-area img {
  max-width: 100%;
  height: auto;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.device-data-area {
  flex: 1 1 45%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Responsive stacking for narrow screens */
@media (max-width: 800px) {
  .device-panel-wrapper {
    flex-direction: column;
    align-items: center;
  }
  .device-image-area,
  .device-data-area {
    flex: 1 1 100%;
  }
}

/* ------------------------------------------------------------
   SHARED BUTTON BAR
   ------------------------------------------------------------ */
#cutButtonBar {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

#cutButtonBar button {
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: white;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

#cutButtonBar button:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.btn-green {
  background-color: #4caf50;
}
.btn-blue {
  background-color: #2196f3;
}
.btn-red {
  background-color: #f44336;
}

/* ------------------------------------------------------------
   PERSISTENT SECTION (Test Panel + Actions)
   ------------------------------------------------------------ */
#cutPersistentWrapper {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 1.5rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto 2rem auto;
  box-sizing: border-box;
}

/* Each panel box */
#cutTestPanel,
#cutActionsPanel {
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1);
  padding: 1rem 1.25rem;
  flex: 1 1 50%;
  box-sizing: border-box;
}

/* Keep Actions panel narrower for balance */
#cutActionsPanel {
  flex: 0 1 30%;
}

/* Inner spacing */
#cutTestPanel label,
#cutActionsPanel button {
  margin: 0.4rem 0;
}

#cutActionsPanel button {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  border: 1px solid #bbb;
  background: #f7f7f7;
  transition: background 0.2s ease;
}

#cutActionsPanel button:hover {
  background: #eaeaea;
}

/* Result explanation box */
#cutExplanation {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.6rem;
  background: #fafafa;
  min-height: 80px;
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.9rem;
}

/* Responsive stacking for small screens */
@media (max-width: 900px) {
  #cutPersistentWrapper {
    flex-direction: column;
    align-items: center;
  }
  #cutTestPanel,
  #cutActionsPanel {
    width: 95%;
  }
}
/* ------------------------------------------------------------
   FIX: Ensure Cut Test Panel stacks vertically again
   ------------------------------------------------------------ */
#cutTestPanel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#cutTestPanel label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: #333;
}

#cutTestPanel input[type='text'],
#cutTestPanel input[type='number'],
#cutTestPanel input:not([type]) {
  width: 100px;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.25rem;
  margin-left: 0.5rem;
}

#cutTestPanel .cut-type-selector {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

#cutTestPanel .cut-results {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

#cutTestPanel #btnTestCut {
  align-self: flex-start;
  margin-top: 0.3rem;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  border: 1px solid #bbb;
  background: #f7f7f7;
  transition: background 0.2s ease;
}
#cutTestPanel #btnTestCut:hover {
  background: #eaeaea;
}
/* ------------------------------------------------------------
   Refinement: narrower persistent wrapper for better balance
   ------------------------------------------------------------ */
#cutPersistentWrapper {
  max-width: 35%;
  margin: 0 auto 2rem auto;
}
/* ------------------------------------------------------------
   Adjust Cut Test Panel width for better balance
   ------------------------------------------------------------ */
#cutTestPanel {
  flex: 0.75; /* narrower than default */
  max-width: 600px; /* safety cap */
}

#cutActionsPanel {
  flex: 0.25; /* fills remaining space */
  max-width: 360px; /* aligns visually */
}

/* Keep responsive stacking clean */
@media (max-width: 900px) {
  #cutTestPanel,
  #cutActionsPanel {
    flex: 1 1 100%;
    max-width: 95%;
  }
}
/* ------------------------------------------------------------
   PANEL LOCKED STATE
   ------------------------------------------------------------ */
.panel-locked input,
.panel-locked select,
.panel-locked textarea,
.panel-locked button {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}
