/* =============================================================================
   FILE: public/css/tes.css
   TES Gate Engine — Day 13
   Gate progress UI, unlock reveal animations, tier badges.
   No external dependencies — pure CSS.
   ============================================================================= */

/* ---------------------------------------------------------------------------
   CSS Variables — inherits from AVL layer if present
   --------------------------------------------------------------------------- */
:root {
  --tes-accent:         #8B6F5E;
  --tes-accent-light:   #D4B896;
  --tes-accent-pale:    #F9F3EE;
  --tes-locked:         #C9C2BB;
  --tes-locked-bg:      #F5F2EF;
  --tes-unlocked:       #5A8A6E;
  --tes-unlocked-bg:    #EDF5F0;
  --tes-text:           #2C2218;
  --tes-muted:          #7A6E65;
  --tes-border:         #E8DDD5;
  --tes-radius:         12px;
  --tes-shadow:         0 2px 12px rgba(44, 34, 24, 0.08);
  --tes-transition:     240ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------------------------------------------------------------------------
   Gate Progress Panel — wraps the full TES UI
   --------------------------------------------------------------------------- */
.tes-panel {
  background: #fff;
  border: 1px solid var(--tes-border);
  border-radius: var(--tes-radius);
  padding: 24px;
  box-shadow: var(--tes-shadow);
  max-width: 480px;
  width: 100%;
}

.tes-panel__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.tes-panel__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--tes-text);
  margin: 0;
  letter-spacing: 0.01em;
}

.tes-panel__subtitle {
  font-size: 0.78rem;
  color: var(--tes-muted);
  margin: 2px 0 0;
}

/* ---------------------------------------------------------------------------
   Current Tier Badge
   --------------------------------------------------------------------------- */
.tes-tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--tes-accent-pale);
  border: 1px solid var(--tes-accent-light);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tes-accent);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tes-tier-badge--locked {
  background: var(--tes-locked-bg);
  border-color: var(--tes-locked);
  color: var(--tes-muted);
}

/* ---------------------------------------------------------------------------
   Gate Spine — vertical timeline of gates
   --------------------------------------------------------------------------- */
.tes-gate-list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

/* Connecting line between nodes */
.tes-gate-list::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 16px;
  bottom: 16px;
  width: 2px;
  background: var(--tes-border);
  z-index: 0;
}

/* ---------------------------------------------------------------------------
   Individual Gate Item
   --------------------------------------------------------------------------- */
.tes-gate-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  position: relative;
  z-index: 1;
}

.tes-gate-item + .tes-gate-item {
  border-top: none; /* Line handled by ::before spine */
}

/* Gate node (circle) */
.tes-gate-node {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  background: var(--tes-locked-bg);
  border: 2px solid var(--tes-locked);
  color: var(--tes-locked);
  transition: background var(--tes-transition),
              border-color var(--tes-transition),
              box-shadow var(--tes-transition);
  position: relative;
  z-index: 2;
}

.tes-gate-item--unlocked .tes-gate-node {
  background: var(--tes-unlocked-bg);
  border-color: var(--tes-unlocked);
  color: var(--tes-unlocked);
}

.tes-gate-item--current .tes-gate-node {
  background: var(--tes-accent);
  border-color: var(--tes-accent);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(139, 111, 94, 0.18);
}

/* Gate label + description */
.tes-gate-body {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
}

.tes-gate-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--tes-text);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tes-gate-item--locked .tes-gate-label {
  color: var(--tes-muted);
}

.tes-gate-description {
  font-size: 0.76rem;
  color: var(--tes-muted);
  margin: 2px 0 0;
  line-height: 1.4;
}

/* Unlock pills */
.tes-gate-unlocks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.tes-gate-unlock-pill {
  font-size: 0.7rem;
  background: var(--tes-unlocked-bg);
  color: var(--tes-unlocked);
  border: 1px solid rgba(90, 138, 110, 0.3);
  border-radius: 10px;
  padding: 2px 8px;
  font-weight: 500;
}

.tes-gate-item--locked .tes-gate-unlock-pill {
  background: var(--tes-locked-bg);
  color: var(--tes-locked);
  border-color: var(--tes-locked);
}

/* ---------------------------------------------------------------------------
   Progress Bar — within a gate item, shows condition progress
   --------------------------------------------------------------------------- */
.tes-progress-bar-wrap {
  margin-top: 8px;
}

.tes-progress-label {
  font-size: 0.72rem;
  color: var(--tes-muted);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
}

.tes-progress-bar {
  height: 4px;
  background: var(--tes-border);
  border-radius: 2px;
  overflow: hidden;
}

.tes-progress-fill {
  height: 100%;
  background: var(--tes-accent);
  border-radius: 2px;
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.tes-progress-fill--complete {
  background: var(--tes-unlocked);
}

/* ---------------------------------------------------------------------------
   Next Requirement hint
   --------------------------------------------------------------------------- */
.tes-next-hint {
  font-size: 0.75rem;
  color: var(--tes-accent);
  background: var(--tes-accent-pale);
  border-left: 3px solid var(--tes-accent-light);
  border-radius: 0 6px 6px 0;
  padding: 8px 12px;
  margin-top: 16px;
  line-height: 1.5;
}

/* ---------------------------------------------------------------------------
   Unlock Reveal Animation — triggered on gate advancement
   Mirrors botanical-bloom from bloom.css but at gate scale
   --------------------------------------------------------------------------- */
@keyframes tes-gate-bloom {
  0%   { opacity: 0; transform: translateY(8px) scale(0.97); }
  60%  { opacity: 1; transform: translateY(-2px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes tes-unlock-flash {
  0%   { background-color: var(--tes-accent-pale); }
  50%  { background-color: #e8f5ee; }
  100% { background-color: transparent; }
}

.tes-gate-item--just-unlocked {
  animation: tes-unlock-flash 1200ms ease-out forwards;
}

.tes-gate-item--just-unlocked .tes-gate-node {
  animation: tes-gate-bloom 600ms ease-out forwards;
}

/* ---------------------------------------------------------------------------
   Inline gate widget — compact version for account nav / header
   --------------------------------------------------------------------------- */
.tes-widget-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--tes-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background var(--tes-transition);
}

.tes-widget-inline:hover {
  background: var(--tes-accent-pale);
}

.tes-widget-inline__label {
  font-weight: 600;
  color: var(--tes-accent);
}

.tes-widget-inline__progress {
  width: 60px;
  height: 4px;
  background: var(--tes-border);
  border-radius: 2px;
  overflow: hidden;
}

.tes-widget-inline__fill {
  height: 100%;
  background: var(--tes-accent);
  border-radius: 2px;
  transition: width 400ms ease;
}

/* ---------------------------------------------------------------------------
   Toast notification — gate unlock toast
   --------------------------------------------------------------------------- */
.tes-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #fff;
  border: 1px solid var(--tes-border);
  border-radius: var(--tes-radius);
  padding: 14px 18px;
  box-shadow: 0 8px 32px rgba(44, 34, 24, 0.16);
  max-width: 320px;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: tes-gate-bloom 400ms ease-out forwards;
  pointer-events: auto;
}

.tes-toast__icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  line-height: 1;
}

.tes-toast__body {}

.tes-toast__title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--tes-text);
  margin: 0 0 2px;
}

.tes-toast__message {
  font-size: 0.76rem;
  color: var(--tes-muted);
  margin: 0;
  line-height: 1.4;
}

.tes-toast__close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--tes-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px;
}

.tes-toast--exit {
  animation: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 300ms ease, transform 300ms ease;
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .tes-panel {
    padding: 16px;
    border-radius: 8px;
  }

  .tes-toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: none;
  }
}
