
/* Upasana Wellness - reusable component styles: SC_Table and SC_Busy */

/* =====================  SC_Table  ===================== */
.uw-sc { background: #fff; border: 1px solid var(--uw-line); border-radius: var(--uw-radius-lg); box-shadow: var(--uw-shadow); overflow: auto; }
.uw-sc-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .93rem; color: var(--uw-ink); }
.uw-sc-table thead { position: sticky; top: 0; z-index: 3; }
.uw-sc-table th, .uw-sc-table td { padding: .65rem 1rem; text-align: left; vertical-align: middle; white-space: nowrap; }
.uw-sc-table .text-end { text-align: right; }
.uw-sc-table .text-center { text-align: center; }

/* Row 1: column headings (solid colour so wide tables show no seams) */
.uw-sc-head th { height: 46px; padding-block: 0; background: var(--uw-forest); color: #fff; font-weight: 600; letter-spacing: .01em; }
/* Row 2: column totals - hides itself automatically when there are none */
.uw-sc-total th { background: #dbe8dd; color: var(--uw-forest); font-weight: 700; border-bottom: 1px solid var(--uw-line); padding-block: .45rem; }
.uw-sc-total:not(:has(th:not(:empty))) { display: none; }
/* Row 3: search boxes */
.uw-sc-filter th { background: var(--uw-mist); border-bottom: 1px solid var(--uw-line); padding: .5rem 1rem; font-weight: 400; }
.uw-input-sm { padding: .45rem .7rem; font-size: .88rem; border-radius: 10px; min-width: 120px; }

.uw-sc-table tbody td { border-bottom: 1px solid var(--uw-line); }
.uw-sc-table tbody tr:nth-child(even) { background: #fafcf9; }
.uw-sc-table tbody tr:hover { background: var(--uw-mist); }
.uw-sc-idx { width: 84px; }
.uw-empty { text-align: center !important; color: var(--uw-ink-soft); padding: 2.2rem 1rem !important; }

/* Editable cells: dashed underline hints they can be changed */
.uw-cell-input { width: 100%; min-width: 90px; padding: .2rem .15rem; border: 0; border-bottom: 1.5px dashed var(--uw-sage); border-radius: 0; background: transparent; font: inherit; color: inherit; transition: border-color .2s, background .2s; }
.uw-cell-input:focus { outline: none; border-bottom: 1.5px solid var(--uw-moss); background: var(--uw-mist); }

/* Row number button + its dropdown (Bootstrap handles open/close) */
.uw-row-btn { display: inline-flex; align-items: center; gap: .3rem; min-width: 52px; justify-content: center; padding: .35rem .6rem; border: 0; border-radius: 9px;
  background: var(--uw-teal); color: #fff; font: 600 .85rem var(--uw-font-body); cursor: pointer; transition: background .2s; }
.uw-row-btn:hover, .uw-row-btn.show { background: var(--uw-forest); color: #fff; }
.uw-dd { min-width: 170px; padding: .35rem; border: 1px solid var(--uw-line); border-radius: 12px; box-shadow: 0 16px 36px -14px rgba(21,58,44,.45); }
.uw-dd-item { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 8px; font: 500 .9rem var(--uw-font-body); color: var(--uw-ink); }
.uw-dd-item::before { content: ""; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--uw-marigold); }
.uw-dd-item:hover, .uw-dd-item:focus, .uw-dd-item:active { background: var(--uw-mist); color: var(--uw-ink); }
.uw-dd-item.danger { color: var(--uw-terracotta); }
.uw-dd-item.danger::before { background: var(--uw-terracotta); }
.uw-dd-item.danger:hover { background: #fbeeea; color: var(--uw-terracotta); }

/* =====================  SC_Busy  ===================== */
.sc-busy {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 1rem;
  background: radial-gradient(700px 420px at 50% 40%, rgba(62,122,90,.45), transparent 70%), rgba(21,58,44,.58);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); cursor: progress;
  /* clicks are blocked at once, but the visuals fade in only if the task takes > 120ms (no flicker on quick actions) */
  animation: sc-fade .3s ease .12s both;
}
.sc-busy-card {
  width: min(320px, 100%); padding: 1.8rem 2rem 1.6rem; text-align: center; border-radius: 26px;
  background: linear-gradient(180deg, #fff, var(--uw-linen)); border-top: 5px solid var(--uw-moss);
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.55); animation: sc-pop .5s cubic-bezier(.2,.9,.3,1.15) .12s both;
}
.sc-lotus { width: 132px; height: 132px; display: block; margin: 0 auto .6rem; overflow: visible; }

.sc-arc { transform-origin: 60px 60px; }
.sc-arc.a1 { animation: sc-spin 1.7s linear infinite; }
.sc-arc.a2 { animation: sc-spin 2.9s linear infinite reverse; }
.sc-petal { fill: var(--uw-teal); transform-box: fill-box; transform-origin: 50% 100%; opacity: .3; animation: sc-bloom 1.9s ease-in-out infinite; animation-delay: var(--d, 0s); }
.sc-head { transform-box: fill-box; transform-origin: center; animation: sc-breathe 1.9s ease-in-out infinite; filter: drop-shadow(0 0 6px rgba(226,161,46,.7)); }

.sc-busy-text { margin: 0; font: 600 1.35rem var(--uw-font-display); color: var(--uw-forest); letter-spacing: .01em; }
.sc-busy-sub { margin: .25rem 0 0; font-size: .9rem; color: var(--uw-ink-soft); }
.sc-dots i { display: inline-block; width: 4px; height: 4px; margin-left: 3px; border-radius: 50%; background: var(--uw-marigold); animation: sc-dot 1.2s ease-in-out infinite; }
.sc-dots i:nth-child(2) { animation-delay: .15s; } .sc-dots i:nth-child(3) { animation-delay: .3s; }

.sc-busy-bar { height: 4px; margin: 1.1rem auto 0; width: 70%; border-radius: 4px; background: var(--uw-mist); overflow: hidden; }
.sc-busy-bar span { display: block; height: 100%; width: 40%; border-radius: 4px; background: linear-gradient(90deg, var(--uw-moss), var(--uw-marigold)); animation: sc-slide 1.4s ease-in-out infinite; }

@keyframes sc-fade   { from { opacity: 0; } to { opacity: 1; } }
@keyframes sc-pop    { from { opacity: 0; transform: translateY(14px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes sc-spin   { to { transform: rotate(360deg); } }
@keyframes sc-bloom  { 0%, 100% { opacity: .3; transform: scale(.78); } 35% { opacity: 1; transform: scale(1); } 70% { opacity: .55; transform: scale(.92); } }
@keyframes sc-breathe{ 0%, 100% { transform: scale(1); } 35% { transform: scale(1.18); } }
@keyframes sc-dot    { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
@keyframes sc-slide  { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }

@media (prefers-reduced-motion: reduce) {
  .sc-busy, .sc-busy-card { animation: none; }
  .sc-arc, .sc-petal, .sc-head, .sc-dots i, .sc-busy-bar span { animation: none; }
  .sc-petal { opacity: 1; } .sc-busy-bar span { width: 100%; }
}

/* =====================  SC_Result (success / failure)  ===================== */
.sc-res {
  position: fixed; inset: 0; z-index: 1001; display: grid; place-items: center; padding: 1rem; outline: none;
  background: radial-gradient(700px 420px at 50% 40%, rgba(62,122,90,.4), transparent 70%), rgba(21,58,44,.58);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: sc-fade .25s ease both;
}
.sc-res.bad { background: radial-gradient(700px 420px at 50% 40%, rgba(178,71,52,.28), transparent 70%), rgba(21,58,44,.62); }
.sc-res-card {
  position: relative; width: min(340px, 100%); padding: 1.7rem 2rem 1.5rem; text-align: center; overflow: hidden; border-radius: 26px;
  background: linear-gradient(180deg, #fff, var(--uw-linen)); border-top: 5px solid var(--uw-moss);
  box-shadow: 0 30px 70px -20px rgba(0,0,0,.55); animation: sc-pop .5s cubic-bezier(.2,.9,.3,1.15) both;
}
.sc-res.bad .sc-res-card { border-top-color: var(--uw-terracotta); animation: sc-pop .5s cubic-bezier(.2,.9,.3,1.15) both, sc-shake .5s ease .75s; }
.sc-res-art { width: 136px; height: 136px; display: block; margin: 0 auto .5rem; overflow: visible; }

/* outer ring draws itself */
.sc-res-ring { stroke: var(--uw-marigold); stroke-dasharray: 346; stroke-dashoffset: 346; transform: rotate(-90deg); transform-origin: 60px 60px; animation: sc-draw .8s ease .05s forwards; }
.sc-res.bad .sc-res-ring { stroke: var(--uw-terracotta); }
/* coloured disc pops in, soft pulse behind it */
.sc-res-disc { transform-box: fill-box; transform-origin: center; transform: scale(0); animation: sc-disc .5s cubic-bezier(.2,1.3,.4,1) .2s forwards; }
.sc-res-pulse { transform-box: fill-box; transform-origin: center; opacity: 0; animation: sc-pulse 1.5s ease-out .55s 1; }
/* tick / cross draw */
.sc-res-mark { stroke-dasharray: 72; stroke-dashoffset: 72; animation: sc-tick .45s cubic-bezier(.6,.1,.3,1) .6s forwards; }
.sc-res-mark.x2 { animation-delay: .78s; }
.sc-res-mark.x1, .sc-res-mark.x2 { stroke-dasharray: 48; stroke-dashoffset: 48; }
/* petal burst (success only) */
.sc-res-spark { fill: var(--c); opacity: 0; transform-box: fill-box; transform-origin: center; animation: sc-spark 1s ease-out var(--d) forwards; }

.sc-res-title { margin: 0; font: 600 1.55rem var(--uw-font-display); color: var(--uw-forest); animation: sc-rise .5s ease .75s both; }
.sc-res.bad .sc-res-title { color: var(--uw-terracotta); }
.sc-res-detail { margin: .35rem 0 0; font-size: .92rem; line-height: 1.5; color: var(--uw-ink-soft); animation: sc-rise .5s ease .85s both; }
.sc-res-actions { display: flex; justify-content: center; gap: .6rem; margin-top: 1.2rem; animation: sc-rise .5s ease .95s both; }
.sc-res-count { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--uw-mist); }
.sc-res-count span { display: block; height: 100%; background: linear-gradient(90deg, var(--uw-moss), var(--uw-marigold)); transform-origin: left; animation: sc-count var(--t) linear forwards; }

@keyframes sc-draw  { to { stroke-dashoffset: 0; } }
@keyframes sc-disc  { to { transform: scale(1); } }
@keyframes sc-pulse { 0% { opacity: .45; transform: scale(1); } 100% { opacity: 0; transform: scale(1.5); } }
@keyframes sc-tick  { to { stroke-dashoffset: 0; } }
@keyframes sc-spark { 0% { opacity: 0; transform: translateY(26px) scale(.2); } 35% { opacity: 1; } 100% { opacity: 0; transform: translateY(-8px) scale(1); } }
@keyframes sc-rise  { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes sc-shake { 15%, 55% { transform: translateX(-7px); } 35%, 75% { transform: translateX(7px); } 100% { transform: none; } }
@keyframes sc-count { from { transform: scaleX(1); } to { transform: scaleX(0); } }

@media (prefers-reduced-motion: reduce) {
  .sc-res, .sc-res-card, .sc-res.bad .sc-res-card, .sc-res-title, .sc-res-detail, .sc-res-actions { animation: none; }
  .sc-res-ring, .sc-res-mark { animation: none; stroke-dashoffset: 0; }
  .sc-res-disc { animation: none; transform: scale(1); }
  .sc-res-pulse, .sc-res-spark, .sc-res-count { display: none; }
}
