<?php
/**
 * OPPULENT CHEMICALLS EXCELLENCE INNOVATION
 * File: services.php
 * Premium responsive services page
 * Two-step enquiry form + email + WhatsApp
 */

if (session_status() !== PHP_SESSION_ACTIVE) {
    session_start();
}

$ocRecipientEmail   = 'V.Kumar1087@gmail.com';
$ocBusinessPhone    = '+91 7428 465 992';
$ocBusinessPhoneLink = '+917428465992';
$ocWhatsAppNumber   = '917428465992';

$ocFormSuccess = '';
$ocFormError   = '';
$ocMailSent    = false;

$ocValues = [
    'name'         => '',
    'email'        => '',
    'country_code' => 'India (+91)',
    'mobile'       => '',
    'location'     => '',
    'company'      => '',
    'product'      => '',
    'quantity'     => '',
    'message'      => '',
];

if (empty($_SESSION['oc_csrf_token'])) {
    $_SESSION['oc_csrf_token'] = bin2hex(random_bytes(32));
}

function ocEscape($value): string
{
    return htmlspecialchars(
        (string) $value,
        ENT_QUOTES | ENT_SUBSTITUTE,
        'UTF-8'
    );
}

/* Process enquiry */
if (
    $_SERVER['REQUEST_METHOD'] === 'POST'
    && isset($_POST['oc_enquiry_submit'])
) {
    foreach ($ocValues as $key => $default) {
        $value = $_POST[$key] ?? $default;

        if (is_string($value)) {
            $ocValues[$key] = trim($value);
        }
    }

    $csrfToken = $_POST['oc_csrf_token'] ?? '';

    if (
        !is_string($csrfToken)
        || !hash_equals($_SESSION['oc_csrf_token'], $csrfToken)
    ) {
        $ocFormError = 'Your session has expired. Please refresh the page and try again.';
    } elseif (
        $ocValues['name'] === ''
        || $ocValues['email'] === ''
        || $ocValues['mobile'] === ''
        || $ocValues['location'] === ''
        || $ocValues['company'] === ''
        || $ocValues['product'] === ''
        || $ocValues['quantity'] === ''
        || $ocValues['message'] === ''
    ) {
        $ocFormError = 'Please complete all required fields.';
    } elseif (
        preg_match('/[\r\n]/', $ocValues['email'])
        || !filter_var($ocValues['email'], FILTER_VALIDATE_EMAIL)
    ) {
        $ocFormError = 'Please enter a valid email address.';
    } elseif (
        preg_match('/[\r\n]/', $ocValues['name'])
        || preg_match('/[\r\n]/', $ocValues['country_code'])
        || preg_match('/[\r\n]/', $ocValues['mobile'])
    ) {
        $ocFormError = 'Please check your contact details.';
    } elseif (
        strlen($ocValues['name']) > 150
        || strlen($ocValues['email']) > 254
        || strlen($ocValues['mobile']) > 40
        || strlen($ocValues['country_code']) > 60
        || strlen($ocValues['location']) > 200
        || strlen($ocValues['company']) > 200
        || strlen($ocValues['product']) > 200
        || strlen($ocValues['quantity']) > 100
        || strlen($ocValues['message']) > 10000
    ) {
        $ocFormError = 'One or more fields exceed the permitted length.';
    } else {
        $safeName = preg_replace('/[\r\n]+/', ' ', $ocValues['name']);
        $subject = 'Website Enquiry - ' . $safeName;

        $body =
            "New enquiry from OPPULENT CHEMICALLS website\n\n"
            . "Name: {$ocValues['name']}\n"
            . "Email: {$ocValues['email']}\n"
            . "Country code: {$ocValues['country_code']}\n"
            . "Mobile: {$ocValues['mobile']}\n"
            . "Location: {$ocValues['location']}\n"
            . "Company: {$ocValues['company']}\n"
            . "Product: {$ocValues['product']}\n"
            . "Required quantity: {$ocValues['quantity']}\n\n"
            . "Requirements:\n{$ocValues['message']}\n";

        $host = preg_replace(
            '/[^a-zA-Z0-9.-]/',
            '',
            (string) ($_SERVER['HTTP_HOST'] ?? '')
        );

        $fromAddress = 'website-enquiry@localhost';

        if ($host !== '' && strpos($host, '.') !== false) {
            $fromAddress = 'website-enquiry@' . $host;
        }

        $headers = [
            'From: OPPULENT CHEMICALLS Website <' . $fromAddress . '>',
            'Reply-To: ' . $ocValues['email'],
            'Content-Type: text/plain; charset=UTF-8',
            'X-Mailer: PHP/' . PHP_VERSION,
        ];

        try {
            $ocMailSent = mail(
                $ocRecipientEmail,
                $subject,
                $body,
                implode("\r\n", $headers)
            );
        } catch (Throwable $e) {
            $ocMailSent = false;
        }

        if ($ocMailSent) {
            $ocFormSuccess = 'Your enquiry email has been submitted. You can also send the details to us on WhatsApp below.';
            $_SESSION['oc_csrf_token'] = bin2hex(random_bytes(32));
        } else {
            $ocFormError = 'Email could not be sent from the server. Please use the WhatsApp button below or call ' . $ocBusinessPhone . '.';
        }
    }
}

$pageTitle = 'Our Services | OPPULENT CHEMICALLS EXCELLENCE INNOVATION';

include __DIR__ . '/header.php';
?>

<!-- Bootstrap & External CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.carousel.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/OwlCarousel2/2.3.4/assets/owl.theme.default.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<link href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;700;800&family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
<style>
/* ===========================================
   OPPULENT CHEMICALLS — SERVICES PAGE
   All styles are scoped to .oc-services
=========================================== */

.oc-services {
    --oc-primary: #087653;
    --oc-primary-dark: #064d38;
    --oc-accent: #c7a66a;
    --oc-ink: #17251e;
    --oc-muted: #6d7a72;
    --oc-border: #e4ebe6;
    --oc-bg: #f5f8f6;

    color: var(--oc-ink);
    background: var(--oc-bg);
    font-family: inherit;
    overflow: hidden;
}

.oc-services *,
.oc-services *::before,
.oc-services *::after {
    box-sizing: border-box;
}

.oc-services .oc-container {
    width: min(1200px, calc(100% - 40px));
    margin-inline: auto;
}

/* Hero */

.oc-services .oc-hero {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: clamp(270px, 36vw, 440px);
    padding: 55px 0;
    isolation: isolate;
    background:
        linear-gradient(
            90deg,
            rgba(3, 35, 25, .91),
            rgba(3, 35, 25, .55) 62%,
            rgba(3, 35, 25, .18)
        ),
        url("assets/images/ourservices.jpg") center/cover no-repeat;
}

.oc-services .oc-hero::after {
    position: absolute;
    z-index: -1;
    inset: 0;
    background: linear-gradient(0deg, rgba(0,0,0,.2), transparent 60%);
    content: "";
}

.oc-services .oc-hero-content {
    max-width: 760px;
    color: #fff;
}

.oc-services .oc-hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    color: #e6d1a7;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.oc-services .oc-hero-kicker::before {
    width: 30px;
    height: 2px;
    background: var(--oc-accent);
    content: "";
}

.oc-services .oc-hero h1 {
    margin: 0 0 16px;
    color: #fff;
    font-size: clamp(36px, 5vw, 62px);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -1.5px;
}

.oc-services .oc-hero p {
    max-width: 620px;
    margin: 0;
    color: rgba(255,255,255,.9);
    font-size: 16px;
    line-height: 1.85;
}

/* Main layout */

.oc-services .oc-main {
    padding: 76px 0 88px;
}

.oc-services .oc-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(320px, .85fr);
    gap: 38px;
    align-items: start;
}

.oc-services .oc-intro {
    margin-bottom: 32px;
}

.oc-services .oc-eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--oc-primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.oc-services .oc-eyebrow::before {
    width: 25px;
    height: 2px;
    background: var(--oc-accent);
    content: "";
}

.oc-services .oc-section-title {
    margin: 0 0 14px;
    color: var(--oc-primary-dark);
    font-size: clamp(29px, 3.2vw, 42px);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.8px;
}

.oc-services .oc-intro-text {
    max-width: 650px;
    margin: 0;
    color: var(--oc-muted);
    font-size: 15px;
    line-height: 1.9;
}

/* Service cards */

.oc-services .oc-service-card {
    margin-bottom: 26px;
    overflow: hidden;
    border: 1px solid var(--oc-border);
    border-radius: 19px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(14, 50, 34, .045);
    transition: transform .25s ease, box-shadow .25s ease;
}

.oc-services .oc-service-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 42px rgba(14, 50, 34, .09);
}

.oc-services .oc-service-content {
    padding: 29px 30px 25px;
}

.oc-services .oc-service-top {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 19px;
}

.oc-services .oc-number {
    display: grid;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 1px solid #d8eade;
    border-radius: 13px;
    background: #edf6ef;
    color: var(--oc-primary);
    font-size: 14px;
    font-weight: 800;
}

.oc-services .oc-service-label {
    color: #8a958e;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.oc-services .oc-service-card h2 {
    margin: 0 0 12px;
    color: var(--oc-primary-dark);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.35;
}

.oc-services .oc-service-card p {
    margin: 0;
    color: var(--oc-muted);
    font-size: 14px;
    line-height: 1.9;
}

.oc-services .oc-service-image {
    padding: 0 24px 24px;
}

.oc-services .oc-service-image img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 390px;
    border-radius: 12px;
    object-fit: contain;
    object-position: center;
}

.oc-services .oc-logistics-visual {
    display: flex;
    align-items: center;
    gap: 17px;
    margin: 0 24px 24px;
    padding: 24px;
    border: 1px solid #e5eee8;
    border-radius: 13px;
    background: linear-gradient(135deg, #f0f7f2, #fafcfb);
}

.oc-services .oc-logistics-icon {
    display: grid;
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    place-items: center;
    border-radius: 15px;
    background: var(--oc-primary);
    color: #fff;
    font-size: 23px;
}

.oc-services .oc-logistics-visual strong {
    display: block;
    margin-bottom: 5px;
    color: var(--oc-primary-dark);
    font-size: 14px;
}

.oc-services .oc-logistics-visual span {
    display: block;
    color: var(--oc-muted);
    font-size: 12px;
    line-height: 1.7;
}

/* Enquiry panel */

.oc-services .oc-enquiry {
    position: sticky;
    top: 24px;
    overflow: hidden;
    border: 1px solid var(--oc-border);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 15px 45px rgba(14, 50, 34, .075);
}

.oc-services .oc-enquiry-head {
    position: relative;
    padding: 30px 27px 27px;
    overflow: hidden;
    background: linear-gradient(135deg, #087653, #06412f);
    color: #fff;
}

.oc-services .oc-enquiry-head::after {
    position: absolute;
    top: -65px;
    right: -40px;
    width: 175px;
    height: 175px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 50%;
    box-shadow: 0 0 0 25px rgba(255,255,255,.035),
                0 0 0 50px rgba(255,255,255,.025);
    content: "";
    pointer-events: none;
}

.oc-services .oc-enquiry-tag {
    display: inline-block;
    margin-bottom: 14px;
    color: #e7d3a9;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.oc-services .oc-enquiry-head h2 {
    position: relative;
    z-index: 1;
    margin: 0 0 10px;
    color: #fff;
    font-size: 27px;
    font-weight: 800;
    line-height: 1.25;
}

.oc-services .oc-enquiry-head p {
    position: relative;
    z-index: 1;
    margin: 0;
    color: rgba(255,255,255,.84);
    font-size: 13px;
    line-height: 1.8;
}

.oc-services .oc-enquiry-body {
    padding: 26px;
}

.oc-services .oc-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
}

.oc-services .oc-progress-step {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 8px;
    color: #8b978f;
    font-size: 11px;
    font-weight: 700;
}

.oc-services .oc-step-circle {
    display: grid;
    flex: 0 0 29px;
    width: 29px;
    height: 29px;
    place-items: center;
    border: 1px solid #dce5df;
    border-radius: 50%;
    background: #fff;
    font-size: 11px;
}

.oc-services .oc-progress-step.active {
    color: var(--oc-primary);
}

.oc-services .oc-progress-step.active .oc-step-circle {
    border-color: var(--oc-primary);
    background: var(--oc-primary);
    color: #fff;
}

.oc-services .oc-progress-line {
    flex: 0 0 20px;
    height: 1px;
    background: #dce5df;
}

.oc-services .oc-form-step[hidden] {
    display: none !important;
}

.oc-services .oc-field {
    margin-bottom: 15px;
}

.oc-services .oc-field label {
    display: block;
    margin-bottom: 7px;
    color: #34483c;
    font-size: 12px;
    font-weight: 750;
}

.oc-services .oc-required {
    color: #c54b40;
}

.oc-services .oc-control {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding: 12px 13px;
    border: 1px solid #dce5df;
    border-radius: 10px;
    outline: none;
    background: #fff;
    color: var(--oc-ink);
    font: inherit;
    font-size: 13px;
    transition: border-color .2s, box-shadow .2s;
}

.oc-services .oc-control:focus {
    border-color: var(--oc-primary);
    box-shadow: 0 0 0 3px rgba(8,118,83,.10);
}

.oc-services .oc-control::placeholder {
    color: #99a49d;
}

.oc-services textarea.oc-control {
    min-height: 115px;
    resize: vertical;
}

.oc-services .oc-field-row {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.3fr);
    gap: 10px;
}

.oc-services .oc-actions {
    display: grid;
    gap: 10px;
    margin-top: 21px;
}

.oc-services .oc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 49px;
    padding: 13px 17px;
    border: 1px solid transparent;
    border-radius: 10px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s, transform .2s;
}

.oc-services .oc-btn-primary {
    background: var(--oc-primary);
    color: #fff;
}

.oc-services .oc-btn-primary:hover {
    transform: translateY(-1px);
    background: var(--oc-primary-dark);
}

.oc-services .oc-btn-secondary {
    border-color: #dfe8e2;
    background: #f4f8f5;
    color: var(--oc-primary-dark);
}

.oc-services .oc-btn-secondary:hover {
    background: #e9f2ec;
}

/* Alerts */

.oc-services .oc-alert {
    margin-bottom: 20px;
    padding: 13px 15px;
    border: 1px solid;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.oc-services .oc-alert-success {
    border-color: #b8e2c8;
    background: #effaf2;
    color: #17683c;
}

.oc-services .oc-alert-error {
    border-color: #f0c6c2;
    background: #fff4f3;
    color: #a02e27;
}

.oc-services .oc-form-note {
    margin: 17px 0 0;
    color: #7b887f;
    font-size: 11px;
    line-height: 1.8;
    text-align: center;
}

/* Contact + WhatsApp */

.oc-services .oc-contact-actions {
    display: grid;
    gap: 12px;
    margin-top: 19px;
}

.oc-services .oc-contact {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 15px;
    border: 1px solid var(--oc-border);
    border-radius: 12px;
    background: #f8faf8;
    color: inherit;
    text-decoration: none;
    transition: border-color .2s, transform .2s;
}

.oc-services .oc-contact:hover {
    border-color: #b8d9c5;
    transform: translateY(-2px);
}

.oc-services .oc-contact-icon {
    display: grid;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 11px;
    background: #e5f2e9;
    color: var(--oc-primary);
    font-size: 18px;
}

.oc-services .oc-contact-info {
    display: block;
    min-width: 0;
}

.oc-services .oc-contact-info small {
    display: block;
    margin-bottom: 4px;
    color: var(--oc-muted);
    font-size: 10px;
}

.oc-services .oc-contact-info strong {
    display: block;
    color: var(--oc-primary-dark);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.oc-services .oc-whatsapp-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    padding: 15px;
    border: 1px solid #20b85a;
    border-radius: 14px;
    background: linear-gradient(135deg, #20c866, #0a9f50);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 9px 22px rgba(20,165,82,.19);
    transition: transform .22s, box-shadow .22s;
}

.oc-services .oc-whatsapp-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 28px rgba(20,165,82,.27);
}

.oc-services .oc-whatsapp-icon {
    display: grid;
    flex: 0 0 43px;
    width: 43px;
    height: 43px;
    place-items: center;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 12px;
    background: rgba(255,255,255,.15);
}

.oc-services .oc-whatsapp-text {
    display: block;
    flex: 1;
    min-width: 0;
}

.oc-services .oc-whatsapp-text strong {
    display: block;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.5;
}

.oc-services .oc-whatsapp-text small {
    display: block;
    margin-top: 3px;
    color: rgba(255,255,255,.9);
    font-size: 10px;
    line-height: 1.6;
}

.oc-services .oc-whatsapp-arrow {
    flex: 0 0 auto;
    font-size: 21px;
    font-weight: 700;
}

/* Responsive */

@media (max-width: 1000px) {
    .oc-services .oc-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }

    .oc-services .oc-enquiry {
        position: static;
        width: 100%;
        max-width: 650px;
        margin-inline: auto;
    }
}

@media (max-width: 600px) {
    .oc-services .oc-container {
        width: calc(100% - 28px);
    }

    .oc-services .oc-hero {
        min-height: 275px;
        padding: 40px 0;
        background-position: center;
    }

    .oc-services .oc-hero h1 {
        font-size: 38px;
        letter-spacing: -.7px;
    }

    .oc-services .oc-hero p {
        font-size: 14px;
    }

    .oc-services .oc-main {
        padding: 42px 0 55px;
    }

    .oc-services .oc-service-content {
        padding: 23px 20px 21px;
    }

    .oc-services .oc-service-card h2 {
        font-size: 21px;
    }

    .oc-services .oc-service-image {
        padding: 0 14px 16px;
    }

    .oc-services .oc-logistics-visual {
        margin: 0 14px 16px;
        padding: 17px;
    }

    .oc-services .oc-enquiry-head {
        padding: 25px 21px;
    }

    .oc-services .oc-enquiry-body {
        padding: 21px;
    }

    .oc-services .oc-field-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .oc-services .oc-progress-step {
        font-size: 10px;
    }

    .oc-services .oc-whatsapp-btn {
        gap: 9px;
        padding: 13px 10px;
    }

    .oc-services .oc-whatsapp-text strong {
        font-size: 12px;
    }

    .oc-services .oc-whatsapp-text small {
        font-size: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .oc-services *,
    .oc-services *::before,
    .oc-services *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
</style>

<div class="oc-services">

    <section class="oc-hero" aria-label="Our Services">
        <div class="oc-container">
            <div class="oc-hero-content">
                <div class="oc-hero-kicker">
                    Quality · Reliability · Innovation
                </div>
                <h1>Our Services</h1>
                <p>
                    Integrated chemical manufacturing, logistics and
                    marketplace solutions designed to support your
                    business requirements with quality and reliability.
                </p>
            </div>
        </div>
    </section>

    <section class="oc-main">
        <div class="oc-container">
            <div class="oc-layout">

                <!-- Services -->
                <main class="oc-services-list">

                    <div class="oc-intro">
                        <div class="oc-eyebrow">What We Do</div>
                        <h2 class="oc-section-title">
                            Solutions Built Around Your Business
                        </h2>
                        <p class="oc-intro-text">
                            Integrated chemical manufacturing, logistics and
                            marketplace solutions designed to support your
                            business requirements with quality and reliability.
                        </p>
                    </div>

                    <article class="oc-service-card">
                        <div class="oc-service-content">
                            <div class="oc-service-top">
                                <div class="oc-number">01</div>
                                <div class="oc-service-label">
                                    Manufacturing Solutions
                                </div>
                            </div>
                            <h2>Toll Manufacturing</h2>
                            <p>
                                From formulation to packaging, our toll
                                manufacturing solutions provide end-to-end
                                chemical production with precision and
                                scalability. We focus on quality control to
                                meet your specific requirements.
                            </p>
                        </div>
                        <div class="oc-service-image">
                            <img
                                src="assets/images/tollmanufacturing.jpg"
                                alt="Toll chemical manufacturing"
                                loading="lazy"
                            >
                        </div>
                    </article>

                    <article class="oc-service-card">
                        <div class="oc-service-content">
                            <div class="oc-service-top">
                                <div class="oc-number">02</div>
                                <div class="oc-service-label">
                                    Supply Chain Solutions
                                </div>
                            </div>
                            <h2>Logistics Service</h2>
                            <p>
                                Fast, flexible and secure logistics solutions
                                help move goods efficiently. From warehousing
                                to delivery coordination, our focus is on
                                reliability, careful handling and dependable
                                service.
                            </p>
                        </div>
                        <div class="oc-logistics-visual">
                            <div class="oc-logistics-icon" aria-hidden="true">
                                &#10148;
                            </div>
                            <div>
                                <strong>Reliable Logistics Support</strong>
                                <span>
                                    Efficient delivery coordination and
                                    supply-chain support for your business.
                                </span>
                            </div>
                        </div>
                    </article>

                    <article class="oc-service-card">
                        <div class="oc-service-content">
                            <div class="oc-service-top">
                                <div class="oc-number">03</div>
                                <div class="oc-service-label">
                                    Digital Procurement
                                </div>
                            </div>
                            <h2>E-commerce Marketplace</h2>
                            <p>
                                Our online marketplace concept simplifies
                                chemical procurement by bringing product
                                discovery and purchasing requirements into
                                a convenient digital experience.
                            </p>
                        </div>
                        <div class="oc-service-image">
                            <img
                                src="assets/images/IBCgrowyourbusiness1.jpg"
                                alt="Chemical e-commerce marketplace"
                                loading="lazy"
                            >
                        </div>
                    </article>

                </main>

                <!-- Enquiry panel -->
                <aside class="oc-enquiry">

                    <div class="oc-enquiry-head">
                        <div class="oc-enquiry-tag">Let's Connect</div>
                        <h2>Get In Touch With Us</h2>
                        <p>
                            Share your requirements and our team can follow
                            up with you.
                        </p>
                    </div>

                    <div class="oc-enquiry-body">

                        <?php if ($ocFormSuccess !== ''): ?>
                            <div class="oc-alert oc-alert-success" role="status">
                                <?= ocEscape($ocFormSuccess) ?>
                            </div>
                        <?php endif; ?>

                        <?php if ($ocFormError !== ''): ?>
                            <div class="oc-alert oc-alert-error" role="alert">
                                <?= ocEscape($ocFormError) ?>
                            </div>
                        <?php endif; ?>

                        <div class="oc-progress" aria-label="Form progress">
                            <div class="oc-progress-step active" data-progress="1">
                                <span class="oc-step-circle">1</span>
                                <span>Your Details</span>
                            </div>
                            <div class="oc-progress-line"></div>
                            <div class="oc-progress-step" data-progress="2">
                                <span class="oc-step-circle">2</span>
                                <span>Requirements</span>
                            </div>
                        </div>

                        <form
                            id="ocEnquiryForm"
                            method="post"
                            action=""
                            autocomplete="on"
                            novalidate
                        >
                            <input
                                type="hidden"
                                name="oc_csrf_token"
                                value="<?= ocEscape($_SESSION['oc_csrf_token']) ?>"
                            >

                            <!-- Step 1 -->
                            <div class="oc-form-step" data-step="1">

                                <div class="oc-field">
                                    <label for="oc-name">
                                        Full Name <span class="oc-required">*</span>
                                    </label>
                                    <input
                                        id="oc-name"
                                        class="oc-control"
                                        type="text"
                                        name="name"
                                        maxlength="150"
                                        placeholder="Enter your full name"
                                        autocomplete="name"
                                        value="<?= ocEscape($ocValues['name']) ?>"
                                        required
                                    >
                                </div>

                                <div class="oc-field">
                                    <label for="oc-email">
                                        Email Address <span class="oc-required">*</span>
                                    </label>
                                    <input
                                        id="oc-email"
                                        class="oc-control"
                                        type="email"
                                        name="email"
                                        maxlength="254"
                                        placeholder="you@company.com"
                                        autocomplete="email"
                                        value="<?= ocEscape($ocValues['email']) ?>"
                                        required
                                    >
                                </div>

                                <div class="oc-field-row">
                                    <div class="oc-field">
                                        <label for="oc-country">
                                            Country Code <span class="oc-required">*</span>
                                        </label>
                                        <select
                                            id="oc-country"
                                            class="oc-control"
                                            name="country_code"
                                            required
                                        >
                                            <?php
                                            $ocCountries = [
                                                'India (+91)',
                                                'Afghanistan (+93)',
                                                'Australia (+61)',
                                                'Bangladesh (+880)',
                                                'Brazil (+55)',
                                                'Canada (+1)',
                                                'China (+86)',
                                                'France (+33)',
                                                'Germany (+49)',
                                                'Indonesia (+62)',
                                                'Italy (+39)',
                                                'Japan (+81)',
                                                'Malaysia (+60)',
                                                'Nepal (+977)',
                                                'Netherlands (+31)',
                                                'New Zealand (+64)',
                                                'Pakistan (+92)',
                                                'Qatar (+974)',
                                                'Saudi Arabia (+966)',
                                                'Singapore (+65)',
                                                'South Africa (+27)',
                                                'Sri Lanka (+94)',
                                                'United Arab Emirates (+971)',
                                                'United Kingdom (+44)',
                                                'United States (+1)',
                                            ];

                                            foreach ($ocCountries as $ocCountry):
                                            ?>
                                                <option
                                                    value="<?= ocEscape($ocCountry) ?>"
                                                    <?= $ocValues['country_code'] === $ocCountry ? 'selected' : '' ?>
                                                >
                                                    <?= ocEscape($ocCountry) ?>
                                                </option>
                                            <?php endforeach; ?>
                                        </select>
                                    </div>

                                    <div class="oc-field">
                                        <label for="oc-mobile">
                                            Mobile Number <span class="oc-required">*</span>
                                        </label>
                                        <input
                                            id="oc-mobile"
                                            class="oc-control"
                                            type="tel"
                                            name="mobile"
                                            maxlength="40"
                                            placeholder="Mobile number"
                                            autocomplete="tel-national"
                                            value="<?= ocEscape($ocValues['mobile']) ?>"
                                            required
                                        >
                                    </div>
                                </div>

                                <div class="oc-actions">
                                    <button
                                        class="oc-btn oc-btn-primary"
                                        type="button"
                                        data-next-step
                                    >
                                        Continue to Requirements
                                        <span aria-hidden="true">&#8594;</span>
                                    </button>
                                </div>
                            </div>

                            <!-- Step 2 -->
                            <div class="oc-form-step" data-step="2" hidden>

                                <div class="oc-field">
                                    <label for="oc-location">
                                        Location <span class="oc-required">*</span>
                                    </label>
                                    <input
                                        id="oc-location"
                                        class="oc-control"
                                        type="text"
                                        name="location"
                                        maxlength="200"
                                        placeholder="City, State, Country"
                                        autocomplete="address-level2"
                                        value="<?= ocEscape($ocValues['location']) ?>"
                                        required
                                    >
                                </div>

                                <div class="oc-field">
                                    <label for="oc-company">
                                        Company Name <span class="oc-required">*</span>
                                    </label>
                                    <input
                                        id="oc-company"
                                        class="oc-control"
                                        type="text"
                                        name="company"
                                        maxlength="200"
                                        placeholder="Enter company name"
                                        autocomplete="organization"
                                        value="<?= ocEscape($ocValues['company']) ?>"
                                        required
                                    >
                                </div>

                                <div class="oc-field">
                                    <label for="oc-product">
                                        Product Name <span class="oc-required">*</span>
                                    </label>
                                    <input
                                        id="oc-product"
                                        class="oc-control"
                                        type="text"
                                        name="product"
                                        maxlength="200"
                                        placeholder="Which chemical product do you need?"
                                        value="<?= ocEscape($ocValues['product']) ?>"
                                        required
                                    >
                                </div>

                                <div class="oc-field">
                                    <label for="oc-quantity">
                                        Required Quantity <span class="oc-required">*</span>
                                    </label>
                                    <input
                                        id="oc-quantity"
                                        class="oc-control"
                                        type="text"
                                        name="quantity"
                                        maxlength="100"
                                        placeholder="e.g. 500 kg or 2 MT"
                                        value="<?= ocEscape($ocValues['quantity']) ?>"
                                        required
                                    >
                                </div>

                                <div class="oc-field">
                                    <label for="oc-message">
                                        Tell Us About Your Requirements
                                        <span class="oc-required">*</span>
                                    </label>
                                    <textarea
                                        id="oc-message"
                                        class="oc-control"
                                        name="message"
                                        maxlength="10000"
                                        placeholder="Describe your specifications, packaging or other requirements..."
                                        required
                                    ><?= ocEscape($ocValues['message']) ?></textarea>
                                </div>

                                <div class="oc-actions">
                                    <button
                                        class="oc-btn oc-btn-secondary"
                                        type="button"
                                        data-prev-step
                                    >
                                        <span aria-hidden="true">&#8592;</span>
                                        Previous
                                    </button>

                                    <button
                                        class="oc-btn oc-btn-primary"
                                        type="submit"
                                        name="oc_enquiry_submit"
                                        value="1"
                                    >
                                        Submit Enquiry
                                        <span aria-hidden="true">&#8594;</span>
                                    </button>
                                </div>
                            </div>
                        </form>

                        <p class="oc-form-note">
                            Your enquiry is handled by our team. You can
                            also send the same details through WhatsApp.
                        </p>

                        <!-- Phone + WhatsApp -->
                        <div class="oc-contact-actions">

                            <a
                                class="oc-contact"
                                href="tel:<?= ocEscape($ocBusinessPhoneLink) ?>"
                            >
                                <span class="oc-contact-icon" aria-hidden="true">
                                    &#9742;
                                </span>
                                <span class="oc-contact-info">
                                    <small>Prefer to speak with us?</small>
                                    <strong><?= ocEscape($ocBusinessPhone) ?></strong>
                                </span>
                            </a>

                            <a
                                class="oc-whatsapp-btn"
                                id="ocWhatsAppButton"
                                href="https://wa.me/<?= ocEscape($ocWhatsAppNumber) ?>"
                                target="_blank"
                                rel="noopener noreferrer"
                            >
                                <span class="oc-whatsapp-icon" aria-hidden="true">
                                    <svg viewBox="0 0 32 32" width="25" height="25" fill="currentColor">
                                        <path d="M16.02 3C8.87 3 3.05 8.8 3.05 15.94c0 2.28.6 4.5 1.75 6.46L3 29l6.77-1.77a13.1 13.1 0 0 0 6.24 1.58h.01C23.16 28.81 29 23 29 15.86 29 12.4 27.65 9.16 25.2 6.72A12.92 12.92 0 0 0 16.02 3zm0 23.6h-.01c-1.96 0-3.88-.53-5.56-1.54l-.4-.24-4.02 1.05 1.07-3.92-.26-.41a10.7 10.7 0 0 1-1.64-5.6c0-5.96 4.85-10.8 10.82-10.8 2.88 0 5.6 1.12 7.63 3.16a10.73 10.73 0 0 1 3.16 7.62c0 5.97-4.85 10.82-10.8 10.82zm5.93-8.1c-.33-.16-1.94-.96-2.24-1.07-.3-.11-.52-.16-.74.16-.22.33-.85 1.07-1.04 1.29-.19.22-.38.25-.71.08-.33-.16-1.39-.51-2.64-1.63-.98-.87-1.64-1.94-1.83-2.27-.19-.33-.02-.5.14-.66.15-.15.33-.38.49-.57.16-.19.22-.33.33-.55.11-.22.06-.41-.03-.57-.08-.16-.74-1.78-1.01-2.43-.27-.64-.54-.55-.74-.56h-.63c-.22 0-.57.08-.87.41-.3.33-1.14 1.12-1.14 2.73 0 1.62 1.17 3.18 1.33 3.4.16.22 2.3 3.51 5.58 4.92.78.34 1.39.54 1.87.69.79.25 1.51.22 2.08.13.63-.09 1.94-.8 2.21-1.57.27-.77.27-1.42.19-1.57-.08-.14-.3-.22-.63-.38z"/>
                                    </svg>
                                </span>

                                <span class="oc-whatsapp-text">
                                    <strong>Chat With Us on WhatsApp</strong>
                                    <small>Quick support for your chemical requirements</small>
                                </span>

                                <span class="oc-whatsapp-arrow" aria-hidden="true">
                                    &#8599;
                                </span>
                            </a>

                        </div>

                    </div>
                </aside>

            </div>
        </div>
    </section>
</div>

<script>
(function () {
    'use strict';

    const form = document.getElementById('ocEnquiryForm');

    if (!form) return;

    const steps = Array.from(form.querySelectorAll('.oc-form-step'));
    const progress = Array.from(
        document.querySelectorAll('.oc-services [data-progress]')
    );

    const whatsappButton = document.getElementById('ocWhatsAppButton');

    function showStep(number) {
        steps.forEach(function (step) {
            step.hidden = Number(step.dataset.step) !== number;
        });

        progress.forEach(function (item) {
            const active = Number(item.dataset.progress) === number;

            item.classList.toggle('active', active);

            if (active) {
                item.setAttribute('aria-current', 'step');
            } else {
                item.removeAttribute('aria-current');
            }
        });
    }

    function validateStep(number) {
        const step = form.querySelector('[data-step="' + number + '"]');

        if (!step) return true;

        const fields = Array.from(
            step.querySelectorAll('input, select, textarea')
        );

        for (const field of fields) {
            if (!field.checkValidity()) {
                showStep(number);
                field.reportValidity();
                field.focus();
                return false;
            }
        }

        return true;
    }

    form.querySelectorAll('[data-next-step]').forEach(function (button) {
        button.addEventListener('click', function () {
            if (validateStep(1)) {
                showStep(2);

                const firstField = form.querySelector(
                    '[data-step="2"] input'
                );

                if (firstField) firstField.focus();
            }
        });
    });

    form.querySelectorAll('[data-prev-step]').forEach(function (button) {
        button.addEventListener('click', function () {
            showStep(1);

            const firstField = form.querySelector(
                '[data-step="1"] input'
            );

            if (firstField) firstField.focus();
        });
    });

    /*
     * Update WhatsApp link live using the current form values.
     * This lets visitors send the details directly without submitting email.
     */
    function updateWhatsAppLink() {
        if (!whatsappButton) return;

        const getValue = function (name) {
            const field = form.elements.namedItem(name);
            return field ? String(field.value || '').trim() : '';
        };

        const message = [
            'Hello OPPULENT CHEMICALLS,',
            '',
            'I would like to enquire about your services.',
            '',
            'Name: ' + getValue('name'),
            'Email: ' + getValue('email'),
            'Country Code: ' + getValue('country_code'),
            'Mobile: ' + getValue('mobile'),
            'Location: ' + getValue('location'),
            'Company: ' + getValue('company'),
            'Product: ' + getValue('product'),
            'Required Quantity: ' + getValue('quantity'),
            '',
            'Requirements:',
            getValue('message')
        ].join('\n');

        whatsappButton.href =
            'https://wa.me/<?= ocEscape($ocWhatsAppNumber) ?>?text=' +
            encodeURIComponent(message);
    }

    form.addEventListener('input', updateWhatsAppLink);
    form.addEventListener('change', updateWhatsAppLink);

    /*
     * Submit the validated form to PHP for email processing.
     * WhatsApp is available as a separate button, so the email submission
     * is not silently replaced by a WhatsApp redirect.
     */
    form.addEventListener('submit', function (event) {
        event.preventDefault();

        for (let number = 1; number <= 2; number++) {
            if (!validateStep(number)) {
                return;
            }
        }

        updateWhatsAppLink();

        form.noValidate = true;
        form.submit();
    });

    <?php if ($ocFormError !== ''): ?>
        showStep(2);
    <?php else: ?>
        showStep(1);
    <?php endif; ?>

    updateWhatsAppLink();
})();
</script>

<?php include __DIR__ . '/footer.php'; ?>
