/* --- CSS VARIABLES & THEME SETUP --- */
:root {
    /* Lab Theme Palette */
    --color-bg: #f8f9fc;
    --color-surface: #ffffff;
    --color-surface-translucent: rgba(255, 255, 255, 0.85);
    --color-primary: #0066ff;
    /* Lab Blue */
    --color-primary-light: #e0eeff;
    --color-primary-dark: #0047b3;
    --color-accent: #00d2ff;
    /* Cyan Data */
    --color-text-heading: #1a202c;
    --color-text-body: #4a5568;
    --color-border: #e2e8f0;
    --color-success: #38a169;
    --color-grid-line: rgba(0, 102, 255, 0.05);

    /* Typography */
    --font-primary: 'Poppins', sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
    /* For data numbers */

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 32px;
    --spacing-xl: 64px;
    --spacing-xxl: 120px;

    /* Shadows & Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-blue: 0 10px 25px -5px rgba(0, 102, 255, 0.25);
    --backdrop-blur: blur(12px);
    --border-radius-sm: 4px;
    --border-radius-md: 8px;
    --border-radius-lg: 16px;
    --border-radius-xl: 24px;
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- RESET & GLOBAL STYLES --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    overflow-x: hidden;
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-bg);
    color: var(--color-text-body);
    line-height: 1.6;
    overflow-x: hidden;
    background-image:
        linear-gradient(var(--color-grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--color-grid-line) 1px, transparent 1px);
    background-size: 40px 40px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--color-text-heading);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* --- UTILITY CLASSES --- */
.section-padding {
    padding: var(--spacing-xxl) 0;
}

.text-center {
    text-align: center;
}

.text-primary {
    color: var(--color-primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    border: none;
    gap: 8px;
    font-size: 1rem;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-blue);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -5px rgba(0, 102, 255, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline:hover {
    background: var(--color-primary-light);
}

.chip {
    display: inline-block;
    background: var(--color-primary-light);
    color: var(--color-primary);
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- HEADER --- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--color-surface-translucent);
    backdrop-filter: var(--backdrop-blur);
    border-bottom: 1px solid var(--color-border);
    transition: var(--transition-smooth);
}

.header.scrolled {
    padding: 10px 0;
    box-shadow: var(--shadow-sm);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo-link img {
    height: 60px;
    width: auto;
}

.nav-list {
    display: flex;
    gap: 32px;
}

.nav-link {
    font-weight: 500;
    position: relative;
    padding: 5px 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transition: var(--transition-fast);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.bar {
    width: 25px;
    height: 3px;
    background-color: var(--color-text-heading);
    transition: var(--transition-fast);
}

/* Mobile Nav Overlay */
.mobile-nav {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 20px;
    transform: translateY(-150%);
    transition: var(--transition-smooth);
    z-index: 999;
}

.mobile-nav.open {
    transform: translateY(0);
    box-shadow: var(--shadow-lg);
}

.mobile-nav ul {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mobile-nav a {
    font-weight: 600;
    font-size: 1.1rem;
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

/* --- HERO SECTION (LAB THEME) --- */
.hero-section {
    padding-top: 160px;
    padding-bottom: 100px;
    position: relative;
    overflow: hidden;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--spacing-xl);
    align-items: center;
}

.hero-content h1 {
    font-size: 3.5rem;
    letter-spacing: -1px;
    margin-bottom: var(--spacing-md);
}

.hero-content p {
    font-size: 1.125rem;
    margin-bottom: var(--spacing-lg);
    color: var(--color-text-body);
    max-width: 500px;
}

.hero-stats {
    display: flex;
    gap: 40px;
    margin-top: 40px;
    border-top: 1px solid var(--color-border);
    padding-top: 20px;
}

.stat-item h4 {
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: 0;
    font-family: var(--font-mono);
}

.stat-item p {
    font-size: 0.875rem;
    margin: 0;
}

/* 3D Scientific Visual */
.hero-visual {
    position: relative;
    height: 500px;
    perspective: 1000px;
}

.lab-dashboard {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    animation: float 6s ease-in-out infinite;
}

.dashboard-card {
    position: absolute;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-main {
    width: 320px;
    height: 240px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(0);
    z-index: 2;
}

.card-float-1 {
    width: 180px;
    height: 120px;
    top: 20%;
    right: 0;
    transform: translateZ(50px);
    z-index: 3;
    animation: pulse 4s infinite;
}

.card-float-2 {
    width: 200px;
    height: 140px;
    bottom: 10%;
    left: 0;
    transform: translateZ(-50px);
    z-index: 1;
    opacity: 0.8;
}

/* Simulated Charts inside cards */
.chart-bar-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 100px;
    margin-top: auto;
}

.chart-bar {
    flex: 1;
    background: var(--color-primary-light);
    border-radius: 4px 4px 0 0;
    animation: chartGrow 2s ease-out forwards;
}

.chart-bar:nth-child(even) {
    background: var(--color-primary);
}

.chart-line {
    height: 2px;
    background: var(--color-accent);
    width: 0;
    animation: widthGrow 2s 1s forwards;
}

/* --- SERVICES (PERIODIC TABLE STYLE) --- */
.services-section {
    background: white;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.service-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    padding: 30px;
    border-radius: var(--border-radius-md);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.service-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.service-icon {
    width: 50px;
    height: 50px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    margin-bottom: 20px;
    color: var(--color-primary);
    font-size: 1.5rem;
}

.service-card h3 {
    font-size: 1.25rem;
}

.service-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--color-primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.service-card:hover .service-overlay {
    transform: scaleX(1);
}

/* --- ROI CALCULATOR SECTION --- */
.calculator-section {
    background: linear-gradient(135deg, #f8f9fc 0%, #eef2f7 100%);
}

.calc-container {
    background: var(--color-surface);
    padding: 40px;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.calc-inputs {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.input-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--color-text-heading);
}

.range-slider {
    width: 100%;
    appearance: none;
    height: 6px;
    background: var(--color-border);
    border-radius: 5px;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.input-value {
    margin-top: 5px;
    font-family: var(--font-mono);
    color: var(--color-primary);
    font-weight: 700;
}

.calc-result {
    background: var(--color-text-heading);
    color: white;
    border-radius: var(--border-radius-lg);
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.calc-result::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    animation: rotate 20s linear infinite;
}

.result-number {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--color-accent);
    font-family: var(--font-mono);
    z-index: 1;
}

/* --- TESTIMONIALS (CASE STUDY STYLE) --- */
.testimonials-wrapper {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding-bottom: 20px;
    scrollbar-width: none;
}

.testimonial-card {
    min-width: 350px;
    background: white;
    padding: 30px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
}

.client-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.client-avatar {
    width: 50px;
    height: 50px;
    background: var(--color-border);
    border-radius: 50%;
}

.metric-badge {
    background: rgba(56, 161, 105, 0.1);
    color: var(--color-success);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 15px;
    display: inline-block;
}

/* --- CONTACT PAGE --- */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
}

.contact-form {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    background: var(--color-bg);
    font-family: inherit;
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    background: white;
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

textarea.form-control {
    resize: vertical;
}

/* --- LEGAL PAGES CONTENT --- */
.legal-content {
    background: white;
    padding: 60px;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--color-border);
    margin-top: 40px;
}

.legal-content h2 {
    margin-top: 30px;
    font-size: 1.5rem;
    border-left: 4px solid var(--color-primary);
    padding-left: 15px;
}

.legal-content p,
.legal-content ul {
    margin-bottom: 15px;
    color: var(--color-text-body);
}

.legal-content ul {
    padding-left: 20px;
    list-style: disc;
}

/* --- FOOTER --- */
.footer {
    background: #1a202c;
    color: #cbd5e0;
    padding: 80px 0 30px;
    position: relative;
    overflow: hidden;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1.5fr;
    gap: 40px;
    margin-bottom: 60px;
    position: relative;
    z-index: 2;
}

.footer-logo {
    height: 60px;
    filter: brightness(0) invert(1);
}

.footer-col h3 {
    color: white;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.footer-col ul li {
    margin-bottom: 12px;
}

.footer-col ul li a:hover {
    color: var(--color-primary);
    padding-left: 5px;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 30px;
    text-align: center;
    font-size: 0.9rem;
}

/* --- CHAT WIDGET --- */
.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 900;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    background: var(--color-primary);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-blue);
    cursor: pointer;
    transition: var(--transition-fast);
}

.chat-toggle:hover {
    transform: scale(1.1);
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 450px;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.chat-window.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

.chat-header {
    background: var(--color-primary);
    color: white;
    padding: 15px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
}

.chat-body {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: var(--color-bg);
}

.message {
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    max-width: 80%;
}

.message.bot {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 0 8px 8px 8px;
}

.message.user {
    background: var(--color-primary);
    color: white;
    margin-left: auto;
    border-radius: 8px 0 8px 8px;
}

/* --- ANIMATIONS --- */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 102, 255, 0.4);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(0, 102, 255, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 102, 255, 0);
    }
}

@keyframes chartGrow {
    from {
        height: 0;
    }

    to {
        height: var(--h, 50%);
    }
}

@keyframes widthGrow {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- MEDIA QUERIES --- */
@media (max-width: 992px) {

    .hero-grid,
    .contact-layout,
    .calculator-section .calc-container {
        grid-template-columns: 1fr;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-visual {
        height: 350px;
    }
}

@media (max-width: 768px) {
    .header-actions .btn {
        display: none;
    }

    .nav-list {
        display: none;
    }

    .mobile-toggle {
        display: flex;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .section-padding {
        padding: 60px 0;
    }

    .hero-section {
        padding-top: 120px;
    }
}