/* frontend/styles/auto.css — 원본 auto.css 이식 (자동화 규칙 빌더)
   공유 dash 기본 클래스는 dash-base.css. hero/cmd/chips 는 NewView 용으로 함께 포함. */
@import "./dash-base.css";

/* 하위 화면마다 카드 수가 적어 — 보드를 단일 열 풀폭으로 (원본 .dash → .auto-page) */
.auto-page .board {
  grid-template-columns: 1fr;
  gap: 16px;
}
.auto-page .card.sp2 {
  grid-column: auto;
}
.auto-page .card.r2 {
  grid-row: auto;
}
/* 작동 방식 설명은 풀폭에서 가로 3열로 */
@media (min-width: 900px) {
  .how-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
  .how {
    border-top: none;
    padding: 0;
  }
  .how:first-child {
    padding-top: 0;
  }
}

/* ---------- 히어로 / 명령 입력 (NewView; 원본 dash.css 공유분) ---------- */
.hero {
  background:
    radial-gradient(95% 105% at 0% 0%, rgba(231, 128, 82, 0.22), transparent 56%),
    radial-gradient(130% 130% at 100% 0%, rgba(255, 255, 255, 0.42), transparent 50%),
    var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow), var(--glass-hi);
  color: var(--ink);
}
.hero-spark {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--coral);
  border: 1px solid transparent;
  padding: 5px 12px;
  border-radius: 999px;
  align-self: flex-start;
  box-shadow: 0 5px 14px -5px var(--coral);
  white-space: nowrap;
}
.hero-spark .ic {
  width: 14px;
  height: 14px;
}
.hero p.brief {
  font-size: clamp(18px, 1.7vw, 22px);
  line-height: 1.5;
  letter-spacing: -0.02em;
  margin: 16px 0 18px;
  color: var(--ink);
  max-width: 40ch;
}
.hero p.brief b {
  color: var(--ink);
  font-weight: 700;
  border-bottom: 2px solid color-mix(in oklab, var(--coral) 60%, transparent);
  padding-bottom: 1px;
}
.cmd {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--glass-2);
  border: 1px solid var(--glass-brd);
  border-radius: 15px;
  padding: 7px 7px 7px 16px;
  margin-top: auto;
}
.cmd > svg:first-child {
  color: var(--ink-2);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.cmd input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  color: var(--ink);
  font-size: 14.5px;
}
.cmd input::placeholder {
  color: var(--faint);
}
.cmd .send {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--fill);
  color: var(--on-fill);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: filter 0.14s;
}
.cmd .send .ic {
  width: 18px;
  height: 18px;
}
.cmd .send:hover {
  filter: brightness(1.05);
}
.send:disabled {
  opacity: 0.4;
  cursor: default;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--glass-2);
  border: 1px solid var(--glass-brd);
  padding: 7px 12px;
  border-radius: 999px;
  transition: background 0.14s;
}
.chip .ic {
  width: 14px;
  height: 14px;
  color: var(--muted);
}
.chip:hover {
  background: var(--card-2);
}

/* ---------- 토글 스위치 ---------- */
.sw {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--card-3);
  border: 1px solid var(--line-2);
  position: relative;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.18s, border-color 0.18s;
}
.sw::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  transition: transform 0.18s;
}
.sw.on {
  background: var(--green);
  border-color: var(--green);
}
.sw.on::after {
  transform: translateX(18px);
}

/* ---------- 트리거 → 조건 → 동작 플로우 칩 ---------- */
.fl {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}
.fl-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 12px;
  border-radius: 12px;
  background: var(--glass-2);
  border: 1px solid var(--glass-brd);
  min-width: 0;
}
.fl-chip .k {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.fl-chip .v {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.fl-chip.tg .k {
  color: var(--blue);
}
.fl-chip.cd .k {
  color: var(--amber);
}
.fl-chip.ac .k {
  color: var(--coral);
}
.fl-arr {
  color: var(--faint);
  display: inline-flex;
}
.fl-arr .ic {
  width: 14px;
  height: 14px;
}

/* ---------- 새 규칙 작성기 ---------- */
.rb-make-btn {
  margin-top: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 11px;
  border-radius: 12px;
  background: var(--fill);
  color: var(--on-fill);
  font-size: 13px;
  font-weight: 600;
  transition: filter 0.14s;
}
.rb-make-btn:hover {
  filter: brightness(1.1);
}
.rb-make-btn .ic {
  width: 15px;
  height: 15px;
}

/* ---------- 내 규칙 목록 ---------- */
.rl-list {
  display: flex;
  flex-direction: column;
}
.rl-row {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}
.rl-row:first-child {
  border-top: none;
  padding-top: 2px;
}
.rl-row .sw {
  margin-top: 3px;
}
.rl-row.off .rl-body {
  opacity: 0.5;
}
.rl-body {
  flex: 1;
  min-width: 0;
  transition: opacity 0.18s;
}
.rl-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.rl-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.rl-cat {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
}
.rl-flow .fl-chip {
  padding: 4px 9px;
  border-radius: 9px;
}
.rl-flow .fl-chip .k {
  font-size: 9px;
}
.rl-flow .fl-chip .v {
  font-size: 11.5px;
  font-weight: 500;
}
.rl-flow .fl-arr .ic {
  width: 12px;
  height: 12px;
}
.rl-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.rl-new {
  animation: rlin 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@keyframes rlin {
  from {
    opacity: 0;
    transform: translateY(-7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- 아리 제안 ---------- */
.sg {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sg-card {
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-brd);
  background: var(--glass-2);
  padding: 13px;
}
.sg-pat {
  display: flex;
  gap: 9px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.55;
  margin-bottom: 11px;
}
.sg-pat .ic {
  width: 15px;
  height: 15px;
  color: var(--violet);
  flex-shrink: 0;
  margin-top: 2px;
}
.sg-offer {
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--card);
  border: 1px solid var(--line);
  margin-bottom: 11px;
}
.sg-name {
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 8px;
}
.sg-btns {
  display: flex;
  gap: 7px;
}
.sg-yes {
  flex: 1;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 9px;
  border-radius: 10px;
  background: var(--fill);
  color: var(--on-fill);
  font-size: 12.5px;
  font-weight: 600;
  transition: filter 0.14s;
}
.sg-yes:hover {
  filter: brightness(1.1);
}
.sg-yes .ic {
  width: 13px;
  height: 13px;
}
.sg-no {
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--glass-2);
  border: 1px solid var(--glass-brd);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: background 0.14s;
}
.sg-no:hover {
  background: var(--card-2);
}
.sg-empty {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 2px;
}
.sg-empty .ic {
  width: 15px;
  height: 15px;
  color: var(--green);
  flex-shrink: 0;
}

/* ---------- 실행 기록 ---------- */
.rb-log {
  display: flex;
  flex-direction: column;
}
.lg-row {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.lg-row:first-child {
  border-top: none;
  padding-top: 2px;
}
.lg-time {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  width: 66px;
  flex-shrink: 0;
  padding-top: 3px;
  white-space: nowrap;
}
.lg-body {
  flex: 1;
  min-width: 0;
}
.lg-rule {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--glass-2);
  border: 1px solid var(--glass-brd);
  border-radius: 999px;
  padding: 2px 8px;
  display: inline-block;
  margin-bottom: 5px;
}
.lg-text {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.45;
}
.lg-undo {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--card-2);
  flex-shrink: 0;
  align-self: center;
  transition: color 0.14s;
}
.lg-undo:hover {
  color: var(--ink);
}

/* ---------- 작동 방식 (내 규칙 사이드 카드) ---------- */
.how-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.how {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.how:first-child {
  border-top: none;
  padding-top: 2px;
}
.how-ic {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: color-mix(in oklab, var(--coral) 13%, transparent);
  color: var(--coral);
}
.how-ic .ic {
  width: 15px;
  height: 15px;
}
.how b {
  font-size: 13px;
  font-weight: 700;
  display: block;
  letter-spacing: -0.01em;
}
.how span {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 3px;
  display: block;
}

/* ---------- 새 자동화 · 미리보기 ---------- */
.nv-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 13px;
}
.nv-hint {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.nv-hint .ic {
  width: 14px;
  height: 14px;
  color: var(--ink-2);
  flex-shrink: 0;
}
.nv-empty {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 18px 4px 8px;
}
.nv-empty-ic {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--glass-2);
  border: 1px solid var(--glass-brd);
  color: var(--coral);
}
.nv-empty-ic .ic {
  width: 22px;
  height: 22px;
}
.nv-empty p {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
  margin: 0;
}
.nv-empty p b {
  color: var(--ink);
  font-weight: 700;
}

/* ---------- 토스트 ---------- */
.au-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 20px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--on-fill);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 80;
  animation: toastin 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.au-toast .ic {
  width: 16px;
  height: 16px;
  color: var(--lime);
}
@keyframes toastin {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
