/* Reset & base */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }
.container { width: 90%; max-width: 1200px; margin: 0 auto; }
/* Colors */
:root {
--primary: #2E86DE;
--secondary: #F2F3F4;
--accent: #117A65;
--dark: #1B2631;
--light: #fff;
}
/* Buttons */
.btn {
background: var(--primary); color: var(--light);
padding: .6em 1.2em; border: none;
cursor: pointer; border-radius: 4px;
transition: background .3s;
}
.btn:hover { background: var(--accent); }
.btn.small { padding: .4em .8em; font-size: .9em; }
/* Header */
.site-header {
background: var(--light); box-shadow: 0 2px 5px rgba(0,0,0,.1);
position: sticky; top: 0; z-index: 1000;
}
.site-header .container {
display: flex; align-items: center; justify-content: space-between; padding: 1em 0;
}
.logo {
font-size: 1.5em; font-weight: bold; color: var(--dark); text-decoration: none;
}
.logo .dot { color: var(--accent); }
nav ul { list-style: none; display: flex; gap: 1em; align-items: center; }
nav a { text-decoration: none; color: var(--dark); }
.demo-btn { background: var(--accent); }
/* Hero */
.hero {
background: url('assets/hero-bg.jpg') center/cover no-repeat;
color: var(--light); padding: 5em 0; text-align: center;
}
.hero h1 { font-size: 2.5em; margin-bottom: .5em; }
.hero p { font-size: 1.2em; margin-bottom: 1em; }
/* Sections */
section { padding: 3em 0; }
.services .grid,
.portfolio .grid { display: grid; gap: 1.5em; }
.services .grid { grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); }
.portfolio .grid { grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); }
.card, .client-card {
background: var(--light); border-radius: 6px;
padding: 1.5em; box-shadow: 0 2px 5px rgba(0,0,0,.1);
}
.client-card img { max-width: 100%; height: auto; margin-bottom: .5em; }
/* Custom list */
.custom-list { list-style: disc inside; margin-top: 1em; }
/* Contact Form */
.contact form { max-width: 600px; margin: 0 auto; }
.form-group { margin-bottom: 1em; }
.form-group label { display: block; margin-bottom: .3em; }
.form-group input,
.form-group textarea {
width: 100%; padding: .6em; border: 1px solid #ccc; border-radius: 4px;
}
/* Footer */
.site-footer { background: var(--dark); color: var(--light); text-align: center; padding: 2em 0; }
.site-footer a { color: var(--light); text-decoration: none; }
/* Responsive */
@media(max-width:768px){
nav ul { flex-direction: column; background: var(--light); position: absolute; top:60px; right:10px; display: none; }
nav ul.show { display: flex; }
}
/* ===== CHAT WIDGET ===== */
#chat-widget { position: fixed; bottom: 20px; right: 20px; width: 300px; font-size: .9em; }
#chat-header {
background: var(--primary); color: #fff; padding: .6em; border-radius: 6px 6px 0 0;
}
#chat-body { border: 1px solid #ccc; border-top: none; background: #fff; max-height: 400px; display: flex; flex-direction: column; }
#user-info-form, #chat-window { padding: 1em; }
#user-info-form input { width: 100%; margin: .5em 0; padding: .5em; }
#start-chat { width: 100%; }
#chat-window.hidden { display: none; }
#messages { flex: 1; overflow-y: auto; margin-bottom: .5em; }
.message { margin: .5em 0; }
.message.user { text-align: right; }
.message.bot { text-align: left; }
.chat-input { display: flex; gap: .5em; }
.chat-input input { flex: 1; padding: .5em; }
#chat-toggle {
position: absolute; top: -40px; right: 0; background: var(--primary);
color: #fff; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
border-radius: 50%; cursor: pointer;
}
// Smooth scroll helper
function scrollToSection(id) {
document.getElementById(id).scrollIntoView({ behavior: 'smooth' });
}
// CONTACT form submission (basic; adapt to your backend)
document.getElementById('contactForm').addEventListener('submit', e => {
e.preventDefault();
alert('Thank you! We will be in touch shortly.');
e.target.reset();
});
// CHAT WIDGET LOGIC
const chatWidget = document.getElementById('chat-widget');
const chatToggle = document.getElementById('chat-toggle');
const userForm = document.getElementById('user-info-form');
const startChatBtn = document.getElementById('start-chat');
const chatWindow = document.getElementById('chat-window');
const messagesEl = document.getElementById('messages');
const chatInput = document.getElementById('chat-input');
const sendBtn = document.getElementById('send-btn');
let user = { name:'', email:'', company:'', phone:'' };
let convo = [];
// toggle widget
chatToggle.addEventListener('click', () => {
chatWidget.classList.toggle('open');
});
// start chat after user info
startChatBtn.addEventListener('click', () => {
const n = document.getElementById('u-name').value.trim();
const e = document.getElementById('u-email').value.trim();
if(!n||!e){
alert('Name & Email are required');
return;
}
user.name = n; user.email = e;
user.company = document.getElementById('u-company').value.trim();
user.phone = document.getElementById('u-phone').value.trim();
userForm.style.display = 'none';
chatWindow.classList.remove('hidden');
appendBotMessage(`Hi ${user.name}, how can I help you today?`);
logChat();
});
// append messages
function appendUserMessage(text) {
const div = document.createElement('div');
div.className = 'message user';
div.innerText = text;
messagesEl.append(div);
messagesEl.scrollTop = messagesEl.scrollHeight;
}
function appendBotMessage(text) {
const div = document.createElement('div');
div.className = 'message bot';
div.innerText = text;
messagesEl.append(div);
messagesEl.scrollTop = messagesEl.scrollHeight;
}
// handle sending
sendBtn.addEventListener('click', sendMessage);
chatInput.addEventListener('keypress', e => {
if(e.key === 'Enter') sendMessage();
});
function sendMessage() {
const text = chatInput.value.trim();
if(!text) return;
appendUserMessage(text);
convo.push({ sender:'user', text, time: new Date().toISOString() });
chatInput.value = '';
// 1. Send to AI endpoint
fetch('/api/chat', {
method:'POST',
headers:{ 'Content-Type':'application/json' },
body: JSON.stringify({ user, message:text, convo })
})
.then(r => r.json())
.then(data => {
const reply = data.reply || 'Sorry, something went wrong.';
appendBotMessage(reply);
convo.push({ sender:'bot', text:reply, time: new Date().toISOString() });
logChat();
})
.catch(err => {
appendBotMessage('Error connecting to chat service.');
});
}
// 2. Log chat (POSTs full convo + user details)
function logChat() {
fetch('/api/log', {
method:'POST',
headers:{ 'Content-Type':'application/json' },
body: JSON.stringify({
user,
convo,
timestamp: new Date().toISOString()
})
})
.catch(err => console.warn('Log failed:', err));
}
This gives you a clean, responsive, professional site with a built-in AI chat + logging ready to hook into your backend. 🚀