/* eLeDia Moodle Tool Guide — component-scoped styles */

/* -------------------------------------------------------------------------
 * WP theme isolation
 *
 * WordPress themes (Twenty Twenty-*, Astra, OceanWP, GeneratePress, Kadence,
 * Avada, Divi …) add aggressive global styles to links, buttons, form
 * elements and headings — often with !important — which override the
 * inline styles the React app sets. To keep the Tool Guide looking the same
 * inside any WP theme, we reset the relevant properties INSIDE our root
 * component and force the inline style to win by using `all: revert` +
 * `!important` on the base layers.
 * ------------------------------------------------------------------------- */

.eledia-toolguide-root,
.eledia-toolguide-root *,
.eledia-toolguide-root *::before,
.eledia-toolguide-root *::after {
    box-sizing: border-box;
}

.eledia-toolguide-root {
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: #353535;
    line-height: 1.5;
    background: #F3F5F8;
    /* Break out of narrow WP post content width so all bands are full viewport width. */
    position: relative;
    left: 50%;
    right: 50%;
    width: 100vw;
    max-width: 100vw;
    margin-left: -50vw;
    margin-right: -50vw;
    overflow-x: clip;
}

@supports not (overflow: clip) {
    .eledia-toolguide-root {
        overflow-x: hidden;
    }
}

.eledia-toolguide-root > .tg-app-shell {
    width: 100%;
    min-height: inherit;
}

.eledia-toolguide-root > .tg-loading {
    min-height: inherit;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 20px;
    background: #F3F5F8;
    color: #194866;
    font-size: 15px !important;
    font-weight: 700;
}

.eledia-toolguide-root .tg-loading-spinner {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    border: 3px solid #D1ECEB;
    border-top-color: #F98012;
    border-radius: 50%;
    animation: eledia-toolguide-spin 0.8s linear infinite;
}

@keyframes eledia-toolguide-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Base text / paragraph resets — WP themes often add margins, font-size
   rules and text-transform to <p>, <span>, <strong>, <em>. */
.eledia-toolguide-root p,
.eledia-toolguide-root span,
.eledia-toolguide-root strong,
.eledia-toolguide-root em,
.eledia-toolguide-root small,
.eledia-toolguide-root label,
.eledia-toolguide-root li {
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    text-shadow: none !important;
    color: inherit;
}

.eledia-toolguide-root h1,
.eledia-toolguide-root h2,
.eledia-toolguide-root h3,
.eledia-toolguide-root h4,
.eledia-toolguide-root h5,
.eledia-toolguide-root h6 {
    font-family: inherit !important;
    line-height: 1.25 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    text-shadow: none !important;
    margin: 0;
    padding: 0;
    color: inherit;
}

/* Links — the single biggest offender. WP themes force underline,
   uppercase, their own brand color and even hover backgrounds on every
   <a>. Inside our component, links must honour the inline `style` set
   by React (footer links get #FCBC82, chip links inherit, etc.). */
.eledia-toolguide-root a,
.eledia-toolguide-root a:link,
.eledia-toolguide-root a:visited,
.eledia-toolguide-root a:hover,
.eledia-toolguide-root a:focus,
.eledia-toolguide-root a:active {
    background: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    text-shadow: none !important;
    font-family: inherit !important;
    font-weight: inherit;
    font-size: inherit !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    border: 0 !important;
    border-radius: 0;
    padding: 0 !important;
    margin: 0;
    outline: none;
}

/* Footer link style: the React inline style sets color + underline on
   links via style={linkSty}. WP themes sometimes override with
   !important — re-assert it here by matching the exact container.
   Since v1.1.12 the footer uses the same beige background as the
   header, so links are dark blue (#194866) to match. */
.eledia-toolguide-root footer a,
.eledia-toolguide-root footer a:link,
.eledia-toolguide-root footer a:visited,
.eledia-toolguide-root footer a:hover,
.eledia-toolguide-root footer a:active {
    color: #194866 !important;
    text-decoration: underline !important;
}

/* Icon links (CC, GitHub) inside the footer flex-row — no underline,
   dark blue so the GitHub octocat inherits via currentColor. */
.eledia-toolguide-root footer a[title="CC BY-NC-SA 4.0"],
.eledia-toolguide-root footer a[title*="GitHub"],
.eledia-toolguide-root footer a[title*="github"] {
    color: #194866 !important;
    text-decoration: none !important;
}

/* Form controls — WP themes frequently make <select>, <input>, <button>
   full-width and override padding, border, background. Reset them. */
.eledia-toolguide-root select,
.eledia-toolguide-root input,
.eledia-toolguide-root button,
.eledia-toolguide-root textarea {
    font-family: inherit !important;
    font-size: inherit !important;
    line-height: inherit !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    text-shadow: none !important;
    box-shadow: none !important;
    width: auto;
    max-width: 100%;
    min-height: 0;
    height: auto;
    margin: 0;
    -webkit-appearance: auto;
    appearance: auto;
}

/* Specifically the filter <select>s: they must stay compact (inline
   style sets padding/border-radius/border). Make sure no theme forces
   display:block or width:100%. */
.eledia-toolguide-root select {
    display: inline-block !important;
    width: auto !important;
    background-color: #FFFFFF !important;
    background-image: none;
    color: #353535 !important;
    cursor: pointer;
}

/* Buttons — prevent theme hover backgrounds / transforms. */
.eledia-toolguide-root button {
    background-image: none;
    text-decoration: none !important;
    cursor: pointer;
}

.eledia-toolguide-root button:hover {
    transform: none !important;
}

/* Tables — some themes set border-collapse, striped backgrounds. */
.eledia-toolguide-root table {
    font-family: inherit !important;
    font-size: inherit !important;
    width: 100%;
    border: 0;
}

.eledia-toolguide-root th,
.eledia-toolguide-root td {
    font-family: inherit !important;
    font-size: inherit !important;
    border: 0;
    background: transparent;
}

.eledia-toolguide-root tr,
.eledia-toolguide-root tr:nth-child(even),
.eledia-toolguide-root tr:nth-child(odd) {
    background: transparent !important;
}

/* Images inside the component (logos, icons) — WP themes sometimes add
   borders, shadows, max-width:none conflicts. */
.eledia-toolguide-root img,
.eledia-toolguide-root svg {
    max-width: 100%;
    height: auto;
    border: 0;
    box-shadow: none;
    background: transparent;
}

/* Lists — WP post content styles often add list-style + padding. */
.eledia-toolguide-root ul,
.eledia-toolguide-root ol {
    list-style: none;
    padding: 0;
    margin: 0;
}

.eledia-toolguide-root ::selection {
    background: #F98012;
    color: white;
}

.eledia-toolguide-root button:focus-visible,
.eledia-toolguide-root a:focus-visible,
.eledia-toolguide-root select:focus-visible,
.eledia-toolguide-root input:focus-visible,
.eledia-toolguide-root [tabindex]:focus-visible {
    outline: 3px solid #b85a00;
    outline-offset: 2px;
}

/* sr-only utility for screen-reader-only content inside the component. */
.eledia-toolguide-root .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;
}

/* Custom scrollbar (matches Prototyp) */
.eledia-toolguide-root ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.eledia-toolguide-root ::-webkit-scrollbar-track {
    background: #F3F5F8;
}

.eledia-toolguide-root ::-webkit-scrollbar-thumb {
    background: #D9D9D9;
    border-radius: 4px;
}

/* High-contrast override — activated by adding .hc to <html>. */
html.hc .eledia-toolguide-root,
html.hc .eledia-toolguide-root * {
    background: #000 !important;
    color: #fff !important;
}

html.hc .eledia-toolguide-root a {
    color: #FCBC82 !important;
    text-decoration: underline !important;
}

html.hc .eledia-toolguide-root button[aria-pressed="true"],
html.hc .eledia-toolguide-root button[aria-current="page"] {
    background: #FCBC82 !important;
    color: #000 !important;
    border-color: #FCBC82 !important;
}

/* Respect prefers-reduced-motion inside the component. */
@media (prefers-reduced-motion: reduce) {
    .eledia-toolguide-root .tg-loading-spinner {
        animation: none !important;
        border-top-color: #D1ECEB;
        box-shadow: inset 0 0 0 4px #F98012;
    }

    .eledia-toolguide-root *,
    .eledia-toolguide-root *::before,
    .eledia-toolguide-root *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Responsive behaviour from the standalone HTML. On phones the matrix is
   rendered as compact tool cards instead of forcing a wide table. */
@media (max-width: 640px) {
    .eledia-toolguide-root h1 {
        font-size: 18px !important;
    }

    .eledia-toolguide-root nav button {
        padding: 6px 10px !important;
        font-size: 12px !important;
    }

    .eledia-toolguide-root table th,
    .eledia-toolguide-root table td {
        padding: 6px !important;
        font-size: 11px !important;
    }

    .eledia-toolguide-root .tg-grid-cards {
        grid-template-columns: 1fr !important;
    }

    .eledia-toolguide-root .tg-desktop-matrix {
        display: none !important;
    }

    .eledia-toolguide-root .tg-mobile-matrix {
        display: grid !important;
    }

    .eledia-toolguide-root .tg-main-pad {
        padding: 12px 12px 28px !important;
    }

    .eledia-toolguide-root .tg-filterbar {
        padding: 10px 12px !important;
    }

    .eledia-toolguide-root .tg-header {
        padding: 16px 14px !important;
    }

    .eledia-toolguide-root .tg-nav {
        padding: 8px 12px !important;
    }

    .eledia-toolguide-root .tg-nav-row {
        justify-content: flex-start !important;
        align-items: flex-start !important;
    }

    .eledia-toolguide-root .tg-nav-actions {
        justify-content: flex-start !important;
        width: 100% !important;
    }

    .eledia-toolguide-root .tg-nav-search-wrap {
        justify-content: flex-start !important;
        width: 100% !important;
    }

    .eledia-toolguide-root .tg-tool-search {
        width: 100% !important;
        max-width: 220px !important;
    }

    .eledia-toolguide-root .tg-filterbar select,
    .eledia-toolguide-root .tg-filterbar label {
        width: 100% !important;
        max-width: 100% !important;
    }

    .eledia-toolguide-root .tg-filterbar > div {
        width: 100% !important;
    }

    .eledia-toolguide-root .tg-mobile-goals {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .eledia-toolguide-root .tg-mobile-goal {
        min-height: 62px !important;
        overflow: hidden !important;
    }

    .eledia-toolguide-root .tg-mobile-goal-label {
        display: block !important;
        width: 100% !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: normal !important;
        hyphens: auto !important;
        font-size: 11px !important;
        line-height: 1.15 !important;
    }

    .eledia-toolguide-root .tg-wizard {
        max-width: 100% !important;
        width: 100% !important;
    }

    .eledia-toolguide-root .tg-wizard-option {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px !important;
    }

    .eledia-toolguide-root .tg-wizard-option-content {
        align-items: flex-start !important;
    }

    .eledia-toolguide-root .tg-wizard-option-content > div {
        min-width: 0 !important;
    }

    .eledia-toolguide-root .tg-wizard-option-content span {
        white-space: normal !important;
        overflow-wrap: anywhere !important;
    }
}

@media (min-width: 641px) {
    .eledia-toolguide-root .tg-mobile-matrix {
        display: none !important;
    }
}
