/**
 * OrgReach Unified Header Frontend Styles
 * 
 * Facebook Messenger-style chat integration with OrgReach branding
 */

/* OrgReach Brand Colors */
:root {
    --orgreach-primary: #823dd8;
    --orgreach-primary-dark: #6f2bb0;
    --orgreach-primary-light: #a26cf5;
    --orgreach-secondary: #5b616b;
    --orgreach-secondary-light: #bca0e6;
    --orgreach-background-lt: #f8f9fb;
    --orgreach-background-dk: #23232b;
    --orgreach-card-lt: #ececf2;
    --orgreach-card-dk: #39395e;
    --orgreach-accent: #02bfe7;
    --orgreach-success: #2e8540;
    --orgreach-warning: #fdb81e;
    --orgreach-danger: #d43a52;
    --orgreach-neutral: #ceced2;
    --orgreach-text-light: #23232b;
    --orgreach-text-dark: #f8f9fb;
}

/* Main Header Container */
.orgreach-unified-header {
    position: relative; /* Changed from sticky to work better in flexbox */
    z-index: inherit; /* Inherit z-index from parent */
    background: var(--orgreach-primary);
    color: var(--orgreach-text-dark);
    box-shadow: 0 2px 8px rgba(130, 61, 216, 0.15);
    font-family: Inter, 'Segoe UI', Arial, sans-serif;
    width: 100%;
    min-height: 60px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}

/* Elementor widget wrapper fix */
.elementor-widget-orgreach-unified-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.elementor-widget-orgreach-unified-header .elementor-widget-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    padding: 10px clamp(15px, 3vw, 40px);
    min-height: 60px;
    box-sizing: border-box;
    margin: 0 auto; /* Center the container */
}

/* Fix for sticky header in flexbox parent with z-index */
.elementor-section[data-settings*="sticky"] .orgreach-unified-header {
    position: sticky;
    top: 0;
    z-index: 30; /* Match parent z-index */
}

/* Logo Section */
.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.header-logo a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.logo-image {
    height: clamp(24px, 4vw, 32px);
    width: auto;
    border-radius: 8px;
}

.organization-name {
    font-size: clamp(16px, 2.5vw, 20px);
    font-weight: 700;
}

/* Navigation */
.header-navigation {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-navigation .header-nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: clamp(12px, 2vw, 24px);
    flex-wrap: wrap;
    justify-content: center;
}

.header-navigation .header-nav-menu li a {
    color: var(--orgreach-text-dark);
    text-decoration: none;
    font-weight: 600;
    padding: clamp(6px, 1vw, 8px) clamp(8px, 1.5vw, 12px);
    border-radius: 8px;
    transition: background-color 0.2s ease;
    font-size: clamp(14px, 1.8vw, 16px);
}

.header-navigation .header-nav-menu li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.5vw, 16px);
    flex-shrink: 0;
}

/* Services Dropdown */
.services-dropdown {
    position: relative;
}

.services-button {
    background: none;
    border: none;
    color: var(--orgreach-text-dark);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: clamp(36px, 5vw, 44px);
    min-width: clamp(36px, 5vw, 44px);
}

.services-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.services-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--orgreach-background-lt);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.services-dropdown:hover .services-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.service-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: var(--orgreach-text-light);
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.service-link:hover {
    background-color: var(--orgreach-card-lt);
}

.service-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.service-name {
    font-weight: 600;
}

/* Email Integration */
.orgreach-email-icon {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: clamp(36px, 5vw, 44px);
    min-width: clamp(36px, 5vw, 44px);
}

.orgreach-email-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.email-notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--orgreach-danger);
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Marketplace Integration */
.orgreach-marketplace-icon {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: clamp(36px, 5vw, 44px);
    min-width: clamp(36px, 5vw, 44px);
}

.orgreach-marketplace-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.marketplace-notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--orgreach-danger);
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Auto Contrast Icons for Accessibility Compliance */
.orgreach-unified-header.auto-contrast-icons svg {
    color: inherit;
}

.orgreach-unified-header.auto-contrast-icons .services-button,
.orgreach-unified-header.auto-contrast-icons .chat-service-link,
.orgreach-unified-header.auto-contrast-icons .email-service-link,
.orgreach-unified-header.auto-contrast-icons .marketplace-service-link {
    position: relative;
}

/* Light background - use dark icons */
.orgreach-unified-header.auto-contrast-icons[style*="background-color: #fff"],
.orgreach-unified-header.auto-contrast-icons[style*="background-color: rgb(255"],
.orgreach-unified-header.auto-contrast-icons[style*="background-color: #f"],
.orgreach-unified-header.auto-contrast-icons[style*="background-color: #e"] {
    color: #23232b;
}

.orgreach-unified-header.auto-contrast-icons[style*="background-color: #fff"] a,
.orgreach-unified-header.auto-contrast-icons[style*="background-color: rgb(255"] a,
.orgreach-unified-header.auto-contrast-icons[style*="background-color: #f"] a,
.orgreach-unified-header.auto-contrast-icons[style*="background-color: #e"] a {
    color: #23232b;
}

/* Service Links */
.chat-service-link,
.email-service-link,
.marketplace-service-link {
    text-decoration: none;
    color: inherit;
}

/* Chat Integration - Facebook Messenger Style */
.orgreach-chat-header-integration {
    position: relative;
}

.facebook-chat-icon {
    position: relative;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: clamp(36px, 5vw, 44px);
    min-width: clamp(36px, 5vw, 44px);
}

.facebook-chat-icon:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.chat-notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--orgreach-danger);
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Chat Dropdown */
.facebook-chat-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: var(--orgreach-background-lt);
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    border: 1px solid var(--orgreach-neutral);
}

.facebook-chat-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chat-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--orgreach-neutral);
    background: var(--orgreach-card-lt);
    border-radius: 8px 8px 0 0;
}

.chat-dropdown-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--orgreach-text-light);
}

.chat-dropdown-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--orgreach-secondary);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.chat-dropdown-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.chat-dropdown-actions {
    padding: 12px 16px;
    border-bottom: 1px solid var(--orgreach-neutral);
}

.chat-new-message {
    width: 100%;
    background: var(--orgreach-primary);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: clamp(36px, 5vw, 44px);
}

.chat-new-message:hover {
    background: var(--orgreach-primary-dark);
}

/* Chat Contacts List */
.chat-contacts-list {
    max-height: 300px;
    overflow-y: auto;
}

.chat-loading-contacts {
    padding: 30px;
    text-align: center;
    color: var(--orgreach-secondary);
}

.orgreach-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--orgreach-neutral);
    border-radius: 50%;
    border-top-color: var(--orgreach-primary);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.chat-no-contacts {
    padding: 30px 20px;
    text-align: center;
    color: var(--orgreach-secondary);
}

.chat-start-conversation {
    margin-top: 12px;
    background: var(--orgreach-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.chat-start-conversation:hover {
    background: var(--orgreach-primary-dark);
}

.chat-contact-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.chat-contact-item:hover {
    background-color: var(--orgreach-card-lt);
}

.chat-contact-item:last-child {
    border-bottom: none;
}

.contact-avatar {
    position: relative;
    margin-right: 12px;
}

.contact-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.contact-online-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: var(--orgreach-success);
    border: 2px solid white;
    border-radius: 50%;
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    font-weight: 600;
    color: var(--orgreach-text-light);
    margin-bottom: 2px;
}

.contact-last-message {
    font-size: 14px;
    color: var(--orgreach-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.contact-time {
    font-size: 12px;
    color: var(--orgreach-secondary);
}

.contact-unread-badge {
    background: var(--orgreach-primary);
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Chat iframe container */
.chat-iframe-container {
    width: 100%;
    height: 350px;
    position: relative;
}

.chat-iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0 0 8px 8px;
}

/* User Profile */
.user-profile-dropdown {
    position: relative;
}

.user-profile-button {
    background: none;
    border: none;
    color: var(--orgreach-text-dark);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-profile-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-weight: 600;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-profile-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--orgreach-background-lt);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-profile-dropdown:hover .user-profile-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-section {
    padding: 8px 0;
}

.user-menu-section:not(:last-child) {
    border-bottom: 1px solid var(--orgreach-neutral);
}

.user-info {
    padding: 8px 12px;
}

.user-info strong {
    display: block;
    color: var(--orgreach-text-light);
    font-weight: 600;
}

.user-email {
    font-size: 14px;
    color: var(--orgreach-secondary);
    margin-top: 2px;
}

.user-menu-link {
    display: block;
    padding: 8px 12px;
    color: var(--orgreach-text-light);
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.user-menu-link:hover {
    background-color: var(--orgreach-card-lt);
}

.logout-link {
    color: var(--orgreach-danger) !important;
}

/* Auth Buttons */
.auth-buttons {
    display: flex;
    gap: 12px;
}

.login-button {
    background: rgba(255, 255, 255, 0.1);
    color: var(--orgreach-text-dark);
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s ease;
    min-height: clamp(36px, 5vw, 44px);
    display: flex;
    align-items: center;
}

.login-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Shortcode Styles */
.orgreach-services-shortcode {
    margin: 20px 0;
}

.orgreach-services-shortcode.layout-grid .services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.orgreach-services-shortcode.layout-grid .service-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    background: var(--orgreach-card-lt);
    border-radius: 8px;
    color: var(--orgreach-text-light);
    text-decoration: none;
    transition: all 0.2s ease;
    gap: 8px;
}

.orgreach-services-shortcode.layout-grid .service-link:hover {
    background: var(--orgreach-primary-light);
    color: white;
    transform: translateY(-2px);
}

.orgreach-services-shortcode.layout-list .services-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.orgreach-services-shortcode.layout-list .service-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    color: var(--orgreach-text-light);
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    margin-bottom: 4px;
}

.orgreach-services-shortcode.layout-list .service-link:hover {
    background: var(--orgreach-card-lt);
}

.orgreach-login-required {
    padding: 20px;
    text-align: center;
    background: var(--orgreach-card-lt);
    border-radius: 8px;
    color: var(--orgreach-secondary);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .header-navigation {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--orgreach-primary);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.3s ease;
    }
    
    .header-navigation.mobile-show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    .header-navigation .header-nav-menu {
        flex-direction: column;
        gap: 0;
        padding: 16px;
    }
    
    .header-navigation .header-nav-menu li a {
        display: block;
        padding: 12px 16px;
        border-radius: 8px;
        margin-bottom: 4px;
    }
    
    .organization-name {
        display: none;
    }
    
    .user-name {
        display: none;
    }
    
    .facebook-chat-dropdown,
    .services-dropdown-menu,
    .user-profile-menu {
        width: min(280px, calc(100vw - 40px));
    }
    
    .orgreach-services-shortcode.layout-grid .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .header-actions {
        gap: 4px;
    }
    
    .services-dropdown {
        display: none;
    }
    
    .facebook-chat-dropdown,
    .services-dropdown-menu,
    .user-profile-menu {
        width: min(260px, calc(100vw - 20px));
        right: -10px;
    }
}
/* Facebook Messenger-style Chat Components */
.facebook-chat-widget {
    position: relative;
}

/* Updated Chat Dropdown Styles */
.facebook-chat-dropdown {
    max-height: 500px;
    display: flex;
    flex-direction: column;
    background: white \!important;
}

.chat-dropdown-actions {
    display: flex;
    gap: 4px;
}

.chat-new-message {
    background: none;
    border: none;
    color: var(--orgreach-secondary);
    cursor: pointer;
    padding: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.chat-new-message:hover {
    background: var(--orgreach-card-lt);
}

/* Chat Contacts List Updates */
.chat-contacts-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    background: white;
}

.chat-contact-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    min-height: 60px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    line-height: 1.4;
}

.chat-contact-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.chat-contact-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    margin-right: 12px;
    flex-shrink: 0;
}

.chat-contact-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.chat-contact-avatar .avatar-initial {
    width: 100%;
    height: 100%;
    background: var(--orgreach-primary-light);
    color: var(--orgreach-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.online-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #44b700;
    border: 2px solid white;
    border-radius: 50%;
}

.chat-contact-info {
    flex: 1;
    min-width: 0;
}

.chat-contact-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--orgreach-text-light);
    margin: 0 0 4px 0;
    line-height: 1.2;
}

.chat-contact-preview {
    font-size: 13px;
    color: var(--orgreach-secondary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.chat-contact-item.has-unread .chat-contact-name {
    color: var(--orgreach-text-light);
}

.chat-contact-item.has-unread .chat-contact-preview {
    font-weight: 600;
    color: var(--orgreach-text-light);
}

.chat-contact-meta {
    display: flex;
    align-items: center;
}

.chat-contact-unread {
    background: var(--orgreach-primary);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
}

/* Chat Dropdown Footer */
.chat-dropdown-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--orgreach-neutral);
    background: white;
    border-radius: 0 0 8px 8px;
}

.see-all-messages {
    display: block;
    text-align: center;
    color: var(--orgreach-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.see-all-messages:hover {
    text-decoration: underline;
}

/* Facebook-style Chat Windows */
.facebook-chat-window {
    position: fixed;
    bottom: 0;
    width: 320px;
    height: 400px;
    background: white;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
}

.facebook-chat-window * {
    box-sizing: border-box;
}

.chat-window-header {
    background: var(--orgreach-primary);
    color: white;
    padding: 10px 12px;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-window-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-window-title h6 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.typing-indicator {
    font-size: 12px;
    font-style: italic;
    opacity: 0.8;
}

.chat-window-actions {
    display: flex;
    gap: 4px;
}

.chat-window-actions button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 18px;
    line-height: 1;
    transition: background-color 0.2s;
}

.chat-window-actions button:hover {
    background: rgba(0, 0, 0, 0.1);
}

.chat-window-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.chat-loading-messages {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--orgreach-secondary);
}

.contact-loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--orgreach-neutral);
    border-radius: 50%;
    border-top-color: var(--orgreach-primary);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 12px;
}

.chat-message {
    display: flex;
    margin-bottom: 8px;
}

.chat-message.own {
    justify-content: flex-end;
}

.chat-message.other {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 8px 12px;
    border-radius: 18px;
    word-wrap: break-word;
}

.chat-message.own .message-bubble {
    background: var(--orgreach-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.other .message-bubble {
    background: #e4e6eb;
    color: var(--orgreach-text-light);
    border-bottom-left-radius: 4px;
}

.message-bubble p {
    margin: 0 0 4px 0;
    font-size: 14px;
    line-height: 1.4;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
}

.chat-window-input {
    padding: 12px;
    background: white;
    border-top: 1px solid #e4e6eb;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input-field {
    flex: 1;
    min-height: 36px;
    max-height: 100px;
    padding: 8px 12px;
    border: 1px solid #e4e6eb;
    border-radius: 20px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    background: #f0f2f5;
    transition: background-color 0.2s;
}

.chat-input-field:focus {
    outline: none;
    border-color: var(--orgreach-primary);
    background: white;
}

.chat-input-actions {
    display: flex;
    gap: 4px;
}

.chat-input-action {
    background: none;
    border: none;
    color: var(--orgreach-primary);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.chat-input-action:hover {
    background: #f0f2f5;
}

.chat-input-action svg {
    display: block;
}

/* Chat SSO Notice */
.chat-sso-notice {
    padding: 12px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--orgreach-secondary);
    background: #f8f9fa;
}

/* Chat Auth Container */
.chat-auth-container {
    padding: 20px;
    text-align: center;
}

.chat-sso-login {
    background: var(--orgreach-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.chat-sso-login:hover {
    background: var(--orgreach-primary-dark);
}

/* Error Messages */
.chat-error {
    color: var(--orgreach-danger);
    text-align: center;
    padding: 20px;
}


/* Chat Contact Actions */
.chat-contact-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.chat-contact-profile {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--orgreach-secondary);
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0;
}

.chat-contact-item:hover .chat-contact-profile {
    opacity: 1;
}

.chat-contact-profile:hover {
    background: var(--orgreach-card-lt);
    color: var(--orgreach-primary);
}

/* Profile Modal */
.orgreach-profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.profile-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.profile-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.profile-modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--orgreach-neutral);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.profile-modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: var(--orgreach-text-light);
}

.profile-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--orgreach-secondary);
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.profile-modal-close:hover {
    background: var(--orgreach-card-lt);
}

.profile-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.profile-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: var(--orgreach-secondary);
}

.profile-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.profile-header {
    text-align: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
    position: relative;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-avatar-initial {
    width: 100%;
    height: 100%;
    background: var(--orgreach-primary-light);
    color: var(--orgreach-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 600;
}

.profile-name {
    margin: 0 0 4px 0;
    font-size: 24px;
    color: var(--orgreach-text-light);
}

.profile-username {
    margin: 0 0 8px 0;
    color: var(--orgreach-secondary);
    font-size: 16px;
}

.profile-organization {
    margin: 0;
    color: var(--orgreach-secondary);
    font-size: 14px;
}

.profile-section {
    padding-bottom: 16px;
    border-bottom: 1px solid var(--orgreach-neutral);
}

.profile-section:last-child {
    border-bottom: none;
}

.profile-section h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: var(--orgreach-text-light);
}

.profile-section p {
    margin: 0;
    color: var(--orgreach-secondary);
    line-height: 1.5;
}

.profile-info-grid {
    display: grid;
    gap: 12px;
}

.profile-info-item {
    display: flex;
    gap: 8px;
}

.info-label {
    font-weight: 600;
    color: var(--orgreach-text-light);
    min-width: 100px;
}

.info-value {
    color: var(--orgreach-secondary);
}

.profile-status {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    background: var(--orgreach-card-lt);
    color: var(--orgreach-secondary);
}

.status-badge.friend {
    background: var(--orgreach-success);
    color: white;
}

.status-badge.blocked {
    background: var(--orgreach-danger);
    color: white;
}

.profile-modal-actions {
    padding: 16px 20px;
    border-top: 1px solid var(--orgreach-neutral);
    display: flex;
    gap: 12px;
    justify-content: center;
}

.profile-modal-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.profile-action-message {
    background: var(--orgreach-primary);
    color: white;
}

.profile-action-message:hover {
    background: var(--orgreach-primary-dark);
}

.profile-action-add-friend {
    background: var(--orgreach-accent);
    color: white;
}

.profile-action-add-friend:hover {
    background: #00a5d4;
}

.profile-action-block {
    background: var(--orgreach-card-lt);
    color: var(--orgreach-danger);
}

.profile-action-block:hover {
    background: var(--orgreach-danger);
    color: white;
}

/* Chat iframe styles */
.facebook-chat-window.iframe-mode .chat-iframe-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
    position: relative;
}

.facebook-chat-window.iframe-mode .chat-iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Loading state for iframe */
.facebook-chat-window.iframe-mode .chat-iframe-container::before {
    content: "Loading chat...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #65676b;
    font-size: 14px;
    pointer-events: none;
    z-index: 0;
}

.facebook-chat-window.iframe-mode .chat-iframe {
    position: relative;
    z-index: 1;
}

/* Draggable chat window styles */
.facebook-chat-window.dragging {
    opacity: 0.9;
    transition: none;
}

.facebook-chat-window .chat-window-header {
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.facebook-chat-window .chat-window-header:active {
    cursor: grabbing;
}

/* Prevent interaction with iframe while dragging */
.facebook-chat-window.dragging .chat-iframe {
    pointer-events: none;
}

/* Smooth transition when windows snap to position */
.facebook-chat-window {
    transition: opacity 0.2s, height 0.3s ease-in-out;
}

/* Minimized chat window */
.facebook-chat-window.minimized {
    height: 40px !important;
    overflow: hidden;
}

.facebook-chat-window.minimized .chat-window-messages,
.facebook-chat-window.minimized .chat-window-input,
.facebook-chat-window.minimized .chat-iframe-container {
    display: none;
}

.facebook-chat-window.minimized .chat-window-header {
    border-radius: 8px;
}

/* Show restore icon when minimized */
.facebook-chat-window .chat-window-minimize {
    font-family: Arial, sans-serif;
    font-size: 20px;
    line-height: 1;
}

/* SSO Chat Mode Styles */
.sso-chat-mode {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    flex: 1;
    min-height: 200px;
    background: #f8f9fa !important;
}

.sso-chat-message {
    margin: auto;
    width: 100%;
    max-width: 280px;
}

.sso-chat-message p {
    margin: 10px 0;
    color: var(--orgreach-text-light, #23232b) !important;
    font-size: 14px;
    line-height: 1.4;
}

.sso-chat-info {
    font-size: 14px;
    color: #65676b;
}

.sso-chat-open-element {
    margin-top: 15px;
    padding: 12px 24px;
    background: var(--orgreach-primary, #823dd8) !important;
    color: white !important;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    display: inline-block;
    text-decoration: none;
}

.sso-chat-open-element:hover {
    background: var(--orgreach-primary-dark, #6f2bb0) !important;
    color: white !important;
}

.sso-input-disabled {
    background: #f0f2f5;
    padding: 15px;
    text-align: center;
    border-top: 1px solid #e4e6eb;
}

.sso-input-message {
    margin: 0;
    color: #65676b;
    font-size: 14px;
}

/* Ensure SSO chat mode is visible */
.facebook-chat-window.iframe-mode {
    background: white !important;
}

.facebook-chat-window.iframe-mode .chat-window-messages {
    background: #f8f9fa !important;
    display: flex !important;
    flex: 1;
    min-height: 0;
}

.facebook-chat-window .sso-chat-message {
    width: 100%;
    text-align: center;
}

.facebook-chat-window .sso-chat-message p:first-child {
    font-weight: 600;
    font-size: 16px;
    color: #1c1e21;
    margin-bottom: 8px;
}

.profile-modal-actions button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.profile-error {
    text-align: center;
    color: var(--orgreach-danger);
    padding: 40px 20px;
}

/* Mobile responsive for profile modal */
@media (max-width: 480px) {
    .profile-modal-content {
        max-width: 100%;
        margin: 10px;
    }
    
    .profile-modal-actions {
        flex-direction: column;
    }
    
    .profile-modal-actions button {
        width: 100%;
    }
}


/* Chat Window with iFrame */
.facebook-chat-window .chat-iframe {
    position: absolute;
    top: 48px; /* Header height */
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100% - 48px);
    border: none;
    background: white;
}

/* Adjust chat window for iframe mode */
.facebook-chat-window.iframe-mode .chat-window-messages,
.facebook-chat-window.iframe-mode .chat-window-input {
    display: none;
}



/* Additional Flexbox and Responsive Fixes */
/* Ensure header fills Elementor column */
.elementor-column .elementor-widget-orgreach-unified-header {
    width: 100%;
}

.elementor-widget-container > .orgreach-unified-header {
    width: 100%;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    margin-right: 10px;
}

.hamburger-box {
    width: 24px;
    height: 24px;
    display: inline-block;
    position: relative;
}

.hamburger-inner {
    display: block;
    top: 50%;
    margin-top: -2px;
}

.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
    width: 24px;
    height: 3px;
    background-color: var(--orgreach-text-dark);
    border-radius: 3px;
    position: absolute;
    transition: transform 0.3s ease;
}

.hamburger-inner::before,
.hamburger-inner::after {
    content: "";
    display: block;
}

.hamburger-inner::before {
    top: -8px;
}

.hamburger-inner::after {
    bottom: -8px;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-content {
    position: absolute;
    left: 0;
    top: 0;
    width: 80%;
    max-width: 300px;
    height: 100%;
    background: var(--orgreach-background-lt);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding: 20px;
}

.mobile-menu-overlay.active .mobile-menu-content {
    transform: translateX(0);
}

.mobile-menu-close {
    position: absolute;
    right: 15px;
    top: 15px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: var(--orgreach-text-light);
}

/* Mobile Navigation Styles */
.mobile-nav-menu {
    list-style: none;
    margin: 40px 0 30px;
    padding: 0;
}

.mobile-nav-menu li {
    margin-bottom: 5px;
}

.mobile-nav-menu li a {
    display: block;
    padding: 12px 0;
    color: var(--orgreach-text-light);
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    border-bottom: 1px solid var(--orgreach-neutral);
}

.mobile-services {
    margin: 30px 0;
}

.mobile-services h3 {
    color: var(--orgreach-primary);
    margin-bottom: 15px;
    font-size: 18px;
}

.mobile-services .service-link {
    display: block;
    padding: 10px 0;
    color: var(--orgreach-text-light);
    text-decoration: none;
}

.mobile-user-section {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    padding: 20px 0;
    border-top: 1px solid var(--orgreach-neutral);
}

.mobile-user-avatar {
    border-radius: 50%;
}

.mobile-user-name {
    flex: 1;
    font-weight: 600;
}

.mobile-logout {
    color: var(--orgreach-danger);
    text-decoration: none;
}

.mobile-auth-section {
    margin-top: 30px;
    padding: 20px 0;
    border-top: 1px solid var(--orgreach-neutral);
}

.mobile-login-button {
    display: block;
    background: var(--orgreach-primary);
    color: white;
    text-align: center;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .header-container {
        padding: 10px 15px;
    }
    
    .header-logo .organization-name {
        display: none;
    }
    
    .header-navigation {
        display: none;
    }
    
    .services-dropdown,
    .user-profile-dropdown {
        display: none;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .header-navigation .header-nav-menu {
        gap: 10px;
    }
    
    .header-navigation .header-nav-menu li a {
        padding: 6px 10px;
        font-size: 14px;
    }
}

/* Fix for Elementor sections */
.elementor-section-stretched .orgreach-unified-header {
    width: 100%;
}

/* Ensure proper flexbox alignment in Elementor */
.elementor-element.elementor-widget-orgreach-unified-header {
    width: 100%;
    flex-shrink: 0;
    flex-grow: 1;
}

/* Proper height handling */
.elementor-widget-orgreach-unified-header {
    min-height: 60px;
    height: auto;
}

.elementor-widget-orgreach-unified-header .elementor-widget-container {
    min-height: inherit;
    height: 100%;
}

.elementor-widget-orgreach-unified-header .orgreach-unified-header {
    height: 100%;
    min-height: 60px;
}

/* Handle Elementor column flexbox */
.elementor-column-wrap > .elementor-widget-wrap > .elementor-element.elementor-widget-orgreach-unified-header,
.elementor-widget-wrap > .elementor-element.elementor-widget-orgreach-unified-header {
    align-self: stretch;
    width: 100%;
}

/* Fix sticky positioning within Elementor sticky sections */
.elementor-section.elementor-sticky--active .orgreach-unified-header {
    position: sticky;
    top: 0;
    width: 100%;
}

/* Ensure header doesn't overflow parent */
.orgreach-unified-header {
    max-width: 100%;
    overflow: hidden;
}


/* Dark Mode Styles */
.orgreach-unified-header.theme-dark,
.orgreach-unified-header.theme-auto.dark-mode-active {
    background: var(--orgreach-background-dk);
    color: var(--orgreach-text-dark);
}

.theme-dark .header-navigation .header-nav-menu li a,
.theme-auto.dark-mode-active .header-navigation .header-nav-menu li a {
    color: var(--orgreach-text-dark);
}

.theme-dark .services-dropdown-menu,
.theme-dark .user-profile-menu,
.theme-auto.dark-mode-active .services-dropdown-menu,
.theme-auto.dark-mode-active .user-profile-menu {
    background: var(--orgreach-card-dk);
    color: var(--orgreach-text-dark);
}

.theme-dark .service-link,
.theme-dark .user-menu-item,
.theme-auto.dark-mode-active .service-link,
.theme-auto.dark-mode-active .user-menu-item {
    color: var(--orgreach-text-dark);
}

.theme-dark .service-link:hover,
.theme-dark .user-menu-item:hover,
.theme-auto.dark-mode-active .service-link:hover,
.theme-auto.dark-mode-active .user-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Bottom Navigation Styles */
.orgreach-unified-header.position-bottom {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    z-index: 9999; /* Ensure it stays above content */
}

/* Override for bottom nav in flexbox container */
.elementor-widget-orgreach-unified-header .orgreach-unified-header.position-bottom {
    position: absolute; /* Use absolute within the widget container */
    bottom: 0;
}

body.has-bottom-header {
    padding-bottom: 60px;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.theme-dark .theme-icon-light,
.theme-auto.dark-mode-active .theme-icon-light {
    display: none;
}

.theme-dark .theme-icon-dark,
.theme-auto.dark-mode-active .theme-icon-dark {
    display: block \!important;
}

/* Mobile Menu Dark Mode */
.theme-dark .mobile-menu-content,
.theme-auto.dark-mode-active .mobile-menu-content {
    background: var(--orgreach-background-dk);
    color: var(--orgreach-text-dark);
}

.theme-dark .mobile-nav-menu li a,
.theme-dark .mobile-services .service-link,
.theme-auto.dark-mode-active .mobile-nav-menu li a,
.theme-auto.dark-mode-active .mobile-services .service-link {
    color: var(--orgreach-text-dark);
    border-bottom-color: var(--orgreach-card-dk);
}

.theme-dark .mobile-menu-close,
.theme-auto.dark-mode-active .mobile-menu-close {
    color: var(--orgreach-text-dark);
}

/* Auto Theme - Media Query for System Dark Mode */
@media (prefers-color-scheme: dark) {
    .orgreach-unified-header.theme-auto {
        background: var(--orgreach-background-dk);
        color: var(--orgreach-text-dark);
    }
}

/* Responsive adjustments for bottom nav */
@media (max-width: 768px) {
    .orgreach-unified-header.position-bottom {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    body.has-bottom-header {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }
}


/* Accessibility Styles */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal \!important;
}

.screen-reader-text:focus {
    background-color: var(--orgreach-background-lt);
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto \!important;
    clip-path: none;
    color: var(--orgreach-primary);
    display: block;
    font-size: 14px;
    font-weight: bold;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* Skip Link */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 2.5rem;
    z-index: 999999;
    text-decoration: underline;
}

.skip-link:focus {
    position: absolute;
    left: 2%;
    top: 2.5rem;
    z-index: 999999;
    padding: 8px 16px;
    background-color: var(--orgreach-primary);
    color: white;
    border-radius: 8px;
    text-decoration: none;
}

/* Focus Indicators */
.orgreach-unified-header *:focus {
    outline: 2px solid var(--orgreach-accent);
    outline-offset: 2px;
}

.theme-dark .orgreach-unified-header *:focus,
.theme-auto.dark-mode-active .orgreach-unified-header *:focus {
    outline-color: var(--orgreach-accent);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .orgreach-unified-header {
        border: 2px solid;
    }
    
    .header-navigation .header-nav-menu li a,
    .services-button,
    .user-profile-button,
    .theme-toggle {
        border: 1px solid;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .orgreach-unified-header *,
    .orgreach-unified-header *::before,
    .orgreach-unified-header *::after {
        animation-duration: 0.01ms \!important;
        animation-iteration-count: 1 \!important;
        transition-duration: 0.01ms \!important;
    }
    
    .mobile-menu-overlay,
    .mobile-menu-content {
        transition: none \!important;
    }
}

/* Ensure visibility in Windows High Contrast Mode */
@media screen and (-ms-high-contrast: active) {
    .orgreach-unified-header {
        border: 1px solid windowText;
    }
    
    .orgreach-unified-header a,
    .orgreach-unified-header button {
        border: 1px solid transparent;
    }
    
    .orgreach-unified-header a:hover,
    .orgreach-unified-header button:hover {
        border-color: highlight;
    }
}


/* WCAG 2.1 AA Compliance Enhancements */

/* 1.4.3 Contrast (Minimum) - Ensure 4.5:1 for normal text, 3:1 for large text */
.orgreach-unified-header {
    /* Primary purple (#823dd8) on white text (#f8f9fb) = 4.54:1 ✓ */
}

/* Enhanced focus indicators for 2.4.7 Focus Visible */
.orgreach-unified-header a:focus-visible,
.orgreach-unified-header button:focus-visible,
.orgreach-unified-header input:focus-visible,
.orgreach-unified-header select:focus-visible {
    outline: 3px solid var(--orgreach-accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--orgreach-background-lt);
}

/* 1.4.11 Non-text Contrast - Ensure 3:1 for UI components */
.orgreach-unified-header button,
.orgreach-unified-header input,
.orgreach-unified-header select {
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* 1.4.10 Reflow - Content reflows without horizontal scrolling at 320px */
@media (max-width: 320px) {
    .orgreach-unified-header {
        min-width: 320px;
    }
    
    .header-container {
        padding: 8px;
    }
    
    .header-logo .logo-image {
        height: 24px;
    }
}

/* 1.4.12 Text Spacing - Support user text spacing preferences */
.orgreach-unified-header *:not(svg) {
    line-height: inherit \!important;
    letter-spacing: inherit \!important;
    word-spacing: inherit \!important;
}

.orgreach-unified-header p,
.orgreach-unified-header li {
    margin-bottom: inherit \!important;
}

/* 1.4.13 Content on Hover or Focus */
.services-dropdown-menu,
.user-profile-menu,
.facebook-chat-dropdown {
    pointer-events: auto;
}

.services-dropdown:hover .services-dropdown-menu,
.services-dropdown:focus-within .services-dropdown-menu,
.user-profile-dropdown:hover .user-profile-menu,
.user-profile-dropdown:focus-within .user-profile-menu {
    opacity: 1;
    visibility: visible;
}

/* Allow dismissing tooltips with ESC */
[role="tooltip"] {
    position: absolute;
    z-index: 10001;
}

/* 2.1.2 No Keyboard Trap */
.mobile-menu-overlay:not(.active) {
    pointer-events: none;
}

/* 2.4.6 Headings and Labels */
.mobile-services h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* 2.5.1 Pointer Gestures - Ensure all functionality is available via single pointer */
.orgreach-unified-header [draggable] {
    cursor: move;
}

/* 2.5.2 Pointer Cancellation */
.orgreach-unified-header button,
.orgreach-unified-header a {
    touch-action: manipulation;
}

/* 2.5.3 Label in Name */
.orgreach-unified-header button[aria-label],
.orgreach-unified-header a[aria-label] {
    position: relative;
}

/* 2.5.4 Motion Actuation - Provide UI alternatives for motion */
@media (prefers-reduced-motion: no-preference) {
    .mobile-menu-content {
        transition: transform 0.3s ease;
    }
}

/* 3.2.3 Consistent Navigation */
.header-nav-menu {
    order: 2;
}

.header-actions {
    order: 3;
}

/* 4.1.3 Status Messages */
[role="status"],
[role="alert"] {
    position: relative;
    padding: 10px;
    margin: 10px 0;
}

/* Additional Color Contrast for Icons */
.orgreach-unified-header svg {
    fill: currentColor;
    stroke: currentColor;
}

/* Ensure minimum touch target size (44x44px) for 2.5.5 Target Size */
.orgreach-unified-header button,
.orgreach-unified-header a,
.orgreach-unified-header input[type="checkbox"],
.orgreach-unified-header input[type="radio"] {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Text alternatives for complex UI */
.hamburger-inner::before {
    content: "";
    speak: none;
}

/* Ensure proper reading order */
.orgreach-unified-header {
    display: flex;
    flex-direction: column;
}

.header-container {
    order: 1;
}

.mobile-menu-overlay {
    order: 2;
}

/* Error identification */
.error-message {
    color: var(--orgreach-danger);
    font-weight: 600;
    margin-top: 5px;
}

/* Success messages */
.success-message {
    color: var(--orgreach-success);
    font-weight: 600;
    margin-top: 5px;
}

/* Ensure link purpose is clear */
.orgreach-unified-header a[target="_blank"]::after {
    content: " (opens in new tab)";
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Language of parts */
[lang]:not([lang=""]) {
    font-style: italic;
}


/* Additional Flexbox Centering Fixes */
/* Ensure header respects parent flexbox alignment */
.elementor-section > .elementor-container > .elementor-column > .elementor-widget-wrap > .elementor-widget-orgreach-unified-header {
    flex: 1 1 100%;
    max-width: 100%;
    align-self: center;
}

/* Fix for nested flexbox containers */
.elementor-widget-orgreach-unified-header > .elementor-widget-container {
    display: flex \!important;
    width: 100% \!important;
    justify-content: center \!important;
    align-items: center \!important;
}

/* Ensure header container stays centered */
.orgreach-unified-header .header-container {
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
}

/* Fix z-index inheritance from parent with z-index 30 */
.elementor-section[style*="z-index: 30"] .orgreach-unified-header,
.elementor-section[style*="z-index:30"] .orgreach-unified-header {
    z-index: 30;
    position: relative;
}

/* Ensure sticky behavior works with parent z-index */
.elementor-sticky--effects .orgreach-unified-header {
    position: sticky \!important;
    top: var(--elementor-sticky-offset, 0) \!important;
}

/* Prevent header from breaking out of container */
.orgreach-unified-header {
    contain: layout style;
}

/* Fix for full-width sections */
.elementor-section-full_width .orgreach-unified-header {
    width: 100vw;
    max-width: 100%;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
}

/* Reset margins for boxed sections */
.elementor-section-boxed .orgreach-unified-header {
    margin-left: 0;
    margin-right: 0;
}
