/**
 * AccessiMate Frontend CSS
 * Modern accessibility toolbar with optimized, eye-catching design
 */

/* CSS Variables for consistent theming */
:root {
    --accessimate-primary: #1e40af; /* Deep indigo for better contrast */
    --accessimate-primary-hover: #1e3a8a; /* Darker indigo for hover */
    --accessimate-primary-light: #60a5fa; /* Lighter indigo for accents */
    --accessimate-secondary: #475569; /* Neutral slate for secondary elements */
    --accessimate-success: #16a34a; /* Vibrant green for success states */
    --accessimate-warning: #fff176; /* Softer yellow for warnings */
    --accessimate-danger: #dc2626; /* Bold red for errors */
    --accessimate-dark: #111827; /* Deep slate for dark backgrounds */
    --accessimate-light: #f9fafb; /* Clean off-white for light backgrounds */
    --accessimate-white: #ffffff;

    --accessimate-gray-100: #f3f4f6;
    --accessimate-gray-200: #e5e7eb;
    --accessimate-gray-300: #d1d5db;
    --accessimate-gray-400: #9ca3af;
    --accessimate-gray-500: #6b7280;
    --accessimate-gray-600: #4b5563;
    --accessimate-gray-700: #374151;
    --accessimate-gray-800: #1f2937;
    --accessimate-gray-900: #111827;

    --accessimate-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --accessimate-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    --accessimate-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --accessimate-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --accessimate-shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

    --accessimate-radius: 0.5rem;
    --accessimate-radius-lg: 0.75rem;
    --accessimate-radius-xl: 1rem;
    --accessimate-radius-full: 9999px;

    --accessimate-font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --accessimate-transition: all 0.2s ease-in-out;
}

/* Reset and base styles for AccessiMate components */
.accessimate-toolbar *,
.accessimate-toolbar *::before,
.accessimate-toolbar *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Main toolbar container */
.accessimate-toolbar {
    position: fixed;
    z-index: 999999;
    font-family: var(--accessimate-font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--accessimate-gray-800);
}

/* Toolbar positioning */
.accessimate-top-right { top: 20px; right: 20px; }
.accessimate-top-left { top: 20px; left: 20px; }
.accessimate-bottom-right { bottom: 20px; right: 20px; }
.accessimate-bottom-left { bottom: 20px; left: 20px; }

/* Responsive positioning for mobile */
@media (max-width: 768px) {
    .accessimate-toolbar {
        top: 10px !important;
        right: 10px !important;
        bottom: auto !important;
        left: auto !important;
    }
}

/* Toggle button */
.accessimate-toolbar-toggle button {
    background: linear-gradient(135deg, var(--accessimate-primary), var(--accessimate-primary-light));
    color: var(--accessimate-white);
    border: none;
    border-radius: var(--accessimate-radius-full);
    width: 56px;
    height: 56px;
    cursor: pointer;
    font-size: 24px;
    box-shadow: var(--accessimate-shadow-lg);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.3s ease-out, background 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.4) rotate(-45deg); /* Dynamic initial state with rotation */
    pointer-events: none;
    visibility: hidden;
}

.accessimate-toolbar-toggle button.loaded {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    pointer-events: auto;
    visibility: visible;
    animation: accessimate-toolbar-toggle 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards; /* Bouncy animation */
}

.accessimate-toolbar-toggle button:hover {
    transform: scale(1.1) rotate(0deg); /* Slight scale on hover */
    box-shadow: var(--accessimate-shadow-xl), 0 0 12px rgba(30, 64, 175, 0.3); /* Glow effect */
    background: linear-gradient(135deg, var(--accessimate-primary-hover), var(--accessimate-primary));
}

.accessimate-toolbar-toggle button:focus {
    outline: 3px solid rgba(30, 64, 175, 0.3);
    outline-offset: 2px;
}

.accessimate-toolbar-toggle button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.accessimate-toolbar-toggle button:hover::before {
    opacity: 1;
}

.accessimate-toolbar-toggle button:active {
    transform: translateY(0);
}

.accessimate-toolbar-toggle button .accessimate-icon {
    border-radius: 100px;
    color: var(--accessimate-white);
    border: 2px solid var(--accessimate-white);
    padding: 6px;
    font-size: 30px;
    line-height: 1;
}

@keyframes accessimate-toolbar-toggle {
    0% {
        opacity: 0;
        transform: scale(0.4) rotate(-45deg);
        pointer-events: none;
        visibility: hidden;
    }
    60% {
        opacity: 1;
        transform: scale(1.15) rotate(10deg); /* Overshoot for bounce */
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        pointer-events: auto;
        visibility: visible;
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .accessimate-toolbar-toggle button,
    .accessimate-toolbar-toggle button.loaded,
    .accessimate-toolbar-toggle button:hover {
        animation: none !important;
        transition-duration: 0.01ms !important;
        transform: none !important;
    }
}

/* Panel styles */
.accessimate-panel {
    position: absolute;
    background: var(--accessimate-white);
    border: 1px solid var(--accessimate-gray-200);
    border-radius: var(--accessimate-radius-xl);
    box-shadow: var(--accessimate-shadow-xl);
    width: 350px;
    max-width: 90vw;
    backdrop-filter: blur(10px);
    overflow: hidden;
    transition: var(--accessimate-transition);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.accessimate-panel.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Panel positioning */
.accessimate-top-right .accessimate-panel,
.accessimate-top-left .accessimate-panel { top: 70px; }
.accessimate-bottom-right .accessimate-panel,
.accessimate-bottom-left .accessimate-panel { bottom: 70px; }
.accessimate-top-right .accessimate-panel,
.accessimate-bottom-right .accessimate-panel { right: 0; }
.accessimate-top-left .accessimate-panel,
.accessimate-bottom-left .accessimate-panel { left: 0; }

/* Mobile panel adjustments */
@media (max-width: 768px) {
    .accessimate-panel {
        width: calc(100vw - 20px);
        left: 10px !important;
        right: 10px !important;
        max-width: none;
    }
}

/* Panel header */
.accessimate-panel-header {
    padding: 24px 28px 20px; /* Increased padding for better spacing */
    border-bottom: 1px solid var(--accessimate-gray-100);
    background: linear-gradient(135deg, var(--accessimate-gray-100) 0%, var(--accessimate-white) 80%); /* Subtler gradient */
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    box-shadow: var(--accessimate-shadow-sm); /* Subtle shadow for depth */
}

.accessimate-panel-header h3 {
    font-size: 20px; /* Slightly larger for emphasis */
    font-weight: 700; /* Bolder for hierarchy */
    color: var(--accessimate-gray-800);
    margin: 0;
    letter-spacing: -0.025em; /* Tighter letter spacing for modern look */
}

.accessimate-panel-header button {
    background: none;
    border: none;
    color: var(--accessimate-gray-700);
    cursor: pointer;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: var(--accessimate-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--accessimate-transition);
}

.accessimate-panel-header button:hover {
    background: var(--accessimate-gray-100);
    color: var(--accessimate-gray-600);
}

.accessimate-header-actions {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

/* Theme toggle button */
.accessimate-theme-toggle {
    background: none;
    border: none;
    color: var(--accessimate-gray-500);
    cursor: pointer;
    font-size: 24px;
    width: 36px;
    height: 36px;
    border-radius: var(--accessimate-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--accessimate-transition);
}

.accessimate-theme-toggle:hover {
    background: var(--accessimate-gray-100);
    color: var(--accessimate-primary);
    transform: scale(1.1); /* Subtle scale effect for interactivity */
}

.accessimate-theme-toggle:focus {
    outline: 2px solid var(--accessimate-primary);
    outline-offset: 2px;
}

.accessimate-theme-toggle .material-icons {
    font-size: 24px;
    line-height: 1;
}

/* Panel content */
.accessimate-panel-content {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
}

/* Custom scrollbar */
.accessimate-panel-content::-webkit-scrollbar { width: 6px; }
.accessimate-panel-content::-webkit-scrollbar-track {
    background: var(--accessimate-gray-100);
    border-radius: var(--accessimate-radius);
}
.accessimate-panel-content::-webkit-scrollbar-thumb {
    background: var(--accessimate-gray-400);
    border-radius: var(--accessimate-radius);
}
.accessimate-panel-content::-webkit-scrollbar-thumb:hover {
    background: var(--accessimate-gray-500);
}

/* Button styles */
.accessimate-btn:focus,
.accessimate-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--accessimate-gray-100);
    border: 1px solid var(--accessimate-gray-300);
    border-radius: var(--accessimate-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--accessimate-gray-800);
    display: flex;
    gap: 10px;
    transition: var(--accessimate-transition);
    text-align: center;
    position: relative;
    overflow: hidden;
    flex-wrap: wrap;
    justify-content: center;
    height: 100%;
    align-items: flex-start;
}

.accessimate-btn:hover {
    background: var(--accessimate-gray-200);
    border-color: var(--accessimate-gray-400);
    transform: translateY(-1px);
    box-shadow: var(--accessimate-shadow);
    color: var(--accessimate-primary);
}

.accessimate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.accessimate-panel-footer .accessimate-btn {
    width: 100%;
    padding: 16px;
    color: var(--accessimate-white);
    border: none;
    border-radius: 0 0 var(--accessimate-radius) var(--accessimate-radius);
    box-shadow: var(--accessimate-shadow-lg);
    flex-direction: row;
    justify-content: center;
    background: linear-gradient(135deg, var(--accessimate-danger) 0%, #ef4444 100%); /* Red gradient for reset */
    border-top: 1px solid var(--accessimate-gray-100);
    transition: var(--accessimate-transition), background 0.3s ease, transform 0.2s ease;
}

.accessimate-panel-footer .accessimate-btn:hover {
    background: linear-gradient(135deg, #b91c1c, var(--accessimate-danger)); /* Darker red gradient on hover */
    transform: translateY(0);
    box-shadow: var(--accessimate-shadow-xl);
}

.accessimate-panel-footer .accessimate-btn:focus {
    outline: none;
}

.accessimate-btn:hover::before { 
    left: 100%;
}

.accessimate-btn:focus {
    outline: 2px solid var(--accessimate-primary);
    outline-offset: 2px;
    /* background: transparent !important; */
}

.accessimate-btn.active {
    background: linear-gradient(135deg, var(--accessimate-primary), var(--accessimate-primary-light));
    border-color: var(--accessimate-primary);
    color: var(--accessimate-white);
    box-shadow: var(--accessimate-shadow-md);
}

.accessimate-btn.active:hover {
    background: linear-gradient(135deg, var(--accessimate-primary-hover), var(--accessimate-primary));
    transform: translateY(-1px);
}

/* Option containers */
.accessimate-option-label {
    display: block;
    width: 100%;
    user-select: none;
    font-size: 14px;
}

.accessimate-option-step {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto;
    gap: 5px;
    line-height: 0;
}

.accessimate-option-step .accessimate-option-step-item {
    height: 2px;
    width: calc(70% / 3);
    border-radius: 2px;
    background: var(--accessimate-gray-400);
    display: inline-block;
}

.accessimate-option-step .accessimate-option-step-item.active {
    background: var(--accessimate-light);
}

/* Font size controls */
.accessimate-font-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding: 12px;
    background: var(--accessimate-gray-100);
    border-radius: var(--accessimate-radius);
    border: 1px solid var(--accessimate-gray-200);
}

.accessimate-font-controls label {
    font-weight: 500;
    color: var(--accessimate-gray-800);
    margin-bottom: 0;
}

.accessimate-btn-sm {
    padding: 8px 12px;
    background: var(--accessimate-white);
    border: 1px solid var(--accessimate-gray-300);
    border-radius: var(--accessimate-radius);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--accessimate-gray-600);
    transition: var(--accessimate-transition);
    min-width: 40px;
}

.accessimate-btn-sm:hover {
    background: var(--accessimate-primary);
    border-color: var(--accessimate-primary);
    color: var(--accessimate-white);
    transform: scale(1.05);
}

.accessimate-btn-sm:focus {
    outline: 2px solid var(--accessimate-primary);
    outline-offset: 2px;
}

#accessimate-font-current {
    font-weight: 600;
    color: var(--accessimate-primary);
    min-width: 50px;
    text-align: center;
}

/* Text to speech */
.accessimate-word-highlight {
    background-color: var(--accessimate-warning); /* Softer yellow */
    color: var(--accessimate-dark);
    border-radius: 2px;
    font-size: inherit !important;
    font-weight: inherit !important;
    line-height: inherit !important;
    box-shadow: 0 0 4px 4px rgba(255, 241, 118, 0.7) !important;
    transition: box-shadow 0.3s ease, background-color 0.3s ease;
    user-select: none; /* prevent accidental text selection flicker */
}

/* Skip link */
.accessimate-skip-link {
    position: absolute;
    left: -9999px;
    top: 20px;
    z-index: 999999;
    background: var(--accessimate-dark);
    color: var(--accessimate-white);
    padding: 12px 20px;
    text-decoration: none;
    border-radius: var(--accessimate-radius);
    font-weight: 500;
    font-size: 14px;
    transition: var(--accessimate-transition);
    box-shadow: var(--accessimate-shadow-lg);
}

.accessimate-skip-link:focus {
    left: 20px;
    outline: 2px solid var(--accessimate-primary);
    outline-offset: 2px;
}

/* Accessibility states */
/* body.accessimate-high-contrast {
    filter: contrast(150%) !important;
}

body.accessimate-high-contrast * {
    text-shadow: none !important;
    box-shadow: none !important;
} */

body.accessimate-enhanced-keyboard *:focus {
    outline: 3px solid var(--accessimate-warning) !important;
    outline-offset: 2px !important;
    z-index: 999 !important;
    position: relative !important;
}

body.accessimate-highlight-links a:not(.accessimate-panel a), 
body.accessimate-highlight-links a:not(.accessimate-panel a) *,
body.accessimate-highlight-links a:not(.accessimate-panel a)::before,
body.accessimate-highlight-links a:not(.accessimate-panel a)::after,
body.accessimate-highlight-links a:not(.accessimate-panel a) *::before,
body.accessimate-highlight-links a:not(.accessimate-panel a) *::after {
    background: linear-gradient(45deg, var(--accessimate-warning), var(--accessimate-warning)) !important;
    color: var(--accessimate-dark) !important;
    text-decoration: underline !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    font-weight: 600 !important;
}

body.accessimate-simplified-text .accessimate-needs-simplification {
    background: linear-gradient(45deg, rgba(30, 64, 175, 0.1), rgba(30, 64, 175, 0.05)) !important;
    border-left: 4px solid var(--accessimate-primary) !important;
    padding: 8px 12px !important;
    margin: 8px 0 !important;
    border-radius: 0 var(--accessimate-radius) var(--accessimate-radius) 0 !important;
}

/* Loading states */
.accessimate-btn.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.accessimate-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: accessimate-spin 1s linear infinite;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

@keyframes accessimate-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tooltip styles */
.accessimate-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accessimate-dark);
    color: var(--accessimate-white);
    padding: 6px 12px;
    border-radius: var(--accessimate-radius);
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: var(--accessimate-transition);
    margin-bottom: 8px;
    z-index: 1000;
}

.accessimate-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--accessimate-dark);
    opacity: 0;
    pointer-events: none;
    transition: var(--accessimate-transition);
    margin-bottom: 4px;
}

.accessimate-tooltip:hover::after,
.accessimate-tooltip:hover::before { opacity: 1; }

/* Status indicators */
.accessimate-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: var(--accessimate-radius);
    font-size: 12px;
    font-weight: 500;
}

.accessimate-status-indicator.success {
    background: rgba(22, 163, 74, 0.1);
    color: var(--accessimate-success);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.accessimate-status-indicator.warning {
    background: rgba(217, 119, 6, 0.1);
    color: var(--accessimate-warning);
    border: 1px solid rgba(217, 119, 6, 0.2);
}

.accessimate-status-indicator.error {
    background: rgba(220, 38, 38, 0.1);
    color: var(--accessimate-danger);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

/* Animation classes */
.accessimate-fade-in { animation: accessimate-fadeIn 0.3s ease-out; }
.accessimate-fade-out { animation: accessimate-fadeOut 0.3s ease-out; }
.accessimate-slide-in-right { animation: accessimate-slide-in-right 0.3s ease-out; }
.accessimate-slide-out-right { animation: accessimate-slide-out-right 0.3s ease-out; }
.accessimate-slide-in-left { animation: accessimate-slide-in-left 0.3s ease-out; }
.accessimate-slide-out-left { animation: accessimate-slide-out-left 0.3s ease-out; }
.accessimate-slide-in-top { animation: accessimate-slide-in-top 0.3s ease-out; }
.accessimate-slide-out-top { animation: accessimate-slide-out-top 0.3s ease-out; }
.accessimate-slide-in-bottom { animation: accessimate-slide-in-bottom 0.3s ease-out; }
.accessimate-slide-out-bottom { animation: accessimate-slide-out-bottom 0.3s ease-out; }

@keyframes accessimate-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes accessimate-fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes accessimate-slide-in-right {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes accessimate-slide-out-right {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

@keyframes accessimate-slide-in-left {
    from { opacity: 0; transform: translateX(-100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes accessimate-slide-out-left {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-100px); }
}

@keyframes accessimate-slide-in-top {
    from { opacity: 0; transform: translateY(-100px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes accessimate-slide-out-top {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-100px); }
}

@keyframes accessimate-slide-in-bottom {
    from { opacity: 0; transform: translateY(100px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes accessimate-slide-out-bottom {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(100px); }
}

/* Dark mode support scoped to toolbar section */
.accessimate-toolbar[data-accessimate-theme="dark"] {
    --accessimate-primary: #60a5fa;
    --accessimate-primary-hover: #3b82f6;
    --accessimate-primary-light: #93c5fd;
    --accessimate-secondary: #94a3b8;
    --accessimate-success: #4ade80;
    --accessimate-warning: #f59e0b;
    --accessimate-danger: #f87171;
    --accessimate-dark: #0f172a;
    --accessimate-light: #1e293b;
    --accessimate-white: #1e293b;
    --accessimate-gray-100: #1e293b;
    --accessimate-gray-200: #334155;
    --accessimate-gray-300: #475569;
    --accessimate-gray-400: #64748b;
    --accessimate-gray-500: #94a3b8;
    --accessimate-gray-600: #cbd5e1;
    --accessimate-gray-700: #d1d5db;
    --accessimate-gray-800: #e5e7eb;
    --accessimate-gray-900: #f3f4f6;
    --accessimate-shadow-sm: 0 1px 2px 0 rgba(255, 255, 255, 0.05);
    --accessimate-shadow: 0 2px 4px rgba(255, 255, 255, 0.08);
    --accessimate-shadow-md: 0 4px 6px rgba(255, 255, 255, 0.1);
    --accessimate-shadow-lg: 0 10px 15px rgba(255, 255, 255, 0.1);
    --accessimate-shadow-xl: 0 20px 25px rgba(255, 255, 255, 0.15);
}

.accessimate-toolbar[data-accessimate-theme="dark"] .accessimate-panel {
    background: var(--accessimate-light);
    border-color: var(--accessimate-gray-300);
    backdrop-filter: blur(10px) brightness(0.9);
}

.accessimate-toolbar[data-accessimate-theme="dark"] .accessimate-panel-header {
    background: linear-gradient(135deg, var(--accessimate-gray-200), var(--accessimate-gray-100));
    box-shadow: var(--accessimate-shadow-sm);
}

.accessimate-toolbar[data-accessimate-theme="dark"] .accessimate-panel-content {
    background: var(--accessimate-light);
}

.accessimate-toolbar[data-accessimate-theme="dark"] .accessimate-btn {
    background: var(--accessimate-gray-200);
    border-color: var(--accessimate-gray-400);
    color: var(--accessimate-gray-800);
}

.accessimate-toolbar[data-accessimate-theme="dark"] .accessimate-btn:hover {
    background: var(--accessimate-gray-300);
    border-color: var(--accessimate-gray-500);
}

.accessimate-toolbar[data-accessimate-theme="dark"] .accessimate-btn.active {
    background: linear-gradient(135deg, var(--accessimate-primary), var(--accessimate-primary-light));
    border-color: var(--accessimate-primary);
    color: var(--accessimate-white);
}

.accessimate-toolbar[data-accessimate-theme="dark"] .accessimate-btn.active:hover {
    background: linear-gradient(135deg, var(--accessimate-primary-hover), var(--accessimate-primary));
    transform: translateY(-1px);
}

.accessimate-toolbar[data-accessimate-theme="dark"] .accessimate-panel-footer .accessimate-btn {
    background: linear-gradient(135deg, var(--accessimate-danger) 0%, #f87171 100%);
}

.accessimate-toolbar[data-accessimate-theme="dark"] .accessimate-panel-footer .accessimate-btn:hover {
    background: linear-gradient(135deg, #b91c1c, var(--accessimate-danger));
    transform: translateY(0);
    box-shadow: var(--accessimate-shadow-xl);
}

.accessimate-toolbar[data-accessimate-theme="dark"] .accessimate-font-controls {
    background: var(--accessimate-gray-200);
    border-color: var(--accessimate-gray-400);
}

.accessimate-toolbar[data-accessimate-theme="dark"] .accessimate-font-controls label {
    color: var(--accessimate-gray-800);
}

.accessimate-toolbar[data-accessimate-theme="dark"] #accessimate-font-current {
    color: var(--accessimate-primary-light);
}

.accessimate-toolbar[data-accessimate-theme="dark"] .accessimate-theme-toggle {
    color: var(--accessimate-gray-600);
}

.accessimate-toolbar[data-accessimate-theme="dark"] .accessimate-theme-toggle:hover {
    background: var(--accessimate-gray-200);
    color: var(--accessimate-primary-light);
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
    :root {
        --accessimate-gray-100: #ffffff;
        --accessimate-gray-200: #f0f0f0;
        --accessimate-gray-300: #d0d0d0;
        --accessimate-primary: #1e3a8a;
        --accessimate-primary-light: #1e40af;
    }

    .accessimate-btn { border-width: 2px; }
    .accessimate-panel { border-width: 2px; }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .accessimate-toolbar *,
    .accessimate-toolbar *::before,
    .accessimate-toolbar *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .accessimate-toolbar { display: none !important; }
}

/* Highlight titles */
/* .accessimate-highlight,
body.accessimate-highlight-titles h1,
body.accessimate-highlight-titles h2,
body.accessimate-highlight-titles h3,
body.accessimate-highlight-titles h4,
body.accessimate-highlight-titles h5,
body.accessimate-highlight-titles h6 {
    outline-style: solid !important;
    outline-color: var(--accessimate-primary) !important;
    outline-width: 2px !important;
    outline-offset: 2px !important;
    border-radius: 5px !important;
    background-color: rgba(30, 64, 175, 0.1) !important;
    color: var(--accessimate-primary) !important;
    text-decoration: underline !important;
    transition: background-color 0.3s ease, color 0.3s ease;
} */
.accessimate-highlight,
body.accessimate-highlight-titles h1:not(.accessimate-panel h1),
body.accessimate-highlight-titles h2:not(.accessimate-panel h2),
body.accessimate-highlight-titles h3:not(.accessimate-panel h3),
body.accessimate-highlight-titles h4:not(.accessimate-panel h4),
body.accessimate-highlight-titles h5:not(.accessimate-panel h5),
body.accessimate-highlight-titles h6:not(.accessimate-panel h6) {
    outline: 3px solid var(--accessimate-primary) !important;
    outline-offset: 4px !important;
    border-radius: var(--accessimate-radius-lg) !important;

    background-color: rgba(30, 64, 175, 0.10) !important;
    color: var(--accessimate-dark) !important;
    text-decoration: underline solid var(--accessimate-primary-light) !important;
    text-underline-offset: 3px;

    box-shadow:
        0 0 8px 3px rgba(30, 64, 175, 0.3),
        0 4px 12px rgba(30, 64, 175, 0.2) !important;

    transition:
        background-color 0.35s ease,
        color 0.35s ease,
        box-shadow 0.35s ease;
    cursor: pointer;
}


/* Highlight all */
body.accessimate-highlight-all *:hover {
    outline-style: solid !important;
    outline-color: var(--accessimate-primary) !important;
    outline-width: 2px !important;
    outline-offset: 2px !important;
}

body.accessimate-highlight-titles .accessimate-toolbar h1,
body.accessimate-highlight-titles .accessimate-toolbar h2,
body.accessimate-highlight-titles .accessimate-toolbar h3,
body.accessimate-highlight-titles .accessimate-toolbar h4,
body.accessimate-highlight-titles .accessimate-toolbar h5,
body.accessimate-highlight-titles .accessimate-toolbar h6,
body.accessimate-highlight-all .accessimate-toolbar:hover,
body.accessimate-highlight-all .accessimate-toolbar *:hover {
    outline-style: none !important;
    outline-width: 0 !important;
}

/* Feature Magnifier */
.accessimate-markup-text-magnifier {
    color: var(--accessimate-white) !important;
    font-size: 36px !important;
    position: absolute !important;
    padding: 16px !important;
    border-radius: 4px !important;
    background: var(--accessimate-dark) !important;
    line-height: 1.5 !important;
    z-index: 999999999 !important;
    word-break: break-word !important;
    width: -moz-fit-content !important;
    width: fit-content !important;
}

/* Cursor adjustments */
.accessimate-cursor-feature1 {
    cursor: url('../images/custom-cursor-v1.png'), default !important;
    transition: transform 0.2s ease-in-out;
}

.accessimate-cursor-feature2 {
    cursor: url('../images/custom-cursor-v2.png'), default !important;
    transition: transform 0.2s ease-in-out;
}

.accessimate-cursor-feature3 {
    cursor: url('../images/custom-cursor-v3.png'), default !important;
    transition: transform 0.2s ease-in-out;
}

/* Notifications */
button.accessimate-notification-close {
    padding: 0;
    margin: 0;
}