/**
 * Enhanced Elementor Split Characters - Styles
 * 
 * CSS styles for split text animations with RTL and responsive support
 */

/* Base styles for split text elements */
.eesc-word,
.eesc-char,
.eesc-line {
    display: inline-block;
    position: relative;
}

.eesc-word {
    white-space: nowrap;
}

.eesc-char {
    transform-origin: center bottom;
}

.eesc-line {
    display: block;
    overflow: hidden;
}

/* Preview styles for Elementor editor */
.eesc-word-preview,
.eesc-char-preview,
.eesc-line-preview {
    display: inline-block;
    position: relative;
}

.eesc-word-preview {
    white-space: nowrap;
}

.eesc-char-preview {
    transform-origin: center bottom;
}

.eesc-line-preview {
    display: block;
    overflow: hidden;
}

/* Animation container styles */
[data-eesc-animation="true"] {
    overflow: visible !important;
}

/* Prevent text selection during animations */
.eesc-animating {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* RTL support */
.rtl .eesc-word,
.rtl .eesc-char {
    direction: rtl;
    unicode-bidi: bidi-override;
}

/* Arabic text optimization */
.eesc-arabic .eesc-word {
    font-feature-settings: "liga" 1, "calt" 1, "kern" 1;
    text-rendering: optimizeLegibility;
}

/* Performance optimizations */
.eesc-word,
.eesc-char,
.eesc-line {
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

/* High performance mode */
.eesc-performance-high .eesc-word,
.eesc-performance-high .eesc-char,
.eesc-performance-high .eesc-line {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Typewriter animation styles */
.eesc-typewriter {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid;
    animation: eesc-blink-caret 1s step-end infinite;
}

@keyframes eesc-blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: currentColor; }
}

/* Responsive design */
@media (max-width: 768px) {
    .eesc-word,
    .eesc-char {
        font-size: inherit;
    }
    
    /* Reduce animation complexity on mobile */
    .eesc-mobile-optimized .eesc-char {
        display: inline;
        transform: none !important;
    }
    
    .eesc-mobile-optimized .eesc-word {
        display: inline-block;
    }
}

@media (max-width: 480px) {
    /* Further mobile optimizations */
    .eesc-word,
    .eesc-char,
    .eesc-line {
        will-change: auto;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .eesc-word,
    .eesc-char,
    .eesc-line {
        animation: none !important;
        transition: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
}

/* Print styles */
@media print {
    .eesc-word,
    .eesc-char,
    .eesc-line {
        display: inline !important;
        transform: none !important;
        opacity: 1 !important;
    }
}

/* Loading states */
.eesc-loading {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.eesc-loaded {
    opacity: 1;
}

/* Error states */
.eesc-error {
    opacity: 1 !important;
    transform: none !important;
}

/* Animation-specific styles */

/* Fade animations */
.eesc-fade-in {
    opacity: 0;
}

/* Slide animations */
.eesc-slide-up {
    transform: translateY(30px);
    opacity: 0;
}

.eesc-slide-down {
    transform: translateY(-30px);
    opacity: 0;
}

.eesc-slide-left {
    transform: translateX(-30px);
    opacity: 0;
}

.eesc-slide-right {
    transform: translateX(30px);
    opacity: 0;
}

/* RTL slide adjustments */
.rtl .eesc-slide-left {
    transform: translateX(30px);
}

.rtl .eesc-slide-right {
    transform: translateX(-30px);
}

/* Zoom animations */
.eesc-zoom-in {
    transform: scale(0.5);
    opacity: 0;
}

/* Rotation animations */
.eesc-rotate-in {
    transform: rotate(-180deg) scale(0.5);
    opacity: 0;
}

/* Flip animations */
.eesc-flip-x {
    transform: rotateX(-90deg);
    opacity: 0;
}

.eesc-flip-y {
    transform: rotateY(-90deg);
    opacity: 0;
}

/* Bounce animation */
.eesc-bounce-in {
    transform: scale(0.3);
    opacity: 0;
}

/* Elastic animation */
.eesc-elastic {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
}

/* Custom animation classes for specific effects */
.eesc-glow {
    text-shadow: 0 0 10px currentColor;
}

.eesc-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.eesc-outline {
    -webkit-text-stroke: 1px currentColor;
    text-stroke: 1px currentColor;
    color: transparent;
}

/* Elementor editor specific styles */
.elementor-editor-active .eesc-word,
.elementor-editor-active .eesc-char,
.elementor-editor-active .eesc-line {
    pointer-events: none;
}

/* Preview button styles */
.eesc-preview-btn {
    width: 100%;
    margin-top: 10px;
    background: #71d7f7 !important;
    border-color: #71d7f7 !important;
    color: #fff !important;
}

.eesc-preview-btn:hover {
    background: #5bc0de !important;
    border-color: #5bc0de !important;
}

.eesc-preview-btn i {
    margin-right: 5px;
}

/* Animation timing adjustments for better UX */
.eesc-word {
    transition-timing-function: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.eesc-char {
    transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Smooth font rendering */
.eesc-word,
.eesc-char,
.eesc-line {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* GPU acceleration for better performance */
.eesc-gpu-accelerated {
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
}

/* Prevent layout shifts during animation */
.eesc-stable-layout {
    contain: layout style paint;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .eesc-typewriter {
        border-color: rgba(255, 255, 255, 0.7);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .eesc-shadow {
        text-shadow: 3px 3px 0 #000;
    }
    
    .eesc-outline {
        -webkit-text-stroke: 2px currentColor;
        text-stroke: 2px currentColor;
    }
}

/* Animation performance indicators */
.eesc-performance-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 9999;
    display: none;
}

.eesc-debug .eesc-performance-indicator {
    display: block;
}

/* Fallback styles for older browsers */
.no-transforms .eesc-word,
.no-transforms .eesc-char,
.no-transforms .eesc-line {
    display: inline;
    opacity: 1 !important;
}

/* Loading spinner for GSAP */
.eesc-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #71d7f7;
    animation: eesc-spin 1s ease-in-out infinite;
}

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