/* ==========================================================
   Accessibility Toolbar
   ========================================================== */

/* --- Skip to Content Link --- */

.cps-a11y-skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1565c0;
    color: #fff;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    z-index: 100000;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    transition: top 0.2s;
}

.cps-a11y-skip-link:focus {
    top: 0;
    outline: 3px solid #ff0;
    outline-offset: 2px;
    color: #fff;
}

/* --- Screen-Reader Only --- */

.cps-a11y-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Toolbar Container --- */

.cps-a11y-toolbar {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
        'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
}

/* Position variants */
.cps-a11y-toolbar--bottom-right { bottom: 20px; right: 20px; }
.cps-a11y-toolbar--bottom-left  { bottom: 20px; left: 20px; }
.cps-a11y-toolbar--top-right    { top: 20px; right: 20px; }
.cps-a11y-toolbar--top-left     { top: 20px; left: 20px; }

/* --- Trigger Button (FAB) --- */

.cps-a11y-toolbar__trigger {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.cps-a11y-toolbar__trigger:hover,
.cps-a11y-toolbar__trigger:focus-visible {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.cps-a11y-toolbar__trigger:focus-visible {
    outline: 3px solid #ff0;
    outline-offset: 3px;
}

/* --- Panel --- */

.cps-a11y-toolbar__panel {
    position: absolute;
    width: 280px;
    max-height: 80vh;
    overflow-y: auto;
    background: #fff;
    color: #333;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.cps-a11y-toolbar__panel[hidden] {
    display: none;
}

/* Panel position based on toolbar corner */
.cps-a11y-toolbar--bottom-right .cps-a11y-toolbar__panel { bottom: 70px; right: 0; }
.cps-a11y-toolbar--bottom-left  .cps-a11y-toolbar__panel { bottom: 70px; left: 0; }
.cps-a11y-toolbar--top-right    .cps-a11y-toolbar__panel { top: 70px; right: 0; }
.cps-a11y-toolbar--top-left     .cps-a11y-toolbar__panel { top: 70px; left: 0; }

/* --- Panel Header --- */

.cps-a11y-toolbar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.cps-a11y-toolbar__title {
    font-weight: 700;
    font-size: 1.1rem;
    color: #333;
}

.cps-a11y-toolbar__close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 4px;
}

.cps-a11y-toolbar__close:hover,
.cps-a11y-toolbar__close:focus-visible {
    background: #f0f0f0;
    color: #333;
}

/* --- Feature List --- */

.cps-a11y-toolbar__features {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.cps-a11y-toolbar__features li {
    margin: 0;
    padding: 0;
}

.cps-a11y-toolbar__btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    text-align: left;
    border-radius: 0;
    transition: background 0.15s;
    font-family: inherit;
    line-height: 1.4;
}

.cps-a11y-toolbar__btn:hover {
    background: #f5f5f5;
}

.cps-a11y-toolbar__btn:focus-visible {
    outline: 2px solid #1565c0;
    outline-offset: -2px;
}

.cps-a11y-toolbar__btn[aria-pressed="true"] {
    background: #e3f2fd;
    font-weight: 600;
}

/* --- Feature Icon --- */

.cps-a11y-toolbar__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    font-weight: 700;
    background: #f0f0f0;
    border-radius: 6px;
    flex-shrink: 0;
}

.cps-a11y-toolbar__btn[aria-pressed="true"] .cps-a11y-toolbar__icon {
    background: #1565c0;
    color: #fff;
}

/* --- Step Indicator --- */

.cps-a11y-toolbar__step-indicator {
    margin-left: auto;
    font-size: 0.75rem;
    color: #999;
    font-weight: 400;
}

/* --- Footer / Reset --- */

.cps-a11y-toolbar__footer {
    border-top: 1px solid #e0e0e0;
    padding: 4px 0;
}

.cps-a11y-toolbar__reset {
    color: #c62828;
}

.cps-a11y-toolbar__reset:hover {
    background: #ffebee;
}

/* --- Reading Mask Overlays --- */

.cps-a11y-reading-mask {
    position: fixed;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9998;
    pointer-events: none;
}

.cps-a11y-reading-mask--top {
    top: 0;
    border-bottom: 3px solid #64b5f6;
}

.cps-a11y-reading-mask--bottom {
    bottom: 0;
    border-top: 3px solid #64b5f6;
}

/* --- Desktop-only features (reading mask) --- */

@media (max-width: 600px) {
    .cps-a11y-toolbar__desktop-only {
        display: none;
    }
}

/* --- Responsive --- */

@media (max-width: 600px) {
    .cps-a11y-toolbar__panel {
        width: 260px;
    }

    .cps-a11y-toolbar--bottom-right,
    .cps-a11y-toolbar--bottom-left {
        bottom: 12px;
    }

    .cps-a11y-toolbar--bottom-right { right: 12px; }
    .cps-a11y-toolbar--bottom-left  { left: 12px; }

    .cps-a11y-toolbar__trigger {
        width: 48px;
        height: 48px;
    }

    .cps-a11y-toolbar__trigger svg {
        width: 22px;
        height: 22px;
    }
}
