/* ========================================================================
   SmartLands Accessibility Widget v1.6.0
   Variables iniettate inline da PHP: --sl-color, --sl-btn-size
   ======================================================================== */

#sl-a11y-btn {
    position: fixed;
    z-index: 99999;
    width: var(--sl-btn-size, 52px);
    height: var(--sl-btn-size, 52px);
    background: var(--sl-color, #1e73be);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 12px rgba(0,0,0,.28);
    transition: transform .18s, box-shadow .18s;
    padding: 0;
    font-family: inherit;
}
#sl-a11y-btn:hover,
#sl-a11y-btn:focus-visible {
    transform: scale(1.1);
    box-shadow: 0 5px 18px rgba(0,0,0,.36);
    outline: 3px solid var(--sl-color, #1e73be);
    outline-offset: 3px;
}
#sl-a11y-btn img { display: block; pointer-events: none; }

#sl-a11y-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99998;
}
#sl-a11y-overlay.sl-open { display: block; }

/* ========================================================================
   PANEL — wider for better text fit
   ======================================================================== */
#sl-a11y-panel {
    position: fixed;
    background: #fff;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: #1f2937;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

#sl-a11y-panel[data-pos="right"] {
    right: 0; top: 0; bottom: 0;
    width: min(420px, 96vw);
    box-shadow: -4px 0 30px rgba(0,0,0,.18);
    transform: translateX(105%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
}
#sl-a11y-panel[data-pos="right"].sl-open  { transform: translateX(0); }

#sl-a11y-panel[data-pos="left"] {
    left: 0; top: 0; bottom: 0;
    width: min(420px, 96vw);
    box-shadow: 4px 0 30px rgba(0,0,0,.18);
    transform: translateX(-105%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
}
#sl-a11y-panel[data-pos="left"].sl-open { transform: translateX(0); }

#sl-a11y-panel[data-pos="center"] {
    top: 50%; left: 50%;
    width: min(500px, 96vw);
    max-height: 90vh;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.28);
    transform: translate(-50%,-50%) scale(.95);
    opacity: 0;
    pointer-events: none;
    transition: transform .25s ease, opacity .25s ease;
}
#sl-a11y-panel[data-pos="center"].sl-open {
    transform: translate(-50%,-50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* ========================================================================
   HEADER
   ======================================================================== */
.sl-ap-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--sl-color, #1e73be);
    color: #fff;
    flex-shrink: 0;
    min-height: 60px;
}
.sl-ap-hdr-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.2;
    flex: 1;
    min-width: 0;
}
.sl-ap-hdr-title img {
    filter: brightness(0) invert(1);
    display: block;
    flex-shrink: 0;
}
.sl-ap-hdr-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sl-ap-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 8px 10px;
    border-radius: 4px;
    opacity: .85;
    font-family: inherit;
    flex-shrink: 0;
    margin-left: 12px;
}
.sl-ap-close:hover,
.sl-ap-close:focus-visible {
    opacity: 1;
    background: rgba(255,255,255,.2);
    outline: none;
}

/* ========================================================================
   TABS
   ======================================================================== */
.sl-ap-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}
.sl-ap-tab {
    flex: 1;
    padding: 12px 4px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #6b7280;
    font-family: inherit;
    transition: all .15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    line-height: 1.15;
    min-height: 60px;
    justify-content: center;
}
.sl-ap-tab:hover { color: #1f2937; background: #f3f4f6; }
.sl-ap-tab.sl-active {
    color: var(--sl-color, #1e73be);
    border-bottom-color: var(--sl-color, #1e73be);
    background: #fff;
}
.sl-ap-tab-ico { font-size: 20px; line-height: 1; }
.sl-ap-tab span:last-child {
    overflow-wrap: break-word;
    text-align: center;
    max-width: 100%;
}

/* ========================================================================
   BODY
   ======================================================================== */
.sl-ap-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #fafafa;
}
.sl-ap-tab-panel { display: none; }
.sl-ap-tab-panel.sl-active { display: block; }

.sl-ap-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #6b7280;
    margin: 0 0 12px;
    padding-top: 2px;
}
.sl-ap-section-title:not(:first-child) {
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

/* ── Profile cards — HORIZONTAL layout for better text fit ── */
.sl-ap-profiles {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sl-ap-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 14px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
    text-align: left;
    width: 100%;
}
.sl-ap-profile:hover {
    border-color: var(--sl-color, #1e73be);
    box-shadow: 0 2px 6px rgba(0,0,0,.07);
}
.sl-ap-profile.sl-on {
    border-color: var(--sl-color, #1e73be);
    background: color-mix(in srgb, var(--sl-color, #1e73be) 8%, white);
}
.sl-ap-profile-ico {
    font-size: 26px;
    line-height: 1;
    flex-shrink: 0;
    width: 38px;
    text-align: center;
}
.sl-ap-profile-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.sl-ap-profile-name {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.25;
}
.sl-ap-profile-desc {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.35;
}

/* ── Tool cards — vertical with generous height ── */
.sl-ap-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}
.sl-ap-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 14px 8px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 9px;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
    text-align: center;
    min-height: 96px;
    word-break: break-word;
    hyphens: auto;
}
.sl-ap-tool:hover {
    border-color: var(--sl-color, #1e73be);
    box-shadow: 0 2px 6px rgba(0,0,0,.07);
}
.sl-ap-tool.sl-on {
    border-color: var(--sl-color, #1e73be);
    background: color-mix(in srgb, var(--sl-color, #1e73be) 10%, white);
}
.sl-ap-tool-ico {
    font-size: 24px;
    line-height: 1;
}
.sl-ap-tool-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
    max-width: 100%;
    overflow-wrap: break-word;
}
.sl-ap-tool-val {
    font-size: 10px;
    color: #fff;
    background: var(--sl-color, #1e73be);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    line-height: 1.3;
    letter-spacing: .03em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================================================
   FOOTER
   ======================================================================== */
.sl-ap-footer {
    padding: 14px 18px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.sl-ap-footer-link {
    font-size: 13px;
    color: #6b7280;
    text-decoration: none;
    text-align: center;
    padding: 7px;
    border-radius: 5px;
    transition: all .15s;
    line-height: 1.35;
}
.sl-ap-footer-link:hover {
    color: var(--sl-color, #1e73be);
    background: #f3f4f6;
    text-decoration: none;
}
.sl-ap-reset {
    width: 100%;
    padding: 10px;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    color: #6b7280;
    font-family: inherit;
    transition: all .15s;
    font-weight: 600;
    line-height: 1.2;
}
.sl-ap-reset:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: #fef2f2;
}

/* ========================================================================
   SKIP LINKS (Skip to content / Skip to footer)
   ======================================================================== */
.sl-skip-links {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 99996;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sl-skip-links a {
    background: var(--sl-color, #1e73be);
    color: #fff !important;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 3px 10px rgba(0,0,0,.25);
}
.sl-skip-links a:hover,
.sl-skip-links a:focus { background: #111; outline: none; }

/* ========================================================================
   FRONTEND EFFECTS (applied to <html> by JS)
   ======================================================================== */
html.sl-fx-hide-images img,
html.sl-fx-hide-images picture,
html.sl-fx-hide-images video,
html.sl-fx-hide-images svg:not(#sl-a11y-panel svg):not(#sl-a11y-btn svg) { visibility: hidden !important; }

html.sl-fx-highlight-titles h1,
html.sl-fx-highlight-titles h2,
html.sl-fx-highlight-titles h3,
html.sl-fx-highlight-titles h4,
html.sl-fx-highlight-titles h5,
html.sl-fx-highlight-titles h6 {
    outline: 2px solid #f59e0b !important;
    outline-offset: 2px !important;
    background: rgba(245,158,11,.08) !important;
}

html.sl-fx-highlight-links a:not(#sl-a11y-panel a):not(#sl-a11y-btn) {
    outline: 2px solid currentColor !important;
    outline-offset: 2px !important;
    text-decoration: underline !important;
    background: rgba(255,235,59,.18) !important;
}

html.sl-fx-highlight-clickable a:not(#sl-a11y-panel a):not(#sl-a11y-btn),
html.sl-fx-highlight-clickable button:not(.sl-ap-tab):not(.sl-ap-tool):not(.sl-ap-profile):not(.sl-ap-close):not(.sl-ap-reset):not(#sl-a11y-btn),
html.sl-fx-highlight-clickable [role="button"],
html.sl-fx-highlight-clickable input[type="submit"],
html.sl-fx-highlight-clickable input[type="button"],
html.sl-fx-highlight-clickable label[for],
html.sl-fx-highlight-clickable select {
    outline: 3px dashed #3b82f6 !important;
    outline-offset: 2px !important;
    background: rgba(59,130,246,.10) !important;
}

html.sl-fx-highlight-focus *:focus {
    outline: 4px solid #f59e0b !important;
    outline-offset: 3px !important;
}

html.sl-fx-reduce-motion *,
html.sl-fx-reduce-motion *::before,
html.sl-fx-reduce-motion *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
}

html.sl-fx-pause-animations *,
html.sl-fx-pause-animations *::before,
html.sl-fx-pause-animations *::after {
    animation-play-state: paused !important;
}

html.sl-fx-big-cursor,
html.sl-fx-big-cursor * {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'><path d='M8 4 L8 36 L16 28 L22 42 L28 40 L22 26 L34 26 Z' fill='black' stroke='white' stroke-width='2'/></svg>") 8 4, auto !important;
}

html.sl-fx-dyslexia-font *:not(#sl-a11y-panel):not(#sl-a11y-panel *):not(#sl-a11y-btn):not(#sl-a11y-btn *) {
    font-family: 'Comic Sans MS', 'OpenDyslexic', Verdana, sans-serif !important;
    letter-spacing: .04em !important;
    word-spacing: .12em !important;
}

#sl-reading-guide {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    height: 36px;
    background: rgba(255, 235, 59, .28);
    border-top: 2px solid #f59e0b;
    border-bottom: 2px solid #f59e0b;
    z-index: 99997;
    pointer-events: none;
    transition: top .04s linear;
}
html.sl-fx-reading-guide #sl-reading-guide { display: block; }

html.sl-fx-tooltips [title]:hover::after {
    content: attr(title);
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #111;
    color: #fff;
    padding: 9px 16px;
    border-radius: 6px;
    font-size: 14px;
    z-index: 99999;
    pointer-events: none;
    max-width: 80vw;
}

/* ========================================================================
   RESPONSIVE
   ======================================================================== */
@media (max-width: 480px) {
    #sl-a11y-panel[data-pos="center"] {
        width: 96vw;
        max-height: 92vh;
        border-radius: 10px;
    }
    .sl-ap-tools { grid-template-columns: 1fr 1fr; gap: 7px; }
    .sl-ap-tool { min-height: 84px; padding: 11px 6px; }
    .sl-ap-tool-name { font-size: 11.5px; }
    .sl-ap-tab { padding: 10px 3px; font-size: 10px; min-height: 56px; }
    .sl-ap-tab-ico { font-size: 17px; }
    .sl-ap-hdr-title { font-size: 15px; }
    .sl-ap-profile { padding: 11px 12px; gap: 11px; }
    .sl-ap-profile-ico { font-size: 22px; width: 32px; }
    .sl-ap-profile-name { font-size: 13px; }
    .sl-ap-profile-desc { font-size: 11.5px; }
}

@media (max-width: 360px) {
    .sl-ap-tab span:last-child { display: none; }
    .sl-ap-tab { gap: 0; }
}
