/**
 * NJ Accessibility Frontend Styles
 * Theme Color: #ebd65d (Icon background, header, inner card borders, active buttons, round close button)
 */

:root {
    --nj-acc-primary: #ebd65d;
    --nj-acc-primary-dark: #d8c243;
    --nj-acc-primary-light: #fdfae6;
    --nj-acc-on-primary: #111111;
    --nj-acc-text-color: #222222;
    --nj-acc-border-color: #ebd65d;
    --nj-acc-card-bg: #ffffff;
    --nj-acc-panel-bg: #ffffff;
    --nj-acc-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Reset for the widget to prevent theme style bleed */
#nj-accessibility-widget,
#nj-accessibility-widget * {
    box-sizing: border-box !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    line-height: 1.3 !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    text-transform: none !important;
    text-shadow: none !important;
    -webkit-font-smoothing: antialiased;
}

/* Base Widget Container */
.nj-acc-container {
    position: fixed !important;
    z-index: 99999999 !important;
    font-size: 14px !important;
}

/* Positioning - Fixed Left Bottom */
.nj-acc-container.nj-pos-bottom-left {
    bottom: 24px !important;
    left: 24px !important;
}

.nj-acc-container.nj-pos-bottom-right {
    bottom: 24px !important;
    right: 24px !important;
}

/* ========================================================
   Floating Trigger Button (Left bottom fixed round icon)
   ======================================================== */
.nj-acc-trigger-btn {
    width: 54px !important;
    height: 54px !important;
    background-color: #ebd65d !important;
    color: #111111 !important;
    border: 2px solid #ffffff !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 16px rgba(235, 214, 93, 0.55), 0 2px 8px rgba(0, 0, 0, 0.2) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease, background-color 0.2s ease !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
}

.nj-acc-trigger-btn:hover {
    background-color: #dec642 !important;
    transform: scale(1.08) !important;
    box-shadow: 0 6px 22px rgba(235, 214, 93, 0.75), 0 3px 10px rgba(0, 0, 0, 0.22) !important;
}

.nj-acc-trigger-btn:active {
    transform: scale(0.96) !important;
}

.nj-acc-trigger-btn svg {
    display: block !important;
    width: 28px !important;
    height: 28px !important;
    fill: currentColor !important;
}

/* When panel is open, hide main trigger so round close button takes its place */
.nj-acc-container.nj-panel-open .nj-acc-trigger-btn {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.8) !important;
}

/* ========================================================
   Accessibility Options Panel (Modal)
   ======================================================== */
.nj-acc-panel {
    position: fixed !important;
    width: 285px !important;
    max-width: calc(100vw - 40px) !important;
    background-color: #ffffff !important;
    border-radius: 14px !important;
    box-shadow: var(--nj-acc-shadow) !important;
    padding: 16px !important;
    padding-bottom: 26px !important;
    border: 2px solid #ebd65d !important;
    z-index: 100000000 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s ease !important;
    overflow: visible !important;
}

.nj-acc-container.nj-pos-bottom-left .nj-acc-panel {
    bottom: 28px !important;
    left: 24px !important;
}

.nj-acc-container.nj-pos-bottom-right .nj-acc-panel {
    bottom: 28px !important;
    right: 24px !important;
}

.nj-acc-panel.nj-active {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
}

/* Header with #ebd65d background */
.nj-acc-header {
    background-color: #ebd65d !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    margin-bottom: 16px !important;
    text-align: center !important;
    box-shadow: 0 2px 6px rgba(235, 214, 93, 0.35) !important;
}

.nj-acc-title {
    color: #111111 !important;
    font-size: 20px !important;
    font-weight: 700 !important;
    margin: 0 !important;
    padding: 0 !important;
    letter-spacing: 0.3px !important;
}

/* 2-Column Grid Layout */
.nj-acc-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    max-height: calc(100vh - 150px) !important;
    overflow-y: auto !important;
    padding: 2px !important;
}

/* Individual Feature Card - Border & Hover with #ebd65d */
.nj-acc-card {
    background-color: #ffffff !important;
    border: 2px solid #ebd65d !important;
    border-radius: 10px !important;
    padding: 14px 8px 12px 8px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    min-height: 96px !important;
    outline: none !important;
    position: relative !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04) !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

.nj-acc-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(235, 214, 93, 0.4) !important;
    background-color: #fdfae6 !important;
    border-color: #d8c243 !important;
}

.nj-acc-card:active {
    transform: scale(0.97) !important;
}

/* Card Icon */
.nj-acc-card-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #111111 !important;
    margin-bottom: 8px !important;
    height: 32px !important;
    transition: transform 0.2s ease !important;
}

.nj-acc-card-icon svg {
    display: block !important;
    width: 28px !important;
    height: 28px !important;
}

/* Card Title */
.nj-acc-card-title {
    color: #111111 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

/* ACTIVE State when an option is selected - #ebd65d background */
.nj-acc-card.nj-is-active {
    background-color: #ebd65d !important;
    border-color: #d8c243 !important;
    color: #111111 !important;
    box-shadow: 0 4px 12px rgba(235, 214, 93, 0.5) !important;
}

.nj-acc-card.nj-is-active .nj-acc-card-icon {
    color: #111111 !important;
}

.nj-acc-card.nj-is-active .nj-acc-card-title {
    color: #111111 !important;
    font-weight: 700 !important;
}

/* Level Indicator Badge for Font Scaling */
.nj-acc-card-badge {
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    background: #111111 !important;
    color: #ebd65d !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    padding: 2px 5px !important;
    border-radius: 6px !important;
    line-height: 1 !important;
}

.nj-acc-card.nj-is-active .nj-acc-card-badge {
    background: #111111 !important;
    color: #ebd65d !important;
}

/* ========================================================
   Round Close ("Cut") Button Fixed at Bottom-Left Corner
   ======================================================== */
.nj-acc-corner-close-btn {
    position: absolute !important;
    bottom: -20px !important;
    left: -16px !important;
    width: 48px !important;
    height: 48px !important;
    background-color: #ebd65d !important;
    color: #111111 !important;
    border: 3px solid #ffffff !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s ease !important;
    padding: 0 !important;
    z-index: 100000002 !important;
    outline: none !important;
}

.nj-acc-container.nj-pos-bottom-right .nj-acc-corner-close-btn {
    left: auto !important;
    right: -16px !important;
}

.nj-acc-corner-close-btn:hover {
    background-color: #dec642 !important;
    transform: scale(1.1) !important;
}

.nj-acc-corner-close-btn:active {
    transform: scale(0.94) !important;
}

.nj-acc-corner-close-btn svg {
    stroke: #111111 !important;
    width: 22px !important;
    height: 22px !important;
}

/* ========================================================
   ACCESSIBILITY MODES APPLIED TO THE ENTIRE PAGE
   ======================================================== */

/* 1. COLOR CONTRAST (High Contrast Dark Theme) */
html.nj-contrast-mode,
html.nj-contrast-mode body {
    background-color: #121212 !important;
    color: #f5f5f5 !important;
}

html.nj-contrast-mode body *:not(#nj-accessibility-widget):not(#nj-accessibility-widget *) {
    background-color: #181818 !important;
    color: #f5f5f5 !important;
    border-color: #444444 !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

html.nj-contrast-mode a:not(#nj-accessibility-widget a) {
    color: #ebd65d !important;
    text-decoration: underline !important;
}

html.nj-contrast-mode h1,
html.nj-contrast-mode h2,
html.nj-contrast-mode h3,
html.nj-contrast-mode h4,
html.nj-contrast-mode h5,
html.nj-contrast-mode h6 {
    color: #ffffff !important;
}

html.nj-contrast-mode input:not(#nj-accessibility-widget input),
html.nj-contrast-mode textarea,
html.nj-contrast-mode select {
    background-color: #242424 !important;
    color: #ffffff !important;
    border: 2px solid #ebd65d !important;
}

html.nj-contrast-mode button:not(#nj-accessibility-widget button) {
    background-color: #333333 !important;
    color: #ebd65d !important;
    border: 2px solid #ebd65d !important;
}

/* 2. MONOCHROME */
html.nj-monochrome-mode body > *:not(#nj-accessibility-widget) {
    filter: grayscale(100%) !important;
    -webkit-filter: grayscale(100%) !important;
}

/* 3. HIGHLIGHT LINKS */
html.nj-highlight-links-mode a:not(#nj-accessibility-widget a) {
    background-color: #ebd65d !important;
    color: #000000 !important;
    text-decoration: underline 3px solid #000000 !important;
    text-underline-offset: 4px !important;
    font-weight: 700 !important;
    outline: 2px solid #000000 !important;
    border-radius: 3px !important;
    padding: 1px 4px !important;
    display: inline-block !important;
}

/* 4. READABLE FONT */
html.nj-readable-font-mode *:not(#nj-accessibility-widget):not(#nj-accessibility-widget *) {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif !important;
    letter-spacing: 0.06em !important;
    word-spacing: 0.12em !important;
    line-height: 1.85 !important;
}

/* 5 & 6. FONT SIZE SCALING */
html.nj-font-scale-1 *:not(#nj-accessibility-widget):not(#nj-accessibility-widget *) {
    font-size: 110% !important;
}

html.nj-font-scale-2 *:not(#nj-accessibility-widget):not(#nj-accessibility-widget *) {
    font-size: 120% !important;
}

html.nj-font-scale-3 *:not(#nj-accessibility-widget):not(#nj-accessibility-widget *) {
    font-size: 130% !important;
}

html.nj-font-scale-4 *:not(#nj-accessibility-widget):not(#nj-accessibility-widget *) {
    font-size: 140% !important;
}

html.nj-font-scale-minus-1 *:not(#nj-accessibility-widget):not(#nj-accessibility-widget *) {
    font-size: 92% !important;
}

html.nj-font-scale-minus-2 *:not(#nj-accessibility-widget):not(#nj-accessibility-widget *) {
    font-size: 85% !important;
}

/* 7. IMAGE DESCRIPTION OVERLAY BADGES */
.nj-img-desc-container {
    position: relative !important;
    display: inline-block !important;
    max-width: 100% !important;
}

.nj-img-desc-badge {
    position: absolute !important;
    bottom: 6px !important;
    left: 6px !important;
    right: 6px !important;
    background: rgba(18, 18, 18, 0.92) !important;
    color: #ffffff !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    border-left: 4px solid #ebd65d !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3) !important;
    z-index: 10000 !important;
    pointer-events: auto !important;
    display: block !important;
    word-break: break-word !important;
    text-align: left !important;
}

/* 8. BIG CURSOR */
html.nj-big-cursor-mode,
html.nj-big-cursor-mode * {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'><path d='M6 4l14 34 6.5-12 12.5-3.5L6 4z' fill='%23000000' stroke='%23ebd65d' stroke-width='3' stroke-linejoin='round'/></svg>"), auto !important;
}

html.nj-big-cursor-mode a,
html.nj-big-cursor-mode button,
html.nj-big-cursor-mode [role="button"],
html.nj-big-cursor-mode input[type="submit"],
html.nj-big-cursor-mode input[type="button"],
html.nj-big-cursor-mode select {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'><path d='M14 4a4 4 0 0 0-4 4v17l-3.8-3.8a3.2 3.2 0 0 0-4.5 4.5l9.5 9.5c2.2 2.2 5.2 3.8 8.8 3.8h8a10 10 0 0 0 10-10V20a4 4 0 0 0-8 0v-2a4 4 0 0 0-8 0v-2a4 4 0 0 0-8 0V8a4 4 0 0 0-4-4z' fill='%23000000' stroke='%23ebd65d' stroke-width='2.5' stroke-linejoin='round'/></svg>"), pointer !important;
}

/* 9. STOP ANIMATIONS */
html.nj-stop-animations-mode *,
html.nj-stop-animations-mode *::before,
html.nj-stop-animations-mode *::after {
    animation-play-state: paused !important;
    animation: none !important;
    -webkit-animation: none !important;
    transition: none !important;
    -webkit-transition: none !important;
    scroll-behavior: auto !important;
}

/* Responsive adjustments */
@media screen and (max-width: 480px) {
    .nj-acc-panel {
        width: calc(100vw - 40px) !important;
        left: 20px !important;
        right: 20px !important;
        bottom: 24px !important;
    }
    
    .nj-acc-grid {
        gap: 8px !important;
    }

    .nj-acc-card {
        padding: 10px 6px !important;
        min-height: 84px !important;
    }

    .nj-acc-card-title {
        font-size: 12px !important;
    }

    .nj-acc-trigger-btn {
        width: 48px !important;
        height: 48px !important;
    }
}
