/**
 * Enhanced UI/UX Styles
 * Dark Mode, Animations, Custom Cursor, Glassmorphism, etc.
 */

/* ===================================
   1. DARK/LIGHT MODE THEME
   =================================== */
:root[data-theme="light"] {
    --color-bg-primary: #ffffff;
    --color-bg-secondary: #f8f9fa;
    --color-bg-tertiary: #f1f3f5;
    --color-bg-card: rgba(255, 255, 255, 0.9);
    --color-text-primary: #1a1a24;
    --color-text-secondary: #52525b;
    --color-text-tertiary: #71717a;
    --color-border: rgba(0, 0, 0, 0.1);
    --color-shadow: rgba(0, 0, 0, 0.1);
    --color-glow: rgba(99, 102, 241, 0.1);
}

/* Dark Mode Toggle Button */
#darkModeToggle {
    position: fixed;
    top: 20px;
    right: 80px;
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#darkModeToggle:hover {
    transform: scale(1.1) rotate(20deg);
    box-shadow: 0 5px 20px var(--color-glow);
}

/* ===================================
   2. PARTICLES BACKGROUND
   =================================== */
#particles-js {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    opacity: 0.3;
}

/* ===================================
   3. SCROLL ANIMATIONS
   =================================== */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Different animation types */
.fade-in {
    opacity: 0;
    transition: opacity 0.8s ease;
}

.fade-in.animated {
    opacity: 1;
}

.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-left.animated {
    opacity: 1;
    transform: translateX(0);
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-right.animated {
    opacity: 1;
    transform: translateX(0);
}

.scale-in {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scale-in.animated {
    opacity: 1;
    transform: scale(1);
}

/* ===================================
   4. CUSTOM CURSOR
   =================================== */
.custom-cursor {
    width: 40px;
    height: 40px;
    border: 2px solid var(--color-accent-primary);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transition: width 0.2s, height 0.2s, border-color 0.2s;
    transform: translate(-50%, -50%);
    mix-blend-mode: difference;
}

.custom-cursor.hover {
    width: 60px;
    height: 60px;
    border-color: var(--color-accent-secondary);
}

.custom-cursor-dot {
    width: 8px;
    height: 8px;
    background: var(--color-accent-primary);
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: transform 0.2s;
}

.custom-cursor-dot.hover {
    transform: translate(-50%, -50%) scale(1.5);
}

/* Hide default cursor on hover-able elements */
body {
    cursor: none;
}

a, button, input, textarea {
    cursor: none;
}

/* Show normal cursor in chat widget */
#live-chat-widget,
#live-chat-widget *,
.chat-window,
.chat-window * {
    cursor: auto !important;
}

#live-chat-widget .chat-button {
    cursor: pointer !important;
}

#live-chat-widget button,
#live-chat-widget input,
#live-chat-widget textarea {
    cursor: text !important;
}

#live-chat-widget button,
#live-chat-widget .chat-close,
#live-chat-widget #chat-send {
    cursor: pointer !important;
}

/* ===================================
   5. LOADING SCREEN
   =================================== */
#pageLoader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--color-bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease;
}

#pageLoader.loaded {
    opacity: 0;
}

.loader-content {
    text-align: center;
}

.loader-logo {
    font-size: 3rem;
    font-weight: 700;
    background: var(--color-accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 1.5s ease-in-out infinite;
    margin-bottom: 2rem;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(99, 102, 241, 0.1);
    border-top-color: var(--color-accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.5rem;
}

.loader-progress-container {
    width: 200px;
    height: 4px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loader-progress {
    height: 100%;
    background: var(--color-accent-gradient);
    width: 0%;
    transition: width 0.3s ease;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

/* ===================================
   6. PARALLAX ELEMENTS
   =================================== */
.parallax {
    will-change: transform;
}

.parallax-bg {
    position: absolute;
    top: -20%;
    left: 0;
    width: 100%;
    height: 120%;
    object-fit: cover;
    z-index: -1;
}

/* ===================================
   7. ADVANCED HOVER EFFECTS
   =================================== */
.card, .service-card, .project-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    transform-style: preserve-3d;
}

.card:hover, .service-card:hover, .project-card:hover {
    box-shadow: 0 20px 60px rgba(99, 102, 241, 0.3);
}

/* Magnetic button effect */
.btn, .cta-button {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Shimmer effect on hover */
.btn::before, .cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before, .cta-button:hover::before {
    left: 100%;
}

/* Glow effect on links */
a {
    position: relative;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--color-accent-gradient);
    transition: width 0.3s ease;
}

a:hover::after {
    width: 100%;
}

/* ===================================
   8. GLASSMORPHISM DESIGN
   =================================== */
.glass {
    background: rgba(26, 26, 36, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .glass {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.glass-card {
    background: rgba(26, 26, 36, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: var(--spacing-lg);
    transition: all 0.3s ease;
}

.glass-card:hover {
    background: rgba(26, 26, 36, 0.8);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-5px);
}

/* ===================================
   9. SCROLL PROGRESS INDICATOR
   =================================== */
.scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: var(--color-accent-gradient);
    width: 0%;
    z-index: 9998;
    transition: width 0.1s ease;
    box-shadow: 0 0 10px var(--color-accent-primary);
}

/* ===================================
   RESPONSIVE ADJUSTMENTS
   =================================== */
@media (max-width: 768px) {
    .custom-cursor,
    .custom-cursor-dot {
        display: none;
    }
    
    body, a, button, input, textarea {
        cursor: auto !important;
    }
    
    #darkModeToggle {
        width: 45px;
        height: 45px;
        right: 70px;
    }
    
    .glass-card {
        backdrop-filter: blur(10px);
    }
}

/* ===================================
   SMOOTH TRANSITIONS
   =================================== */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Disable transitions during page load */
.preload * {
    transition: none !important;
}
