/* =============================================================================
   assets/css/actmata-toolbar.css
   ============================================================================= */

/* ==============================================================
   0. CSS‑Variablen (inline via PHP aus deinen Settings befüllt)
   ============================================================== */
:root {
  --actmata-btn-bg: #0d6efd;
  --actmata-btn-bg-rgb: 13, 110, 253;
  --actmata-btn-hover: #0b5ed7;
  --actmata-btn-text-color: #ffffff;

  --actmata-modal-bg: #ffffff;
  --actmata-modal-text-color: #212529;

  --actmata-modal-btn-bg: #e9ecef;
  --actmata-modal-btn-hover: #dde1e4;
  --actmata-modal-btn-text: #212529;
  --actmata-active-btn-bg: #d0e2ff;

  --actmata-focus-color: #ff0;

  --actmata-h1-bg: yellow;
  --actmata-h1-text: #000000;

  /* für Leseführung */
  --rg-pos: 50vh;
  --rg-half: 2em;
}

/* ==============================================================
   1. Open‑Button (fixiert, außerhalb des Modals)
   ============================================================== */
.actmata-btn {
  position: fixed;
  width: 70px;
  height: 70px;
  background-color: var(--actmata-btn-bg) !important;
  color: var(--actmata-btn-text-color) !important;
  border: none;
  padding: 8px;
  border-radius: 50px;
  font-size: 14px !important;
  z-index: 10006;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  --actmata-icon-primary: currentColor !important;
  --actmata-icon-secondary: currentColor !important;
}

.actmata-btn:hover {
  background-color: var(--actmata-btn-hover) !important;
}

.actmata-btn svg {
  fill: currentColor;
  width: 4em;
  height: 4em;
  flex-shrink: 0;
}

/* ==============================================================
   2. Modal‑Backdrop (transparent)
   ============================================================== */
.actmata-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: transparent;
  pointer-events: none;
  z-index: 10005;
}

/* ==============================================================
   3. Modal‑Container (fixiert im Viewport)
   ============================================================== */
.actmata-modal {
  display: none;
  position: fixed;
  z-index: 10006;
  font-size: 14px !important;
}

/* ==============================================================
   4. Modal‑Dialog (Hintergrund/Text)
   ============================================================== */
.actmata-modal-dialog {
  background-color: var(--actmata-modal-bg) !important;
  color: var(--actmata-modal-text-color) !important;
  border-radius: 4px;
  max-width: 360px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
}

/* Header */
.actmata-modal-header {
  padding: 12px;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.actmata-modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.actmata-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--actmata-modal-btn-bg) !important;
  color: var(--actmata-modal-btn-text) !important;
  border: 1px solid #adb5bd;
  border-radius: 4px;
  padding: 8px;
  transition: background-color 0.15s ease;
  font: inherit;
}

.actmata-modal-close:hover {
  background-color: var(--actmata-modal-btn-hover) !important;
}

.actmata-modal-close:focus {
  outline: 2px solid var(--actmata-focus-color) !important;
  outline-offset: 2px;
}

.actmata-modal-close svg {
  fill: currentColor;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

/* ==============================================================
   5. Modal‑Body & Buttons (3 Spalten, kompakt)
   ============================================================== */
.actmata-modal-body {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  align-items: stretch;
}

.actmata-modal-body button {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  aspect-ratio: 1 / 1;
  padding: 12px;
  box-sizing: border-box;
  font-size: 12px !important;
  font-weight: 500;
  color: var(--actmata-modal-btn-text) !important;
  background-color: var(--actmata-modal-btn-bg) !important;
  border: 1px solid #adb5bd;
  border-radius: 4px;

  transition: background-color 0.15s ease;
}

.actmata-modal-body button:hover {
  background-color: var(--actmata-modal-btn-hover) !important;
}

.actmata-modal-body button:focus {
  outline: 2px solid var(--actmata-focus-color) !important;
  outline-offset: 2px;
}

.actmata-modal-body button svg {
  fill: currentColor;
  width: 2.2em;
  height: 2.2em;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.actmata-modal-body button span {
  margin-top: auto;
  text-align: center;
  line-height: 1.2;
}

/* ==============================================================
   6. Aktiver Zustand
   ============================================================== */
.actmata-modal-body button.active {
  background-color: var(--actmata-active-btn-bg) !important;
  border-color: var(--actmata-btn-bg) !important;
  border-width: 2px;
  color: var(--actmata-modal-btn-text) !important;
}

#actmata-modal button#actmata-toggle-tts.active {
  background-color: var(--actmata-modal-btn-hover) !important;
  border-color: var(--actmata-btn-bg) !important;
}

/* Highlight für das gerade vorgelesene Element */
.actmata-tts-active {
  outline: 2px solid var(--actmata-h1-text);
  background-color: var(--actmata-h1-bg) !important;
  color: var(--actmata-h1-text) !important;
}

/* ==============================================================
   7. Accessibility‑Klassen & Positioning
   ============================================================== */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.actmata-pos-bottom-left {
  bottom: 16px;
  left: 16px;
}

.actmata-pos-bottom-right {
  bottom: 16px;
  right: 16px;
}

.actmata-pos-top-left {
  top: 64px;
  left: 16px;
}

.actmata-pos-top-right {
  top: 64px;
  right: 16px;
}

html.actmata-contrast {
  filter: invert(1) hue-rotate(180deg) !important;
}

html.actmata-grayscale {
  filter: grayscale(1) !important;
}

body.actmata-focus *:focus {
  outline: 3px solid var(--actmata-focus-color) !important;
  outline-offset: 2px !important;
}

/* Leseführung */
body.actmata-reading-guide::before,
body.actmata-reading-guide::after {
  content: "";
  position: fixed;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.7);
  pointer-events: none;
  z-index: 10003;
}

body.actmata-reading-guide::before {
  top: 0;
  height: calc(var(--rg-pos) - var(--rg-half));
}

body.actmata-reading-guide::after {
  top: calc(var(--rg-pos) + var(--rg-half));
  bottom: 0;
}

/* Links unterstreichen */
body.actmata-underline-links a {
  text-decoration: underline !important;
}

/* H1 hervorheben */
html.actmata-highlight-h1 h1 {
  background-color: var(--actmata-h1-bg) !important;
  color: var(--actmata-h1-text) !important;
}

/* Animationen stoppen */
body.actmata-stop-animations *,
body.actmata-stop-animations *::before,
body.actmata-stop-animations *::after {
  animation-play-state: paused !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Bilder ausblenden (Zusatz für Hintergrundbilder) */
html.actmata-hide-images *,
html.actmata-hide-images *::before,
html.actmata-hide-images *::after {
  background-image: none !important;
}

/* Sättigung */
html.actmata-low-saturation {
  filter: saturate(0.5) !important;
}

html.actmata-high-saturation {
  filter: saturate(1.5) !important;
}

/* Alt‑Text Styling */
.actmata-alt-text {
  display: block;
  font-style: italic;
  color: #333;
  background: #f8f9fa;
  padding: 0.25em 0.5em;
  margin-bottom: 0.5em;
  border-radius: 4px;
}

/* ===========================================================================
   Großer Cursor: auf BODY und alle Nachfahren anwenden
   =========================================================================== */


/* ------------- Eigener Cursor ------------- */
body.actmata-large-cursor,
body.actmata-large-cursor * {
  cursor: var(--actmata-cursor-url) !important;
}

/* ===========================================================================
   8. Responsive Layout (Mobile Devices)
   =========================================================================== */

/* Funktionen die auf Touch-Geräten keinen Sinn machen ausblenden */
@media (max-width: 768px) {

  #actmata-large-cursor,
  #actmata-reading-guide,
  #actmata-toggle-tts {
    display: none !important;
  }
}

@media (max-width: 480px) {

  #actmata-modal.actmata-pos-top-left,
  #actmata-modal.actmata-pos-top-right {
    top: 16px !important;
    left: 16px !important;
    right: 16px !important;
  }

  #actmata-modal.actmata-pos-bottom-left,
  #actmata-modal.actmata-pos-bottom-right {
    bottom: 16px !important;
    left: 16px !important;
    right: 16px !important;
  }

  .actmata-modal-dialog {
    max-width: 100% !important;
    width: 100% !important;
    max-height: calc(100vh - 32px) !important;
    overflow-y: auto !important;
  }

  .actmata-modal-header {
    padding: 8px 12px !important;
  }

  .actmata-modal-title {
    font-size: 14px !important;
  }

  /* Platzsparendes Layout auf Smartphones: 3 Spalten, minimierte Zwischenräume */
  .actmata-modal-body {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 4px !important;
    padding: 8px !important;
  }

  .actmata-modal-body button {
    padding: 6px 4px !important;
    font-size: 10px !important;
  }

  .actmata-modal-body button svg {
    width: 2.8em !important;
    height: 2.8em !important;
    margin-bottom: 4px !important;
  }
}