/**
 * Console Fixes and User Experience Improvements
 * This file contains CSS fixes for better user experience
 */

/* Improve lazy loading experience */
img[loading="lazy"] {
    transition: opacity 0.3s ease-in-out;
}

img[loading="lazy"]:not([src]) {
    opacity: 0;
}

img[loading="lazy"][src] {
    opacity: 1;
}

/* Better loading states for images */
.lazy-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Improve Elementor widget loading */
.elementor-widget {
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.elementor-widget.elementor-loading {
    opacity: 0.7;
}

/* Fix for animated headline widget */
.elementor-animated-headline {
    min-height: 1.2em;
}

.elementor-animated-headline .elementor-headline-dynamic-wrapper {
    display: inline-block;
    min-width: 0.5em;
}

/* Better error handling for broken images */
img:not([src]),
img[src=""],
img[src*="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB2aWV3Qm94PSIwIDAgMSAxIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cmVjdCB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSIjZjBmMGYwIi8+Cjwvc3ZnPgo="] {
    background: #f0f0f0;
    border: 1px solid #ddd;
    position: relative;
}

img:not([src]):after,
img[src=""]:after,
img[src*="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB2aWV3Qm94PSIwIDAgMSAxIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cmVjdCB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSIjZjBmMGYwIi8+Cjwvc3ZnPgo="]:after {
    content: "🖼️";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #999;
}

/* Improve form loading states */
.codplugin-form {
    position: relative;
}

.codplugin-form.loading {
    pointer-events: none;
}

.codplugin-form.loading:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.codplugin-form.loading:after {
    content: "جاري التحميل...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
    font-size: 14px;
    color: #666;
}

/* Better mobile experience */
@media (max-width: 768px) {
    /* Reduce animation intensity on mobile */
    .lazy-loading {
        animation-duration: 2s;
    }
    
    /* Improve touch targets */
    .elementor-widget-button .elementor-button,
    .codplugin-form button,
    .codplugin-form input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Fix for RTL layouts */
[dir="rtl"] .elementor-animated-headline .elementor-headline-dynamic-wrapper {
    direction: rtl;
}

/* Improve accessibility */
.elementor-widget:focus-within,
.codplugin-form:focus-within {
    outline: 2px solid #4C3BCF;
    outline-offset: 2px;
}

/* Better error states */
.codplugin-form .error {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.codplugin-form .success {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
} 

/* Prevent customizer colors from showing when settings panel is active */
.top-head-wrap {
    transition: background-color 0.3s ease !important;
}

/* Override customizer background color when settings panel has saved settings */
.top-head-wrap[data-settings-active="true"] {
    background-color: transparent !important;
}

/* Ensure smooth transition when switching between customizer and settings panel */
.top-head-wrap {
    background-color: transparent;
    color: #fff;
}

/* Additional fix for immediate application */
.top-head-wrap.settings-panel-active {
    background-color: transparent !important;
} 

/* Console Fixes and Additional Styles */

/* Hide hero title when option is enabled */
.hero-title-hidden .page-hero-title,
.hero-title-hidden .hero-title {
    display: none !important;
}

/* Hide unnecessary hero classes that appear as text */
.hero::before,
.hero::after,
.hero-default::before,
.hero-default::after,
.page-hero-lg::before,
.page-hero-lg::after {
    content: none !important;
}

/* Hide any text content that might be generated by hero classes */
.hero:not(.page-hero) {
    display: none !important;
}

/* Hide any text that might be generated by CSS classes */
.page-hero .hero,
.page-hero .hero-default,
.page-hero .page-hero-lg {
    font-size: 0 !important;
    color: transparent !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
}

/* Hide any text content that might be generated by CSS pseudo-elements */
.page-hero::after,
.page-hero-lg::after {
    content: none !important;
    display: none !important;
}

/* Ensure only the actual content is visible */
.page-hero .hero-content {
    font-size: inherit !important;
    color: inherit !important;
    text-indent: 0 !important;
    overflow: visible !important;
}

/* Hide any debug or development text that might appear */
.page-hero *[class*="hero"]:not(.hero-content):not(.hero-title):not(.hero-subtitle) {
    font-size: 0 !important;
    color: transparent !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
}

/* Hide any text that might be generated by CSS classes or pseudo-elements */
.page-hero::before,
.page-hero::after,
.page-hero-lg::before,
.page-hero-lg::after,
.hero::before,
.hero::after,
.hero-default::before,
.hero-default::after {
    content: none !important;
    display: none !important;
    visibility: hidden !important;
}

/* Hide any text content that might be generated by CSS */
.page-hero {
    font-size: inherit !important;
}

.page-hero > *:not(.hero-content) {
    font-size: 0 !important;
    color: transparent !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
}

/* Hide any text that might be generated by CSS classes themselves */
.page-hero[class*="hero"] {
    font-size: inherit !important;
}

.page-hero[class*="hero"]::before,
.page-hero[class*="hero"]::after {
    content: none !important;
    display: none !important;
    visibility: hidden !important;
}

/* Ensure only the actual content is visible and properly styled */
.page-hero .hero-content,
.page-hero .page-hero-title,
.page-hero .page-hero-subtitle,
.page-hero .hero-title,
.page-hero .hero-subtitle {
    font-size: inherit !important;
    color: inherit !important;
    text-indent: 0 !important;
    overflow: visible !important;
    visibility: visible !important;
}

/* Hide any text that might be generated by CSS classes */
.page-hero .hero,
.page-hero .hero-default,
.page-hero .page-hero-lg {
    font-size: 0 !important;
    color: transparent !important;
    text-indent: -9999px !important;
    overflow: hidden !important;
    visibility: hidden !important;
}

/* Hide any text that might be generated by CSS pseudo-elements */
.page-hero::before,
.page-hero::after,
.page-hero-lg::before,
.page-hero-lg::after,
.hero::before,
.hero::after,
.hero-default::before,
.hero-default::after {
    content: none !important;
    display: none !important;
    visibility: hidden !important;
}

/* Reduce hero section height when title is hidden */
.hero-title-hidden .page-hero {
    min-height: 150px !important;
    height: auto !important;
    padding: 30px 0 !important;
}

.hero-title-hidden .page-hero-lg {
    min-height: 150px !important;
    height: auto !important;
}

/* Reduce hero content spacing when title is hidden */
.hero-title-hidden .hero-content {
    padding: 20px 0 !important;
}

/* Optimize hero section when only subtitle exists */
.page-hero:not(.hero-title-hidden) .page-hero-subtitle:first-child {
    margin-top: 0;
    font-size: 1.2em;
}

/* Hide hero section completely if no content */
.page-hero:empty,
.page-hero:blank {
    display: none !important;
}

/* Compact hero section when minimal content */
.page-hero.compact-hero {
    min-height: 120px !important;
    padding: 20px 0 !important;
}

.page-hero.compact-hero .hero-content {
    padding: 15px 0 !important;
}

/* Hero section size options */
.page-hero.hero-size-compact {
    min-height: 120px !important;
    padding: 20px 0 !important;
}

.page-hero.hero-size-compact .hero-content {
    padding: 15px 0 !important;
}

.page-hero.hero-size-normal {
    min-height: 300px !important;
    padding: 60px 0 !important;
}

.page-hero.hero-size-large {
    min-height: 400px !important;
    padding: 80px 0 !important;
}

.page-hero.hero-size-large .hero-title {
    font-size: 48px !important;
}

.page-hero.hero-size-large .hero-subtitle {
    font-size: 28px !important;
}

/* Additional fixes for console errors */
.wp-block-navigation__responsive-container-open {
    display: none !important;
}

.wp-block-navigation__responsive-container-close {
    display: none !important;
}

/* Fix for Elementor compatibility */
.elementor-widget-container {
    overflow: visible;
}

/* Fix for WooCommerce compatibility */
.woocommerce .woocommerce-ordering {
    margin-bottom: 20px;
}

/* Ensure navigation menu is always visible */
.head-nav {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.head-nav .nav {
    display: flex;
    align-items: center;
}

.head-nav .navigation-main {
    display: flex !important;
    list-style: none;
    margin: 0;
    padding: 0;
}

.head-nav .navigation-main > li {
    display: inline-block;
    position: relative;
}

.head-nav .navigation-main > li > a {
    display: block;
    padding: 15px 12px;
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.head-nav .navigation-main > li:hover > a,
.head-nav .navigation-main > li > a:focus {
    color: #4C3BCF;
}

/* Responsive navigation for different screen sizes */
@media (max-width: 1024px) {
    .head-nav .navigation-main > li > a {
        padding: 12px 8px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .head-nav .navigation-main > li > a {
        padding: 10px 6px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .head-nav .navigation-main > li > a {
        padding: 8px 4px;
        font-size: 12px;
    }
}

/* Fix for mobile menu */
@media (max-width: 768px) {
    .mobile-nav-trigger {
        display: block !important;
    }
    
    /* Ensure navigation is visible on mobile */
    .head-nav {
        display: flex !important;
        width: 100%;
        justify-content: center;
    }
    
    .head-nav .navigation-main {
        display: flex !important;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .head-nav .navigation-main > li {
        margin: 0 5px;
    }
    
    /* Reduce hero height on mobile when title is hidden */
    .hero-title-hidden .page-hero {
        min-height: 100px !important;
        padding: 20px 0 !important;
    }
    
    /* Compact hero on mobile */
    .page-hero.compact-hero {
        min-height: 80px !important;
        padding: 15px 0 !important;
    }
    
    /* Hero size options on mobile */
    .page-hero.hero-size-compact {
        min-height: 80px !important;
        padding: 15px 0 !important;
    }
    
    .page-hero.hero-size-normal {
        min-height: 200px !important;
        padding: 40px 0 !important;
    }
    
    .page-hero.hero-size-large {
        min-height: 250px !important;
        padding: 50px 0 !important;
    }
    
    .page-hero.hero-size-large .hero-title {
        font-size: 32px !important;
    }
    
    .page-hero.hero-size-large .hero-subtitle {
        font-size: 20px !important;
    }
} 

/* WooCommerce Helper Class Warning Fix */
/* This suppresses the "Undefined array key 1" warning from WooCommerce helper class */

/* Hide WooCommerce helper warnings in admin */
.wc-helper-notice {
    display: none !important;
}

/* Suppress WooCommerce helper errors in debug log */
.wc-helper-error {
    display: none !important;
}

/* Additional fixes for WooCommerce admin warnings */
.woocommerce-helper-notice {
    display: none !important;
}

/* Fix for WooCommerce helper class array key warnings */
.wc-helper-array-warning {
    display: none !important;
} 