/* Base styles and utilities */
:where([class^="ri-"])::before {
    content: "\f3c2";
}

body {
    font-family: 'Inter', sans-serif;
}

/* Animation classes */
.parallax-bg {
    transform: translateY(var(--scroll-y, 0));
}

.wave-divider {
    clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
}

.diagonal-divider {
    clip-path: polygon(0 0, 100% 15%, 100% 100%, 0 85%);
}

.double-wave {
    clip-path: polygon(0 0, 100% 0, 100% 80%, 50% 90%, 0 80%);
}

.floating-animation {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.15);
}

.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple-effect:hover::after {
    width: 300px;
    height: 300px;
}

.glow-button {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.glow-button:hover {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.5);
}

.scroll-reveal {
    opacity: 0;
    transform: translateY(100px);
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.parallax-tilt {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.parallax-tilt:hover {
    transform: rotateX(var(--rotate-x)) rotateY(var(--rotate-y));
}

.text-gradient {
    background: linear-gradient(135deg, #3B82F6, #1E3A8A);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.magnetic-button {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Responsive improvements */
@media (max-width: 768px) {
    .floating-animation {
        animation-duration: 4s;
    }
    
    .card-hover:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .text-gradient {
        background: linear-gradient(135deg, #3B82F6, #1E3A8A);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #3B82F6;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1E3A8A;
}

/* Image styling and fallbacks */
.hero-image {
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    min-height: 384px;
}

.app-image {
    background: linear-gradient(135deg, #F8FAFC 0%, #E2E8F0 100%);
    min-height: 384px;
}

.caregiver-image {
    background: linear-gradient(135deg, #F1F5F9 0%, #CBD5E1 100%);
    min-width: 48px;
    min-height: 48px;
}

.hero-image::before,
.app-image::before,
.caregiver-image::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hero-image:not([src]),
.app-image:not([src]),
.caregiver-image:not([src]) {
    position: relative;
}

.hero-image:not([src])::before,
.app-image:not([src])::before,
.caregiver-image:not([src])::before {
    opacity: 1;
}

/* Loading state for images */
img {
    transition: opacity 0.3s ease;
}

img[src=""] {
    opacity: 0;
}

/* Ensure images maintain aspect ratio */
.hero-image,
.app-image {
    object-fit: cover;
    object-position: center;
}

.caregiver-image {
    object-fit: cover;
    object-position: center top;
}

/* Intro Animation - Care Connection Network */
.intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1E3A8A 0%, #0F172A 70%, #000000 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeOut 1s ease-out 6s forwards;
    opacity: 1;
    pointer-events: all;
}

.intro-overlay.hidden {
    display: none;
}

.network-container {
    position: relative;
    width: 500px;
    height: 350px;
    max-width: 90vw;
    max-height: 70vh;
}

.care-node {
    position: absolute;
    width: 16px;
    height: 16px;
    background: #3B82F6;
    border-radius: 50%;
    border: 2px solid rgba(59, 130, 246, 0.3);
    animation: nodeAppear 0.8s ease-out forwards;
    opacity: 0;
    transform: scale(0);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
}

.care-node.center {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3B82F6, #60A5FA);
    border: 3px solid rgba(255, 255, 255, 0.2);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: centerNodeAppear 1s ease-out 0.5s forwards;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.8), 0 0 60px rgba(59, 130, 246, 0.4);
}

.care-node:nth-child(1) { top: 20%; left: 20%; animation-delay: 1.5s; }
.care-node:nth-child(2) { top: 15%; left: 60%; animation-delay: 1.8s; }
.care-node:nth-child(3) { top: 30%; left: 85%; animation-delay: 2.1s; }
.care-node:nth-child(4) { top: 65%; left: 80%; animation-delay: 2.4s; }
.care-node:nth-child(5) { top: 85%; left: 45%; animation-delay: 2.7s; }
.care-node:nth-child(6) { top: 75%; left: 15%; animation-delay: 3s; }
.care-node:nth-child(7) { top: 45%; left: 10%; animation-delay: 3.3s; }

.connection-line {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.8), transparent);
    border-radius: 1px;
    animation: connectionDraw 1.5s ease-out forwards;
    opacity: 0;
    transform-origin: left;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.connection-line:nth-child(8) { 
    top: 25%; left: 25%; width: 160px; 
    transform: rotate(15deg); 
    animation-delay: 3.6s; 
}
.connection-line:nth-child(9) { 
    top: 22%; left: 58%; width: 120px; 
    transform: rotate(35deg); 
    animation-delay: 3.9s; 
}
.connection-line:nth-child(10) { 
    top: 52%; left: 38%; width: 180px; 
    transform: rotate(-20deg); 
    animation-delay: 4.2s; 
}
.connection-line:nth-child(11) { 
    top: 70%; left: 28%; width: 140px; 
    transform: rotate(-35deg); 
    animation-delay: 4.5s; 
}
.connection-line:nth-child(12) { 
    top: 75%; left: 45%; width: 160px; 
    transform: rotate(25deg); 
    animation-delay: 4.8s; 
}

.intro-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-family: 'Pacifico', cursive;
    font-size: 3rem;
    opacity: 0;
    animation: logoReveal 1s ease-out 5.2s forwards;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    z-index: 10;
}

.intro-tagline {
    position: absolute;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    font-weight: 300;
    text-align: center;
    opacity: 0;
    animation: taglineSlide 1s ease-out 5.6s forwards;
    letter-spacing: 1px;
}

.network-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    animation: networkPulse 2s ease-in-out infinite;
    animation-delay: 1s;
}

@keyframes nodeAppear {
    0% { 
        opacity: 0; 
        transform: scale(0) rotate(180deg); 
    }
    70% { 
        opacity: 1; 
        transform: scale(1.2) rotate(-10deg); 
    }
    100% { 
        opacity: 1; 
        transform: scale(1) rotate(0deg); 
    }
}

@keyframes centerNodeAppear {
    0% { 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0) rotate(0deg); 
    }
    50% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1.3) rotate(180deg); 
    }
    100% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1) rotate(360deg); 
    }
}

@keyframes connectionDraw {
    0% { 
        opacity: 0; 
        transform: scaleX(0) scaleY(0.5); 
    }
    50% { 
        opacity: 1; 
        transform: scaleX(0.5) scaleY(1); 
    }
    100% { 
        opacity: 0.8; 
        transform: scaleX(1) scaleY(1); 
    }
}

@keyframes logoReveal {
    0% { 
        opacity: 0; 
        transform: translate(-50%, -50%) scale(0.5) rotateY(-90deg); 
    }
    70% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1.1) rotateY(10deg); 
    }
    100% { 
        opacity: 1; 
        transform: translate(-50%, -50%) scale(1) rotateY(0deg); 
    }
}

@keyframes taglineSlide {
    0% { 
        opacity: 0; 
        transform: translateX(-50%) translateY(40px); 
    }
    100% { 
        opacity: 1; 
        transform: translateX(-50%) translateY(0); 
    }
}

@keyframes networkPulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1); 
        opacity: 0.6; 
    }
    50% { 
        transform: translate(-50%, -50%) scale(2); 
        opacity: 0.1; 
    }
}

@keyframes fadeOut {
    0% { 
        opacity: 1; 
        pointer-events: all; 
        transform: scale(1); 
    }
    100% { 
        opacity: 0; 
        pointer-events: none; 
        transform: scale(1.05); 
    }
}

/* Responsive adjustments for intro */
@media (max-width: 768px) {
    .network-container {
        width: 350px;
        height: 250px;
    }
    
    .intro-logo {
        font-size: 2.5rem;
    }
    
    .intro-tagline {
        font-size: 1rem;
        padding: 0 20px;
    }
    
    .care-node {
        width: 12px;
        height: 12px;
    }
    
    .care-node.center {
        width: 24px;
        height: 24px;
    }
}
