/**
 * WCAG Accessibility Toolbar Styles
 * Author: Ahmed Haj Abed
 * Version: 1.2.0
 * Uses !important to override theme styles
 */

/* ============================================
   TOOLBAR WIDGET CONTAINER
   ============================================ */
.wcag-toolbar-widget {
    position: relative !important;
    display: inline-block !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* ============================================
   TOOLBAR (Horizontal inline)
   ============================================ */
.wcag-toolbar {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 12px !important;
    background-color: #ffffff !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

/* ============================================
   TOOLBAR BUTTONS
   ============================================ */
.wcag-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 8px 14px !important;
    min-height: 40px !important;
    background-color: #f3f4f6 !important;
    color: #374151 !important;
    border: 1px solid transparent !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    cursor: pointer !important;
    transition: background-color 0.15s ease, color 0.15s ease !important;
    white-space: nowrap !important;
    text-decoration: none !important;
}

.wcag-btn:hover {
    background-color: #e5e7eb !important;
    color: #1f2937 !important;
}

.wcag-btn:focus {
    outline: 2px solid #2563eb !important;
    outline-offset: 2px !important;
}

.wcag-btn[aria-pressed="true"],
.wcag-btn.active {
    background-color: #2563eb !important;
    color: #ffffff !important;
    border-color: #2563eb !important;
}

/* ============================================
   ICONS
   ============================================ */
.wcag-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0 !important;
}

.wcag-icon svg {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
}

/* ============================================
   PANEL (Dropdown)
   ============================================ */
.wcag-panel {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    margin-top: 8px !important;
    z-index: 999999 !important;
}

.wcag-panel[hidden] {
    display: none !important;
}

.wcag-panel-content {
    width: 260px !important;
    background-color: #ffffff !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
    overflow: hidden !important;
}

/* Panel Header */
.wcag-panel-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 14px 16px !important;
    background-color: #2563eb !important;
    color: #ffffff !important;
}

.wcag-panel-title {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
}

.wcag-panel-close {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    border-radius: 4px !important;
    color: #ffffff !important;
    font-size: 22px !important;
    line-height: 1 !important;
    cursor: pointer !important;
}

.wcag-panel-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

/* Panel Body */
.wcag-panel-body {
    padding: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    max-height: 350px !important;
    overflow-y: auto !important;
}

/* ============================================
   PANEL BUTTONS
   ============================================ */
.wcag-panel-btn {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    padding: 12px 14px !important;
    background-color: #f3f4f6 !important;
    color: #374151 !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-align: left !important;
    cursor: pointer !important;
    transition: background-color 0.15s ease !important;
}

.wcag-panel-btn:hover {
    background-color: #e5e7eb !important;
}

.wcag-panel-btn:focus {
    outline: 2px solid #2563eb !important;
    outline-offset: 1px !important;
}

.wcag-panel-btn[aria-pressed="true"] {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

.wcag-panel-btn .wcag-icon {
    flex-shrink: 0 !important;
}

/* Reset Button */
.wcag-reset-btn {
    background-color: #fee2e2 !important;
    color: #dc2626 !important;
    margin-top: 4px !important;
}

.wcag-reset-btn:hover {
    background-color: #fecaca !important;
}

/* ============================================
   FONT SIZE CONTROLS
   ============================================ */
.wcag-font-controls {
    padding: 12px 14px !important;
    background-color: #f3f4f6 !important;
    border-radius: 8px !important;
}

.wcag-font-label {
    display: block !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #374151 !important;
    margin-bottom: 10px !important;
}

.wcag-font-btns {
    display: flex !important;
    gap: 6px !important;
}

.wcag-font-btn {
    flex: 1 !important;
    padding: 10px 8px !important;
    background-color: #ffffff !important;
    color: #374151 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background-color 0.15s ease, border-color 0.15s ease !important;
}

.wcag-font-btn:hover {
    background-color: #f9fafb !important;
    border-color: #2563eb !important;
}

.wcag-font-btn:focus {
    outline: 2px solid #2563eb !important;
    outline-offset: 1px !important;
}

/* ============================================
   ACCESSIBILITY EFFECTS - WITH !IMPORTANT
   ============================================ */

/* Dark Mode - Same approach as High Contrast */
body.wcag-dark-mode,
body.wcag-dark-mode .testimonial div,
body.wcag-dark-mode .filters-container,
body.wcag-dark-mode span.account-name,
body.wcag-dark-mode .account-dropdown a,
body.wcag-dark-mode .cats {
    background-color: #000 !important;
    color: #FFF !important;
}

body.wcag-dark-mode .elementor-widget-theme-site-logo,
body.wcag-dark-mode .product-desc-content img,
body.wcag-dark-mode .elementor-widget-woocommerce-product-content img {
    background: #fff !important;
}

body.wcag-dark-mode a,
body.wcag-dark-mode h3,
body.wcag-dark-mode h2,
body.wcag-dark-mode h1,
body.wcag-dark-mode h4,
body.wcag-dark-mode h5,
body.wcag-dark-mode h6,
body.wcag-dark-mode div,
body.wcag-dark-mode p,
body.wcag-dark-mode span,
body.wcag-dark-mode li,
body.wcag-dark-mode label {
    color: #fff !important;
}

body.wcag-dark-mode button,
body.wcag-dark-mode input,
body.wcag-dark-mode textarea,
body.wcag-dark-mode select {
    background-color: #333 !important;
    color: #FFF !important;
    border: 1px solid #FFF !important;
}

body.wcag-dark-mode a.elementor-sub-item {
    background: #000 !important;
}

body.wcag-dark-mode section,
body.wcag-dark-mode header,
body.wcag-dark-mode footer,
body.wcag-dark-mode nav,
body.wcag-dark-mode article,
body.wcag-dark-mode aside,
body.wcag-dark-mode main {
    background-color: #000 !important;
}

/* Protect toolbar widget from dark mode */
body.wcag-dark-mode .wcag-toolbar-widget,
body.wcag-dark-mode .wcag-toolbar-widget *:not(.wcag-btn[aria-pressed="true"]) {
    background-color: revert !important;
    color: revert !important;
}

body.wcag-dark-mode .wcag-toolbar {
    background-color: #ffffff !important;
}

body.wcag-dark-mode .wcag-btn {
    background-color: #f3f4f6 !important;
    color: #374151 !important;
}

body.wcag-dark-mode .wcag-btn[aria-pressed="true"] {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

body.wcag-dark-mode .wcag-panel-content {
    background-color: #ffffff !important;
}

body.wcag-dark-mode .wcag-panel-header {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

body.wcag-dark-mode .wcag-panel-btn {
    background-color: #f3f4f6 !important;
    color: #374151 !important;
}

body.wcag-dark-mode .wcag-panel-btn[aria-pressed="true"] {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

/* High Contrast - Same as user's original code */
body.wcag-high-contrast,
body.wcag-high-contrast .testimonial div,
body.wcag-high-contrast .filters-container,
body.wcag-high-contrast span.account-name,
body.wcag-high-contrast .account-dropdown a,
body.wcag-high-contrast .cats {
    background-color: #000 !important;
    color: #FFF !important;
}

body.wcag-high-contrast .elementor-widget-theme-site-logo,
body.wcag-high-contrast .product-desc-content img,
body.wcag-high-contrast .elementor-widget-woocommerce-product-content img {
    background: #fff !important;
}

body.wcag-high-contrast a,
body.wcag-high-contrast h3,
body.wcag-high-contrast h2,
body.wcag-high-contrast h1,
body.wcag-high-contrast h4,
body.wcag-high-contrast h5,
body.wcag-high-contrast h6,
body.wcag-high-contrast div,
body.wcag-high-contrast p,
body.wcag-high-contrast span,
body.wcag-high-contrast li,
body.wcag-high-contrast label {
    color: #fff !important;
}

body.wcag-high-contrast button,
body.wcag-high-contrast input,
body.wcag-high-contrast textarea,
body.wcag-high-contrast select {
    background-color: #333 !important;
    color: #FFF !important;
    border: 1px solid #FFF !important;
}

body.wcag-high-contrast a.elementor-sub-item {
    background: #000 !important;
}

body.wcag-high-contrast section,
body.wcag-high-contrast header,
body.wcag-high-contrast footer,
body.wcag-high-contrast nav,
body.wcag-high-contrast article,
body.wcag-high-contrast aside,
body.wcag-high-contrast main {
    background-color: #000 !important;
}

/* Protect toolbar from high contrast */
body.wcag-high-contrast .wcag-toolbar-widget,
body.wcag-high-contrast .wcag-toolbar-widget * {
    background-color: revert !important;
    color: revert !important;
    border-color: revert !important;
}

body.wcag-high-contrast .wcag-toolbar {
    background-color: #ffffff !important;
}

body.wcag-high-contrast .wcag-btn {
    background-color: #f3f4f6 !important;
    color: #374151 !important;
}

body.wcag-high-contrast .wcag-btn[aria-pressed="true"] {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

body.wcag-high-contrast .wcag-panel-content {
    background-color: #ffffff !important;
}

body.wcag-high-contrast .wcag-panel-btn {
    background-color: #f3f4f6 !important;
    color: #374151 !important;
}

body.wcag-high-contrast .wcag-panel-btn[aria-pressed="true"] {
    background-color: #2563eb !important;
    color: #ffffff !important;
}

/* Highlight Links */
body.wcag-highlight-links a {
    background-color: #ffff00 !important;
    color: #000 !important;
    padding: 2px 4px !important;
    text-decoration: underline !important;
}

body.wcag-highlight-links .wcag-toolbar-widget a {
    background-color: transparent !important;
    color: inherit !important;
    padding: 0 !important;
    text-decoration: none !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 48 48'%3E%3Cpath fill='%23000' stroke='%23fff' stroke-width='2' d='M8 8l28 12-12 4-4 12z'/%3E%3C/svg%3E") 8 8, auto !important;
}

/* Dyslexia Font */
body.wcag-dyslexia-font,
body.wcag-dyslexia-font * {
    font-family: OpenDyslexic, Comic Sans MS, Arial, sans-serif !important;
}

/* Line Height */
body.wcag-line-height,
body.wcag-line-height * {
    line-height: 2 !important;
}

/* Font Size Scaling - Using zoom for proportional scaling */
html.wcag-font-scaled {
    zoom: var(--wcag-font-scale, 1) !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .wcag-toolbar {
        padding: 6px 10px !important;
        gap: 6px !important;
    }
    
    .wcag-btn {
        padding: 6px 10px !important;
        min-height: 36px !important;
        font-size: 13px !important;
    }
    
    .wcag-btn-label {
        display: none !important;
    }
    
    .wcag-panel-content {
        width: 240px !important;
    }
}

/* ============================================
   ELEMENTOR EDITOR
   ============================================ */
.elementor-editor-active .wcag-panel {
    display: none !important;
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    .wcag-toolbar-widget {
        display: none !important;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .wcag-btn,
    .wcag-panel-btn,
    .wcag-font-btn {
        transition: none !important;
    }
}
