/* ── Performance Abacus Dashboard ──────────────────────────────────────── */
/* Companion CSS for dashboard_abacus.js                                   */

/* ── Design tokens ──────────────────────────────────────────────────────── */
:root {
  /* Colors */
  --ab-rod:          #9B72CF;
  --ab-beam-clr:     #9B72CF;
  --ab-text-primary: #FFFFFF;
  --ab-text-muted:   #8899AA;
   --clr-smallText-primary-light: #7C5AA6;

  /* Layout — all pixel values match the JS animation constants */
  --ab-col-w:        56px;   /* column width = bead width (beads fill column) */
  --ab-rod-w:        10px;
  --ab-frame-pad:    12px;
  --ab-frame-radius: 14px;
  --ab-inner-h:      220px;  /* fixed column height */
  --ab-beam-top:     44px;   /* beam top edge inside .ab-col */
  --ab-beam-h:       11px;   /* beam thickness */
}

/* ── Dashboard container — sits inside the page, inherits its background ── */
#abacus-dashboard {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Cairo', 'Tajawal', system-ui, sans-serif;
  direction: rtl;
  width: 100%;
}

/* ── Frame (transparent — visual comes from page, not the abacus widget) ── */
.ab-frame {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

/* ── Inner playing field ────────────────────────────────────────────────── */
.ab-inner {
  position: relative;
  width: 224px;              /* 4 columns × 56px */
  height: var(--ab-inner-h);   /* 220 px — matches column height */
  background: transparent;
  border-radius: 4px;
  overflow: visible;
}

/* ── Horizontal beam ────────────────────────────────────────────────────── */
.ab-beam {
  position: absolute;
  top: var(--ab-beam-top);    /* 44 px — sits at 44 px from .ab-inner top */
  left: 0;
  right: 0;
  width: 100%;               /* stretch full width of .ab-inner */
  height: var(--ab-beam-h);   /* 11 px */
  background:  #d1bdec 100%;

  border-radius: 3px;
  z-index: 2;                  /* above rod (1), below beads (3) */
  box-shadow: 0 2px 8px rgba(217, 195, 246, 0.5);
}

/* ── Column row ─────────────────────────────────────────────────────────── */
.ab-cols {
  display: flex;
  flex-direction: row;  /* columns run right-to-left visually (RTL) */
  height: 100%;
  width: 100%;
  gap: 10px;
}

/* ── Single column ──────────────────────────────────────────────────────── */
.ab-col {
  position: relative;
  width: var(--ab-col-w);   /* 56 px — beads span full column width */
  height: 220px;             /* fixed; matches --ab-inner-h */
  cursor: pointer;
  transition: background 0.2s;
}

.ab-col:hover {
  background: rgba(155, 114, 207, 0.06);
  border-radius: 4px;
}

/* ── Vertical rod ───────────────────────────────────────────────────────── */
.ab-rod {
  position: absolute;
  left: calc((var(--ab-col-w) - var(--ab-rod-w)) / 2);  /* centered in 56 px → 23 px */
  top: 0;
  bottom: 0;
  width: var(--ab-rod-w);
    background:  #d1bdec ;

  border-radius: 5px;
  box-shadow: 0 0 6px rgba(217, 195, 246, 0.25);
  z-index: 1;                  /* below beam (2) and beads (3) */
}

/* ── Bead base styles ───────────────────────────────────────────────────── */
.ab-bead {
  position: absolute;
  left: 0;
  width: 100%;               /* fills the full 56 px column width */
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FF6B6B 0%, #4ECDC4 100%);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.25),
    inset 0 2px 4px rgba(255, 255, 255, 0.3);
  transition: transform 400ms ease-in-out;
  z-index: 3;                /* above rod (1) and beam (2) */
}


/* ── Heaven bead ─────────────────────────────────────────────────────────── */
/* Rests at TOP of column, away from beam                                   */
.ab-heaven,
.heaven-bead {
  top: 8px;                         /* 8 px below column top edge */
  transform: translateY(0);
}

/* Active: slides DOWN 28 px toward beam (top: 44 px) */
.heaven-bead.active {
  transform: translateY(8px);
}

/* ── Earth beads ─────────────────────────────────────────────────────────── */
/* Rest at BOTTOM of column (220 px tall), away from beam.                  */
/* Beam bottom edge = 44 + 11 = 55 px from top                             */
/*                  = 220 - 55 = 165 px from bottom.                       */
/*                                                                          */
/* Stack from bottom (4 px pad, 28 px bead, 4 px gap each):                */
/*   e0 bottom: 4 px   → translateY target = -(165 - 4  - 28) = -133 px   */
/*   e1 bottom: 36 px  → translateY target = -(165 - 36 - 28) = -101 px   */
/*   e2 bottom: 68 px  → translateY target = -(165 - 68 - 28) = -69 px    */
/*   e3 bottom: 100 px → translateY target = -(165 - 100- 28) = -37 px    */

.ab-earth-0 { bottom: 4px;   transform: translateY(0); }
.ab-earth-1 { bottom: 36px;  transform: translateY(0); }
.ab-earth-2 { bottom: 68px;  transform: translateY(0); }
.ab-earth-3 { bottom: 100px; transform: translateY(0); }

/* Active: each bead slides UP so its top edge sits flush below the beam   */
.ab-earth-0.active { transform: translateY(-40px); }
.ab-earth-1.active { transform: translateY(-39px); }
.ab-earth-2.active { transform: translateY(-38px);  }
.ab-earth-3.active { transform: translateY(-37px);  }

/* ── Labels row ─────────────────────────────────────────────────────────── */
.ab-labels {
  display: flex;
  flex-direction: row;
  direction: rtl;
  margin-top: 10px;
  gap: 0;
  width: 224px;              /* match .ab-inner width: 4 columns × 56px */
}

/* Each column's label block (name + % + status) */
.ab-label-cell {
  width: var(--ab-col-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding-top: 6px;
  transition: opacity 0.3s;
}

/* Arabic metric name */
.ab-label-name {
  font-size: 11px;
  font-weight: 700;
  color: var( --clr-smallText-primary-light);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* Numeric % value */
.ab-label-pct {
  font-family: 'Cairo', 'Tajawal', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--clr-primary-darkest);
  line-height: 1;
  direction: ltr;
}

/* Hint line below the labels row */
.abacus-hint {
  text-align: center;
  font-size: 11px;
  color: var( --clr-smallText-primary-light);
  margin-top: 6px;
  margin-bottom: 0;
}


.ab-cell--no-data .ab-label-pct {
  color: var(--ab-text-muted);
  font-size: 16px;
}

/* ── Wrapper ────────────────────────────────────────────────────────────── */
.ab-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  background: transparent;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
/* Column/bead dimensions are fixed px — no layout rescaling needed.         */
@media (max-width: 420px) {
  :root {
    --ab-frame-pad: 10px;
    --ab-rod-w:     8px;
  }
}
.ab-inner,
.ab-beam,
.ab-labels {
  transition: width 400ms ease-in-out;
}


  .perf-meter {
    flex: 1;
    min-width: 0;
    max-width: 387px;
    padding: 0;
  }
  .perf-meter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
    width: 100%;
    max-width: 348px;
    margin: 0 auto 8px;
  }
  .perf-meter-header h2 {
    color: var(--clr-primary-darkest);
    font-size: 24px;
    line-height: 32px;
    font-weight: 700;
    margin: 0;
  }
  .abacus-locked-container {
    position: relative;
    max-width: 348px;
    margin: 0 auto;
  }
  .abacus-locked-container #abacus-dashboard {
    filter: blur(2.5px);
    opacity: 0.45;
    pointer-events: none;
    user-select: none;
  }
  .abacus-locked-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 14px;
    text-align: center;
    padding: 16px;
  }
  .abacus-locked-overlay svg {
    color: var(--clr-primary-darkest, #2d0047);
    opacity: 0.85;
  }
  .abacus-locked-overlay p {
    color: var(--clr-primary-darkest, #2d0047);
    font-size: 13px;
    font-weight: 600;
    margin: 0;
  }
  .perf-meter-register-btn {
    display: inline-block;
    padding: 7px 22px;
    background: var(--ab-beam-clr);
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
  }
  .perf-meter-register-btn:hover {
    opacity: 0.88;
  }
  .ab-mode-toggle {
    display: flex;
    gap: 4px;
    background: var(--clr-primary-lighter);
    border-radius: 30px;
    padding: 3px;
  }
  .ab-mode-btn {
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    color: var(--clr-primary-light);
    background: transparent;
    border: none;
    border-radius: 26px;
    padding: 4px 10px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    direction: rtl;
  }
  .ab-mode-btn.ab-mode-btn--active {
    background: var(--clr-white);
    color: var(--clr-primary-darkest);
    box-shadow: 0 2px 6px rgba(78, 0, 92, 0.15);
  }
  .abacus-wrap {
    position: relative;
    width: 100%;
    max-width: 280px;
    height: 240px;
    margin: 0 auto;
    direction: ltr;
    overflow: hidden;
  }
  .ab-bead {
    position: absolute;
    left: 0;
    width: 56px;
    height: 28px;
    border-radius: 999px;
    background: #f5cc86;
  }
  .abacus-labels {
    display: flex;
    width: 100%;
    max-width: 280px;
    margin: 8px auto 0;
    direction: ltr;
  }