/* ============================================================
   CyberWCAG - WCAG 2.1 AA Accessibility Plugin Styles
   ============================================================ */

/* ----------------------------------------------------------
   Skip Navigation Link (WCAG 2.4.1)
   Hidden until focused by keyboard users
   ---------------------------------------------------------- */
.cyberwcag-skip-nav {
    position: absolute;
    top: -9999px;
    left: -9999px;
    z-index: 99999;
    padding: 12px 24px;
    background: #005fcc;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0 0 6px 0;
    outline: 3px solid #ffcc00;
}

.cyberwcag-skip-nav:focus {
    top: 0;
    left: 0;
}

/* ----------------------------------------------------------
   Enhanced Focus Indicators (WCAG 2.4.7)
   Applied when focus_enhancement is enabled via JS body class
   ---------------------------------------------------------- */
body a:focus-visible,
body button:focus-visible,
body input:focus-visible,
body select:focus-visible,
body textarea:focus-visible,
body [tabindex]:focus-visible,
body [role="button"]:focus-visible,
body [role="link"]:focus-visible,
body [role="menuitem"]:focus-visible,
body [role="tab"]:focus-visible,
body [role="checkbox"]:focus-visible,
body [role="radio"]:focus-visible {
    outline: 3px solid #005fcc !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 5px rgba(0, 95, 204, 0.25) !important;
    border-radius: 2px;
}

/* ----------------------------------------------------------
   Element highlight when clicked in scanner panel
   ---------------------------------------------------------- */
.cyberwcag-highlight {
    outline: 4px solid #ff4500 !important;
    outline-offset: 4px !important;
    animation: cyberwcag-pulse 0.6s ease-in-out 4;
}

@keyframes cyberwcag-pulse {
    0%, 100% { outline-color: #ff4500; }
    50%       { outline-color: #ffcc00; }
}

/* ----------------------------------------------------------
   High Contrast Mode (user toolbar toggle)
   ---------------------------------------------------------- */
body.cyberwcag-high-contrast *:not(#cyberwcag-toolbar):not(#cyberwcag-toolbar *):not(#cyberwcag-panel):not(#cyberwcag-panel *) {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

body.cyberwcag-high-contrast a:not(#cyberwcag-toolbar a),
body.cyberwcag-high-contrast a:not(#cyberwcag-toolbar a) * {
    color: #ffff00 !important;
}

body.cyberwcag-high-contrast img:not(#cyberwcag-toolbar img) {
    filter: invert(1) contrast(1.2) !important;
}

body.cyberwcag-high-contrast button:not(#cyberwcag-toolbar button) {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #ffffff !important;
}

/* ----------------------------------------------------------
   Dyslexia-friendly Font
   ---------------------------------------------------------- */
body.cyberwcag-dyslexic *:not(#cyberwcag-toolbar):not(#cyberwcag-toolbar *):not(#cyberwcag-panel):not(#cyberwcag-panel *) {
    font-family: 'Arial', 'Verdana', 'Helvetica', sans-serif !important;
    letter-spacing: 0.08em !important;
    word-spacing: 0.2em !important;
    line-height: 1.8 !important;
}

/* ----------------------------------------------------------
   Link Highlight Mode
   ---------------------------------------------------------- */
body.cyberwcag-link-highlight a:not(#cyberwcag-toolbar a):not(.cyberwcag-skip-nav) {
    background-color: #fffde7 !important;
    outline: 2px solid #f57f17 !important;
    outline-offset: 1px !important;
    padding: 1px 3px !important;
    border-radius: 2px !important;
    text-decoration: underline !important;
}

/* ----------------------------------------------------------
   Reading Guide
   ---------------------------------------------------------- */
#cyberwcag-reading-guide {
    position: fixed;
    left: 0;
    right: 0;
    height: 24px;
    background: rgba(255, 255, 0, 0.25);
    border-top: 2px solid rgba(255, 200, 0, 0.6);
    border-bottom: 2px solid rgba(255, 200, 0, 0.6);
    pointer-events: none;
    z-index: 99990;
    display: none;
}

/* ----------------------------------------------------------
   Accessibility Toolbar (FAB)
   ---------------------------------------------------------- */
#cyberwcag-toolbar {
    position: fixed;
    z-index: 99995;
}

/* Position variants */
#cyberwcag-toolbar.cyberwcag-toolbar-bottom-right { bottom: 24px; right: 24px; }
#cyberwcag-toolbar.cyberwcag-toolbar-bottom-left  { bottom: 24px; left: 24px; }
#cyberwcag-toolbar.cyberwcag-toolbar-top-right    { top: 24px;    right: 24px; }
#cyberwcag-toolbar.cyberwcag-toolbar-top-left     { top: 24px;    left: 24px; }

/* FAB button */
.cyberwcag-toolbar-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #005fcc;
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: background 0.2s, transform 0.2s;
    font-size: 22px;
}

.cyberwcag-toolbar-fab:hover {
    background: #004099;
    transform: scale(1.08);
}

.cyberwcag-toolbar-fab:focus-visible {
    outline: 3px solid #ffcc00;
    outline-offset: 3px;
}

/* Toolbar panel */
.cyberwcag-toolbar-panel {
    display: none;
    position: absolute;
    background: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 10px;
    padding: 16px;
    width: 230px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
}

.cyberwcag-toolbar-panel.cyberwcag-toolbar-open {
    display: block;
}

/* Position panel above FAB for bottom positions */
#cyberwcag-toolbar.cyberwcag-toolbar-bottom-right .cyberwcag-toolbar-panel,
#cyberwcag-toolbar.cyberwcag-toolbar-bottom-left  .cyberwcag-toolbar-panel {
    bottom: 64px;
}

/* Position panel below FAB for top positions */
#cyberwcag-toolbar.cyberwcag-toolbar-top-right .cyberwcag-toolbar-panel,
#cyberwcag-toolbar.cyberwcag-toolbar-top-left  .cyberwcag-toolbar-panel {
    top: 64px;
}

/* Right-aligned panels */
#cyberwcag-toolbar.cyberwcag-toolbar-bottom-right .cyberwcag-toolbar-panel,
#cyberwcag-toolbar.cyberwcag-toolbar-top-right    .cyberwcag-toolbar-panel {
    right: 0;
}

/* Left-aligned panels */
#cyberwcag-toolbar.cyberwcag-toolbar-bottom-left .cyberwcag-toolbar-panel,
#cyberwcag-toolbar.cyberwcag-toolbar-top-left    .cyberwcag-toolbar-panel {
    left: 0;
}

.cyberwcag-toolbar-title {
    font-size: 13px;
    font-weight: 700;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.cyberwcag-toolbar-group {
    margin-bottom: 10px;
}

.cyberwcag-toolbar-label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.cyberwcag-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cyberwcag-toolbar-controls span {
    font-size: 13px;
    font-weight: 600;
    min-width: 36px;
    text-align: center;
    color: #333;
}

/* Small tool buttons */
.cyberwcag-tool-btn {
    padding: 5px 10px;
    border: 1px solid #ccc;
    background: #f5f5f5;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s;
}

.cyberwcag-tool-btn:hover {
    background: #e0e0e0;
}

.cyberwcag-tool-btn:focus-visible {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

/* Toggle buttons */
.cyberwcag-toggle-btn {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #ccc;
    background: #f9f9f9;
    color: #333;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    position: relative;
}

.cyberwcag-toggle-btn::after {
    content: 'OFF';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 700;
    color: #999;
}

.cyberwcag-toggle-btn[aria-pressed="true"] {
    background: #005fcc;
    color: #ffffff;
    border-color: #005fcc;
}

.cyberwcag-toggle-btn[aria-pressed="true"]::after {
    content: 'ON';
    color: rgba(255,255,255,0.8);
}

.cyberwcag-toggle-btn:hover {
    border-color: #005fcc;
}

.cyberwcag-toggle-btn:focus-visible {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

.cyberwcag-btn-reset-all {
    width: 100%;
    background: #fff3e0;
    border-color: #ff8f00;
    color: #bf360c;
}

.cyberwcag-btn-reset-all:hover {
    background: #ffe0b2;
}

/* ----------------------------------------------------------
   Scanner Panel
   ---------------------------------------------------------- */
#cyberwcag-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 380px;
    max-height: 60vh;
    z-index: 99994;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Courier New', monospace;
    font-size: 12px;
    box-shadow: -4px 0 24px rgba(0,0,0,0.25);
    border-radius: 10px 0 0 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#cyberwcag-panel-header {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: #1a1a2e;
    color: #ffffff;
    gap: 8px;
    flex-shrink: 0;
}

.cyberwcag-panel-title {
    font-weight: 700;
    font-size: 13px;
    flex: 1;
}

.cyberwcag-panel-counts {
    font-size: 12px;
    display: flex;
    gap: 8px;
}

#cyberwcag-panel-close {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

#cyberwcag-panel-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

#cyberwcag-panel-body {
    overflow-y: auto;
    flex: 1;
    background: #16213e;
    padding: 10px;
}

.cyberwcag-no-issues {
    color: #66bb6a;
    font-weight: 600;
    padding: 16px;
    text-align: center;
}

.cyberwcag-issue-group {
    margin-bottom: 10px;
    background: #0f3460;
    border-radius: 6px;
    overflow: hidden;
}

.cyberwcag-issue-header {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    background: rgba(255,255,255,0.07);
    color: #e0e0e0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cyberwcag-issue-count {
    background: rgba(255,255,255,0.15);
    padding: 1px 7px;
    border-radius: 10px;
}

.cyberwcag-issue-item {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.15s;
}

.cyberwcag-issue-item:hover { background: rgba(255,255,255,0.07); }
.cyberwcag-issue-item:last-child { border-bottom: none; }

.cyberwcag-issue-msg {
    color: #e0e0e0;
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 3px;
}

.cyberwcag-issue-fix {
    color: #80cbc4;
    font-size: 11px;
    line-height: 1.4;
}

.cyberwcag-issue-more {
    padding: 5px 10px;
    color: #7986cb;
    font-size: 11px;
    font-style: italic;
}

#cyberwcag-panel-toggle {
    position: fixed;
    bottom: 0;
    right: 0;
    background: #1a1a2e;
    color: #e0e0e0;
    width: 52px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    gap: 4px;
    font-size: 16px;
    border-radius: 8px 0 0 0;
    z-index: 99993;
    user-select: none;
}

.cyberwcag-toggle-badge {
    background: #d32f2f;
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    padding: 1px 5px;
    font-weight: 700;
}

/* ----------------------------------------------------------
   Responsive: hide panel on small screens
   ---------------------------------------------------------- */
@media (max-width: 480px) {
    #cyberwcag-panel {
        width: 100%;
        border-radius: 10px 10px 0 0;
        max-height: 50vh;
    }

    .cyberwcag-toolbar-panel {
        width: 200px;
    }
}
