/* 
    Terra AI Solutions - Custom Styles
    Theme: Deep Space (Blue/Purple AI vibe)
*/

:root {
    --primary: #3b82f6;
    /* Blue */
    --secondary: #8b5cf6;
    /* Purple */
    --accent: #14b8a6;
    /* Teal/Cyan */
    --bg-main: #020617;
    /* Slate 950 */
    --bg-darker: #000000;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.05);
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Preloader */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-main);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
}

.preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preloader-logo {
    width: 320px;
    height: auto;
    margin-bottom: 30px;
    mix-blend-mode: screen;
    animation: pulse-logo 2s ease-in-out infinite;
    filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.4));
}

.spinner-container {
    position: relative;
    width: 60px;
    height: 60px;
}

.glow-spinner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--primary);
    border-bottom-color: var(--secondary);
    animation: spin 1.5s linear infinite;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4), inset 0 0 20px rgba(139, 92, 246, 0.4);
}

.fade-text {
    animation: pulse-opacity 2s ease-in-out infinite;
    font-size: 0.95rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse-logo {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.4));
    }

    50% {
        transform: scale(1.1);
        filter: drop-shadow(0 0 25px rgba(59, 130, 246, 0.8));
    }

    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 15px rgba(139, 92, 246, 0.4));
    }
}

@keyframes pulse-opacity {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }

    100% {
        opacity: 0.5;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Typography Utilities */
.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, var(--accent) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    animation: text-shine 5s linear infinite;
}

.tracking-wide {
    letter-spacing: 0.15em;
}

.fs-7 {
    font-size: 0.85rem;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Navbar */
.navbar {
    transition: all 0.3s ease;
    padding: 1rem 0;
}

.navbar.scrolled {
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.5rem 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.navbar .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    transition: all 0.3s;
    font-weight: 500;
}

.navbar .navbar-nav .nav-link:hover,
.navbar .navbar-nav .nav-link.active {
    color: var(--accent) !important;
    text-shadow: 0 0 10px rgba(20, 184, 166, 0.4);
}

.section-bg {
    background-color: rgba(255, 255, 255, 0.015);
}

.custom-toggler {
    border-color: #ffffff;
    background: var(--glass-bg);
}

.custom-toggler .navbar-toggler-icon {
    filter: invert(1) brightness(100%) !important;
    color: #ffffff !important;
}

/* Brand Logo */
.brand-logo {
    transition: all 0.3s ease;
    mix-blend-mode: screen;
}

.navbar-brand:hover .brand-logo {
    transform: scale(1.05);
    filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.4));
}


/* Buttons */
.btn-primary {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    border: none;
    color: white;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(to right, #2563eb, #7c3aed);
    transform: translateY(-2px);
    color: white;
}

.btn-glow {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.btn-glow:hover {
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.6);
}

.glass-btn {
    backdrop-filter: blur(4px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
}

/* Hero Section */
.hero-section {
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.1) 0%, rgba(2, 6, 23, 1) 50%);
}

.relative-z {
    position: relative;
    z-index: 2;
}

.badge-glow {
    background: rgba(20, 184, 166, 0.1);
    color: var(--accent);
    border: 1px solid rgba(20, 184, 166, 0.3);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 1px;
    border-radius: 50px;
}

.image-glow {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 0 30px rgba(59, 130, 246, 0.3));
    animation: floating 6s ease-in-out infinite;
}

.hero-image-wrapper {
    position: relative;
}

.floating-card {
    position: absolute;
    bottom: -20px;
    left: -20px;
    padding: 15px 25px;
    border-radius: 12px;
    z-index: 3;
    animation: floating-inverse 5s ease-in-out infinite;
}

.floating-shape {
    position: absolute;
    filter: blur(80px);
    z-index: 0;
    border-radius: 50%;
    opacity: 0.4;
    animation: pulse-slow 8s infinite alternate;
}

.shape-1 {
    width: 300px;
    height: 300px;
    background: rgba(59, 130, 246, 0.5);
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 400px;
    height: 400px;
    background: rgba(139, 92, 246, 0.5);
    bottom: 10%;
    right: -100px;
    animation-delay: 2s;
}

/* Background Gradients */
.section-bg {
    background: linear-gradient(180deg, var(--bg-main) 0%, #040924 100%);
}

/* About Section */
.badge-proprietorship {
    position: absolute;
    bottom: 20px;
    right: -20px;
    border-radius: 15px;
    width: 140px;
    animation: floating 4s ease-in-out infinite;
}

/* Services */
.transition-hover {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.service-card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(139, 92, 246, 0.3);
    box-shadow: 0 10px 40px rgba(139, 92, 246, 0.15);
}

.icon-circle {
    transition: all 0.3s ease;
}

.service-card:hover .icon-circle {
    transform: scale(1.1);
}

.text-purple {
    color: #b06ab3 !important;
}

.bg-purple {
    background-color: #b06ab3 !important;
}

/* Contact form */
.custom-input {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.custom-input:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.custom-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.cta-glow-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    z-index: 0;
}

/* Custom Select Dropdowns */
.custom-select {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.custom-select:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.custom-select option {
    background-color: #0f172a;
    color: white;
}

/* Footer Links */
.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--primary);
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--glass-bg);
    color: white;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.social-icon:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

/* Animations Keyframes */
@keyframes text-shine {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

@keyframes floating {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0px);
    }
}

@keyframes floating-inverse {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(15px);
    }

    100% {
        transform: translateY(0px);
    }
}

@keyframes pulse-slow {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }

    100% {
        transform: scale(1.2);
        opacity: 0.6;
    }
}

@keyframes card-pulse-glow {
    0% {
        box-shadow: 0 0 15px rgba(20, 184, 166, 0.2);
        border-color: rgba(20, 184, 166, 0.3);
    }
    100% {
        box-shadow: 0 0 35px rgba(20, 184, 166, 0.9), inset 0 0 15px rgba(20, 184, 166, 0.4);
        border-color: rgba(20, 184, 166, 1);
    }
}


/* Intersection Observer Initial States */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.fade-in-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.fade-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.visible {
    opacity: 1;
    transform: translate(0) !important;
}

/* Animation Delays */
.delay-1 {
    transition-delay: 0.1s;
}

.delay-2 {
    transition-delay: 0.2s;
}

.delay-3 {
    transition-delay: 0.3s;
}

/* Responsive Adjustments */
@media (max-width: 991px) {
    .navbar {
        background: rgba(2, 6, 23, 0.95);
        backdrop-filter: blur(16px);
    }

    .hero-content {
        text-align: center;
    }

    .hero-content p {
        padding-right: 0 !important;
    }

    .hero-content .d-flex {
        justify-content: center;
    }

    .badge-proprietorship {
        right: 0;
        bottom: 0;
    }
}

/* Floating Action Buttons */
.whatsapp-float,
.chatbot-float {
    width: 60px;
    height: 60px;
    border-radius: 50px;
    text-align: center;
    font-size: 30px;
    transition: all 0.3s ease-in-out;
}

.whatsapp-float {
    box-shadow: 0px 4px 20px rgba(37, 211, 102, 0.4);
}

.chatbot-float {
    box-shadow: 0px 4px 20px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border: none;
}

.whatsapp-float:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0px 6px 25px rgba(37, 211, 102, 0.6);
    color: #FFF;
}

.chatbot-float:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0px 6px 25px rgba(59, 130, 246, 0.6);
    color: #FFF;
}

.whatsapp-float i,
.chatbot-float i {
    margin-top: 2px;
}

.navbar-toggler {
    color: #FFF !important;
}

/* FAQ Generator Styles */
.faq-count-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.faq-count-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}

.faq-count-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

/* Accordion Custom Styling */
.accordion-item {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 12px !important;
    margin-bottom: 10px;
    overflow: hidden;
}

.accordion-button {
    background: transparent !important;
    color: #fff !important;
    font-weight: 500;
    padding: 1.2rem;
    box-shadow: none !important;
}

.accordion-button:not(.collapsed) {
    background: rgba(139, 92, 246, 0.05) !important;
    color: var(--primary) !important;
}

.accordion-button::after {
    filter: invert(1);
}

.accordion-body {
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    padding-top: 0;
}

/* Custom Chatbot Window */
.ai-chatbot {
    position: fixed !important;
    bottom: 110px;
    right: 30px;
    width: 350px;
    max-height: 500px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform-origin: bottom right;
    animation: scaleIn 0.3s ease-in-out forwards;
}

/* WhatsApp Window */
.whatsapp-window {
    position: fixed !important;
    bottom: 110px;
    left: 30px;
    width: 290px;
    max-height: 420px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform-origin: bottom left;
    animation: scaleIn 0.3s ease-in-out forwards;
}

.chat-body {
    flex-grow: 1;
    overflow-y: auto;
    height: 300px;
}

.chat-body::-webkit-scrollbar {
    width: 5px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 576px) {

    /* Full-screen bottom-sheet popups on mobile */
    .ai-chatbot,
    .whatsapp-window {
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        height: 90vh;
        max-height: 90vh;
        border-radius: 20px 20px 0 0 !important;
        z-index: 1050 !important;
        /* always above FABs */
    }

    .chat-body {
        height: calc(90vh - 140px);
    }

    /* Hide floating action buttons behind popup when any chat is open */
    body.chat-open .floating-buttons,
    body.chat-open #whatsappBtn {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s;
    }
}


/* AI Cursor Glow Effect */
:root {
    --mouse-x: 50vw;
    --mouse-y: 50vh;
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at var(--mouse-x) var(--mouse-y), rgba(139, 92, 246, 0.15) 0%, rgba(20, 184, 166, 0.05) 15%, transparent 35%);
    pointer-events: none;
    z-index: 10000;
    mix-blend-mode: screen;
    opacity: 0;
    transition: opacity 0.4s ease;
}

body.mouse-moving::after {
    opacity: 1;
}

/* Card Hover Spotlight AI Effect */
.glass-panel,
.service-card,
.price-card,
.score-card,
.input-card,
.glass-card,
.glass-wrap,
.suggestion-card,
.cta-banner {
    position: relative;
    isolation: isolate;
    /* Creates a stacking context so glowing stays behind content */
}

/* Base styling for interactive cards */
.glass-panel::before,
.service-card::before,
.price-card::before,
.score-card::before,
.input-card::before,
.glass-card::before,
.glass-wrap::before,
.suggestion-card::before,
.cta-banner::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    /* Slight bleed */
    background: radial-gradient(400px circle at var(--local-mouse-x, -500px) var(--local-mouse-y, -500px),
            rgba(139, 92, 246, 0.4),
            transparent 40%);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    border-radius: inherit;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    padding: 2px;
    /* width of the glowing border */
}

.glass-panel:hover::before,
.service-card:hover::before,
.price-card:hover::before,
.score-card:hover::before,
.input-card:hover::before,
.glass-card:hover::before,
.glass-wrap:hover::before,
.suggestion-card:hover::before,
.cta-banner:hover::before {
    opacity: 1;
}

/* AI Trailing Mouse Cursor */
.ai-mouse-trailer {
    position: fixed;
    top: -10px;
    left: -10px;
    width: 20px;
    height: 20px;
    background: rgba(139, 92, 246, 0.4);
    border-radius: 50%;
    pointer-events: none;
    z-index: 10001;
    mix-blend-mode: screen;
    box-shadow: 0 0 15px 5px rgba(20, 184, 166, 0.3);
    transition: width 0.2s, height 0.2s, background 0.2s, box-shadow 0.2s;
    opacity: 0;
}

.ai-mouse-trailer.interacting {
    width: 35px;
    height: 35px;
    top: -17.5px;
    left: -17.5px;
    background: rgba(20, 184, 166, 0.2);
    box-shadow: 0 0 30px 10px rgba(139, 92, 246, 0.5);
    border: 2px solid rgba(139, 92, 246, 0.6);
}