/* KAPOCS – élő órarendtervező tábla a herróban (assets/js/kapocs-hero-solver.js). */
.kso {
  --kso-ink: #0d2b38;
  --kso-copy: #526a76;
  --kso-teal: #178e8b;
  --kso-line: rgba(13, 43, 56, .1);
  --kso-ry: -9deg;
  --kso-rx: 4deg;
  position: relative;
  width: min(100%, 660px);
  margin-left: auto;
  perspective: 1600px;
  font-family: "Inter", ui-sans-serif, -apple-system, "Segoe UI", sans-serif;
}

.kso-fallback img {
  display: block;
  width: 100%;
  border-radius: 18px;
  box-shadow: 0 30px 70px rgba(13, 57, 69, .16);
}

.kso.kso-ready .kso-fallback {
  display: none;
}

.kso-card {
  position: relative;
  padding: 16px 16px 14px;
  border: 1px solid rgba(23, 142, 139, .2);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(248, 252, 252, .9));
  box-shadow:
    0 40px 80px rgba(13, 57, 69, .16),
    0 10px 24px rgba(13, 57, 69, .06),
    inset 0 1px rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transform: rotateY(var(--kso-ry)) rotateX(var(--kso-rx));
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.2, .8, .2, 1), box-shadow .5s;
}

.kso-card::before {
  position: absolute;
  z-index: -1;
  inset: 12% -6% -10% 8%;
  border-radius: 40px;
  background: radial-gradient(ellipse at 60% 40%, rgba(40, 170, 166, .22), transparent 70%);
  filter: blur(18px);
  content: "";
}

.kso-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kso-title {
  display: grid;
  min-width: 0;
  margin-right: auto;
  line-height: 1.2;
}

.kso-title strong {
  color: var(--kso-ink);
  font: 700 15px/1.2 "Plus Jakarta Sans", "Inter", sans-serif;
  letter-spacing: -.01em;
}

.kso-title span {
  color: #70848d;
  font-size: 10.5px;
  font-weight: 500;
}

.kso-status {
  display: inline-grid;
  padding: 5px 10px;
  border-radius: 999px;
  color: #3b5360;
  background: #eef3f5;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

/* Állandó doboz: a látható felirat és a rejtett méretező (a leghosszabb, „Kész · …”
   felirat) ugyanabban a cellában, így a pirula szélessége nem változik futás közben. */
.kso-status > span {
  grid-area: 1 / 1;
}

.kso-status-sizer {
  visibility: hidden;
}

.kso-status-busy {
  color: #106f6c;
  background: #e2f4f2;
}

.kso-status-busy .kso-status-text::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #28aaa6;
  vertical-align: 1px;
  animation: kso-blink 1s ease-in-out infinite;
  content: "";
}

.kso-status-done {
  color: #fff;
  background: linear-gradient(135deg, #169d95, #087f79);
  box-shadow: 0 6px 16px rgba(10, 132, 125, .25);
}

.kso-replay {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--kso-line);
  border-radius: 9px;
  color: var(--kso-ink);
  background: #fff;
  font: 600 11.5px/1 "Inter", sans-serif;
  cursor: pointer;
  transition: border-color .2s, opacity .2s;
}

.kso-replay svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kso-replay:hover {
  border-color: rgba(23, 142, 139, .5);
}

.kso-replay:disabled {
  opacity: .45;
  cursor: default;
}

/* Szüneteltetés (WCAG 2.2.2): ugyanaz az ikongomb, mint az Újratervezés, négyzetesen. */
.kso-pause {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--kso-line);
  border-radius: 9px;
  color: var(--kso-ink);
  background: #fff;
  cursor: pointer;
  transition: border-color .2s, opacity .2s;
}

.kso-pause[hidden] {
  display: none;
}

.kso-pause svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kso-pause:hover {
  border-color: rgba(23, 142, 139, .5);
}

.kso-pause[aria-pressed="true"] {
  border-color: rgba(23, 142, 139, .5);
  color: #106f6c;
}

.kso-pause:disabled {
  opacity: .45;
  cursor: default;
}

/* Megállítva a „Tervezés…” jelző pont sem villog. */
.kso-is-paused .kso-status-busy .kso-status-text::before {
  animation-play-state: paused;
}

/* Csak képernyőolvasónak (a kért újratervezés vége). */
.kso-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

.kso-progress {
  height: 3px;
  margin: 12px 0 12px;
  overflow: hidden;
  border-radius: 3px;
  background: #e8eff1;
}

.kso-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #28aaa6, #2f6df6);
  transition: width .3s ease;
}

.kso-body {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
}

.kso-tray {
  display: grid;
  align-content: start;
  gap: 5px;
}

.kso-tray-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 4px;
  color: #106f6c;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.kso-tray-head svg {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.kso-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 24px;
  padding: 0 8px 0 9px;
  border: 1px solid rgba(13, 43, 56, .08);
  border-left: 3px solid var(--kso-color);
  border-radius: 7px;
  background: #fff;
  font-size: 11px;
  transition: opacity .3s, transform .3s;
}

.kso-pill-name {
  overflow: hidden;
  color: var(--kso-ink);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.kso-pill-count {
  color: #70848d;
  font-size: 10px;
  font-weight: 700;
}

.kso-pill-done {
  opacity: .32;
  transform: scale(.97);
}

.kso-grid {
  display: grid;
  grid-template-columns: 22px repeat(5, minmax(0, 1fr));
  grid-auto-rows: auto;
  gap: 4px;
}

.kso-corner,
.kso-day,
.kso-period {
  display: grid;
  place-items: center;
  color: #70848d;
  font-size: 10px;
  font-weight: 700;
}

.kso-day {
  height: 18px;
  letter-spacing: .04em;
}

.kso-period {
  font-size: 9.5px;
}

.kso-cell {
  position: relative;
  height: 44px;
  border: 1px dashed rgba(13, 43, 56, .13);
  border-radius: 8px;
  background: rgba(244, 248, 249, .7);
  transition: border-color .2s, background-color .2s, box-shadow .2s;
}

.kso-cell-off {
  border-style: solid;
  border-color: transparent;
  background: repeating-linear-gradient(135deg, rgba(13, 43, 56, .025) 0 6px, transparent 6px 12px);
}

.kso-cell-filled {
  border-style: solid;
  border-color: transparent;
  background: transparent;
}

.kso-cell-conflict {
  border: 1.5px solid #e5484d;
  background: rgba(229, 72, 77, .07);
  box-shadow: 0 0 0 4px rgba(229, 72, 77, .1);
  animation: kso-shake .36s ease;
}

.kso-cell-undo {
  border-color: #f0a33a;
  background: rgba(240, 163, 58, .1);
}

.kso-lesson {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 1px;
  padding: 3px 6px 3px 8px;
  overflow: hidden;
  border-left: 3px solid var(--kso-color);
  border-radius: 8px;
  background: color-mix(in srgb, var(--kso-color) 12%, #fff);
  box-shadow: 0 2px 6px rgba(13, 57, 69, .07);
  transition: opacity .25s, transform .25s, box-shadow .25s;
}

.kso-lesson strong {
  overflow: hidden;
  color: var(--kso-ink);
  font-size: 11px;
  line-height: 1.15;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.kso-lesson span {
  color: color-mix(in srgb, var(--kso-color) 70%, #0d2b38);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
}

.kso-cell-pop .kso-lesson {
  animation: kso-pop .32s cubic-bezier(.2, .8, .2, 1);
}

.kso-fly {
  position: absolute;
  z-index: 5;
  inset: auto;
  pointer-events: none;
  box-shadow: 0 14px 28px rgba(13, 57, 69, .22);
}

.kso-ghost {
  opacity: .55;
  filter: grayscale(.2);
}

.kso-reason {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: calc(100% + 6px);
  width: max-content;
  max-width: 190px;
  padding: 5px 8px;
  border-radius: 7px;
  color: #fff;
  background: #c23a3f;
  box-shadow: 0 8px 18px rgba(194, 58, 63, .3);
  font-size: 10.5px;
  font-style: normal;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  transform: translateX(-50%);
  animation: kso-rise .25s ease;
}

.kso-reason::after {
  position: absolute;
  top: 100%;
  left: 50%;
  border: 5px solid transparent;
  border-top-color: #c23a3f;
  transform: translateX(-50%);
  content: "";
}

.kso-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--kso-line);
}

.kso-stat {
  display: grid;
  line-height: 1.1;
}

.kso-stat b {
  color: var(--kso-ink);
  font: 700 19px/1.1 "Plus Jakarta Sans", "Inter", sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.kso-stat small {
  margin-top: 3px;
  color: #70848d;
  font-size: 10.5px;
  font-weight: 600;
}

.kso-done .kso-stat:last-child b {
  color: #0f8a84;
  animation: kso-pop .4s cubic-bezier(.2, .8, .2, 1);
}

/* Tanárnézet */
.kso-focus .kso-cell-filled .kso-lesson {
  opacity: .28;
}

.kso-focus .kso-cell-filled .kso-lesson.kso-match {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--kso-color), 0 8px 18px rgba(13, 57, 69, .16);
  transform: translateY(-1px);
}

.kso-tip {
  position: absolute;
  z-index: 7;
  max-width: 260px;
  padding: 6px 9px;
  border-radius: 8px;
  color: #fff;
  background: rgba(13, 43, 56, .94);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 8px));
}

/* Kész: zöld fény végigsöpör a táblán */
.kso-grid {
  position: relative;
}

.kso-sweep .kso-grid::after {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(105deg, transparent 30%, rgba(40, 170, 166, .28) 50%, transparent 70%);
  background-size: 250% 100%;
  pointer-events: none;
  content: "";
  animation: kso-sweep 1.1s ease forwards;
}

.kso-done .kso-cell-filled .kso-lesson {
  box-shadow: 0 2px 6px rgba(13, 57, 69, .07), inset 0 0 0 1px rgba(23, 142, 139, .08);
}

@keyframes kso-pop {
  0% { transform: scale(.85); opacity: .4; }
  70% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes kso-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

@keyframes kso-rise {
  from { opacity: 0; transform: translate(-50%, 4px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes kso-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

@keyframes kso-sweep {
  from { background-position: 130% 0; opacity: 1; }
  to { background-position: -30% 0; opacity: 0; }
}

/* Az Órarend szekció „Élő bemutató” helyén. */
@media (min-width: 1081px) {
  .ks-showcase--live {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
  }
}

.ks-showcase--live .kso {
  --kso-ry: 6deg;
  --kso-rx: 3deg;
  margin: 0;
}

@media (max-width: 1180px) {
  .kso {
    --kso-ry: -5deg;
    --kso-rx: 3deg;
  }
}

@media (max-width: 850px) {
  .kso {
    --kso-ry: 0deg;
    --kso-rx: 0deg;
    width: min(100%, 640px);
    margin: 8px auto 0;
  }
}

@media (max-width: 560px) {
  .kso-card {
    padding: 13px 11px 12px;
    border-radius: 18px;
  }

  .kso-title span,
  .kso-replay span {
    display: none;
  }

  .kso-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .kso-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .kso-tray-head {
    flex-basis: 100%;
    margin: 0;
  }

  .kso-pill {
    height: 22px;
    padding: 0 6px 0 7px;
    font-size: 10px;
  }

  .kso-cell {
    height: 38px;
  }

  .kso-lesson {
    padding: 2px 3px 2px 5px;
  }

  .kso-lesson strong {
    font-size: 9.5px;
  }

  .kso-lesson span {
    font-size: 8.5px;
  }

  .kso-stat b {
    font-size: 16px;
  }

  .kso-reason {
    max-width: 150px;
    font-size: 9.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kso-card {
    transform: none;
    transition: none;
  }

  .kso *,
  .kso *::before,
  .kso *::after {
    animation: none !important;
    transition: none !important;
  }
}
