/* ============ TableForge — icons + detailed workflow animation ============ */

/* Inline command icon — bigger, on a neutral light tile so dark icons read */
.cmd-ico { width: 28px; height: 28px; background: #eceff5; border: 1px solid #c8cdd8;
  border-radius: 6px; padding: 3px; box-sizing: border-box; vertical-align: -9px; margin-right: 10px; }

/* ---- Ribbon illustration ---- */
.rbn { display: flex; overflow-x: auto; border: 1px solid var(--border-2); border-radius: 12px;
  background: #2b2d3a; padding: 6px 4px; margin: 16px 0; }
.rbn-panel { display: flex; flex-direction: column; align-items: center; padding: 2px 7px;
  border-right: 1px solid rgba(255,255,255,.07); flex: 0 0 auto; }
.rbn-panel:last-child { border-right: 0; }
.rbn-btns { display: flex; gap: 1px; }
.rbn-b { display: flex; flex-direction: column; align-items: center; width: 60px; padding: 5px 2px; border-radius: 5px; }
.rbn-b:hover { background: rgba(255,255,255,.06); }
.rbn-b img { width: 30px; height: 30px; margin-bottom: 5px; background: #eceff5; border-radius: 5px; padding: 3px; box-sizing: border-box; }
.rbn-b span { font-size: .6rem; line-height: 1.15; text-align: center; color: #cdd6f4; }
.rbn-title { margin-top: 5px; font-size: .58rem; color: #8a90a0; text-transform: uppercase; letter-spacing: .05em; }
.cmd-table tr.grp td { background: #1a1b26; color: var(--accent); font-weight: 700;
  font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; }
.cmd-table td .bt { display: flex; align-items: center; gap: 9px; }
.cmd-table td .bt b { color: var(--text); white-space: nowrap; }

/* ---- EXCONFIG dialog illustration ---- */
.cfg { border: 1px solid var(--border-2); border-radius: 12px; overflow: hidden; margin: 16px 0; background: var(--surface-2); }
.cfg-bar { display: flex; align-items: center; gap: 6px; padding: 7px 11px; background: #21222e;
  border-bottom: 1px solid var(--border); font-size: .72rem; color: var(--text-2); font-family: 'JetBrains Mono', monospace; }
.cfg-bar i { width: 8px; height: 8px; border-radius: 50%; }
.cfg-bar i:nth-child(1) { background: #f38ba8; } .cfg-bar i:nth-child(2) { background: #f9e2af; } .cfg-bar i:nth-child(3) { background: #a6e3a1; }
.cfg-bar span { margin-left: 4px; }
.cfg table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.cfg th { text-align: left; padding: 8px 12px; color: var(--muted); font-size: .68rem; text-transform: uppercase;
  letter-spacing: .06em; border-bottom: 1px solid var(--border); background: #1a1b26; white-space: nowrap; }
.cfg td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.cfg tr.sel td { background: rgba(137,180,250,.13); }
.cfg .rx { text-align: center; font-size: 1.05rem; line-height: 1; }
.cfg .on { color: var(--green); } .cfg .off { color: #555a6e; }
.cfg-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 9px 12px;
  font-size: .78rem; color: var(--text-2); background: #1a1b26; border-top: 1px solid var(--border); }
.cfg-foot b { color: var(--text); }
.cfg-foot .k { display: inline-block; background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: 5px; padding: 1px 7px; margin: 0 2px; font-size: .92em; }
.cfg-foot .pri { color: #fff; background: #2563c7; border-color: #2563c7; }

/* ---- Animation shell ---- */
.tfa { background: var(--surface); border: 1px solid var(--border-2); border-radius: 16px;
  padding: 22px; margin: 10px 0 6px; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.tfa-row { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }

/* ---- Window chrome ---- */
.tfa-win { border: 1px solid var(--border-2); border-radius: 10px; overflow: hidden;
  background: var(--surface-2); width: 250px; box-shadow: 0 8px 24px -16px rgba(0,0,0,.7); }
.tfa-bar { display: flex; align-items: center; gap: 5px; padding: 6px 9px; font-size: .68rem;
  color: var(--text-2); background: #21222e; border-bottom: 1px solid var(--border); }
.tfa-bar i { width: 8px; height: 8px; border-radius: 50%; background: #3a3d4d; }
.tfa-bar i:nth-child(1) { background: #f38ba8; } .tfa-bar i:nth-child(2) { background: #f9e2af; } .tfa-bar i:nth-child(3) { background: #a6e3a1; }
.tfa-bar span { margin-left: 4px; font-family: 'JetBrains Mono', monospace; }

/* ---- Excel sheet ---- */
.tfa-sheet { position: relative; display: grid; grid-template-columns: 18px 60px 34px 56px;
  background: #ffffff; font-family: 'JetBrains Mono', monospace; font-size: 10.5px; }
.tfa-sheet > span { padding: 3px 5px; border-right: 1px solid #e3e6ec; border-bottom: 1px solid #e3e6ec;
  color: #2b2f3a; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.tfa-sheet .ci, .tfa-sheet .ri { background: #eef1f6; color: #9097a6; text-align: center; font-weight: 700; }
.tfa-sheet .hh { font-weight: 700; }
.tfa-chg { position: relative; display: inline-block; min-width: 32px; }
.tfa-chg b { font-weight: 400; position: absolute; left: 0; top: 0; }
.tfa-chg .o { position: static; animation: tfaXo 12s linear infinite; }
.tfa-chg .n { color: #1c9e57; opacity: 0; animation: tfaXn 12s linear infinite; }
.tfa-marquee { position: absolute; left: 18px; top: 0; width: 150px; height: 100%;
  border: 2px dashed #1f8f4e; border-radius: 2px; opacity: 0; pointer-events: none;
  animation: tfaMarq 12s ease-in-out infinite; }

/* ---- Arrow between windows ---- */
.tfa-arrow { position: relative; width: 52px; height: 10px; }
.tfa-arrow::before { content: ""; position: absolute; left: 0; right: 8px; top: 50%; height: 2px;
  background: repeating-linear-gradient(90deg, var(--border-2) 0 5px, transparent 5px 10px); }
.tfa-arrow::after { content: ""; position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  border-left: 7px solid var(--border-2); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.tfa-dot { position: absolute; top: 50%; left: 0; width: 9px; height: 9px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 10px var(--green); transform: translate(-50%, -50%); opacity: 0;
  animation: tfaDot 12s ease-in-out infinite; }

/* ---- AutoCAD drawing window ---- */
.tfa-dwg .tfa-canvas { background: #0d1018;
  background-image: linear-gradient(rgba(137,180,250,.07) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(137,180,250,.07) 1px, transparent 1px);
  background-size: 14px 14px; padding: 8px; }
.tfa-svg { display: block; width: 100%; height: auto; }
.tfa-grid { fill: none; stroke: #74c7ec; stroke-width: 1.4; stroke-linecap: square;
  stroke-dasharray: 1300; stroke-dashoffset: 1300; animation: tfaGrid 12s ease-in-out infinite; }
.tfa-txt { opacity: 0; animation: tfaTxt 12s ease-in-out infinite; }
.tfa-co { animation: tfaCo 12s linear infinite; }
.tfa-cn { fill: #a6e3a1; opacity: 0; animation: tfaCn 12s linear infinite; }
.tfa-flash { fill: rgba(166,227,161,.85); opacity: 0; animation: tfaFlash 12s ease-in-out infinite; }

/* ---- Command toolbar ---- */
.tfa-tools { display: flex; gap: 26px; align-items: flex-start; flex-wrap: wrap; justify-content: center; }
.tfa-step { display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative;
  opacity: .4; filter: grayscale(.55); animation: tfaStep 12s ease-in-out infinite; animation-delay: calc(var(--i) * 4s); }
.tfa-icw { display: grid; place-items: center; width: 52px; height: 52px; background: #eceff5;
  border: 1px solid #c8cdd8; border-radius: 13px; box-shadow: 0 2px 6px -2px rgba(0,0,0,.4); }
.tfa-icw img { width: 38px; height: 38px; }
.tfa-cmd { font-family: 'JetBrains Mono', monospace; font-size: .7rem; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 2px 8px; white-space: nowrap; }
.tfa-spin img { animation: tfaSpin 12s ease-in-out infinite; }
.tfa-watch img { animation: tfaEye 12s ease-in-out infinite; transform-origin: center; }
.tfa-badge { position: absolute; top: -10px; right: -8px; font-size: .58rem; color: var(--green);
  background: rgba(166,227,161,.12); border: 1px solid rgba(166,227,161,.45); border-radius: 100px; padding: 0 6px; }

/* ---- Status toast ---- */
.tfa-toast { position: relative; height: 24px; width: 100%; max-width: 460px; }
.tfa-toast span { position: absolute; left: 0; right: 0; text-align: center; font-size: .82rem; opacity: 0; }
.tfa-t1 { color: #f9e2af; animation: tfaT1 12s ease-in-out infinite; }
.tfa-t2 { color: var(--green); animation: tfaT2 12s ease-in-out infinite; }

/* ===================== keyframes (12s master loop) ===================== */
@keyframes tfaStep {
  0%   { opacity: .4; filter: grayscale(.55); transform: translateY(0) scale(1); }
  4%   { opacity: 1; filter: none; transform: translateY(-3px) scale(1.06); }
  26%  { opacity: 1; filter: none; transform: translateY(0) scale(1); }
  31%  { opacity: .4; filter: grayscale(.55); }
  100% { opacity: .4; filter: grayscale(.55); }
}
@keyframes tfaSpin { 0%, 66% { transform: rotate(0); } 86% { transform: rotate(360deg); } 100% { transform: rotate(360deg); } }
@keyframes tfaEye { 0%, 33%, 60%, 100% { transform: scale(1); } 40%, 50% { transform: scale(1.22); } }
@keyframes tfaMarq {
  0%, 2% { opacity: 0; } 5% { opacity: 1; } 27% { opacity: 1; } 31% { opacity: 0; } 100% { opacity: 0; }
}
@keyframes tfaDot {
  0%, 8% { left: 2px; opacity: 0; } 11% { opacity: 1; } 23% { left: 46px; opacity: 1; } 26% { left: 46px; opacity: 0; } 100% { opacity: 0; }
}
@keyframes tfaGrid {
  0%, 9% { stroke-dashoffset: 1300; } 25% { stroke-dashoffset: 0; } 90% { stroke-dashoffset: 0; }
  97%, 100% { stroke-dashoffset: 1300; }
}
@keyframes tfaTxt { 0%, 24% { opacity: 0; } 32% { opacity: 1; } 90% { opacity: 1; } 96%, 100% { opacity: 0; } }
/* Excel value change ($520 -> $880) at the EXWATCH edit, reset at loop end */
@keyframes tfaXo { 0%, 35% { opacity: 1; } 39% { opacity: 0; } 96% { opacity: 0; } 99%, 100% { opacity: 1; } }
@keyframes tfaXn { 0%, 35% { opacity: 0; } 39% { opacity: 1; } 96% { opacity: 1; } 99%, 100% { opacity: 0; } }
/* CAD value updates only after EXUPDATEALL */
@keyframes tfaCo { 0%, 71% { opacity: 1; } 77% { opacity: 0; } 100% { opacity: 0; } }
@keyframes tfaCn { 0%, 71% { opacity: 0; } 77% { opacity: 1; } 100% { opacity: 1; } }
@keyframes tfaFlash { 0%, 71% { opacity: 0; } 76% { opacity: .8; } 84% { opacity: 0; } 100% { opacity: 0; } }
@keyframes tfaT1 { 0%, 33% { opacity: 0; transform: translateY(5px); } 38% { opacity: 1; transform: none; } 62% { opacity: 1; } 66% { opacity: 0; } 100% { opacity: 0; } }
@keyframes tfaT2 { 0%, 69% { opacity: 0; transform: translateY(5px); } 74% { opacity: 1; transform: none; } 93% { opacity: 1; } 97% { opacity: 0; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .tfa * { animation: none !important; }
  .tfa-step { opacity: 1; filter: none; }
  .tfa-grid { stroke-dashoffset: 0; } .tfa-txt { opacity: 1; }
  .tfa-chg .n, .tfa-cn, .tfa-t2 { opacity: 0; } .tfa-co, .tfa-chg .o { opacity: 1; }
}
@media (max-width: 600px) { .tfa-win { width: 220px; } .tfa-tools { gap: 16px; } }
