/* ================================================================
   TTS Player + Accessibility Panel — Styles
   ================================================================ */

/* ------------------------------------------------------------------
   1. Active element highlight
   ------------------------------------------------------------------ */

.tts-active {
  position: relative;
  background: linear-gradient(
    135deg,
    rgba(44, 63, 98, 0.06) 0%,
    rgba(164, 193, 243, 0.14) 100%
  );
  border-left: 3px solid var(--primary-color, #2C3F62);
  padding-left: 12px;
  border-radius: 4px;
  transition: background 0.35s ease, border-color 0.35s ease, padding-left 0.25s ease;
}

/* Subtle animated "pulse" glow while speaking */
.tts-active::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 4px;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(44, 63, 98, 0.08);
  animation: tts-pulse 2s ease-in-out infinite;
}

@keyframes tts-pulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(44, 63, 98, 0.08); }
  50%      { box-shadow: inset 0 0 0 2px rgba(44, 63, 98, 0.16); }
}

/* ------------------------------------------------------------------
   2. Floating Accessibility Button (FAB)
   ------------------------------------------------------------------ */

#a11y-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--primary-color, #2C3F62);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(44, 63, 98, 0.35);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

#a11y-fab:hover {
  background: #1a325e;
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(44, 63, 98, 0.45);
}

#a11y-fab:active {
  transform: scale(0.96);
}

#a11y-fab svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

/* ------------------------------------------------------------------
   3. Backdrop overlay
   ------------------------------------------------------------------ */

#a11y-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#a11y-overlay.is-visible {
  opacity: 1;
  pointer-events: all;
}

/* ------------------------------------------------------------------
   4. Slide-in Drawer
   ------------------------------------------------------------------ */

#a11y-drawer {
  position: fixed;
  bottom: 90px;        /* sits above the FAB */
  right: 24px;
  z-index: 10002;
  width: 300px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;

  /* Hidden state */
  transform: translateY(20px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity   0.22s ease;
  transform-origin: bottom right;
}

#a11y-drawer.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ------------------------------------------------------------------
   5. Drawer Header
   ------------------------------------------------------------------ */

.a11y-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--primary-color, #2C3F62);
  color: #fff;
}

.a11y-drawer__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.a11y-drawer__title svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

#a11y-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  transition: background 0.15s ease, color 0.15s ease;
}

#a11y-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

#a11y-close svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ------------------------------------------------------------------
   6. Drawer Sections
   ------------------------------------------------------------------ */

.a11y-section {
  padding: 16px;
  border-bottom: 1px solid #eef0f4;
}

.a11y-section:last-child {
  border-bottom: none;
}

.a11y-section__label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-color, #2C3F62);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.a11y-section__label svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}

.a11y-section__desc {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* ------------------------------------------------------------------
   7. TTS Controls (inline inside drawer)
   ------------------------------------------------------------------ */

.tts-controls-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-color, #F2F6FC);
  padding: 6px 10px;
  border-radius: 9999px;
  width: fit-content;
}

/* ------------------------------------------------------------------
   8. Individual control buttons
   ------------------------------------------------------------------ */

.tts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
  color: var(--primary-color, #2C3F62);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.tts-btn:hover:not(:disabled) {
  background: var(--primary-color, #2C3F62);
  color: #fff;
  transform: scale(1.1);
}

.tts-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.tts-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Primary action (play / pause / resume) gets a filled style */
.tts-btn--primary {
  width: 40px;
  height: 40px;
  background: var(--primary-color, #2C3F62);
  color: #fff;
}

.tts-btn--primary:hover:not(:disabled) {
  background: #1a325e;
  transform: scale(1.12);
}

/* ------------------------------------------------------------------
   9. SVG icon sizing inside buttons
   ------------------------------------------------------------------ */

.tts-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  pointer-events: none;
}

.tts-btn--primary svg {
  width: 20px;
  height: 20px;
}

/* ------------------------------------------------------------------
   10. Screen-reader-only label
   ------------------------------------------------------------------ */

.tts-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

