/**
 * Typing Effect CSS Styles
 * Beautiful typing animations for text content
 */

/* Main typing effect container */
.typing-effect-container {
    display: inline-block;
    position: relative;
    overflow: hidden;
}

/* Text wrapper */
.typing-text-wrapper {
    display: inline-flex;
    align-items: center;
    position: relative;
}

/* The actual text content */
.typing-text-content {
    display: inline-block;
    font-weight: inherit;
    color: inherit;
    font-size: inherit;
    white-space: nowrap;
    position: relative;
    /* Fix blur issues */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    /* Ensure proper text rendering */
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Typing cursor */
.typing-cursor {
    display: inline-block;
    font-weight: 300;
    color: #FFD700;
    animation: blink-cursor 1.2s infinite;
    margin-left: 3px;
    font-size: 1em;
    line-height: 1;
    user-select: none;
}

/* Cursor animations */
@keyframes blink-cursor {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Active typing cursor */
.typing-cursor.typing {
    color: #4CAF50;
    animation: pulse-typing 0.6s ease-in-out infinite alternate;
}

/* Active deleting cursor */
.typing-cursor.deleting {
    color: #F44336;
    animation: pulse-deleting 0.4s ease-in-out infinite alternate;
}

@keyframes pulse-typing {
    from { 
        opacity: 1; 
        transform: scale(1);
        text-shadow: 0 0 5px currentColor;
    }
    to { 
        opacity: 0.7; 
        transform: scale(1.1);
        text-shadow: 0 0 10px currentColor;
    }
}

@keyframes pulse-deleting {
    from { 
        opacity: 1; 
        transform: scale(1);
    }
    to { 
        opacity: 0.5; 
        transform: scale(0.9);
    }
}

/* Hero section typing effect */
.hero-typing-effect {
    font-size: 3.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
    margin-bottom: 1rem;
    /* Override any gradient text conflicts */
    -webkit-text-fill-color: initial !important;
    background: none !important;
    -webkit-background-clip: initial !important;
}

.hero-typing-effect .typing-text-content {
    /* Apply gradient effect specifically to typed text */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
    /* Fix blur by ensuring proper rendering */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.hero-typing-effect .typing-cursor {
    font-size: 0.9em;
    color: #FFD700;
    text-shadow: 0 0 10px #FFD700;
    /* Ensure cursor is always visible */
    -webkit-text-fill-color: #FFD700 !important;
    background: none !important;
}

/* Subtitle typing effect */
.subtitle-typing-effect {
    font-size: 1.5rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 1rem;
}

.subtitle-typing-effect .typing-cursor {
    color: rgba(255, 255, 255, 0.8);
}

/* Card title typing effect */
.card-title-typing-effect {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.card-title-typing-effect .typing-cursor {
    color: #667eea;
}

/* Responsive design */
@media (max-width: 1024px) {
    .hero-typing-effect {
        font-size: 3rem;
    }
    
    .typing-text-content {
        white-space: normal;
        word-break: break-word;
    }
}

@media (max-width: 768px) {
    .hero-typing-effect {
        font-size: 2.5rem;
        line-height: 1.3;
    }
    
    .subtitle-typing-effect {
        font-size: 1.2rem;
    }
    
    .typing-cursor {
        margin-left: 2px;
    }
}

@media (max-width: 480px) {
    .hero-typing-effect {
        font-size: 2rem;
        line-height: 1.4;
    }
    
    .subtitle-typing-effect {
        font-size: 1rem;
    }
    
    .card-title-typing-effect {
        font-size: 1.2rem;
    }
}

/* Animation entrance effects */
.typing-effect-container.fade-in {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Glow effect for special typing */
.typing-effect-glow .typing-text-content {
    text-shadow: 0 0 20px currentColor;
    animation: textGlow 2s ease-in-out infinite alternate;
}

@keyframes textGlow {
    from {
        text-shadow: 0 0 20px currentColor;
    }
    to {
        text-shadow: 0 0 30px currentColor, 0 0 40px currentColor;
    }
}

/* Underline effect */
.typing-effect-underline .typing-text-content {
    position: relative;
}

.typing-effect-underline .typing-text-content::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #FFD700, #FFA500);
    transform: scaleX(0);
    transform-origin: left;
    animation: underlineGrow 0.5s ease-out 0.5s forwards;
}

@keyframes underlineGrow {
    to {
        transform: scaleX(1);
    }
}

/* Gradient text effect */
.typing-effect-gradient .typing-text-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Multi-color typing effect */
.typing-effect-multicolor .typing-text-content {
    background: linear-gradient(
        45deg,
        #ff6b6b,
        #4ecdc4,
        #45b7d1,
        #96ceb4,
        #ffeaa7,
        #dda0dd,
        #98d8c8
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Loading dots effect */
.typing-loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 10px;
}

.typing-loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: loadingDots 1.4s infinite;
}

.typing-loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loadingDots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Special effects for different contexts */
.typing-effect-neon {
    color: #fff;
    text-shadow: 
        0 0 5px currentColor,
        0 0 10px currentColor,
        0 0 15px currentColor,
        0 0 20px #ff00de,
        0 0 35px #ff00de,
        0 0 40px #ff00de;
    animation: neonFlicker 2s infinite alternate;
}

@keyframes neonFlicker {
    0%, 18%, 22%, 25%, 53%, 57%, 100% {
        text-shadow: 
            0 0 5px currentColor,
            0 0 10px currentColor,
            0 0 15px currentColor,
            0 0 20px #ff00de,
            0 0 35px #ff00de,
            0 0 40px #ff00de;
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .typing-cursor,
    .typing-cursor.typing,
    .typing-cursor.deleting {
        animation: none;
        opacity: 1;
    }
    
    .typing-effect-glow .typing-text-content,
    .typing-effect-neon {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .typing-cursor {
        color: #fff;
        background: #000;
        padding: 0 2px;
    }
    
    .typing-text-content {
        text-shadow: none;
    }
}