/* ============================================
   VISUAL EFFECTS - Advanced Visual Enhancements
   Medicate International 2026
   ============================================ */

/* ---- Custom Scrollbar ---- */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: #f0f4f8;
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #1a6b8a, #2d9cb8);
    border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #145a75, #1a6b8a);
}
html {
    scrollbar-width: thin;
    scrollbar-color: #1a6b8a #f0f4f8;
}

/* ---- Progress Bar (Top) ---- */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, #1a6b8a, #2d9cb8, #4ecdc4, #2d9cb8, #1a6b8a);
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
    z-index: 100000;
    transition: width 0.1s linear;
    border-radius: 0 2px 2px 0;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ---- Glassmorphism Cards ---- */
.glass-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.glass-card:hover {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-5px);
}

/* Apply glassmorphism to service cards */
.services-section .service-card,
.service-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(26, 107, 138, 0.1);
    border-radius: 20px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
    position: relative;
}
.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #1a6b8a, #4ecdc4);
    transform: scaleX(0);
    transition: transform 0.4s ease;
    transform-origin: right;
}
.service-card:hover::before {
    transform: scaleX(1);
    transform-origin: left;
}
.service-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 60px rgba(26, 107, 138, 0.2);
}

/* ---- Animated Gradient Borders ---- */
.gradient-border {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
}
.gradient-border::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #1a6b8a, #4ecdc4, #ff6b6b, #ffd93d, #1a6b8a);
    background-size: 400% 400%;
    animation: borderGradient 6s ease infinite;
    z-index: -1;
    border-radius: 18px;
}
.gradient-border::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: white;
    border-radius: 14px;
    z-index: -1;
}

@keyframes borderGradient {
    0% { background-position: 0% 50%; }
    25% { background-position: 100% 50%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
    100% { background-position: 0% 50%; }
}

/* ---- Gradient Mesh Backgrounds ---- */
.mesh-bg {
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(26, 107, 138, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(78, 205, 196, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 80%, rgba(45, 156, 184, 0.08) 0%, transparent 50%),
        linear-gradient(135deg, #f8fbfd 0%, #eef5f9 100%);
}

/* ---- Parallax Sections ---- */
.parallax-section {
    position: relative;
    overflow: hidden;
}
.parallax-bg {
    position: absolute;
    top: -50%;
    left: 0;
    width: 100%;
    height: 200%;
    background-size: cover;
    background-position: center;
    will-change: transform;
    z-index: -1;
}

/* ---- Floating Elements ---- */
.floating-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}
.float-el {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    animation: floatAnimation var(--duration, 8s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}
.float-el:nth-child(1) {
    width: 80px; height: 80px;
    background: #1a6b8a;
    top: 10%; left: 5%;
    --duration: 7s; --delay: 0s;
}
.float-el:nth-child(2) {
    width: 120px; height: 120px;
    background: #4ecdc4;
    top: 60%; right: 10%;
    --duration: 9s; --delay: 1s;
}
.float-el:nth-child(3) {
    width: 60px; height: 60px;
    background: #2d9cb8;
    top: 30%; right: 25%;
    --duration: 6s; --delay: 2s;
}
.float-el:nth-child(4) {
    width: 100px; height: 100px;
    background: #1a6b8a;
    bottom: 20%; left: 15%;
    --duration: 10s; --delay: 3s;
}
.float-el:nth-child(5) {
    width: 50px; height: 50px;
    background: #4ecdc4;
    top: 50%; left: 40%;
    --duration: 8s; --delay: 1.5s;
}

@keyframes floatAnimation {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(20px, -30px) rotate(5deg); }
    50% { transform: translate(-10px, 20px) rotate(-3deg); }
    75% { transform: translate(15px, 10px) rotate(3deg); }
}

/* ---- Morphing Shapes (Background Blobs) ---- */
.morphing-blob {
    position: absolute;
    border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%;
    animation: morphBlob 12s ease-in-out infinite;
    opacity: 0.06;
    filter: blur(40px);
}
.morphing-blob:nth-child(1) {
    width: 400px; height: 400px;
    background: #1a6b8a;
    top: -100px; right: -100px;
    animation-duration: 12s;
}
.morphing-blob:nth-child(2) {
    width: 300px; height: 300px;
    background: #4ecdc4;
    bottom: -50px; left: -50px;
    animation-duration: 15s;
    animation-delay: -5s;
}

@keyframes morphBlob {
    0%, 100% { border-radius: 40% 60% 70% 30% / 40% 50% 60% 50%; }
    25% { border-radius: 70% 30% 50% 50% / 30% 60% 40% 70%; }
    50% { border-radius: 50% 50% 30% 70% / 60% 40% 70% 30%; }
    75% { border-radius: 30% 70% 60% 40% / 50% 70% 30% 60%; }
}

/* ---- Neumorphism Buttons ---- */
.btn-neu {
    background: #f0f4f8;
    border: none;
    border-radius: 12px;
    padding: 14px 28px;
    box-shadow: 6px 6px 12px #d1d9e6, -6px -6px 12px #ffffff;
    transition: all 0.3s ease;
    color: #1a6b8a;
    font-weight: 600;
    cursor: pointer;
}
.btn-neu:hover {
    box-shadow: 4px 4px 8px #d1d9e6, -4px -4px 8px #ffffff;
    transform: translateY(-2px);
}
.btn-neu:active {
    box-shadow: inset 4px 4px 8px #d1d9e6, inset -4px -4px 8px #ffffff;
    transform: translateY(0);
}

/* ---- 3D Tilt Cards ---- */
.tilt-card {
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.1s ease;
}
.tilt-card .tilt-content {
    transform: translateZ(30px);
    transition: transform 0.3s ease;
}
.tilt-card:hover .tilt-content {
    transform: translateZ(50px);
}

/* ---- Text Reveal Animation ---- */
.text-reveal {
    overflow: hidden;
}
.text-reveal span {
    display: inline-block;
    transform: translateY(100%);
    opacity: 0;
    animation: textReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes textReveal {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ---- Typewriter Effect ---- */
.typewriter-container {
    display: inline-block;
    position: relative;
}
.typewriter-text {
    color: #4ecdc4;
    font-weight: 700;
    border-left: 3px solid #4ecdc4;
    padding-left: 8px;
    animation: cursorBlink 1s step-end infinite;
}

@keyframes cursorBlink {
    0%, 100% { border-color: #4ecdc4; }
    50% { border-color: transparent; }
}

/* ---- Animated SVG Icons ---- */
.animated-icon {
    transition: all 0.4s ease;
}
.animated-icon:hover {
    transform: scale(1.2) rotate(5deg);
}
.pulse-icon {
    animation: pulseIcon 2s ease-in-out infinite;
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ---- Image Comparison Slider ---- */
.comparison-slider {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}
.comparison-slider img {
    width: 100%;
    display: block;
}
.comparison-slider .before-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 100%;
    overflow: hidden;
}
.comparison-slider .before-img img {
    width: 200%;
    max-width: none;
}
.comparison-slider .slider-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: white;
    cursor: ew-resize;
    z-index: 10;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}
.comparison-slider .slider-handle::after {
    content: '⟷';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    color: #1a6b8a;
}

/* ---- Particle Canvas ---- */
#particles-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ---- Cursor Trail ---- */
.cursor-dot {
    position: fixed;
    width: 8px;
    height: 8px;
    background: rgba(26, 107, 138, 0.6);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transition: opacity 0.3s ease;
    mix-blend-mode: multiply;
}
.cursor-ring {
    position: fixed;
    width: 30px;
    height: 30px;
    border: 2px solid rgba(26, 107, 138, 0.3);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99998;
    transition: all 0.15s ease;
    mix-blend-mode: multiply;
}

/* ---- Page Transition ---- */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a6b8a, #2d9cb8);
    z-index: 999999;
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.5s cubic-bezier(0.86, 0, 0.07, 1);
    pointer-events: none;
}
.page-transition-overlay.active {
    transform: scaleY(1);
    transform-origin: top;
}

/* ---- Hover Reveal Images ---- */
.hover-reveal {
    position: relative;
    overflow: hidden;
}
.hover-reveal .reveal-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transform: scale(1.1);
    transition: all 0.5s ease;
    z-index: -1;
}
.hover-reveal:hover .reveal-img {
    opacity: 0.2;
    transform: scale(1);
}

/* ---- Animated Counter Styles ---- */
.counter-value {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #1a6b8a, #4ecdc4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---- Responsive Adjustments ---- */
@media (max-width: 768px) {
    .cursor-dot, .cursor-ring {
        display: none !important;
    }
    .float-el {
        display: none;
    }
    .morphing-blob {
        width: 200px !important;
        height: 200px !important;
    }
    .comparison-slider {
        max-width: 100%;
    }
    #particles-canvas {
        opacity: 0.5;
    }
}

/* ---- Dark Mode Adjustments ---- */
[data-theme="dark"] .glass-card,
[data-theme="dark"] .service-card {
    background: rgba(30, 40, 50, 0.85);
    border-color: rgba(78, 205, 196, 0.2);
}
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #1a2332;
}
[data-theme="dark"] .mesh-bg {
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(26, 107, 138, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(78, 205, 196, 0.15) 0%, transparent 50%),
        linear-gradient(135deg, #0d1b2a 0%, #1a2332 100%);
}
[data-theme="dark"] .btn-neu {
    background: #1a2332;
    box-shadow: 6px 6px 12px #0d1520, -6px -6px 12px #273040;
    color: #4ecdc4;
}
[data-theme="dark"] .gradient-border::after {
    background: #1a2332;
}
[data-theme="dark"] .cursor-dot {
    background: rgba(78, 205, 196, 0.6);
}
[data-theme="dark"] .cursor-ring {
    border-color: rgba(78, 205, 196, 0.3);
}
