/**
 * Easy Language Component CSS
 * 
 * Styles for the Easy Language component on the frontend
 */

/* --- NEW Easy Language Bar - Enhanced Positioning --- */
.easilyaccessible-easy-language-bar {
    z-index: 100000;
    /* Default background & text colors - can be overridden by user settings */
    background-color: #1d1d1f; /* Default to dark charcoal/near black */
    color: #ffffff; /* Default white text */
    padding: 10px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25); /* Slightly adjusted shadow for dark bar */
    display: flex;
    align-items: center;
    transition: transform 0.3s ease-in-out, background-color 0.2s ease, color 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    font-size: 15px;
    line-height: 1.4;
}

/* Fixed positioning (browser top/bottom) */
.easilyaccessible-bar-fixed-top,
.easilyaccessible-bar-fixed-bottom {
    position: fixed;
    left: 0;
    right: 0;
}

.easilyaccessible-bar-fixed-top,
.easilyaccessible-bar-top {
    top: 0;
    border-bottom: 1px solid #333333; /* Subtle dark border */
}

.easilyaccessible-bar-fixed-bottom,
.easilyaccessible-bar-bottom {
    bottom: 0;
    border-top: 1px solid #333333; /* Subtle dark border */
}

/* Content-relative positioning (header/footer) */
.easilyaccessible-bar-above_header,
.easilyaccessible-bar-under_header,
.easilyaccessible-bar-above_footer,
.easilyaccessible-bar-under_footer {
    position: relative;
    width: 100%;
    margin: 0;
}

.easilyaccessible-bar-above_header,
.easilyaccessible-bar-under_header {
    border-bottom: 1px solid #333333;
}

.easilyaccessible-bar-above_footer,
.easilyaccessible-bar-under_footer {
    border-top: 1px solid #333333;
}

/* Sticky positioning */
.easilyaccessible-bar-sticky {
    position: sticky !important;
    top: 0;
    z-index: 100001;
}

/* Ensure sticky bars at footer position work correctly */
.easilyaccessible-bar-above_footer.easilyaccessible-bar-sticky,
.easilyaccessible-bar-under_footer.easilyaccessible-bar-sticky {
    bottom: 0;
    top: auto;
}

/* Text alignment within the bar */
.easilyaccessible-align-left {
    justify-content: flex-start;
}

.easilyaccessible-align-center {
    justify-content: center;
}

.easilyaccessible-align-right {
    justify-content: flex-end;
}

.easilyaccessible-bar-trigger {
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    color: inherit; /* Inherits text color from bar */
    transition: background-color 0.2s ease, color 0.2s ease;
}

.easilyaccessible-bar-trigger .dashicons {
    margin-right: 8px;
    font-size: 1.2em;
    line-height: 1;
    color: inherit; /* Inherits color from parent */
}

.easilyaccessible-bar-trigger:hover,
.easilyaccessible-bar-trigger:focus {
    background-color: #333333; /* Lighter dark gray hover */
    outline: none;
}

.easilyaccessible-bar-trigger:focus-visible {
    background-color: #333333;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.7); /* Apple blue focus ring, more visible on dark */
}


/* Dropdown Menu for the Bar - Enhanced with List styling integration */
.easilyaccessible-bar-dropdown {
    position: absolute;
    background-color: var(--el-dropdown-bg-color, #ffffff); /* Use list background color */
    color: var(--el-dropdown-text-color, #1d1d1f); /* Use list text color */
    border: 1px solid var(--el-dropdown-border-color, rgba(0,0,0,0.1));
    box-shadow: 0 6px 18px rgba(0,0,0,0.1);
    z-index: 100001;
    list-style: none;
    margin: 0;
    padding: var(--el-dropdown-padding, 8px);
    min-width: 220px;
    border-radius: 6px; /* Match list border-radius */
    font-size: var(--el-dropdown-font-size, 14px);
    text-align: var(--el-dropdown-text-align, left);
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
}

/* Show dropdown with smooth animation */
.easilyaccessible-bar-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Dropdown direction control - improved positioning */
.easilyaccessible-bar-dropdown.dropdown-direction-down,
.easilyaccessible-bar-top .easilyaccessible-bar-dropdown {
    top: calc(100% + 4px); /* Place below the bar with a small gap */
    bottom: auto;
    transform-origin: top center;
}

.easilyaccessible-bar-dropdown.dropdown-direction-down.show,
.easilyaccessible-bar-top .easilyaccessible-bar-dropdown.show {
    transform: translateY(0);
}

.easilyaccessible-bar-dropdown.dropdown-direction-up,
.easilyaccessible-bar-bottom .easilyaccessible-bar-dropdown {
    bottom: calc(100% + 4px); /* Place above the bar with a small gap */
    top: auto;
    transform-origin: bottom center;
    transform: translateY(8px);
}

.easilyaccessible-bar-dropdown.dropdown-direction-up.show,
.easilyaccessible-bar-bottom .easilyaccessible-bar-dropdown.show {
    transform: translateY(0);
}

/* Aligning dropdown based on text alignment in bar */
.easilyaccessible-align-left .easilyaccessible-bar-dropdown {
    left: 0; 
}

.easilyaccessible-align-center .easilyaccessible-bar-dropdown {
    left: 50%;
    transform: translateX(-50%);
}

.easilyaccessible-align-center .easilyaccessible-bar-dropdown.dropdown-direction-up {
    transform: translateX(-50%);
}

.easilyaccessible-align-right .easilyaccessible-bar-dropdown {
    right: 0;
    left: auto;
}


.easilyaccessible-bar-dropdown li {
    margin: 0;
    padding: 6px 12px; /* Match list item padding */
}

/* Links in Dropdown - Enhanced with List styling integration */
.easilyaccessible-dropdown-link {
    display: inline-flex; /* Match list link display */
    align-items: center;
    color: var(--el-dropdown-text-color, #1d1d1f);
    font-size: var(--el-dropdown-font-size, 14px);
    text-decoration: none; 
    white-space: nowrap;
    transition: color 0.2s ease; /* Match list link transition */
}

.easilyaccessible-dropdown-link .dashicons {
    margin-right: 6px; /* Match list icon margin */
    color: inherit; /* Inherits color from parent */
    font-size: 1.1em;
    flex-shrink: 0; /* Prevent icon from shrinking */
}

.easilyaccessible-dropdown-link:hover,
.easilyaccessible-dropdown-link:focus {
    color: #0073aa; /* Match list hover color */
    text-decoration: underline; /* Match list hover text decoration */
    outline: none;
}

.easilyaccessible-dropdown-link:focus-visible {
    outline: 2px solid var(--el-dropdown-focus-color, rgba(0, 122, 255, 0.5));
    outline-offset: 2px;
}

/* Dropdown headers and separators - inherit list styling */
.easilyaccessible-dropdown-header {
    padding: calc(var(--el-dropdown-padding, 8px) / 2) 15px;
    font-size: calc(var(--el-dropdown-font-size, 14px) * 0.85);
    font-weight: 600;
    color: var(--el-dropdown-header-color, #666);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 8px 0 4px 0;
    border-bottom: 1px solid var(--el-dropdown-border-color, rgba(0, 0, 0, 0.1));
}

.easilyaccessible-dropdown-separator {
    margin: 8px 0;
    padding: 0;
    border: none;
    height: 1px;
    background: var(--el-dropdown-border-color, rgba(0, 0, 0, 0.1));
}

/* --- Existing Menu integration styles - Updated for Apple UI feel --- */
.easilyaccessible-menu-easy-language-icon,
.easilyaccessible-menu-easy-language-available {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.easilyaccessible-has-easy-language {
    position: relative;
}

.easilyaccessible-menu-easy-language-available {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    color: #ffffff;
    background-color: #afca0a;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 13px;
    line-height: 1;
    transition: all 0.2s ease;
    vertical-align: middle;
    box-shadow: 0 0 0 2px #ffffff;
    animation: easilyaccessible-pulse 2s infinite ease-in-out;
}

@keyframes easilyaccessible-pulse {
    0% {
        box-shadow: 0 0 0 0px rgba(0, 122, 255, 0.6), 0 0 0 2px #ffffff;
    }
    70% {
        box-shadow: 0 0 0 5px rgba(0, 122, 255, 0), 0 0 0 2px #ffffff;
    }
    100% {
        box-shadow: 0 0 0 0px rgba(0, 122, 255, 0), 0 0 0 2px #ffffff;
    }
}

.easilyaccessible-menu-easy-language-available:hover,
.easilyaccessible-menu-easy-language-available:focus {
    background-color: #005ecb; /* Darker Apple blue */
    transform: scale(1.1);
    /* Keep the white border on hover/focus too if pulse is stopped or for clarity */
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px rgba(0, 122, 255, 0.3); 
    outline: none;
    cursor: pointer;
    animation: none; /* Stop pulse on hover/focus */
}

.easilyaccessible-menu-easy-language-available:focus-visible {
    /* Ensure focus is distinct beyond just hover styles */
     box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #afca0a; 
}

.easilyaccessible-menu-easy-language-available .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 1;
    color: inherit; /* Inherits color from parent */
}

/* Badge (if used elsewhere, this is just a carry-over, review if it needs Apple UI) */
.easilyaccessible-easy-language-badge {
    display: inline-flex;
    align-items: center;
    background-color: #afca0a; /* Apple Blue */
    color: white;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px; /* More rounded */
    margin-left: 10px;
    vertical-align: middle;
}

.easilyaccessible-easy-language-badge .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    margin-right: 4px;
    color: inherit; /* Inherits color from parent */
}

/* Dark mode support for the new bar */
@media (prefers-color-scheme: dark) {
    /* Bar is already dark by default, these rules are for the DROPDOWN in dark mode */
    /* User settings for bar color will override the default dark bar if set */

    .easilyaccessible-bar-dropdown {
        background-color: var(--el-dropdown-bg-color, #2c2c2e); /* Dark gray for dropdown background */
        border-color: var(--el-dropdown-border-color, #444444); /* Slightly lighter border for dropdown */
        color: var(--el-dropdown-text-color, #eeeeee); /* Light text for items in dark dropdown */
    }

    .easilyaccessible-bar-dropdown .easilyaccessible-dropdown-link {
        color: var(--el-dropdown-text-color, #eeeeee); /* Light text for links */
    }

    .easilyaccessible-bar-dropdown .easilyaccessible-dropdown-link .dashicons {
        color: #bbbbbb; /* Lighter gray for icons in dark dropdown links */
    }

    .easilyaccessible-bar-dropdown .easilyaccessible-dropdown-link:hover,
    .easilyaccessible-bar-dropdown .easilyaccessible-dropdown-link:focus {
        background-color: #3a3a3c; /* Slightly lighter dark gray for hover */
        color: #ffffff;
    }
    
    .easilyaccessible-bar-dropdown .easilyaccessible-dropdown-link:focus-visible {
        box-shadow: inset 0 0 0 2px rgba(0, 122, 255, 0.7); /* More visible focus on dark */
    }

    /* Menu indicator in dark mode (if menu background is very dark) */
    .easilyaccessible-menu-easy-language-available {
        /* The white border (box-shadow) should provide enough contrast on most dark menu backgrounds */
        /* If specific dark theme menus clash, adjustments might be needed here */
        box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
    }
}

/* High contrast mode support - adjust as needed */
@media (forced-colors: active) {
    .easilyaccessible-easy-language-bar {
        border: 1px solid CanvasText;
        background-color: Canvas; /* Will usually be white or black based on system */
        color: CanvasText;
    }
    .easilyaccessible-easy-language-bar .easilyaccessible-bar-trigger {
        color: CanvasText;
    }
    .easilyaccessible-easy-language-bar .easilyaccessible-bar-trigger .dashicons {
        color: CanvasText;
    }

    .easilyaccessible-bar-trigger:hover,
    .easilyaccessible-bar-trigger:focus {
        background-color: Highlight;
        color: HighlightText;
        outline: 1px solid HighlightText; /* Simplified outline */
    }
    .easilyaccessible-bar-trigger:focus-visible {
        outline: 2px solid HighlightText; 
        box-shadow: none;
    }

    .easilyaccessible-bar-dropdown {
        border: 1px solid CanvasText;
        background-color: Canvas;
        color: CanvasText;
    }

    .easilyaccessible-dropdown-link {
        color: CanvasText;
    }

    .easilyaccessible-dropdown-link .dashicons {
        color: CanvasText;
    }

    .easilyaccessible-dropdown-link:hover,
    .easilyaccessible-dropdown-link:focus {
        background-color: Highlight;
        color: HighlightText;
        outline: 1px solid CanvasText; /* Simplified outline */
    }
     .easilyaccessible-dropdown-link:focus-visible {
        outline: 2px solid HighlightText; 
        box-shadow: none;
    }

    /* Menu indicator high contrast */
    .easilyaccessible-menu-easy-language-available {
        border: 1px solid CanvasText;
        background-color: Canvas;
        color: CanvasText;
        box-shadow: 0 0 0 1px CanvasText !important; /* Ensure visibility of outer ring */
        animation: none !important; /* Stop pulse in high contrast */
    }
    
    .easilyaccessible-menu-easy-language-available:hover,
    .easilyaccessible-menu-easy-language-available:focus,
    .easilyaccessible-menu-easy-language-available:focus-visible {
        background-color: Highlight;
        color: HighlightText;
        outline: 2px solid CanvasText;
        box-shadow: 0 0 0 1px HighlightText !important;
    }
}

/* Easy Language Shortcode Styles */
.easilyaccessible-easy-language-shortcode {
    margin: 20px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-left: 4px solid #2271b1;
    border-radius: 4px;
}

.easilyaccessible-easy-language-shortcode h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #2271b1;
    font-size: 16px;
}

.easilyaccessible-easy-language-shortcode ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.easilyaccessible-easy-language-shortcode li {
    margin: 8px 0;
    padding: 0;
}

.easilyaccessible-easy-language-shortcode a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: #2271b1;
    font-weight: 500;
    transition: color 0.2s ease;
}

.easilyaccessible-easy-language-shortcode a:hover {
    color: #135e96;
    text-decoration: underline;
}

.easilyaccessible-easy-language-shortcode .dashicons {
    margin-right: 5px;
    font-size: 16px;
    line-height: 1;
}

.easilyaccessible-easy-language-shortcode .current-page {
    font-style: italic;
    opacity: 0.8;
}

.easilyaccessible-easy-language-shortcode .current-page a {
    color: #666;
    cursor: default;
}

.easilyaccessible-easy-language-shortcode .current-page a:hover {
    color: #666;
    text-decoration: none;
}

/* Button style variant */
.easilyaccessible-easy-language-shortcode.style-buttons .easy-language-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.easilyaccessible-easy-language-shortcode .easy-language-button {
    display: inline-flex;
    align-items: center;
    padding: 8px 15px;
    background-color: #2271b1;
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.easilyaccessible-easy-language-shortcode .easy-language-button:hover {
    background-color: #135e96;
    color: #ffffff;
    text-decoration: none;
}

.easilyaccessible-easy-language-shortcode .easy-language-button.current-page {
    background-color: #666;
    cursor: default;
}

.easilyaccessible-easy-language-shortcode .easy-language-button.current-page:hover {
    background-color: #666;
}

.easilyaccessible-easy-language-shortcode .easy-language-button .dashicons {
    margin-right: 5px;
    font-size: 16px;
}

/* --- Easy Language List Display Customization --- */
.easilyaccessible-easy-language-list {
    margin: 15px 0;
    padding: var(--el-list-padding, 8px);
    background-color: var(--el-list-bg-color, #f9f9f9);
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
    list-style: none;
}

.easilyaccessible-easy-language-list.align-left {
    text-align: left;
}

.easilyaccessible-easy-language-list.align-center {
    text-align: center;
}

.easilyaccessible-easy-language-list.align-right {
    text-align: right;
}

.easilyaccessible-easy-language-list li {
    margin: 0;
    padding: 6px 12px;
}

.easilyaccessible-easy-language-list a {
    color: var(--el-list-text-color, #333333);
    font-size: var(--el-list-font-size, 16px);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: color 0.2s ease;
}

.easilyaccessible-easy-language-list a:hover,
.easilyaccessible-easy-language-list a:focus {
    color: #0073aa;
    text-decoration: underline;
}

.easilyaccessible-easy-language-list .dashicons {
    margin-right: 6px;
    font-size: 1.1em;
}

/* --- Easy Language Menu Integration --- */
.easilyaccessible-easy-language-menu-list {
    font-family: inherit;
}

.easilyaccessible-easy-language-menu-list h4 {
    margin: 0 0 8px 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: inherit !important;
}

.easilyaccessible-easy-language-menu-list ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.easilyaccessible-easy-language-menu-list li {
    margin: 4px 0 !important;
    padding: 0 !important;
}

.easilyaccessible-easy-language-link {
    display: block !important;
    padding: 6px 8px !important;
    text-decoration: none !important;
    border-radius: 4px !important;
    transition: background-color 0.2s ease !important;
    color: inherit !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
}

.easilyaccessible-easy-language-link:hover,
.easilyaccessible-easy-language-link:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
    text-decoration: none !important;
    color: inherit !important;
}

.easilyaccessible-easy-language-link[aria-current="page"] {
    background-color: rgba(255, 255, 255, 0.15) !important;
    font-weight: 600 !important;
}

.easilyaccessible-easy-language-link .dashicons {
    width: 16px !important;
    height: 16px !important;
    font-size: 16px !important;
    line-height: 1 !important;
    margin-right: 6px !important;
    vertical-align: text-top !important;
    opacity: 0.8;
}

.easilyaccessible-easy-language-link[aria-current="page"] .dashicons {
    opacity: 1;
}

/* Dark theme adjustments for accessibility menu */
.easilyaccessible-accessibility-panel.theme-dark .easilyaccessible-easy-language-link:hover,
.easilyaccessible-accessibility-panel.theme-dark .easilyaccessible-easy-language-link:focus {
    background-color: rgba(0, 0, 0, 0.2) !important;
}

.easilyaccessible-accessibility-panel.theme-dark .easilyaccessible-easy-language-link[aria-current="page"] {
    background-color: rgba(0, 0, 0, 0.25) !important;
}

/* High contrast theme adjustments */
.easilyaccessible-accessibility-panel.theme-high-contrast .easilyaccessible-easy-language-link {
    border: 1px solid transparent !important;
}

.easilyaccessible-accessibility-panel.theme-high-contrast .easilyaccessible-easy-language-link:hover,
.easilyaccessible-accessibility-panel.theme-high-contrast .easilyaccessible-easy-language-link:focus {
    border-color: currentColor !important;
    background-color: transparent !important;
}

.easilyaccessible-accessibility-panel.theme-high-contrast .easilyaccessible-easy-language-link[aria-current="page"] {
    background-color: currentColor !important;
    color: var(--easilyaccessible-bg-color, #ffffff) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .easilyaccessible-easy-language-bar {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .easilyaccessible-bar-dropdown {
        min-width: 180px;
        left: 0 !important; /* Force left alignment on mobile for better visibility */
        right: auto !important;
        transform: none !important; /* Disable centering transforms on mobile */
    }
    
    .easilyaccessible-bar-dropdown.dropdown-direction-up {
        /* Ensure enough space above on mobile */
        bottom: calc(100% + 8px);
    }
    
    .easilyaccessible-bar-dropdown.dropdown-direction-down {
        /* Ensure enough space below on mobile */
        top: calc(100% + 8px);
    }
    
    .easilyaccessible-easy-language-list {
        margin: 10px 0;
        padding: 6px;
    }
    
    .easilyaccessible-easy-language-list a {
        font-size: 14px;
    }
    
    /* Better touch targets on mobile */
    .easilyaccessible-bar-trigger {
        padding: 8px 12px;
        min-height: 44px; /* iOS minimum touch target */
        display: flex;
        align-items: center;
    }
    
    .easilyaccessible-dropdown-link {
        padding: 12px 15px; /* Larger touch targets */
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* High-density displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .easilyaccessible-bar-dropdown {
        box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .easilyaccessible-bar-dropdown {
        transition: none;
    }
    
    .easilyaccessible-bar-trigger {
        transition: none;
    }
    
    .easilyaccessible-dropdown-link {
        transition: none;
    }
}

/* Dropdown alignment matching list alignment classes */
.easilyaccessible-bar-dropdown.align-left {
    text-align: left;
}

.easilyaccessible-bar-dropdown.align-center {
    text-align: center;
}

.easilyaccessible-bar-dropdown.align-right {
    text-align: right;
}

.easilyaccessible-bar-dropdown.align-center .easilyaccessible-dropdown-link,
.easilyaccessible-bar-dropdown.align-right .easilyaccessible-dropdown-link {
    width: 100%; /* Ensure links take full width for alignment to work properly */
    justify-content: var(--el-dropdown-text-align, flex-start);
}

.easilyaccessible-bar-dropdown.align-center .easilyaccessible-dropdown-link {
    justify-content: center;
}

.easilyaccessible-bar-dropdown.align-right .easilyaccessible-dropdown-link {
    justify-content: flex-end;
}