/* WS WCAG Tools CSS */

/* Skip Link */
.ws-wcag-skip-link {
    position: absolute;
    top: -9999px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 10px 20px;
    z-index: 999999;
    text-decoration: none;
    font-size: 16px;
    font-weight: bold;
    border: 2px solid #fff;
}
.ws-wcag-skip-link:focus {
    top: 0;
}

/* Toggle Button */
#ws-wcag-container {
    position: fixed;
    z-index: 99999;
    right: 0;
}

#ws-wcag-toggle {
    background-color: var(--ws-wcag-color, #0055aa);
    color: #fff;
    border: none;
    border-radius: 4px 0 0 4px;
    padding: 10px;
    cursor: pointer;
    box-shadow: -2px 2px 5px rgba(0,0,0,0.2);
    transition: opacity 0.3s, visibility 0.3s, right 0.3s;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative; /* Ensure it can be positioned if needed, though we use opacity now */
    right: 0;
}

#ws-wcag-toggle.ws-active {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#ws-wcag-toggle:hover, #ws-wcag-toggle:focus {
    filter: brightness(0.9);
    outline: 2px solid #ffcc00;
}

/* Panel */
#ws-wcag-panel {
    position: fixed;
    right: 0;
    width: 300px;
    background-color: #fff;
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    border-radius: 4px 0 0 4px;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    max-height: 80vh;
    overflow-y: auto;
}

#ws-wcag-panel.ws-visible {
    transform: translateX(0);
}

.ws-hidden {
    display: none; /* Fallback */
}

/* Header */
.ws-wcag-header {
    background-color: var(--ws-wcag-color, #0055aa);
    color: #fff;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ws-wcag-header h3 {
    margin: 0;
    font-size: 16px;
    color: #fff;
    font-weight: bold;
}

#ws-wcag-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
}

/* Grid */
.ws-wcag-grid {
    padding: 15px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Buttons */
.ws-wcag-btn {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.2s;
    color: #333;
}

.ws-wcag-btn:hover, .ws-wcag-btn:focus {
    background-color: #e2e6ea;
    border-color: #adb5bd;
    outline: 2px solid var(--ws-wcag-color, #0055aa);
}

.ws-wcag-btn.active {
    background-color: var(--ws-wcag-color, #0055aa);
    color: #fff;
    border-color: var(--ws-wcag-color, #0055aa);
}

.ws-wcag-btn.full-width {
    grid-column: 1 / -1;
    background-color: #fff;
    border-color: var(--ws-wcag-color, #0055aa);
    color: var(--ws-wcag-color, #0055aa);
}
.ws-wcag-btn.full-width:hover {
    background-color: var(--ws-wcag-color, #0055aa);
    color: #fff;
}

.ws-icon {
    font-size: 24px;
    margin-bottom: 5px;
    display: block;
    height: 24px;
    width: 24px;
}
.ws-icon svg {
    width: 100%;
    height: 100%;
}

.ws-label {
    font-size: 12px;
}

.ws-wcag-footer {
    padding: 10px 15px;
    text-align: center;
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    font-size: 10px;
    color: #6c757d;
}

.ws-declaration-link {
    color: var(--ws-wcag-color, #0055aa);
    text-decoration: underline;
    font-weight: bold;
    font-size: 11px;
}

/* Accessibility Modes */

/* Grayscale */
body.wcag-grayscale {
    filter: grayscale(100%) !important;
}

/* High Contrast */
body.wcag-contrast {
    background-color: #000 !important;
    color: #fff !important;
}
body.wcag-contrast * {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}
body.wcag-contrast a,
body.wcag-contrast a:hover,
body.wcag-contrast button,
body.wcag-contrast input {
    color: #ffff00 !important;
    text-decoration: underline !important;
}
body.wcag-contrast img {
    filter: grayscale(100%) contrast(120%);
}
body.wcag-contrast .ws-wcag-btn {
    border: 2px solid #fff;
}
body.wcag-contrast .ws-wcag-btn.active {
    background-color: #ffff00 !important;
    color: #000 !important;
    border-color: #fff !important;
}

/* Links Underline */
body.wcag-links a {
    text-decoration: underline !important;
}

/* Stop Animations */
body.wcag-stop-animations *,
body.wcag-stop-animations *:before,
body.wcag-stop-animations *:after {
    transition: none !important;
    animation: none !important;
}

/* Readable Font */
body.wcag-readable-font * {
    font-family: Arial, Helvetica, sans-serif !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.1em !important;
    line-height: 1.5 !important;
}

/* Big Cursor */
body.wcag-big-cursor,
body.wcag-big-cursor * {
    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='%23000000' stroke='%23ffffff' stroke-width='2' d='M7 2l12 11.2-5.8.5 3.3 7.3-2.2.9-3.2-7.4-4.4 4.6z'/%3E%3C/svg%3E") 0 0, auto !important;
}
body.wcag-big-cursor a,
body.wcag-big-cursor button,
body.wcag-big-cursor input,
body.wcag-big-cursor [role="button"] {
     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='%23ffcc00' stroke='%23000000' stroke-width='2' d='M9 20l-1.3-3H6.2L12 4l5.8 13h-1.5l-1.3 3H9z'/%3E%3C/svg%3E") 12 12, pointer !important;
}

/* Enhanced Focus Ring */
body.wcag-focus-ring *:focus {
    outline: 4px solid #ffcc00 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px #000 !important;
}

/* Reading Guide */
#ws-wcag-reading-guide {
    position: fixed;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: rgba(255, 255, 0, 0.7);
    z-index: 2147483647;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
    display: none;
}
#ws-wcag-reading-guide.ws-visible {
    display: block;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #ws-wcag-panel {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        top: 0 !important; /* Force top 0 on mobile */
        border-radius: 0;
    }

    #ws-wcag-toggle {
        width: 40px;
        height: 40px;
        top: 50% !important; /* Center vertically on mobile initially */
    }

    .ws-wcag-grid {
        grid-template-columns: 1fr 1fr;
        padding-bottom: 50px; /* Space for scroll */
    }
}
