/* ============================================================
   Gladiator Accessibility Widget — Front-End Styles
   Sidebar Edition — WCAG 2.2 AAA / IS 5568
   ============================================================ */

/* ── Skip Link ────────────────────────────────────────────── */
.gac-skip-link {
    position: absolute;
    top: -100px;
    right: 0;
    left: 0;
    margin: 0 auto;
    width: fit-content;
    background: #1560bd;
    color: #fff;
    padding: 12px 24px;
    border-radius: 0 0 8px 8px;
    font-weight: 700;
    font-size: 15px;
    z-index: 99999;
    text-decoration: none;
    transition: top .25s;
}

.gac-skip-link:focus {
    top: 0;
    outline: 3px solid #ffcc00;
    outline-offset: 2px;
}

/* ── Widget Wrapper ───────────────────────────────────────── */
#gac-widget-wrapper {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100000;
    pointer-events: none;
}

/* ── Overlay (backdrop) ───────────────────────────────────── */
.gac-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}

#gac-widget-wrapper.gac-open .gac-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* ── Sidebar Panel ────────────────────────────────────────── */
.gac-panel {
    position: fixed !important;
    top: 0 !important;
    height: 100vh !important;
    width: 320px !important;
    max-width: 85vw !important;
    background: #fff !important;
    z-index: 2 !important;
    display: flex !important;
    flex-direction: column !important;
    font-family: -apple-system, 'Segoe UI', Tahoma, Arial, sans-serif !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity .25s ease, transform .32s cubic-bezier(.4, 0, .2, 1) !important;
}

.gac-panel-right {
    right: 0 !important;
    left: auto !important;
    transform: translateX(110%) !important;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0) !important;
}

.gac-panel-left {
    left: 0 !important;
    right: auto !important;
    transform: translateX(-110%) !important;
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0) !important;
}

#gac-widget-wrapper.gac-open .gac-panel {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateX(0) !important;
}

#gac-widget-wrapper.gac-open .gac-panel-right {
    box-shadow: -8px 0 40px rgba(0, 0, 0, .18) !important;
}

#gac-widget-wrapper.gac-open .gac-panel-left {
    box-shadow: 8px 0 40px rgba(0, 0, 0, .18) !important;
}

/* ── Floating Trigger Button ──────────────────────────────── */
.gac-trigger {
    position: fixed !important;
    z-index: 3 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    border: none !important;
    cursor: pointer !important;
    font-family: inherit !important;
    font-weight: 700 !important;
    color: #fff !important;
    text-decoration: none !important;
    background-image: none !important;
    padding: 14px 12px !important;
    border-radius: 16px !important;
    min-width: 54px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .22) !important;
    transition: opacity .2s, transform .15s !important;
    pointer-events: auto !important;
}

.gac-trigger:hover,
.gac-trigger:focus,
.gac-trigger:active {
    color: #fff !important;
    background-image: none !important;
    text-decoration: none !important;
    transform: translateY(-2px) !important;
    opacity: 1 !important;
}

.gac-trigger:focus-visible {
    outline: 3px solid #ffcc00 !important;
    outline-offset: 3px !important;
}

/* Horizontal position — offset from edge */
.gac-trigger-right {
    right: var(--gac-offset-x, 24px) !important;
    left: auto !important;
}

.gac-trigger-left {
    left: var(--gac-offset-x, 24px) !important;
    right: auto !important;
}

/* Vertical position */
.gac-trigger-bottom {
    bottom: var(--gac-offset-y, 24px) !important;
    top: auto !important;
}

.gac-trigger-top {
    top: var(--gac-offset-y, 24px) !important;
    bottom: auto !important;
}

.gac-trigger-center {
    top: 50% !important;
    bottom: auto !important;
    transform: translateY(-50%) !important;
}

/* When panel is open, hide the trigger */
#gac-widget-wrapper.gac-open .gac-trigger {
    opacity: 0 !important;
    pointer-events: none !important;
}

.gac-trigger-icon {
    line-height: 1;
    flex-shrink: 0;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.gac-trigger-icon svg,
.gac-trigger-icon img {
    display: block;
    width: 22px;
    height: 22px;
}

/* Trigger label */
.gac-trigger-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    white-space: nowrap;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* Sizes */
.gac-size-small .gac-trigger { padding: 10px 9px !important; min-width: 44px !important; }
.gac-size-small .gac-trigger-icon svg { width: 18px !important; height: 18px !important; }
.gac-size-small .gac-trigger-label { font-size: 10px !important; }

.gac-size-large .gac-trigger { padding: 18px 14px !important; min-width: 64px !important; }
.gac-size-large .gac-trigger-icon svg { width: 26px !important; height: 26px !important; }
.gac-size-large .gac-trigger-label { font-size: 12px !important; max-width: 88px !important; }

/* ── Panel Header ─────────────────────────────────────────── */
.gac-panel-header {
    background: linear-gradient(135deg, #1560bd 0%, #0d3f80 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.gac-panel-title {
    flex: 1;
    font-weight: 700;
    font-size: 15px;
}

.gac-reset-btn,
.gac-close-btn {
    background: rgba(255, 255, 255, .18) !important;
    border: none !important;
    color: #fff !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    padding: 4px 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    transition: background .2s !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

.gac-reset-btn:hover,
.gac-close-btn:hover {
    background: rgba(255, 255, 255, .35) !important;
}

.gac-reset-btn:focus-visible,
.gac-close-btn:focus-visible {
    outline: 2px solid #ffcc00 !important;
    outline-offset: 2px !important;
}

/* ── Language Switcher ────────────────────────────────────── */
.gac-lang-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e8ecf0;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.gac-lang-btn {
    background: transparent !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 6px !important;
    color: #64748b !important;
    cursor: pointer !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 3px 8px !important;
    transition: border-color .15s, background .15s, color .15s !important;
    font-family: inherit !important;
    box-shadow: none !important;
    text-decoration: none !important;
    line-height: 1.6 !important;
}

.gac-lang-btn:hover {
    border-color: #1560bd !important;
    color: #1560bd !important;
    background: #f0f5ff !important;
}

.gac-lang-btn.active,
.gac-lang-btn.active:hover {
    background: #1560bd !important;
    border-color: #1560bd !important;
    color: #fff !important;
}

/* ── Panel Body ───────────────────────────────────────────── */
.gac-panel-body {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 8px 10px;
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    align-content: start;
}

/* ── Panel Footer ─────────────────────────────────────────── */
.gac-panel-footer {
    padding: 10px 14px;
    text-align: center;
    font-size: 11px;
    color: #aaa;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.gac-panel-footer a {
    color: #1560bd !important;
    font-weight: 700 !important;
    text-decoration: none !important;
}

.gac-panel-footer a:hover {
    text-decoration: underline !important;
}

/* ── Feature Rows ─────────────────────────────────────────── */
.gac-row {
    border-radius: 10px;
    transition: background .15s;
}

/* Step rows & statement link span full width */
.gac-row-step,
.gac-statement-link {
    grid-column: 1 / -1;
}

.gac-row-active {
    background: #e8f1ff;
}

/* Kill theme button overrides */
#gac-widget-wrapper .gac-row-btn,
#gac-widget-wrapper .gac-row-btn:link,
#gac-widget-wrapper .gac-row-btn:visited {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    width: 100% !important;
    height: 72px !important;
    padding: 8px 6px !important;
    background: #fafafa !important;
    border: 1.5px solid #e8e8e8 !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #333 !important;
    text-align: center !important;
    line-height: 1.3 !important;
    box-shadow: none !important;
    outline: none !important;
    text-decoration: none !important;
}

#gac-widget-wrapper .gac-row-btn:hover,
#gac-widget-wrapper .gac-row-btn:focus {
    border-color: #1560bd !important;
    background: #f0f5ff !important;
    color: #1560bd !important;
    box-shadow: none !important;
    outline: 2px solid rgba(21, 96, 189, .3) !important;
    outline-offset: 2px !important;
}

#gac-widget-wrapper .gac-row-active .gac-row-btn,
#gac-widget-wrapper .gac-row-active .gac-row-btn:hover,
#gac-widget-wrapper .gac-row-active .gac-row-btn:focus,
#gac-widget-wrapper .gac-row-active .gac-row-btn:active {
    background: #e8f1ff !important;
    border-color: #1560bd !important;
    color: #1560bd !important;
    box-shadow: none !important;
}

.gac-row-icon {
    flex-shrink: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

.gac-row-icon svg {
    display: block;
}

.gac-row-label {
    font-size: 11px;
    line-height: 1.3;
    word-break: keep-all;
}

.gac-row-check {
    color: #1560bd;
    font-weight: 900;
    font-size: 14px;
    line-height: 1;
}

/* Step row */
.gac-row-step .gac-row-btn { display: none; }

.gac-row-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1.5px solid #e8e8e8;
    border-radius: 10px;
    margin-bottom: 5px;
    transition: border-color .17s;
}

.gac-row-step.gac-row-active {
    border-color: #1560bd;
    background: #e8f1ff;
}

.gac-step-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;
}

#gac-widget-wrapper .gac-step-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    border-radius: 50% !important;
    border: 2px solid #ddd !important;
    background: #fff !important;
    cursor: pointer !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    color: #333 !important;
    padding: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    text-decoration: none !important;
    transition: border-color .15s, background .15s !important;
}

#gac-widget-wrapper .gac-step-btn:hover {
    border-color: #1560bd !important;
    background: #e8f1ff !important;
    color: #1560bd !important;
}

#gac-widget-wrapper .gac-step-btn:focus,
#gac-widget-wrapper .gac-step-btn:focus-visible,
#gac-widget-wrapper .gac-step-btn:active {
    border-color: #1560bd !important;
    background: #e8f1ff !important;
    color: #1560bd !important;
    box-shadow: none !important;
    outline: 2px solid rgba(21, 96, 189, .35) !important;
    outline-offset: 2px !important;
}

.gac-step-val {
    font-size: 13px;
    font-weight: 700;
    color: #1560bd;
    min-width: 26px;
    text-align: center;
}

/* Statement link */
.gac-statement-link {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 10px 0 4px;
    color: #1560bd !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    background: #f0f5ff !important;
    border-radius: 8px !important;
    padding: 8px !important;
    border: 1px solid #c5d8f7 !important;
    transition: background .17s !important;
    box-shadow: none !important;
}

.gac-statement-link:hover { background: #dde9fc !important; }

.gac-statement-link:focus-visible { outline: 2px solid #1560bd !important; }

/* ── TTS Indicator ────────────────────────────────────────── */
.gac-tts-indicator {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1560bd;
    color: #fff;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    z-index: 100000;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(21, 96, 189, .4);
}

/* ── Reading Guide ────────────────────────────────────────── */
#gac-reading-guide {
    position: fixed;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(21, 96, 189, .5);
    z-index: 99997;
    pointer-events: none;
    top: 0;
}

/* ── Reading Mask ─────────────────────────────────────────── */
#gac-reading-mask {
    position: fixed;
    inset: 0;
    z-index: 99996;
    pointer-events: none;
    background: rgba(0, 0, 0, .7);
}

/* ── Mobile Responsive ────────────────────────────────────── */
@media (max-width: 600px) {
    .gac-panel {
        width: min(320px, 90vw) !important;
    }

    .gac-panel-body {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Body Classes applied by widget.js ─────────────────────── */

/* High Contrast */
html.gac-high-contrast { background: #000 !important; color: #fff !important; }
html.gac-high-contrast * { background-color: #000 !important; color: #fff !important; border-color: #fff !important; }
html.gac-high-contrast a { color: #ffff00 !important; }
html.gac-high-contrast img { filter: brightness(0.85) contrast(1.5) !important; }

/* Dark Mode */
html.gac-dark-mode { filter: invert(1) hue-rotate(180deg); }
html.gac-dark-mode img,
html.gac-dark-mode video,
html.gac-dark-mode iframe { filter: invert(1) hue-rotate(180deg); }

/* Dyslexia Font */
body.gac-dyslexia,
body.gac-dyslexia * { font-family: 'OpenDyslexic', Arial, sans-serif !important; letter-spacing: .05em; word-spacing: .1em; }

/* Highlight Links */
body.gac-highlight-links a { background: #ffff00 !important; color: #000 !important; text-decoration: underline !important; padding: 0 2px; border-radius: 2px; outline: 2px solid #000; }

/* Keyboard Navigation */
body.gac-keyboard-nav *:focus-visible,
body.gac-keyboard-nav *:focus { outline: 3px solid #1560bd !important; outline-offset: 4px !important; box-shadow: 0 0 0 6px rgba(21, 96, 189, .2) !important; border-radius: 4px; }

/* Large Cursor */
body.gac-large-cursor,
body.gac-large-cursor * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'%3E%3Cpath d='M5 2L35 22H20L12 38z' fill='black' stroke='white' stroke-width='2'/%3E%3C/svg%3E") 5 2, auto !important; }

/* Focus Highlight */
body.gac-focus-highlight *:focus-visible { outline: 4px solid #ffcc00 !important; outline-offset: 3px !important; box-shadow: 0 0 0 8px rgba(255, 204, 0, .3) !important; }

/* TTS mode */
body.gac-tts-mode { cursor: crosshair; }
body.gac-tts-mode *:hover { outline: 2px dashed #1560bd; outline-offset: 2px; }

/* Tooltip */
.gac-has-tooltip { position: relative; }
.gac-has-tooltip::after {
    content: attr(data-gac-tooltip);
    position: absolute;
    bottom: 100%;
    right: 0;
    background: rgba(0, 0, 0, .85);
    color: #fff;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s;
    z-index: 99999;
    max-width: 200px;
}
.gac-has-tooltip:hover::after,
.gac-has-tooltip:focus::after { opacity: 1; }
