/* LadderLab EDU V2 — reorganização da interface para desktop e refinamento visual. */
:root {
  --ll-v2-blue: #005ca9;
  --ll-v2-blue-dark: #003f73;
  --ll-v2-orange: #f47b20;
  --ll-v2-ink: #173247;
  --ll-v2-border: #cbd9e3;
  --ll-v2-panel: #ffffff;
  --ll-v2-soft: #edf4f8;
  --ll-v2-shadow: 0 10px 26px rgba(22, 58, 80, .09);
}

.developer-credit {
  display: block;
  margin-top: .18rem;
  color: rgba(255, 255, 255, .86) !important;
  font-size: .64rem !important;
  font-weight: 700;
  letter-spacing: .02em;
}

.developer-credit-full {
  margin-bottom: .35rem;
  color: #fff;
  font-weight: 800;
}

.instruction-library[data-v2-enhanced="true"] {
  width: 100%;
  margin: 0 0 .8rem;
  padding: .7rem .8rem;
  overflow: visible;
  border: 1px solid var(--ll-v2-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, .98);
  box-shadow: var(--ll-v2-shadow);
}

.library-v2-shell { display: grid; gap: .55rem; }
.library-v2-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
}
.library-v2-heading > div { display: grid; gap: .06rem; }
.library-v2-heading strong { color: var(--ll-v2-ink); font-size: .98rem; }
.library-v2-help { color: #6c7b87; font-size: .68rem; }

.library-v2-tabs {
  display: flex;
  gap: .35rem;
  overflow-x: auto;
  padding-bottom: .1rem;
  scrollbar-width: thin;
}
.library-v2-tab {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 34px;
  padding: .35rem .7rem;
  border: 1px solid #d6e1e9;
  border-radius: 9px;
  background: #f7fafc;
  color: #355268;
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}
.library-v2-tab > span { color: var(--ll-v2-blue); font-size: .82rem; }
.library-v2-tab.active {
  border-color: var(--ll-v2-blue);
  background: var(--ll-v2-blue);
  color: #fff;
  box-shadow: 0 4px 10px rgba(0, 92, 169, .19);
}
.library-v2-tab.active > span { color: #fff; }

.library-v2-panel {
  display: none;
  align-items: stretch;
  gap: .42rem;
  min-height: 62px;
  overflow-x: auto;
  padding: .15rem 0 .2rem;
}
.library-v2-panel.active { display: flex; }
.library-tool-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 78px;
  width: 78px;
  min-width: 78px;
  height: 58px;
  padding: .28rem;
  border: 1px solid #cbd9e3;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff, #f2f6f9);
  color: #15384f;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
  cursor: pointer;
}
.library-tool-button:not(:disabled):hover {
  border-color: var(--ll-v2-blue);
  background: #eef7ff;
  transform: translateY(-1px);
  box-shadow: 0 5px 12px rgba(0, 92, 169, .12);
}
.library-tool-button:disabled {
  opacity: .62;
  cursor: not-allowed;
  background: repeating-linear-gradient(135deg, #f5f7f8 0 8px, #edf1f3 8px 16px);
}
.library-tool-button .tool-symbol {
  color: #073f69;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .9rem;
  font-weight: 900;
  white-space: nowrap;
}
.library-tool-button .tool-label {
  position: absolute;
  z-index: 40;
  left: 50%;
  bottom: calc(100% + 9px);
  width: max-content;
  max-width: 220px;
  padding: .38rem .55rem;
  border-radius: 7px;
  background: #102f45;
  color: #fff;
  font-size: .66rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity .12s ease, transform .12s ease;
}
.library-tool-button:hover .tool-label,
.library-tool-button:focus-visible .tool-label {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
.tool-badge {
  position: absolute;
  right: 4px;
  top: 4px;
  padding: 1px 4px;
  border-radius: 5px;
  background: #e9eef2;
  color: #526572;
  font-size: .45rem;
  font-weight: 900;
}
.library-reference-note,
.library-v2-panel .compatibility-note {
  flex: 0 0 250px;
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem .7rem;
  border: 1px dashed #c7d3dc;
  border-radius: 10px;
  background: #f8fafb;
  color: #62727e;
  font-size: .62rem;
  line-height: 1.3;
}
.library-reference-note strong { color: var(--ll-v2-orange); }
.library-v2-panel .compatibility-note { display: grid; }

.v2-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(500px, .92fr);
  gap: .9rem;
  align-items: start;
}
.v2-column { min-width: 0; display: grid; gap: .85rem; }
.v2-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(245px, 285px);
  gap: .75rem;
  align-items: start;
}
.v2-editor-area,
.v2-properties-area { min-width: 0; }
.v2-properties-area .properties-panel {
  position: sticky;
  top: .65rem;
  max-height: calc(100vh - 1.3rem);
  overflow: auto;
}
.v2-simulation-column .scenario-panel { min-width: 0; }
.v2-simulation-column .scenario-layout {
  grid-template-columns: minmax(0, 1fr) !important;
}
.v2-simulation-column .scenario-content-grid {
  grid-template-columns: minmax(0, 1fr) !important;
}
.v2-simulation-column .scenario-console {
  grid-template-columns: minmax(0, 1fr) !important;
}
.v2-simulation-column .scenario-console > * { grid-column: 1 !important; grid-row: auto !important; }
.v2-simulation-column .scenario-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.v2-editor-column .monitor-panel { margin-top: 0; }
.v2-editor-column .monitor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.v2-editor-column .diagnostics-panel { margin-top: 0; }
.v2-simulation-column .evaluation-panel { margin-top: 0; }

.v2-editor-area .section-heading { align-items: end; }
.v2-editor-area .network-card { box-shadow: 0 6px 18px rgba(20, 63, 88, .07); }
.v2-editor-area .ladder-scroll { background: linear-gradient(180deg, #fbfdff, #f4f8fb); }

.ladder-output .output-device-card {
  fill: #f9fbfd;
  stroke: #b7cbd9;
  stroke-width: 1.4;
  filter: drop-shadow(0 3px 4px rgba(15, 46, 66, .12));
}
.ladder-output.coil-output .output-device-card { fill: #f6fbff; stroke: #8eb8d7; }
.ladder-output.set-output .output-device-card { fill: #eefaf3; stroke: #73ba91; }
.ladder-output.reset-output .output-device-card { fill: #fff4f2; stroke: #d89b92; }
.ladder-output.timer-output .output-device-card { fill: #fff8ee; stroke: #e0ad6e; }
.ladder-output.counter-output .output-device-card { fill: #f7f2ff; stroke: #a99ac8; }
.ladder-output.energized .output-device-card {
  stroke: var(--ll-v2-orange);
  stroke-width: 2.3;
  filter: drop-shadow(0 0 5px rgba(244,123,32,.34));
}
.ladder-output .output-type-dot { fill: #6c8798; }
.ladder-output.set-output .output-type-dot { fill: #2da263; }
.ladder-output.reset-output .output-type-dot { fill: #cf5f50; }
.ladder-output.timer-output .output-type-dot { fill: #e49331; }
.ladder-output.counter-output .output-type-dot { fill: #7f67ad; }
.ladder-output.energized .output-type-dot { fill: var(--ll-v2-orange); }
.ladder-output path,
.ladder-output > line,
.ladder-output rect:not(.selection-box):not(.output-device-card) {
  stroke-width: 2.3;
}
.ladder-output .ladder-address { font-size: 13px; font-weight: 900; fill: #163c55; }
.ladder-output .ladder-caption { font-size: 9px; font-weight: 800; fill: #667a88; letter-spacing: .02em; }
.ladder-output .ladder-symbol { font-weight: 900; }

.evaluation-panel .score { display: none !important; }

.bottling-scenario-panel .bottling-line-scene {
  border-color: #9babb4;
  background: #bfcbd1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6), 0 14px 30px rgba(20,42,54,.17);
}
.bottling-line-scene .factory-bg { fill: url(#factory-wall-v2) !important; }
.bottling-line-scene .factory-floor-zone { fill: url(#factory-floor-v2) !important; opacity: 1 !important; }
.bottling-line-scene .wall-grid-v2 path { stroke: #87969e; stroke-width: 1; }
.bottling-line-scene .overhead-pipes-v2 path {
  fill: none;
  stroke: #50626b;
  stroke-width: 12;
  stroke-linecap: round;
  filter: drop-shadow(0 4px 3px rgba(22,37,45,.18));
}
.bottling-line-scene .overhead-pipes-v2 circle { fill: #f47b20; stroke: #7c3b12; stroke-width: 2; }
.bottling-line-scene .tank-shell {
  fill: url(#steel-v2) !important;
  stroke: #455861 !important;
  stroke-width: 2.2 !important;
  filter: url(#industrial-shadow-v2) !important;
}
.bottling-line-scene .tank-hopper { fill: url(#steel-v2) !important; stroke: #455861 !important; }
.bottling-line-scene .tank-valve { fill: #3c4b53 !important; stroke: #17272f !important; }
.bottling-line-scene .bottling-tank.active .tank-valve { fill: var(--ll-v2-orange) !important; }
.bottling-line-scene .machine-frame {
  fill: url(#machine-v2) !important;
  stroke: #455861 !important;
  filter: url(#industrial-shadow-v2) !important;
}
.bottling-line-scene .machine-head { fill: #2f414b !important; stroke: #15252d; stroke-width: 1.5; }
.bottling-line-scene .machine-actuator { fill: #586b75 !important; }
.bottling-line-scene .process-machine.active .machine-actuator { fill: var(--ll-v2-orange) !important; }
.bottling-line-scene .belt { fill: url(#belt-v2) !important; stroke: #11191d !important; }
.bottling-line-scene .roller { fill: url(#steel-v2) !important; stroke: #394a52 !important; }
.bottling-line-scene .conveyor.running .roller { stroke: var(--ll-v2-orange) !important; }
.bottling-line-scene .belt-edge { stroke: #dbe3e7 !important; opacity: .95 !important; }

.control-cabinet-v2 .cabinet-shell { fill: url(#machine-v2); stroke: #465962; stroke-width: 2.5; filter: url(#industrial-shadow-v2); }
.control-cabinet-v2 .cabinet-screen { fill: #142b38; stroke: #66808d; stroke-width: 1.5; }
.control-cabinet-v2 .lamp { stroke: #283941; stroke-width: 1.5; }
.control-cabinet-v2 .lamp.green { fill: #32bd72; }
.control-cabinet-v2 .lamp.amber { fill: #f4b843; }
.control-cabinet-v2 .lamp.red { fill: #d95a50; }
.control-cabinet-v2 .cabinet-plate { fill: #e8eef1; stroke: #7c8e97; }
.control-cabinet-v2 text { fill: #213943; font-size: 8px; font-weight: 900; letter-spacing: .04em; }
.safety-rail-v2 path { fill: none; stroke: #f0b22f; stroke-width: 5; stroke-linecap: round; filter: drop-shadow(0 2px 1px rgba(0,0,0,.18)); }
.floor-safety-line { fill: none; stroke: #ffd44d; stroke-width: 4; stroke-dasharray: 18 9; opacity: .9; }
.hazard-stripes-v2 { fill: none; stroke: #2d3438; stroke-width: 8; }
.floor-markings-v2 text { fill: rgba(255,255,255,.72); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.bottling-line-scene .liquid-stream { stroke-width: 7 !important; filter: drop-shadow(0 0 4px rgba(75,163,216,.35)); }
.bottling-line-scene .process-bottle { filter: drop-shadow(0 7px 5px rgba(10,26,35,.32)) !important; }
.bottling-line-scene .bottle-outline { stroke: #244858 !important; stroke-width: 2.4 !important; }
.bottling-line-scene .bottling-hud rect,
.bottling-line-scene .bottling-counts rect {
  fill: rgba(8, 39, 57, .95) !important;
  stroke: #6f8b9a !important;
  filter: drop-shadow(0 5px 5px rgba(11,33,45,.22));
}
.bottling-line-scene .inductive-station rect { fill: #1d536f !important; stroke: #0f3244 !important; }

#app input:focus,
#app select:focus,
#app textarea:focus {
  outline: 2px solid rgba(0,92,169,.28);
  outline-offset: 1px;
}

@media (min-width: 1100px) {
  #app > main { max-width: none; padding: .8rem .9rem 1.2rem; }
  .instruction-library[data-v2-enhanced="true"] {
    position: sticky;
    top: 0;
    z-index: 25;
  }
}

@media (max-width: 1280px) {
  .v2-main-grid { grid-template-columns: minmax(0, 1.25fr) minmax(430px, .9fr); }
  .v2-editor-row { grid-template-columns: minmax(0, 1fr) 245px; }
  .v2-simulation-column .scenario-inputs { grid-template-columns: 1fr; }
}

@media (max-width: 1050px) {
  .v2-main-grid { grid-template-columns: 1fr; }
  .v2-editor-row { grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); }
  .v2-simulation-column { order: 2; }
  .v2-properties-area .properties-panel { position: static; max-height: none; }
  .library-v2-help { display: none; }
}

@media (max-width: 760px) {
  .instruction-library[data-v2-enhanced="true"] { border-radius: 0; margin-inline: -.5rem; width: calc(100% + 1rem); }
  .v2-editor-row { grid-template-columns: 1fr; }
  .library-v2-panel.active { gap: .35rem; }
  .library-tool-button { flex-basis: 98px; min-width: 98px; width: 98px; height: 64px; }
  .library-tool-button .tool-label {
    position: static;
    width: auto;
    max-width: 92px;
    padding: 0;
    background: transparent;
    color: #4d6271;
    font-size: .57rem;
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  .v2-editor-column .monitor-grid { grid-template-columns: 1fr; }
  .v2-simulation-column .scenario-inputs { grid-template-columns: 1fr; }
}
