/* =========================================================
   Mech-Mind 2D Camera Selector  —  styles matching 3D tool
   ========================================================= */

* { box-sizing: border-box; }

:root {
  --layout-max-width: 100%;
  --layout-padding-inline: clamp(14px, 2.2vw, 40px);
  --ui-scale: 1;
}

@media (min-width: 1100px) {
  :root {
    --layout-max-width: 100%;
    --ui-scale: 1.12;
  }
}

@media (min-width: 2000px) {
  :root {
    --layout-max-width: 2000px;
    --ui-scale: 1.22;
  }
}

body {
  margin: 0;
  background: #ffffff;
  font-family: "Times New Roman", Times, serif;
  color: #2f3a53;
  font-size: calc(14px * var(--ui-scale));
}

.app-tooltip {
  position: fixed;
  z-index: 2000;
  pointer-events: none;
  max-width: 320px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #c7d1e0;
  background: #f3f7fd;
  color: #2f3a53;
  font-family: "Times New Roman", Times, serif;
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 4px 10px rgba(47, 58, 83, 0.15);
  white-space: pre-line;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.1s ease, transform 0.1s ease;
}

.app-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- NAVBAR -------------------------------------------- */
.navbar {
  background: #ffffff;
  border-bottom: 1px solid #d7dbe2;
  padding: 0 var(--layout-padding-inline);
  height: calc(60px * var(--ui-scale));
  display: flex;
  align-items: center;
  font-size: calc(14px * var(--ui-scale));
  box-shadow: 0 2px 4px rgba(189, 189, 189, 0.5);
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--layout-max-width);
  margin: 0 auto;
  width: 100%;
}
.nav-left { display: flex; align-items: center; gap: 22px; }
.nav-logo { display: inline-flex; align-items: center; }
.nav-logo-img {
  display: block;
  height: 2.667em;
  width: auto;
}
.nav-link { color: #3f4a63; text-decoration: none; font-size: inherit; }
.nav-link:hover { color: #1d6fe4; }
.nav-lang { color: #3f4a63; font-size: inherit; cursor: pointer; }

/* ---- MAIN CONTAINER ------------------------------------ */
.main-container {
  width: min(var(--layout-max-width), 100%);
  margin: 0 auto;
  padding: 0 var(--layout-padding-inline) calc(32px * var(--ui-scale));
}

.main-title {
  text-align: center;
  font-size: calc(32px * var(--ui-scale));
  font-weight: 700;
  padding: calc(14px * var(--ui-scale)) 0 calc(12px * var(--ui-scale));
  color: #2f3a53;
}

/* ---- 3-COLUMN LAYOUT ----------------------------------- */
.layout-row {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: 0;
}

.col-title {
  text-align: center;
  font-weight: 700;
  margin-bottom: 10px;
  color: #2f3a53;
}

/* ---- LEFT COLUMN --------------------------------------- */
.left-col { width: calc(230px * var(--ui-scale)); flex-shrink: 0; }

.params-panel {
  background-color: rgba(248, 249, 250, 1);
  border-radius: 6px;
  padding: 16px;
  min-height: calc(650px * var(--ui-scale));
}

/* Param row (circle + label) */
.param-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

.circle-label {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: #fff; flex-shrink: 0;
}
.bg-orange { background: #e07020; }
.bg-blue   { background: #1d6fe4; }
.bg-red    { background: #ef4444; }
.bg-green  { background: #34b27d; }

.param-name { font-size: 13px; }
.orange-text { color: #e07020; }
.blue-text   { color: #1d6fe4; }
.red-text    { color: #ef4444; }
.green-text  { color: #34b27d; }
.compact-header { margin-bottom: 4px; }
.param-help {
  font-size: 11px;
  color: #6b7280;
  margin: -2px 0 8px 30px;
  line-height: 1.3;
}

/* Slider row */
.slider-row {
  display: flex; align-items: center; gap: 8px;
}
.mb-20 { margin-bottom: 20px; }
.mb-12 { margin-bottom: 12px; }

.preset-block {
  background: #eef3fa;
  border: 1px solid #d3dceb;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 14px;
}

.preset-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #53617d;
  margin-bottom: 7px;
}

.simple-guide {
  background: #f3f7fd;
  border: 1px solid #d3dceb;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 12px;
}

.simple-guide-title {
  font-size: 11px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 4px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.simple-guide-text {
  font-size: 11px;
  color: #475569;
  line-height: 1.35;
}

.preset-row {
  display: flex;
  gap: 6px;
  margin: 0;
}
.preset-btn {
  flex: 1;
  border: 1px solid #bfc8d8;
  background: #eef2f8;
  color: #334155;
  border-radius: 4px;
  padding: 5px 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.preset-btn:hover {
  border-color: #7c5cbf;
  color: #1d6fe4;
}

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(to right, #7c5cbf 0%, #7c5cbf 50%, #dde1ea 50%, #dde1ea 100%);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #7c5cbf;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #7c5cbf;
  cursor: pointer;
  border: none;
}

.spin-box {
  width: calc(68px * var(--ui-scale));
  padding: 5px 6px;
  border: 1px solid #bfc8d8;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
  font-family: inherit;
  background: #f7f8fb;
}
.spin-box:focus { outline: none; border-color: #7c5cbf; }

.field-label { font-size: 12px; color: #3f4a63; margin: 12px 0 4px; }

.full-select {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid #bfc8d8;
  border-radius: 4px;
  font-size: 13px;
  background: #f7f8fb;
  font-family: inherit;
  cursor: pointer;
}
.full-select:focus { outline: none; border-color: #7c5cbf; }

/* Sensor info table */
.sensor-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  margin-top: 18px;
  border: 0.5px solid #c7cedb;
  border-radius: 4px;
  overflow: hidden;
}
.sensor-table td {
  padding: 5px 8px;
  border: 1px solid #c7cedb;
  border-radius: 0;
}
.sensor-table td:first-child {
  background: rgba(236, 244, 250, 1);
  color: #3f4a63;
  white-space: nowrap;
}
.sensor-table td:last-child { font-weight: 600; text-align: right; }

.sensor-table tr:first-child td:first-child { border-top-left-radius: 4px; }
.sensor-table tr:first-child td:last-child  { border-top-right-radius: 4px; }
.sensor-table tr:last-child td:first-child  { border-bottom-left-radius: 4px; }
.sensor-table tr:last-child td:last-child   { border-bottom-right-radius: 4px; }

/* ---- CENTER COLUMN ------------------------------------- */
.center-col {
  flex: 1;
  min-width: 0;
  margin: 0 calc(6px * var(--ui-scale));
}
.center-inner { display: flex; height: calc(650px * var(--ui-scale)); }

/* Camera sidebar */
.camera-sidebar-panel {
  width: calc(150px * var(--ui-scale));
  flex-shrink: 0;
  background: rgba(236, 244, 250, 1);
  border-radius: 6px;
  padding: 14px 0px 8px 8px;
  margin-right: 6px;
}

#camera-sidebar {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: #c5cce0 #e1e7f0;
}
#camera-sidebar::-webkit-scrollbar { width: 4px; height: 6px; }
#camera-sidebar::-webkit-scrollbar-track { background: #e1e7f0; border-radius: 8px; }
#camera-sidebar::-webkit-scrollbar-thumb { background: #c5cce0; border-radius: 2px; }

.cam-btn {
  position: relative;
  width: 95%;
  padding: 8px 8px 6px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: #b4becb;
  color: #fff;
  transition: background 0.12s;
  font-family: inherit;
  min-height: calc(56px * var(--ui-scale));
}
.cam-btn:hover { filter: brightness(1.06); }
.cam-btn.viable { background: #2b83da; }
.cam-btn.selected { background: #2b83da; }
.cam-btn.selected::after {
  content: '▶';
  position: absolute;
  right: -10px;
  top: 50%;
  transform: translateY(-50%);
  color: #2b83da;
  font-size: 13px;
  line-height: 1;
}
.cam-btn .cam-name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  word-break: break-word;
}

.fit-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #e2e8f0;
}

.status-badge {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.badge-ok  { background: #2dba5f; }
.badge-nok { background: #e07020; }
.badge-best { background: #2dba5f; }
.badge-good { background: #2b83da; }
.badge-possible { background: #f59e0b; }

/* FOV panel (right of sidebar) */
.fov-panel {
  flex: 1;
  min-width: 0;
  background: rgba(236, 244, 250, 1);
  border-radius: 6px;
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  margin-left: 0;
}

/* Results top row */
.results-top {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #c7cedb;
  padding-bottom: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}
.res-group {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 6px;
  row-gap: 2px;
  background: #dce2ea;
  border-radius: 4px;
  padding: 6px 10px;
  flex: 1;
  min-width: 130px;
  container-type: inline-size;
}
.res-label {
  font-size: 12px;
  color: #55627b;
  white-space: normal;
  overflow-wrap: anywhere;
  flex: 1 1 auto;
  min-width: 0;
}
.res-value {
  flex: 1 1 auto;
}
.res-group strong {
  font-size: 14px;
  font-weight: 700;
  color: #22304a;
  margin-left: auto;
  text-align: right;
}

@container (max-width: 280px) {
  .res-label {
    flex-basis: 100%;
  }

  .res-group strong {
    margin-left: 0;
    text-align: left;
  }
}

.result-summary {
  font-size: 12px;
  color: #334155;
  padding: 2px 2px 8px;
}

/* Canvas */
.canvas-container { flex: 1; min-height: 0; }
#fov-svg { width: 100%; height: 100%; display: block; background: rgba(236, 244, 250, 1); border-radius: 2px; }

/* DoF row below diagram */
.dof-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 8px 0 4px;
  font-size: 13px;
}
.dof-row .res-label { font-size: 12px; color: #6b7280; }
.dof-row strong { color: #1a1f36; margin-right: 10px; }

.disclaimer {
  font-size: 11px;
  color: #9ca3af;
  text-align: normal;
  line-height: 1.5;
  margin-top: 6px;
}

/* ---- RIGHT COLUMN -------------------------------------- */
.right-col { width: calc(250px * var(--ui-scale)); flex-shrink: 0; }

.cam-info-panel {
  background-color: rgba(248, 249, 250, 1);
  border-radius: 6px;
  padding: 16px;
  min-height: calc(650px * var(--ui-scale));
}
.cam-info-panel h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 8px;
  color: #2f3a53;
}
.cam-info-panel ul {
  padding-left: 16px;
  margin: 0 0 14px;
}
.cam-info-panel li { font-size: 13px; margin: 5px 0; }

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.spec-table td {
  padding: 6px 4px;
  border-bottom: 1px solid #b8c1ce;
  vertical-align: top;
}
.spec-table td:first-child { color: #3f4a63; }
.spec-table td:last-child  { font-weight: 600; text-align: right; }

.view-specs-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  color: #1d6fe4;
  text-decoration: none;
}
.view-specs-link:hover { text-decoration: underline; }

/* ---- RESPONSIVE LAYOUT ---------------------------------- */
@media (max-width: 1000px) {
  .left-col { width: 215px; }
  .right-col { width: 230px; }
  .camera-sidebar-panel { width: 120px; }
}

@media (max-width: 1000px) {
  .layout-row {
    flex-direction: column;
    gap: 12px;
  }

  .left-col,
  .center-col,
  .right-col {
    width: 100%;
    margin: 0;
  }

  .params-panel,
  .cam-info-panel {
    min-height: 0;
  }

  .center-inner {
    height: auto;
    flex-direction: column;
    gap: 8px;
  }

  #camera-sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 4px 0;
    gap: 6px;
    scrollbar-width: thin;
  }

  .camera-sidebar-panel {
    width: 100%;
    padding: 6px;
    margin-right: 0;
  }

  #camera-sidebar::-webkit-scrollbar {
    height: 6px;
  }

  .cam-btn {
    width: 148px;
    min-width: 148px;
  }

  .cam-btn.selected::after {
    right: auto;
    left: 50%;
    top: auto;
    bottom: -8px;
    transform: translateX(-50%) rotate(90deg);
  }

  .fov-panel {
    margin-left: 0;
    min-height: 520px;
  }
}

@media (max-width: 760px) {
  .navbar {
    padding: 0 12px;
  }

  .nav-left {
    gap: 12px;
  }

  .main-title {
    font-size: 26px;
  }

  .results-top {
    gap: 6px;
  }

  .res-group {
    min-width: 0;
  }
}
