/* Main Footer */
.main-footer {
    background: var(--primary-gradient);
    color: var(--white);
    padding: 4rem 0 2rem;
    position: relative;
    margin-top: auto;
    z-index: 1;
    overflow: hidden;
    isolation: isolate; /* Creates a new stacking context */
}

.main-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--secondary-gradient);
    animation: footerGradientShift 3s ease infinite alternate;
    z-index: 2;
}

.main-footer::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 2;
}

/* Footer-specific animations - renamed to avoid conflicts */
@keyframes footerGradientShift {
    0% {
        background: linear-gradient(90deg, var(--secondary), var(--primary-light));
    }
    100% {
        background: linear-gradient(90deg, var(--primary-light), var(--secondary));
    }
}

/* Footer Content */
.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
    animation: footerFadeInUp 0.8s ease-out;
}

@keyframes footerFadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer Sections - Animation only applies to footer sections */
.footer-section {
    position: relative;
    animation: footerFadeIn 0.6s ease-out forwards;
    opacity: 0;
}

.footer-section:nth-child(1) { animation-delay: 0.1s; }
.footer-section:nth-child(2) { animation-delay: 0.2s; }
.footer-section:nth-child(3) { animation-delay: 0.3s; }
.footer-section:nth-child(4) { animation-delay: 0.4s; }

@keyframes footerFadeIn {
    to {
        opacity: 1;
    }
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    margin-bottom: 1.5rem;
    position: relative;
    padding: 10px 0;
    animation: footerLogoSlide 1s ease-out;
}

@keyframes footerLogoSlide {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.logo::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--secondary-gradient);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo:hover::before {
    width: 100%;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.logo-text span:first-child {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--white) 0%, var(--primary-lighter) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: footerTextGlow 2s ease-in-out infinite alternate;
}

.logo-text span:last-child {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--secondary-lighter);
    letter-spacing: 0.5px;
}

@keyframes footerTextGlow {
    from {
        filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.3));
    }
    to {
        filter: drop-shadow(0 0 10px rgba(0, 180, 216, 0.5));
    }
}

.footer-section p {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Footer Headings */
.footer-section h4 {
    color: var(--white);
    margin-bottom: 1.8rem;
    font-size: 1.2rem;
    font-weight: 700;
    position: relative;
    padding-bottom: 10px;
    animation: footerHeadingSlide 0.5s ease-out;
}

@keyframes footerHeadingSlide {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.footer-section h4::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--secondary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.footer-section:hover h4::after {
    width: 60px;
}

/* Footer Links */
.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 0.75rem;
    position: relative;
    animation: footerListItemFade 0.4s ease-out forwards;
    opacity: 0;
    transform: translateX(-10px);
}

.footer-links li:nth-child(1) { animation-delay: 0.1s; }
.footer-links li:nth-child(2) { animation-delay: 0.2s; }
.footer-links li:nth-child(3) { animation-delay: 0.3s; }
.footer-links li:nth-child(4) { animation-delay: 0.4s; }
.footer-links li:nth-child(5) { animation-delay: 0.5s; }

@keyframes footerListItemFade {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.footer-links a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    position: relative;
}

.footer-links a::before {
    content: '→';
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    color: var(--secondary);
}

.footer-links a:hover {
    color: var(--white);
    padding-left: 10px;
}

.footer-links a:hover::before {
    opacity: 1;
    transform: translateX(0);
}

/* Social Links */
.social-links {
    display: flex;
    gap: 15px;
    margin-top: 2rem;
    animation: footerSocialSlide 0.8s ease-out;
}

@keyframes footerSocialSlide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.social-links a {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.social-links a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.social-links a:hover::before {
    left: 100%;
}

.social-links a:hover {
    background: var(--primary-light);
    transform: translateY(-5px) scale(1.1);
    box-shadow: var(--secondary-glow);
    color: var(--white);
}

.social-links a i {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.social-links a:hover i {
    transform: scale(1.2);
}

/* Newsletter Form */
.newsletter-form {
    animation: footerFormSlide 0.6s ease-out;
    position: relative;
}

@keyframes footerFormSlide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.input-group {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.input-group:focus-within {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2);
}

.form-control {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 20px;
    color: var(--white);
    font-size: 0.95rem;
    outline: none;
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.btn {
    background: var(--secondary-gradient);
    border: none;
    color: var(--white);
    padding: 0 25px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn::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.6s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    background: linear-gradient(135deg, var(--secondary-dark), var(--secondary));
    transform: translateX(3px);
    box-shadow: var(--secondary-glow);
}

.btn i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.btn:hover i {
    transform: translateX(3px) rotate(-15deg);
}

/* Copyright */
.copyright {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    position: relative;
    animation: footerCopyrightFade 1s ease-out;
}

@keyframes footerCopyrightFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.copyright::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 2px;
    background: var(--secondary);
    border-radius: 2px;
}

.copyright p {
    animation: footerPulse 2s ease-in-out infinite;
}

@keyframes footerPulse {
    0%, 100% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
}

/* Background Elements - Properly scoped */
.bg-elements {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
    opacity: 0.2; /* Further reduced for better visual balance */
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 180, 216, 0.08) 0%, transparent 70%);
    animation: footerFloat 20s infinite ease-in-out;
    z-index: 0;
}

.bg-circle:nth-child(1) {
    width: 300px;
    height: 300px;
    top: -150px;
    right: -100px;
    animation-delay: 0s;
}

.bg-circle:nth-child(2) {
    width: 200px;
    height: 200px;
    bottom: 100px;
    left: -50px;
    animation-delay: 5s;
}

.bg-circle:nth-child(3) {
    width: 150px;
    height: 150px;
    top: 50%;
    right: 30%;
    animation-delay: 10s;
}

@keyframes footerFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    33% {
        transform: translateY(-20px) rotate(120deg);
    }
    66% {
        transform: translateY(20px) rotate(240deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .main-footer {
        padding: 3rem 0 1.5rem;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .copyright {
        padding-top: 1.5rem;
    }
    
    /* Disable animations on mobile for better performance */
    .footer-section,
    .logo,
    .footer-links li,
    .social-links,
    .newsletter-form,
    .copyright {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

@media (max-width: 480px) {
    .logo-text span:first-child {
        font-size: 1.2rem;
    }
    
    .social-links a {
        width: 40px;
        height: 40px;
    }
    
    .form-control {
        padding: 12px 15px;
    }
    
    .btn {
        padding: 0 20px;
    }
}