/**
 * WP Accessibility Module - Widget Styles
 * v1.0.2 - Improved design for desktop & mobile
 */

/* ========================================
   CSS VARIABLES & THEME TOKENS
   ======================================== */
#wp-a11y-widget {
    --wp-a11y-primary: #0066cc;
    --wp-a11y-secondary: #004999;
    --wp-a11y-text: #ffffff;
    --wp-a11y-bg: #f8f9fa;
    --wp-a11y-bg-hover: #ffffff;
    --wp-a11y-border: #e5e7eb;
    --wp-a11y-text-dark: #1f2937;
    --wp-a11y-text-muted: #6b7280;
    --wp-a11y-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
    --wp-a11y-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --wp-a11y-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
    --wp-a11y-shadow-trigger: 0 4px 14px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
    --wp-a11y-radius-sm: 8px;
    --wp-a11y-radius-md: 12px;
    --wp-a11y-radius-lg: 16px;
    --wp-a11y-transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --wp-a11y-z-backdrop: 999998;
    --wp-a11y-z-widget: 999999;
}

/* ========================================
   WIDGET CONTAINER
   ======================================== */
.wp-a11y-widget {
    position: fixed;
    z-index: var(--wp-a11y-z-widget);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--wp-a11y-text-dark);
}

/* ========================================
   POSITIONING (with safe-area support)
   ======================================== */
.wp-a11y-widget.wp-a11y-position-bottom-right {
    bottom: max(var(--wp-a11y-offset-y, 20px), env(safe-area-inset-bottom, var(--wp-a11y-offset-y, 20px)));
    right: max(var(--wp-a11y-offset-x, 20px), env(safe-area-inset-right, var(--wp-a11y-offset-x, 20px)));
}

.wp-a11y-widget.wp-a11y-position-bottom-left {
    bottom: max(var(--wp-a11y-offset-y, 20px), env(safe-area-inset-bottom, var(--wp-a11y-offset-y, 20px)));
    left: max(var(--wp-a11y-offset-x, 20px), env(safe-area-inset-left, var(--wp-a11y-offset-x, 20px)));
}

.wp-a11y-widget.wp-a11y-position-top-right {
    top: max(var(--wp-a11y-offset-y, 20px), env(safe-area-inset-top, var(--wp-a11y-offset-y, 20px)));
    right: max(var(--wp-a11y-offset-x, 20px), env(safe-area-inset-right, var(--wp-a11y-offset-x, 20px)));
}

.wp-a11y-widget.wp-a11y-position-top-left {
    top: max(var(--wp-a11y-offset-y, 20px), env(safe-area-inset-top, var(--wp-a11y-offset-y, 20px)));
    left: max(var(--wp-a11y-offset-x, 20px), env(safe-area-inset-left, var(--wp-a11y-offset-x, 20px)));
}

/* ========================================
   BACKDROP (Mobile overlay)
   ======================================== */
.wp-a11y-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: var(--wp-a11y-z-backdrop);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--wp-a11y-transition);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.wp-a11y-backdrop.wp-a11y-backdrop-visible {
    opacity: 1;
    pointer-events: all;
}

/* ========================================
   TRIGGER BUTTON (Enhanced PRO)
   ======================================== */
#wp-a11y-widget .wp-a11y-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50% !important;
    background: var(--wp-a11y-primary) !important;
    background-color: var(--wp-a11y-primary) !important;
    background-image: linear-gradient(135deg,
        var(--wp-a11y-primary) 0%,
        var(--wp-a11y-secondary) 100%) !important;
    color: var(--wp-a11y-text) !important;
    border: none !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.15),
        0 2px 6px rgba(0, 0, 0, 0.1),
        0 0 0 0 currentColor;
    transition: transform var(--wp-a11y-transition),
                box-shadow var(--wp-a11y-transition),
                opacity var(--wp-a11y-transition);
    padding: 0 !important;
    margin: 0 !important;
    position: relative;
    overflow: visible;
    text-decoration: none !important;
    line-height: 1 !important;
    font-family: inherit !important;
    -webkit-tap-highlight-color: transparent;
}

/* Inner overlay for hover effect */
#wp-a11y-widget .wp-a11y-trigger::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0);
    transition: background var(--wp-a11y-transition);
    border-radius: 50%;
    pointer-events: none;
}

/* Tooltip label */
#wp-a11y-widget .wp-a11y-trigger::after {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    background: rgba(31, 41, 55, 0.95);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1;
}

#wp-a11y-widget .wp-a11y-trigger:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Tooltip position adjustments based on widget position */
.wp-a11y-widget.wp-a11y-position-bottom-left #wp-a11y-widget .wp-a11y-trigger::after,
.wp-a11y-widget.wp-a11y-position-top-left .wp-a11y-trigger::after,
#wp-a11y-widget.wp-a11y-position-bottom-left .wp-a11y-trigger::after,
#wp-a11y-widget.wp-a11y-position-top-left .wp-a11y-trigger::after {
    right: auto;
    left: calc(100% + 12px);
    transform: translateY(-50%) translateX(-8px);
}

.wp-a11y-widget.wp-a11y-position-bottom-left #wp-a11y-widget .wp-a11y-trigger:hover::after,
.wp-a11y-widget.wp-a11y-position-top-left .wp-a11y-trigger:hover::after,
#wp-a11y-widget.wp-a11y-position-bottom-left .wp-a11y-trigger:hover::after,
#wp-a11y-widget.wp-a11y-position-top-left .wp-a11y-trigger:hover::after {
    transform: translateY(-50%) translateX(0);
}

/* Counter Badge - Active features count */
.wp-a11y-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #ef4444;
    color: #ffffff;
    border-radius: 11px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid #ffffff;
    line-height: 1;
    z-index: 2;
    opacity: 0;
    transform: scale(0);
    transition: opacity var(--wp-a11y-transition), transform var(--wp-a11y-transition);
    pointer-events: none;
    font-family: inherit;
}

.wp-a11y-badge.wp-a11y-badge-visible {
    opacity: 1;
    transform: scale(1);
    animation: wp-a11y-badge-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes wp-a11y-badge-pop {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Hover state */
#wp-a11y-widget .wp-a11y-trigger:hover {
    transform: scale(1.08);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.25),
        0 4px 10px rgba(0, 0, 0, 0.15);
}

#wp-a11y-widget .wp-a11y-trigger:hover::before {
    background: rgba(255, 255, 255, 0.12);
}

#wp-a11y-widget .wp-a11y-trigger:hover svg {
    animation: wp-a11y-icon-wave 0.6s ease;
}

/* Wave animation on icon hover */
@keyframes wp-a11y-icon-wave {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-8deg) scale(1.1); }
    75% { transform: rotate(8deg) scale(1.1); }
}

#wp-a11y-widget .wp-a11y-trigger:active {
    transform: scale(0.95);
}

#wp-a11y-widget .wp-a11y-trigger:focus {
    outline: 3px solid var(--wp-a11y-primary) !important;
    outline-offset: 3px !important;
}

#wp-a11y-widget .wp-a11y-trigger:focus:not(:focus-visible) {
    outline: none !important;
}

#wp-a11y-widget .wp-a11y-trigger[aria-expanded="true"] {
    transform: scale(1.05);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.25),
        0 4px 10px rgba(0, 0, 0, 0.15);
}

#wp-a11y-widget .wp-a11y-trigger svg {
    width: 30px;
    height: 30px;
    fill: var(--wp-a11y-text) !important;
    position: relative;
    z-index: 1;
    transition: transform var(--wp-a11y-transition);
    pointer-events: none;
}

/* Ripple effect */
.wp-a11y-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: wp-a11y-ripple-effect 0.6s ease-out;
    pointer-events: none;
}

@keyframes wp-a11y-ripple-effect {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Pulse animation for first-visit attention */
@keyframes wp-a11y-pulse {
    0%, 100% {
        box-shadow:
            0 4px 14px rgba(0, 0, 0, 0.15),
            0 2px 6px rgba(0, 0, 0, 0.1),
            0 0 0 0 rgba(255, 255, 255, 0);
    }
    50% {
        box-shadow:
            0 4px 14px rgba(0, 0, 0, 0.15),
            0 2px 6px rgba(0, 0, 0, 0.1),
            0 0 0 12px rgba(255, 255, 255, 0);
    }
}

@keyframes wp-a11y-pulse-ring {
    0% {
        transform: scale(0.95);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

#wp-a11y-widget .wp-a11y-trigger.wp-a11y-trigger-pulse::before {
    animation: wp-a11y-pulse-ring 1.5s ease-out infinite;
    background: var(--wp-a11y-primary);
    z-index: -1;
}

/* Auto-hide on scroll */
#wp-a11y-widget .wp-a11y-trigger.wp-a11y-trigger-scrolling {
    opacity: 0.5;
}

#wp-a11y-widget .wp-a11y-trigger.wp-a11y-trigger-scrolling:hover {
    opacity: 1;
}

/* ========================================
   PANEL
   ======================================== */
.wp-a11y-panel {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 420px;
    max-width: calc(100vw - 40px);
    max-height: min(85vh, 720px, calc(100vh - var(--wp-a11y-offset-y, 20px) - 96px));
    background: #ffffff;
    border-radius: var(--wp-a11y-radius-lg);
    box-shadow: var(--wp-a11y-shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(16px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity var(--wp-a11y-transition), transform var(--wp-a11y-transition);
    pointer-events: none;
    border: 1px solid var(--wp-a11y-border);
}

.wp-a11y-panel:not([hidden]) {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Position adjustments for panel */
.wp-a11y-widget.wp-a11y-position-bottom-left .wp-a11y-panel,
.wp-a11y-widget.wp-a11y-position-top-left .wp-a11y-panel {
    right: auto;
    left: 0;
    transform-origin: bottom left;
}

.wp-a11y-widget.wp-a11y-position-top-right .wp-a11y-panel {
    bottom: auto;
    top: 76px;
    transform-origin: top right;
}

.wp-a11y-widget.wp-a11y-position-top-left .wp-a11y-panel {
    bottom: auto;
    top: 76px;
    transform-origin: top left;
}

/* Enlarged widget */
.wp-a11y-widget.wp-a11y-enlarged .wp-a11y-panel {
    width: 520px;
    font-size: 16px;
}

.wp-a11y-widget.wp-a11y-enlarged .wp-a11y-label {
    font-size: 14px;
}

/* ========================================
   HEADER
   ======================================== */
.wp-a11y-header {
    background: var(--wp-a11y-primary);
    color: var(--wp-a11y-text);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    position: relative;
}

.wp-a11y-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
}

.wp-a11y-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--wp-a11y-text);
    letter-spacing: -0.01em;
}

.wp-a11y-shortcut {
    font-size: 11px;
    opacity: 0.85;
    font-weight: 400;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    letter-spacing: 0.02em;
}

#wp-a11y-widget .wp-a11y-close {
    background: transparent !important;
    border: none !important;
    color: var(--wp-a11y-text) !important;
    cursor: pointer;
    padding: 6px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background var(--wp-a11y-transition), transform var(--wp-a11y-transition);
    margin: 0 !important;
    -webkit-tap-highlight-color: transparent;
}

#wp-a11y-widget .wp-a11y-close:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    transform: rotate(90deg);
}

#wp-a11y-widget .wp-a11y-close:focus {
    outline: 2px solid var(--wp-a11y-text) !important;
    outline-offset: 2px;
}

#wp-a11y-widget .wp-a11y-close svg {
    fill: var(--wp-a11y-text) !important;
}

/* ========================================
   BODY
   ======================================== */
.wp-a11y-body {
    padding: 18px 20px 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--wp-a11y-border) transparent;
}

.wp-a11y-body::-webkit-scrollbar {
    width: 6px;
}

.wp-a11y-body::-webkit-scrollbar-track {
    background: transparent;
}

.wp-a11y-body::-webkit-scrollbar-thumb {
    background: var(--wp-a11y-border);
    border-radius: 3px;
}

.wp-a11y-body::-webkit-scrollbar-thumb:hover {
    background: var(--wp-a11y-text-muted);
}

/* ========================================
   TOGGLE SIZE (Enlarge)
   ======================================== */
.wp-a11y-toggle-size {
    margin-bottom: 16px;
    padding: 12px 14px;
    background: var(--wp-a11y-bg);
    border-radius: var(--wp-a11y-radius-sm);
    border: 1px solid var(--wp-a11y-border);
}

.wp-a11y-toggle-size label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    gap: 12px;
}

.wp-a11y-toggle-size label > span:first-child {
    font-size: 13px;
    font-weight: 500;
    color: var(--wp-a11y-text-dark);
    flex: 1;
}

.wp-a11y-toggle-size input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.wp-a11y-toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #d1d5db;
    border-radius: 12px;
    transition: background var(--wp-a11y-transition);
    flex-shrink: 0;
}

.wp-a11y-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform var(--wp-a11y-transition);
    box-shadow: var(--wp-a11y-shadow-sm);
}

.wp-a11y-toggle-size input:checked + .wp-a11y-toggle-switch {
    background: var(--wp-a11y-primary);
}

.wp-a11y-toggle-size input:checked + .wp-a11y-toggle-switch::after {
    transform: translateX(20px);
}

.wp-a11y-toggle-size input:focus + .wp-a11y-toggle-switch {
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.25);
}

/* ========================================
   OPTIONS GRID (3 columns desktop, 2 mobile)
   ======================================== */
.wp-a11y-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

/* ========================================
   OPTION BUTTON
   ======================================== */
#wp-a11y-widget .wp-a11y-option {
    position: relative;
    background: var(--wp-a11y-bg) !important;
    background-color: var(--wp-a11y-bg) !important;
    background-image: none !important;
    border: 1.5px solid var(--wp-a11y-border) !important;
    border-radius: var(--wp-a11y-radius-md) !important;
    padding: 12px 8px !important;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    transition: all var(--wp-a11y-transition);
    min-height: 92px;
    color: var(--wp-a11y-text-dark) !important;
    font-family: inherit !important;
    text-decoration: none !important;
    -webkit-tap-highlight-color: transparent;
    line-height: 1.3 !important;
}

#wp-a11y-widget .wp-a11y-option:hover {
    background: var(--wp-a11y-bg-hover) !important;
    background-color: var(--wp-a11y-bg-hover) !important;
    border-color: var(--wp-a11y-primary) !important;
    transform: translateY(-2px);
    box-shadow: var(--wp-a11y-shadow-md);
}

#wp-a11y-widget .wp-a11y-option:focus {
    outline: 2px solid var(--wp-a11y-primary) !important;
    outline-offset: 2px !important;
}

#wp-a11y-widget .wp-a11y-option:focus:not(:focus-visible) {
    outline: none !important;
}

#wp-a11y-widget .wp-a11y-option:active {
    transform: translateY(0) scale(0.98);
}

#wp-a11y-widget .wp-a11y-option[aria-pressed="true"] {
    background: var(--wp-a11y-primary) !important;
    background-color: var(--wp-a11y-primary) !important;
    border-color: var(--wp-a11y-primary) !important;
    color: var(--wp-a11y-text) !important;
    box-shadow: var(--wp-a11y-shadow-md);
}

#wp-a11y-widget .wp-a11y-option[aria-pressed="true"]:hover {
    background: var(--wp-a11y-secondary) !important;
    background-color: var(--wp-a11y-secondary) !important;
    border-color: var(--wp-a11y-secondary) !important;
}

.wp-a11y-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    transition: transform var(--wp-a11y-transition);
}

#wp-a11y-widget .wp-a11y-option:hover .wp-a11y-icon {
    transform: scale(1.1);
}

#wp-a11y-widget .wp-a11y-option[aria-pressed="true"] .wp-a11y-icon {
    fill: var(--wp-a11y-text) !important;
}

.wp-a11y-label {
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.25;
    word-break: break-word;
    hyphens: auto;
}

.wp-a11y-state {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    font-weight: 600;
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.wp-a11y-indicator {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 16px;
    height: 16px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--wp-a11y-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0);
    transition: all var(--wp-a11y-transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

#wp-a11y-widget .wp-a11y-option[aria-pressed="true"] .wp-a11y-indicator {
    opacity: 1;
    transform: scale(1);
}

/* ========================================
   INCREMENT OPTION (Large Text)
   ======================================== */
#wp-a11y-widget .wp-a11y-option-increment {
    grid-column: span 1;
}

.wp-a11y-controls {
    display: flex;
    gap: 4px;
    width: 100%;
    margin-top: 4px;
}

#wp-a11y-widget .wp-a11y-controls button {
    flex: 1;
    background: rgba(0, 0, 0, 0.08) !important;
    background-color: rgba(0, 0, 0, 0.08) !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 4px 6px !important;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--wp-a11y-transition);
    color: var(--wp-a11y-text-dark) !important;
    line-height: 1 !important;
    margin: 0 !important;
    -webkit-tap-highlight-color: transparent;
    min-height: 24px;
}

#wp-a11y-widget .wp-a11y-controls button:hover {
    background: rgba(0, 0, 0, 0.15) !important;
    background-color: rgba(0, 0, 0, 0.15) !important;
}

#wp-a11y-widget .wp-a11y-option[aria-pressed="true"] .wp-a11y-controls button {
    background: rgba(255, 255, 255, 0.2) !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: var(--wp-a11y-text) !important;
}

#wp-a11y-widget .wp-a11y-option[aria-pressed="true"] .wp-a11y-controls button:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    background-color: rgba(255, 255, 255, 0.3) !important;
}

/* ========================================
   RESET BUTTON
   ======================================== */
#wp-a11y-widget .wp-a11y-reset {
    width: 100%;
    background: transparent !important;
    background-color: transparent !important;
    color: #dc2626 !important;
    border: 1.5px solid #fecaca !important;
    border-radius: var(--wp-a11y-radius-sm) !important;
    padding: 10px 16px !important;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all var(--wp-a11y-transition);
    font-family: inherit !important;
    margin: 0 !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
    -webkit-tap-highlight-color: transparent;
}

#wp-a11y-widget .wp-a11y-reset:hover {
    background: #fef2f2 !important;
    background-color: #fef2f2 !important;
    border-color: #dc2626 !important;
}

#wp-a11y-widget .wp-a11y-reset:active {
    transform: scale(0.98);
}

#wp-a11y-widget .wp-a11y-reset:focus {
    outline: 2px solid #dc2626 !important;
    outline-offset: 2px;
}

#wp-a11y-widget .wp-a11y-reset svg {
    width: 16px;
    height: 16px;
    fill: currentColor !important;
}

/* ========================================
   TABLET (481px - 768px)
   ======================================== */
@media (max-width: 768px) and (min-width: 481px) {
    .wp-a11y-panel {
        width: 400px;
    }

    .wp-a11y-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

/* ========================================
   MOBILE (< 480px) - Bottom sheet style
   ======================================== */
@media (max-width: 480px) {
    #wp-a11y-widget .wp-a11y-trigger {
        width: 56px;
        height: 56px;
    }

    #wp-a11y-widget .wp-a11y-trigger svg {
        width: 28px;
        height: 28px;
    }

    /* Hide tooltip on mobile - no hover */
    #wp-a11y-widget .wp-a11y-trigger::after {
        display: none;
    }

    /* Smaller badge on mobile */
    .wp-a11y-badge {
        min-width: 20px;
        height: 20px;
        font-size: 10px;
        top: -3px;
        right: -3px;
    }

    .wp-a11y-panel {
        position: fixed;
        bottom: 0 !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 88vh;
        border-radius: var(--wp-a11y-radius-lg) var(--wp-a11y-radius-lg) 0 0;
        transform: translateY(100%);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .wp-a11y-panel:not([hidden]) {
        transform: translateY(0);
    }

    .wp-a11y-widget.wp-a11y-position-bottom-left .wp-a11y-panel,
    .wp-a11y-widget.wp-a11y-position-bottom-right .wp-a11y-panel,
    .wp-a11y-widget.wp-a11y-position-top-left .wp-a11y-panel,
    .wp-a11y-widget.wp-a11y-position-top-right .wp-a11y-panel {
        transform-origin: center bottom;
    }

    /* Drag handle indicator on mobile */
    .wp-a11y-panel::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: rgba(0, 0, 0, 0.15);
        border-radius: 2px;
        z-index: 10;
    }

    .wp-a11y-header {
        padding: 20px 18px 14px;
        border-radius: var(--wp-a11y-radius-lg) var(--wp-a11y-radius-lg) 0 0;
    }

    .wp-a11y-header h2 {
        font-size: 15px;
    }

    .wp-a11y-body {
        padding: 14px 16px 18px;
    }

    .wp-a11y-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    #wp-a11y-widget .wp-a11y-option {
        min-height: 88px;
        padding: 10px 6px !important;
    }

    .wp-a11y-icon {
        width: 26px;
        height: 26px;
    }

    .wp-a11y-label {
        font-size: 11px;
    }

    .wp-a11y-widget.wp-a11y-enlarged .wp-a11y-panel {
        font-size: 16px;
    }

    .wp-a11y-widget.wp-a11y-enlarged .wp-a11y-label {
        font-size: 13px;
    }

    .wp-a11y-widget.wp-a11y-enlarged #wp-a11y-widget .wp-a11y-option,
    .wp-a11y-widget.wp-a11y-enlarged .wp-a11y-option {
        min-height: 100px;
    }
}

/* ========================================
   SMALL MOBILE (< 360px)
   ======================================== */
@media (max-width: 360px) {
    .wp-a11y-grid {
        gap: 6px;
    }

    #wp-a11y-widget .wp-a11y-option {
        min-height: 80px;
        padding: 8px 4px !important;
    }

    .wp-a11y-icon {
        width: 24px;
        height: 24px;
    }

    .wp-a11y-label {
        font-size: 10.5px;
    }
}

/* ========================================
   LARGE DESKTOP (> 1400px)
   ======================================== */
@media (min-width: 1400px) {
    .wp-a11y-panel {
        width: 460px;
    }

    .wp-a11y-widget.wp-a11y-enlarged .wp-a11y-panel {
        width: 560px;
    }
}

/* ========================================
   HIGH-DPI / RETINA OPTIMIZATIONS
   ======================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .wp-a11y-icon,
    #wp-a11y-widget .wp-a11y-trigger svg {
        shape-rendering: geometricPrecision;
    }
}

/* ========================================
   REDUCED MOTION SUPPORT
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    #wp-a11y-widget,
    #wp-a11y-widget * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }

    #wp-a11y-widget .wp-a11y-trigger:hover,
    #wp-a11y-widget .wp-a11y-option:hover,
    #wp-a11y-widget .wp-a11y-close:hover {
        transform: none !important;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .wp-a11y-widget,
    .wp-a11y-backdrop {
        display: none !important;
    }
}

/* ========================================
   RTL SUPPORT
   ======================================== */
[dir="rtl"] .wp-a11y-widget.wp-a11y-position-bottom-right .wp-a11y-panel,
[dir="rtl"] .wp-a11y-widget.wp-a11y-position-top-right .wp-a11y-panel {
    right: auto;
    left: 0;
}

[dir="rtl"] .wp-a11y-indicator {
    right: auto;
    left: 6px;
}
