/* ============================================
   JkCharry | Jkey's - Estilos Premium Optimizados
   Performance: GPU Acceleration + Reduced Repaints
   ============================================ */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --bg-dark: #0f172a;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Lexend', -apple-system, BlinkMacSystemFont, sans-serif;
    background: radial-gradient(circle at 50% 50%, #0f172a 0%, #020617 100%);
    color: #e6eef8;
    contain: layout style;
}

/* Improve selection visibility */
::selection {
    background: rgba(99, 102, 241, 0.3);
    color: #fff;
}

/* Optimized Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #020617;
}

::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 5px;
    border: 3px solid #020617;
}

::-webkit-scrollbar-thumb:hover {
    background: #4f46e5;
}

/* ===== PARTICLES BACKGROUND (GPU Accelerated) ===== */
#tsparticles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    will-change: transform;
    transform: translateZ(0);
    contain: strict;
}

/* ===== GLASSMORPHISM (Optimized) ===== */
.glass {
    background: rgba(255, 255, 255, 0.06);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transform: translateZ(0);
}

/* ===== GRADIENT TEXT (GPU Accelerated) ===== */
.gradient-text {
    background: linear-gradient(to right, #00c6ff, #ff00cc, #00c6ff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientMove 3s linear infinite;
    will-change: background-position;
}

.gradient-text-animated {
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899, #f59e0b, #6366f1);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease infinite;
    will-change: background-position;
}

@keyframes gradientMove {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

@keyframes gradientShift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* ===== HOVER EFFECTS (GPU Accelerated with transform3d) ===== */
.hover-lift {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        box-shadow 0.4s ease,
        border-color 0.3s ease;
    will-change: transform;
    transform: translateZ(0);
}

.hover-lift:hover {
    transform: translate3d(0, -12px, 0) scale(1.02);
    box-shadow: 0 20px 50px rgba(79, 70, 229, 0.3);
    border-color: rgba(99, 102, 241, 0.4);
}

.hover-lift i {
    transition: transform 0.4s ease;
}

.hover-lift:hover i {
    transform: scale(1.2) rotate(5deg);
}

/* ===== BUTTON GLOW (Optimized Animation) ===== */
.btn-glow {
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
}

.btn-glow::before {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 120%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    transition: left 0.6s ease;
    will-change: left;
}

.btn-glow:hover::before {
    left: 100%;
}

/* ===== CHAT WINDOW (GPU Accelerated) ===== */
.chat-window {
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1),
        opacity 0.25s ease;
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* ===== TYPING INDICATOR (Optimized) ===== */
.typing-indicator span {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 4px;
    background: #64748B;
    border-radius: 50%;
    animation: dot 1.2s infinite;
    will-change: transform;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes dot {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

/* ===== PROGRESS BAR (GPU Accelerated) ===== */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #4F46E5, #818CF8);
    width: 0;
    z-index: 9999;
    transform: translateZ(0);
    will-change: width;
}

/* ===== FORM INPUTS (Optimized Transitions) ===== */
.form-input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #818CF8;
}

.form-input.error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.06);
}

/* ===== ACCESSIBILITY ===== */
.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== MOBILE MENU (GPU Accelerated) ===== */
.mobile-menu {
    transition: transform 0.3s ease-in-out;
    will-change: transform;
    transform: translateX(100%);
}

.mobile-menu.open {
    transform: translateX(0);
}

/* ===== PULSE ANIMATION (Optimized) ===== */
.pulse-glow {
    animation: pulse 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    will-change: opacity;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.16;
    }

    50% {
        opacity: 0.24;
    }
}

/* ===== FADE IN SECTIONS (GPU Accelerated with content-visibility) ===== */
.fade-in-section {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
    transition: opacity 0.6s ease, transform 0.6s ease;
    will-change: opacity, transform;
    content-visibility: auto;
    contain-intrinsic-size: 0 500px;
}

.fade-in-section.visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

/* ===== LAZY LOADING FOR IMAGES ===== */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded,
img[loading="lazy"]:not([src=""]) {
    opacity: 1;
}

/* ===== REDUCED MOTION (Accessibility) ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .fade-in-section {
        opacity: 1;
        transform: none;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Reduce particles on mobile for performance */
    #tsparticles {
        opacity: 0.5;
    }
}

/* ===== PRINT STYLES ===== */
@media print {

    #tsparticles,
    .chat-window,
    #chat-bubble,
    .progress-bar {
        display: none !important;
    }
}