/* ============================================
   מנגיש - Mangish Accessibility Toolbar
   IS 5568 + WCAG 2.1 AA Compliant
   Premium Design with Noto Sans Hebrew
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Hebrew:wght@300;400;500;600;700;800;900&display=swap');

/* Reset & Base */
#mangish-toggle-btn,
#mangish-panel,
#mangish-panel *,
#mangish-reading-guide,
#mangish-structure-modal,
#mangish-structure-modal * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans Hebrew', 'Segoe UI', Arial, sans-serif;
}

/* ============================================
   Toggle Button - Base Styles
   ============================================ */
.mangish-toggle {
    position: fixed !important;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    background: linear-gradient(145deg, #1976D2, #0D47A1) !important;
}

.mangish-toggle:hover,
.mangish-toggle:focus {
    outline: 3px solid #FFD700;
    outline-offset: 3px;
}

.mangish-toggle:active {
    transform: scale(0.95);
}

/* ============================================
   Style 1: Floating Circle (default)
   ============================================ */
.mangish-toggle.mangish-style-circle {
    bottom: 24px;
    border-radius: 50%;
    box-shadow: 0 6px 24px rgba(21, 101, 192, 0.45), 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.9);
}

.mangish-toggle.mangish-style-circle:hover,
.mangish-toggle.mangish-style-circle:focus {
    transform: scale(1.12);
    box-shadow: 0 8px 32px rgba(21, 101, 192, 0.55), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.mangish-toggle.mangish-style-circle.mangish-right {
    right: 24px;
}

.mangish-toggle.mangish-style-circle.mangish-left {
    left: 24px;
}

/* Pulse animation for circle style */
.mangish-toggle.mangish-style-circle::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(21, 101, 192, 0.3);
    animation: mangish-pulse 2.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes mangish-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.15); opacity: 0; }
}

/* ============================================
   Style 2: Side-Attached Half-Rounded Rectangle
   Attached to the side at vertical middle.
   Straight edges on the attached side,
   rounded on the outer (visible) side.
   ============================================ */
.mangish-toggle.mangish-style-side {
    top: 50%;
    transform: translateY(-50%);
    width: 44px !important;
    height: 52px !important;
    box-shadow: 0 4px 20px rgba(21, 101, 192, 0.4), 0 2px 8px rgba(0, 0, 0, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.7);
}

.mangish-toggle.mangish-style-side:hover,
.mangish-toggle.mangish-style-side:focus {
    transform: translateY(-50%) scale(1.06);
    box-shadow: 0 6px 28px rgba(21, 101, 192, 0.55), 0 4px 12px rgba(0, 0, 0, 0.18);
}

.mangish-toggle.mangish-style-side:active {
    transform: translateY(-50%) scale(0.96);
}

/* Side-attached RIGHT: straight left edges, rounded right edges */
.mangish-toggle.mangish-style-side.mangish-right {
    right: 0;
    border-radius: 14px 0 0 14px;
    border-right: none;
}

/* Side-attached LEFT: straight right edges, rounded left edges */
.mangish-toggle.mangish-style-side.mangish-left {
    left: 0;
    border-radius: 0 14px 14px 0;
    border-left: none;
}

.mangish-toggle.mangish-style-side svg {
    width: 24px !important;
    height: 24px !important;
}

/* No pulse animation for side-attached style */
.mangish-toggle.mangish-style-side::after {
    display: none;
}

/* ============================================
   Panel
   ============================================ */
.mangish-panel {
    position: fixed !important;
    top: 0;
    width: 400px;
    max-width: 100vw;
    height: 100vh;
    background: #fafbfc;
    z-index: 9999999;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    direction: rtl;
    font-size: 15px;
    color: #2d3748;
}

.mangish-panel-right {
    right: 0;
    transform: translateX(100%);
}

.mangish-panel-left {
    left: 0;
    transform: translateX(-100%);
}

.mangish-panel.mangish-open {
    transform: translateX(0);
}

/* Custom scrollbar */
.mangish-panel::-webkit-scrollbar {
    width: 5px;
}

.mangish-panel::-webkit-scrollbar-track {
    background: transparent;
}

.mangish-panel::-webkit-scrollbar-thumb {
    background: rgba(21, 101, 192, 0.2);
    border-radius: 10px;
}

.mangish-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(21, 101, 192, 0.4);
}

/* ============================================
   Header
   ============================================ */
.mangish-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 22px !important;
    background: linear-gradient(135deg, #1565C0 0%, #0D47A1 100%) !important;
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(13, 71, 161, 0.3);
}

.mangish-header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mangish-header-logo svg {
    opacity: 0.9;
}

.mangish-title {
    font-size: 19px;
    font-weight: 700;
    margin: 0;
    color: #fff;
    letter-spacing: -0.3px;
}

.mangish-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.mangish-header-actions button {
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mangish-header-actions button:hover,
.mangish-header-actions button:focus {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    outline: 2px solid #FFD700;
    outline-offset: 1px;
}

/* ============================================
   Content
   ============================================ */
.mangish-content {
    padding: 16px 18px 24px;
}

/* Section */
.mangish-section {
    margin-bottom: 24px;
}

.mangish-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #8896ab;
    margin-bottom: 14px;
    padding: 15px 4px !important;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mangish-section-title::before {
    content: '';
    width: 3px;
    height: 14px;
    background: linear-gradient(to bottom, #1565C0, #42A5F5);
    border-radius: 2px;
    flex-shrink: 0;
}

/* Controls Grid */
.mangish-controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ============================================
   Control Card (Toggle)
   ============================================ */
.mangish-control {
    background: #fff;
    border: 1.5px solid #e8ecf1;
    border-radius: 14px;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 6px;
    min-height: 88px;
    justify-content: center;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.mangish-control::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(21, 101, 192, 0.03), rgba(66, 165, 245, 0.06));
    opacity: 0;
    transition: opacity 0.25s;
    border-radius: 14px;
}

.mangish-control:hover {
    border-color: #90CAF9;
    box-shadow: 0 4px 16px rgba(21, 101, 192, 0.1);
    transform: translateY(-1px);
}

.mangish-control:hover::before {
    opacity: 1;
}

.mangish-control:focus-within {
    outline: 3px solid #1565C0;
    outline-offset: 2px;
}

.mangish-control.mangish-active {
    background: linear-gradient(135deg, #1565C0 0%, #1976D2 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 16px rgba(21, 101, 192, 0.35);
}

.mangish-control.mangish-active::before {
    display: none;
}

.mangish-control.mangish-active .mangish-control-icon {
    color: #fff;
}

.mangish-control-icon {
    color: #1565C0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s;
    position: relative;
    z-index: 1;
}

.mangish-control-icon svg {
    width: 22px;
    height: 22px;
}

.mangish-control-label {
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.3;
    position: relative;
    z-index: 1;
    letter-spacing: -0.1px;
}

/* ============================================
   Counter Controls
   ============================================ */
.mangish-counter {
    cursor: default;
}

.mangish-counter-btns {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}

.mangish-counter-btns button {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1.5px solid #1565C0;
    background: rgba(21, 101, 192, 0.05);
    color: #1565C0;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.mangish-counter-btns button:hover,
.mangish-counter-btns button:focus {
    background: #1565C0;
    color: #fff;
    outline: 2px solid #FFD700;
    outline-offset: 1px;
}

.mangish-counter-val {
    font-size: 14px;
    font-weight: 800;
    min-width: 22px;
    text-align: center;
    color: #1565C0;
}

.mangish-control.mangish-active .mangish-counter-btns button {
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.mangish-control.mangish-active .mangish-counter-btns button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: #fff;
}

.mangish-control.mangish-active .mangish-counter-val {
    color: #fff;
}

/* ============================================
   Multi-select (Text Align) - Clean style
   ============================================ */
.mangish-multi {
    grid-column: span 2;
    cursor: default;
}

.mangish-multi-btns {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    position: relative;
    z-index: 1;
    background: #f0f2f5;
    border-radius: 8px;
    padding: 3px !important;
}

.mangish-multi-btns button {
    flex: 1;
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: #6b7a8d;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    font-family: 'Noto Sans Hebrew', sans-serif;
    margin: 0px 3px !important;
    background: white;
    padding: 3px 6px !important;
}

.mangish-multi-btns button:hover {
    background: rgba(255, 255, 255, 0.7);
    color: #1565C0;
}

.mangish-multi-btns button:focus {
    outline: 2px solid #1565C0;
    outline-offset: -1px;
}

.mangish-multi-btns button.mangish-active {
    background: #fff;
    color: #1565C0;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Declaration Link
   ============================================ */
.mangish-declaration-section {
    margin-top: 8px;
}

.mangish-declaration-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(21, 101, 192, 0.06), rgba(66, 165, 245, 0.08));
    border: 1.5px solid rgba(21, 101, 192, 0.15);
    border-radius: 14px;
    color: #1565C0;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.25s ease;
}

.mangish-declaration-link:hover,
.mangish-declaration-link:focus {
    background: linear-gradient(135deg, rgba(21, 101, 192, 0.1), rgba(66, 165, 245, 0.14));
    border-color: rgba(21, 101, 192, 0.3);
    outline: 2px solid #FFD700;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.1);
}

/* ============================================
   Footer Branding
   ============================================ */
.mangish-footer {
    padding: 16px 22px;
    text-align: center;
    border-top: 1px solid #e8ecf1;
    background: #fff;
}

.mangish-branding {
    color: #8896ab;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: color 0.2s;
    letter-spacing: -0.1px;
}

.mangish-branding:hover {
    color: #1565C0;
}

.mangish-branding strong {
    color: #1565C0;
    font-weight: 700;
}

/* ============================================
   Reading Guide
   ============================================ */
.mangish-reading-guide {
    position: fixed !important;
    left: 0;
    width: 100%;
    height: 14px;
    background: rgba(21, 101, 192, 0.2);
    border-top: 2.5px solid rgba(21, 101, 192, 0.7);
    border-bottom: 2.5px solid rgba(21, 101, 192, 0.7);
    z-index: 9999998;
    pointer-events: none;
    transition: top 0.05s ease;
}

/* ============================================
   Page Structure Modal
   ============================================ */
.mangish-structure-modal {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 21, 36, 0.5);
    z-index: 99999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mangish-structure-inner {
    background: #fff;
    border-radius: 20px;
    width: 500px;
    max-width: 90vw;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}

.mangish-structure-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    background: linear-gradient(135deg, #1565C0, #0D47A1);
    color: #fff;
}

.mangish-structure-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}

.mangish-structure-close {
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.mangish-structure-close:hover,
.mangish-structure-close:focus {
    background: rgba(255, 255, 255, 0.25);
    outline: 2px solid #FFD700;
}

.mangish-structure-content {
    padding: 20px;
    overflow-y: auto;
    max-height: 60vh;
    direction: rtl;
}

.mangish-structure-content ul {
    list-style: none;
    padding: 0;
}

.mangish-structure-content li {
    padding: 10px 14px;
    border-right: 3px solid #1565C0;
    margin-bottom: 6px;
    background: #f8f9fc;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.mangish-structure-content li:hover {
    background: #E3F2FD;
    transform: translateX(-2px);
}

.mangish-structure-content .mangish-h-tag {
    font-weight: 700;
    color: #1565C0;
    font-size: 11px;
    margin-left: 8px;
    background: rgba(21, 101, 192, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
}

.mangish-structure-content .mangish-h1 { padding-right: 0; }
.mangish-structure-content .mangish-h2 { padding-right: 16px; }
.mangish-structure-content .mangish-h3 { padding-right: 32px; }
.mangish-structure-content .mangish-h4 { padding-right: 48px; }
.mangish-structure-content .mangish-h5 { padding-right: 64px; }
.mangish-structure-content .mangish-h6 { padding-right: 80px; }

/* Landmark list */
.mangish-structure-content .mangish-landmarks {
    margin-top: 16px;
    border-top: 1px solid #e8ecf1;
    padding-top: 14px;
}

.mangish-structure-content .mangish-landmarks li {
    border-right-color: #4CAF50;
}

.mangish-structure-content .mangish-landmark-tag {
    font-weight: 700;
    color: #4CAF50;
    font-size: 11px;
    margin-left: 8px;
    background: rgba(76, 175, 80, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ============================================
   Overlay when panel is open
   Light overlay - NO blur so user can see changes
   ============================================ */
.mangish-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.15);
    z-index: 9999998;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.mangish-overlay.mangish-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================
   TOOLBAR PROTECTION
   Prevent accessibility modes from breaking
   the toolbar itself
   ============================================ */
#mangish-toggle-btn,
#mangish-panel,
#mangish-panel *,
#mangish-reading-guide,
.mangish-overlay,
#mangish-structure-modal,
#mangish-structure-modal *,
.mangish-skip-link {
    filter: none !important;
    mix-blend-mode: normal !important;
}

/* ============================================
   JS Tooltip (floating div created by JS)
   ============================================ */
.mangish-tooltip {
    position: fixed;
    z-index: 99999999;
    background: #1a202c;
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Noto Sans Hebrew', 'Segoe UI', Arial, sans-serif;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: rtl;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.mangish-tooltip.mangish-tooltip-visible {
    opacity: 1;
}

/* ============================================
   Accessibility Styles Applied to Page
   ============================================ */

/* ---- Text Size Scaling ----
   Uses CSS zoom on html for true scaling of all elements.
*/
html[data-mangish-zoom="1"]  { zoom: 1.12; }
html[data-mangish-zoom="2"]  { zoom: 1.25; }
html[data-mangish-zoom="3"]  { zoom: 1.4; }
html[data-mangish-zoom="4"]  { zoom: 1.55; }
html[data-mangish-zoom="5"]  { zoom: 1.7; }
html[data-mangish-zoom="-1"] { zoom: 0.9; }
html[data-mangish-zoom="-2"] { zoom: 0.8; }
html[data-mangish-zoom="-3"] { zoom: 0.7; }

/* ---- Content Scaling ----
   Uses CSS zoom on body (stacks with html zoom).
   Does NOT break position:fixed like transform does.
*/
body[data-mangish-scale="1"]  { zoom: 1.05; }
body[data-mangish-scale="2"]  { zoom: 1.1; }
body[data-mangish-scale="3"]  { zoom: 1.15; }
body[data-mangish-scale="4"]  { zoom: 1.2; }
body[data-mangish-scale="5"]  { zoom: 1.25; }
body[data-mangish-scale="-1"] { zoom: 0.95; }
body[data-mangish-scale="-2"] { zoom: 0.9; }
body[data-mangish-scale="-3"] { zoom: 0.85; }

/* Keep toolbar at real size when page is zoomed */
html[data-mangish-zoom] #mangish-toggle-btn,
html[data-mangish-zoom] #mangish-panel,
html[data-mangish-zoom] .mangish-overlay,
html[data-mangish-zoom] #mangish-reading-guide,
html[data-mangish-zoom] #mangish-structure-modal,
html[data-mangish-zoom] .mangish-skip-link,
body[data-mangish-scale] #mangish-toggle-btn,
body[data-mangish-scale] #mangish-panel,
body[data-mangish-scale] .mangish-overlay,
body[data-mangish-scale] #mangish-reading-guide,
body[data-mangish-scale] #mangish-structure-modal,
body[data-mangish-scale] .mangish-skip-link {
    zoom: 1;
}

/* Readable Font */
body.mangish-readable-font,
body.mangish-readable-font *:not(#mangish-panel):not(#mangish-panel *):not(#mangish-toggle-btn):not(#mangish-toggle-btn *):not(#mangish-structure-modal):not(#mangish-structure-modal *) {
    font-family: Arial, Helvetica, sans-serif !important;
}

/* Dyslexia Font */
body.mangish-dyslexia-font,
body.mangish-dyslexia-font *:not(#mangish-panel):not(#mangish-panel *):not(#mangish-toggle-btn):not(#mangish-toggle-btn *):not(#mangish-structure-modal):not(#mangish-structure-modal *) {
    font-family: "OpenDyslexic", "Comic Sans MS", Arial, sans-serif !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.1em !important;
}

/* High Contrast */
body.mangish-high-contrast {
    filter: contrast(1.5) !important;
}

/* Dark Contrast */
body.mangish-dark-contrast {
    background-color: #000 !important;
    color: #fff !important;
}

body.mangish-dark-contrast *:not(#mangish-panel):not(#mangish-panel *):not(#mangish-toggle-btn):not(#mangish-toggle-btn *):not(.mangish-overlay):not(#mangish-structure-modal):not(#mangish-structure-modal *):not(.mangish-skip-link):not(#mangish-reading-guide):not(.mangish-tooltip) {
    background-color: #000 !important;
    color: #fff !important;
}

body.mangish-dark-contrast a:not(#mangish-panel a):not(.mangish-skip-link) {
    color: #FFD700 !important;
}

body.mangish-dark-contrast img:not(#mangish-panel img) {
    filter: brightness(0.8) !important;
}

/* Light Contrast */
body.mangish-light-contrast {
    background-color: #fff !important;
    color: #000 !important;
}

body.mangish-light-contrast *:not(#mangish-panel):not(#mangish-panel *):not(#mangish-toggle-btn):not(#mangish-toggle-btn *):not(.mangish-overlay):not(#mangish-structure-modal):not(#mangish-structure-modal *):not(.mangish-skip-link):not(#mangish-reading-guide):not(.mangish-tooltip) {
    background-color: #fff !important;
    color: #000 !important;
}

body.mangish-light-contrast a:not(#mangish-panel a):not(.mangish-skip-link) {
    color: #0000EE !important;
}

/* Invert Colors */
body.mangish-invert-colors {
    filter: invert(1) hue-rotate(180deg) !important;
}

body.mangish-invert-colors img:not(#mangish-panel img),
body.mangish-invert-colors video,
body.mangish-invert-colors svg:not(#mangish-panel svg):not(#mangish-toggle-btn svg) {
    filter: invert(1) hue-rotate(180deg) !important;
}

/* Grayscale */
body.mangish-grayscale {
    filter: grayscale(1) !important;
}

/* Highlight Links */
body.mangish-highlight-links a:not(#mangish-panel a):not(.mangish-declaration-link):not(.mangish-branding):not(.mangish-skip-link) {
    outline: 3px solid #FFD700 !important;
    outline-offset: 2px !important;
    text-decoration: underline !important;
    background: rgba(255, 215, 0, 0.15) !important;
}

/* Highlight Headings */
body.mangish-highlight-headings h1:not(#mangish-panel h1),
body.mangish-highlight-headings h2:not(#mangish-panel h2),
body.mangish-highlight-headings h3:not(#mangish-panel h3):not(#mangish-structure-modal h3),
body.mangish-highlight-headings h4:not(#mangish-panel h4):not(#mangish-structure-modal h4),
body.mangish-highlight-headings h5,
body.mangish-highlight-headings h6 {
    outline: 3px solid #4CAF50 !important;
    outline-offset: 2px !important;
    background: rgba(76, 175, 80, 0.1) !important;
}

/* Big Cursor */
body.mangish-big-cursor,
body.mangish-big-cursor *:not(#mangish-panel):not(#mangish-panel *) {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' stroke='%23fff' stroke-width='1' d='M7 2l12 11.2-5.8.5 3.3 7.3-2.2 1-3.2-7.4L7 18.5V2z'/%3E%3C/svg%3E"), auto !important;
}

/* Stop Animations - exclude toolbar */
body.mangish-stop-animations *:not(#mangish-panel):not(#mangish-panel *):not(#mangish-toggle-btn):not(.mangish-overlay) {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
}

body.mangish-stop-animations *:not(#mangish-panel *):not(#mangish-toggle-btn)::before,
body.mangish-stop-animations *:not(#mangish-panel *):not(#mangish-toggle-btn)::after {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
}

/* Hide Images */
body.mangish-hide-images img:not(#mangish-panel img),
body.mangish-hide-images svg:not(#mangish-panel svg):not(#mangish-toggle-btn svg):not(#mangish-structure-modal svg),
body.mangish-hide-images video,
body.mangish-hide-images [style*="background-image"]:not(#mangish-panel [style*="background-image"]) {
    opacity: 0.05 !important;
}

/* Focus Mode */
body.mangish-focus-mode .mangish-focus-highlight {
    position: relative;
    z-index: 1;
}

body.mangish-focus-mode .mangish-focus-dim {
    opacity: 0.3 !important;
}

/* ADHD Mode */
body.mangish-adhd-mode {
    max-width: 800px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

body.mangish-adhd-mode *:not(#mangish-panel):not(#mangish-panel *):not(#mangish-toggle-btn):not(.mangish-overlay):not(#mangish-structure-modal):not(#mangish-structure-modal *):not(.mangish-skip-link):not(.mangish-tooltip) {
    animation: none !important;
    transition: none !important;
}

body.mangish-adhd-mode aside,
body.mangish-adhd-mode .sidebar,
body.mangish-adhd-mode [class*="sidebar"],
body.mangish-adhd-mode [class*="widget"],
body.mangish-adhd-mode [role="complementary"],
body.mangish-adhd-mode .ad,
body.mangish-adhd-mode [class*="banner"]:not(#mangish-panel [class*="banner"]),
body.mangish-adhd-mode [class*="popup"],
body.mangish-adhd-mode [class*="modal"]:not(.mangish-structure-modal) {
    display: none !important;
}

/* Keyboard Navigation */
body.mangish-keyboard-nav *:not(#mangish-panel *):not(#mangish-toggle-btn):not(.mangish-skip-link):focus {
    outline: 3px solid #1565C0 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px rgba(21, 101, 192, 0.2) !important;
}

/* Text-to-Speech highlight */
.mangish-tts-highlight {
    background: rgba(21, 101, 192, 0.15) !important;
    outline: 2px solid #1565C0 !important;
    border-radius: 4px;
}

/* ============================================
   Line Height Scaling (via CSS variable)
   ============================================ */
html[data-mangish-lh] body *:not(#mangish-panel):not(#mangish-panel *):not(#mangish-toggle-btn):not(#mangish-toggle-btn *) {
    line-height: var(--mangish-lh) !important;
}

/* ============================================
   Letter Spacing (via CSS variable)
   ============================================ */
html[data-mangish-ls] body *:not(#mangish-panel):not(#mangish-panel *):not(#mangish-toggle-btn):not(#mangish-toggle-btn *) {
    letter-spacing: var(--mangish-ls) !important;
}

/* ============================================
   Word Spacing (via CSS variable)
   ============================================ */
html[data-mangish-ws] body *:not(#mangish-panel):not(#mangish-panel *):not(#mangish-toggle-btn):not(#mangish-toggle-btn *) {
    word-spacing: var(--mangish-ws) !important;
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 480px) {
    .mangish-panel {
        width: 100vw;
    }

    .mangish-controls-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .mangish-control {
        padding: 12px 8px;
        min-height: 80px;
    }

    .mangish-toggle.mangish-style-circle {
        bottom: 16px;
    }

    .mangish-toggle.mangish-style-circle.mangish-right {
        right: 16px;
    }

    .mangish-toggle.mangish-style-circle.mangish-left {
        left: 16px;
    }

    .mangish-toggle.mangish-style-circle::after {
        display: none;
    }

    .mangish-toggle.mangish-style-side {
        width: 38px !important;
        height: 46px !important;
    }
}

/* ============================================
   Print - Hide toolbar
   ============================================ */
@media print {
    #mangish-toggle-btn,
    #mangish-panel,
    .mangish-overlay,
    #mangish-reading-guide,
    #mangish-structure-modal {
        display: none !important;
    }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .mangish-panel,
    .mangish-toggle,
    .mangish-overlay,
    .mangish-control {
        transition: none !important;
    }

    .mangish-toggle::after {
        animation: none !important;
    }
}

/* ============================================
   Skip to content (Keyboard Nav)
   ============================================ */
.mangish-skip-link {
    position: fixed !important;
    top: -100%;
    right: 10px;
    background: linear-gradient(135deg, #1565C0, #0D47A1);
    color: #fff;
    padding: 14px 28px;
    border-radius: 0 0 12px 12px;
    font-size: 15px;
    font-weight: 700;
    z-index: 99999999;
    text-decoration: none;
    transition: top 0.3s;
    box-shadow: 0 4px 16px rgba(21, 101, 192, 0.3);
    font-family: 'Noto Sans Hebrew', sans-serif;
}

.mangish-skip-link:focus {
    top: 0;
    outline: 3px solid #FFD700;
}
