@import '../shared.css';

.kx-ops {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.kx-ops__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.kx-ops__title {
  font-size: var(--fs-h1);
  line-height: var(--lh-h1);
  color: var(--color-neutral-900);
}
.kx-ops__subtitle {
  font-size: var(--fs-body);
  color: var(--color-neutral-500);
  margin-top: 2px;
}

/* 12컬럼 벤토 */
.kx-ops__grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-4);
  align-items: start;
}
.kx-ops__heat {
  grid-column: span 8;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  position: relative;
}
.kx-ops__aside {
  grid-column: span 4;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.kx-ops__parking {
  grid-column: span 12;
}

.kx-ops__sensor-badge {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  z-index: 2;
  font-size: var(--fs-micro);
  color: var(--color-warning);
  background: #fff4e5;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.kx-ops__degraded-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-caption);
  color: var(--color-neutral-700);
  background: #fff8ef;
  border: 1px solid #ffe4bf;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
}
.kx-ops__degraded-badge {
  font-size: var(--fs-micro);
  color: var(--color-warning);
  background: #fff4e5;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

/* 히트맵 홀 셀 */
.kx-ops__halls {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-3);
  padding: var(--space-6) 0 var(--space-4);
}
.kx-ops__hall {
  position: relative;
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 200px;
  border: 1px solid transparent;
  color: var(--color-neutral-900);
}
.kx-ops__hall.is-smooth {
  background: rgba(18, 183, 106, 0.14);
  border-color: rgba(18, 183, 106, 0.3);
}
.kx-ops__hall.is-moderate {
  background: rgba(247, 144, 9, 0.16);
  border-color: rgba(247, 144, 9, 0.32);
}
.kx-ops__hall.is-busy {
  background: rgba(217, 45, 32, 0.18);
  border-color: rgba(217, 45, 32, 0.4);
  box-shadow: inset 0 0 0 1px rgba(217, 45, 32, 0.25);
}
.kx-ops__hall-label {
  font-weight: var(--fw-bold);
  font-size: var(--fs-h3);
}
.kx-ops__hall-tag {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  font-size: var(--fs-micro);
  font-weight: var(--fw-bold);
  color: var(--color-on-accent);
  background: var(--color-error);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}
.kx-ops__hall-people {
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-700);
}

.kx-ops__heat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  border-top: var(--border-card);
  padding-top: var(--space-3);
  flex-wrap: wrap;
}
.kx-ops__legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: var(--space-4);
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
}
.kx-ops__legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.kx-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.kx-dot.is-smooth { background: #12b76a; }
.kx-dot.is-moderate { background: var(--color-violation-warn); }
.kx-dot.is-busy { background: var(--color-error); }
.kx-ops__total {
  font-size: var(--fs-body);
  color: var(--color-neutral-700);
}
.kx-ops__total strong {
  color: var(--color-neutral-900);
}

/* HVAC */
.kx-ops__hvac {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.kx-ops__gauge {
  position: relative;
  width: 140px;
  flex-shrink: 0;
}
.kx-ops__gauge-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.kx-ops__gauge-label strong {
  font-size: var(--fs-h2);
  color: var(--color-neutral-900);
}
.kx-ops__gauge-label span {
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
}
.kx-ops__hvac-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.kx-ops__hvac-meta > div {
  display: flex;
  flex-direction: column;
}
.kx-ops__meta-k {
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
}
.kx-ops__hvac-meta strong {
  font-size: var(--fs-h3);
  color: var(--color-neutral-900);
}
.kx-ops__sensor-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.kx-ops__series {
  max-height: 320px;
  overflow-y: auto;
}
.kx-ops__pill {
  font-size: var(--fs-caption);
  font-weight: var(--fw-semibold);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}
.kx-ops__pill.is-ok {
  background: #e6f4ee;
  color: var(--color-success);
}

/* 스위치 */
.kx-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
  cursor: pointer;
}
.kx-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.kx-switch__track {
  width: 34px;
  height: 20px;
  border-radius: var(--radius-pill);
  background: var(--color-neutral-200);
  position: relative;
  transition: background 0.15s ease;
}
.kx-switch__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-white);
  transition: transform 0.15s ease;
}
.kx-switch input:checked + .kx-switch__track {
  background: var(--color-primary-600);
}
.kx-switch input:checked + .kx-switch__track::after {
  transform: translateX(14px);
}
.kx-switch input:focus-visible + .kx-switch__track {
  outline: 2px solid var(--color-primary-600);
  outline-offset: 2px;
}

/* 조명존 fill tone */
.kx-barlist__fill.is-success { background: #12b76a; }
.kx-barlist__fill.is-warning { background: var(--color-violation-warn); }
.kx-barlist__fill.is-error { background: var(--color-error); }

/* 주차 */
.kx-ops__note {
  font-size: var(--fs-micro);
  color: var(--color-neutral-500);
}
.kx-ops__zones {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}
.kx-ops__zone {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border: var(--border-card);
  border-radius: var(--radius-lg);
  background: var(--color-neutral-050);
}
.kx-ops__zone-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.kx-ops__zone-label {
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  color: var(--color-neutral-900);
}
.kx-ops__zone-pct {
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
}
.kx-ops__zone-pct.is-success { color: var(--color-success); }
.kx-ops__zone-pct.is-warning { color: var(--color-warning); }
.kx-ops__zone-pct.is-error { color: var(--color-error); }
.kx-ops__zone-count {
  font-size: var(--fs-caption);
  color: var(--color-neutral-500);
}

@media (max-width: 1200px) {
  .kx-ops__heat { grid-column: span 12; }
  .kx-ops__aside { grid-column: span 12; flex-direction: row; }
  .kx-ops__aside > .kx-card { flex: 1; }
}
@media (max-width: 900px) {
  .kx-ops__halls { grid-template-columns: repeat(2, 1fr); }
  .kx-ops__zones { grid-template-columns: repeat(2, 1fr); }
  .kx-ops__aside { flex-direction: column; }
}
