/*
=================
CSS Variables - Reusable colors and values
=================
*/
:root {
  /* Main colors */
  --accent-color: #6366f1;            /* Purple accent color for interactive elements */
  --text-primary: #1a1a1a;            /* Main text color */
  --text-secondary: #666;             /* Secondary text color */
  --background: #ffffff;              /* Page background color */

  /* Additional backgrounds (for gradients / glass effects) */
  --hero-background: linear-gradient(
    120deg,
    rgba(99, 102, 241, 0.05) 0%,
    rgba(255, 255, 255, 1) 100%
  );
  --glass-background: rgba(255, 255, 255, 0.6);

  /* Spacing and sizing */
  --nav-height: 4rem;                /* Height of the navigation bar */
  --container-padding: 2rem;         /* Padding for containers */

  /* Transitions & Effects */
  --transition-speed: 0.2s;          /* Standard transition speed for hover effects */
  --box-shadow-base: 0 4px 6px rgba(0, 0, 0, 0.05);
  --box-shadow-hover: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/*
=================
Reset and Base Styles
=================
*/
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--background);
}

img {
  max-width: 100%;
  display: block;
}

/*
=================
Layout and Container
=================
*/
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/*
=================
Header and Navigation
=================
*/
header {
  height: var(--nav-height);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  background: var(--glass-background);
  backdrop-filter: blur(12px);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

nav {
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Brand logo styling */
.brand {
  font-size: 1.6rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--text-primary);
  transition: color var(--transition-speed) ease;
}

.brand span {
  color: var(--accent-color);
}

.brand:hover {
  color: var(--accent-color);
}

/* Navigation links */
.nav-links a {
  margin-left: 2rem;
  text-decoration: none;
  color: var(--text-secondary);
  transition: color var(--transition-speed) ease;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--accent-color);
}

/*
=================
Main Content Area
=================
*/
main {
  margin-top: var(--nav-height); /* Push content below fixed header */
  padding: 4rem 0;              /* Adjust if you want less vertical space overall */
  background: var(--hero-background);
}

/* Hero section styling */
.hero {
  text-align: center;
  padding: 2rem 2rem; 
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-primary);
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0.75rem auto 0;
  line-height: 1.5;
  text-align: center;
}

.hero p.home-description {
  text-align: justify;
}

/* Call to action button */
.cta-button {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.75rem 2rem;
  background: var(--accent-color);
  color: #fff;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  transition: background var(--transition-speed) ease, transform var(--transition-speed) ease;
  text-decoration: none;
}

.cta-button:hover {
  background: #5558ef; 
  transform: translateY(-2px);
}

/*
=================
Project Cards & Sections
=================
*/
section {
  padding: 1rem 0;
  margin-bottom: 0;
}

.project-description {
  padding-bottom: 0.5rem;
  margin-bottom: 0;
}

section h2 {
  font-size: 2rem;
  margin-bottom: 2rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-primary);
}

/*
=================
Articles Section
=================
*/
.articles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.article-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 1.5rem;
}

.article-content p {
  margin-bottom: 1.2rem;
}

.article-card {
  background: var(--glass-background);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--box-shadow-base);
  transition: transform var(--transition-speed) ease,
              box-shadow var(--transition-speed) ease,
              background var(--transition-speed) ease;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--box-shadow-hover);
  background: rgba(255, 255, 255, 0.8);
}

.article-card h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.article-date {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/*
=================
Project Card
=================
*/
.project-card {
  background: var(--glass-background);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem; 
  box-shadow: var(--box-shadow-base);
  transition: transform var(--transition-speed) ease,
              box-shadow var(--transition-speed) ease,
              background var(--transition-speed) ease;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.project-card p, 
.project-card ul, 
.project-card li {
  text-align: justify;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--box-shadow-hover);
  background: rgba(255,255,255,0.8);
}

/*
=================
Chatbox Section Fix
=================
*/
/* If you wrap your chat in <section class="chatbox-section">, 
   this removes extra top spacing above it. */
.chatbox-section {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.chatbox-section h3 {
  margin-top: 0 !important;
  margin-bottom: 0.75rem !important;
}

/*
=================
Chat Interface
=================
*/

/* Chat container: switch to flex layout */
.chat-container {
  background: var(--glass-background);
  backdrop-filter: blur(14px);
  border-radius: 12px;
  box-shadow: var(--box-shadow-base);
  margin: 1rem 0; 
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.4);
  height: 500px;
  width: 100%;
  position: relative;
  transition: box-shadow var(--transition-speed) ease, transform var(--transition-speed) ease;
  display: flex;
  flex-direction: column;
}

.chat-container:hover {
  box-shadow: var(--box-shadow-hover);
  transform: translateY(-2px);
}

/* The n8n chat widget will fill this container, also flex-based */
#n8n-chat-container {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/*
=================
n8n Chat Widget Customization
=================
*/
:root {
  /* PRIMARY BRAND COLOR (Indigo) */
  --chat--color-primary: #6366f1;
  --chat--color-primary-shade-50: #5558ef;
  --chat--color-primary-shade-100: #4c4fe0;

  /* Force Indigo for user messages */
  --chat--color-secondary: #6366f1 !important;
  --chat--color-secondary-shade-50: #5558ef !important; 
  --chat--message--user--background: #6366f1 !important;
  --chat--message--user--color: #ffffff;

  /* Text and background colors */
  --chat--color-dark: #1a1a1a;
  --chat--color-white: #ffffff;
  --chat--color-light: #f8fafc;

  /* Bot messages */
  --chat--message--bot--background: #ffffff;
  --chat--message--bot--color: #1a1a1a;
  --chat--message--bot--border: 1px solid rgba(99, 102, 241, 0.1);

  /* Chat header: glass effect */
  --chat--header--background: rgba(255, 255, 255, 0.6);
  --chat--header--color: #1a1a1a;

  /* Input field styling */
  --chat--input--background: #ffffff;
  --chat--input--color: #1a1a1a;
  --chat--input--border: 1px solid rgba(99, 102, 241, 0.2);
  --chat--input--placeholder-color: rgba(26, 26, 26, 0.5);
  --chat--input--focus-border-color: #6366f1;

  /* Spacing & Borders */
  --chat--border-radius: 12px;
  --chat--message--border-radius: 10px;
  --chat--button--border-radius: 8px;

  /* Other UI elements */
  --chat--shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  --chat--window--background: rgba(255, 255, 255, 0.98);
  --chat--padding: 0;
  --chat--message--spacing: 12px;
  --chat--message--font-size: 0.95rem;

  /* Disable floating toggle button in window mode */
  --chat--toggle--display: none;
}

/* The main .n8n-chat container inside #n8n-chat-container */
#n8n-chat-container .n8n-chat {
  border: 1px solid rgba(99, 102, 241, 0.15);
  box-shadow: var(--box-shadow-base);
  transition: all var(--transition-speed) ease;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

#n8n-chat-container .n8n-chat:hover {
  box-shadow: var(--box-shadow-hover);
}

/* Force consistent fonts across the chat, with slightly smaller size */
#n8n-chat-container .n8n-chat,
#n8n-chat-container .n8n-chat * {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 0.95rem !important;
  line-height: 1.4 !important;
  box-sizing: border-box;
}

/* Remove top margin on the first bubble */
#n8n-chat-container .n8n-chat-messages > *:first-child {
  margin-top: 0 !important;
}

/* Chat header at the top (flex: 0 0 auto) */
#n8n-chat-container .n8n-chat-header {
  flex: 0 0 auto;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
  background: var(--chat--header--background);
  color: var(--chat--header--color);
  padding: 0.75rem 1rem;
  border-top-left-radius: var(--chat--border-radius);
  border-top-right-radius: var(--chat--border-radius);
}

#n8n-chat-container .n8n-chat-header-title {
  font-weight: 600;
  display: flex;
  align-items: center;
  margin: 0;
}

#n8n-chat-container .n8n-chat-header-title::before {
  content: 'ai';
  color: var(--accent-color);
  margin-right: 8px;
}

/* Chat body in the middle (flex: 1 1 auto) */
#n8n-chat-container .n8n-chat-body {
  flex: 1 1 auto;
  overflow-y: auto;
  background: #fff;
  padding: 1rem;
  margin: 0; 
}

#n8n-chat-container .n8n-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Bot and user message bubbles */
#n8n-chat-container .n8n-chat-message-bot,
#n8n-chat-container .n8n-chat-message-user {
  border-radius: var(--chat--message--border-radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

#n8n-chat-container .n8n-chat-message-bot {
  background: var(--chat--message--bot--background);
  color: var(--chat--message--bot--color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

#n8n-chat-container .n8n-chat-message-user {
  background: var(--chat--message--user--background);
  color: var(--chat--message--user--color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Topic buttons (if used) */
#n8n-chat-container .n8n-chat-topic-button {
  background-color: #6366f1 !important;
  color: #ffffff !important;
  border-radius: 8px;
}

#n8n-chat-container .n8n-chat-topic-button:hover {
  background-color: #5558ef !important;
}

/* Input bar at the bottom (flex: 0 0 auto) */
#n8n-chat-container .n8n-chat-input {
  flex: 0 0 auto;
  border-top: 1px solid rgba(99, 102, 241, 0.1);
  background: #fff;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom-left-radius: var(--chat--border-radius);
  border-bottom-right-radius: var(--chat--border-radius);
  position: static !important; /* Ensure no absolute positioning */
}

#n8n-chat-container .n8n-chat-input-field {
  flex: 1 1 auto;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--chat--button--border-radius);
  padding: 0.75rem 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#n8n-chat-container .n8n-chat-input-send-button {
  background-color: var(--chat--color-primary);
  color: #fff;
  border-radius: var(--chat--button--border-radius);
  width: 50px;
  font-size: 1rem;
  line-height: 1.6;
  cursor: pointer;
  transition: transform var(--transition-speed) ease, background-color var(--transition-speed) ease;
}

#n8n-chat-container .n8n-chat-input-send-button:hover {
  background-color: var(--chat--color-primary-shade-50);
  transform: translateY(-2px);
}

/*
=================
Footer
=================
*/
footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-secondary);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  background: #fafafa;
}

footer a {
  color: var(--accent-color);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.legal-disclaimer {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: left;
  width: 100%;
}

.legal-disclaimer h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.legal-disclaimer p {
  margin-bottom: 1rem;
  line-height: 1.5;
  text-align: justify;
}

/*
=================
Contact Form Styles
=================
*/
.contact-form {
  max-width: 600px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-weight: 500;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  transition: border var(--transition-speed) ease;
}

.form-group input:focus,
.form-group textarea:focus {
  border: 1px solid var(--accent-color);
  outline: none;
}

.form-group textarea {
  min-height: 150px;
  resize: vertical;
}

.submit-button {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity var(--transition-speed) ease, background var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.submit-button:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

/*
=================
Media Queries
=================
*/
@media (max-width: 768px) {
  .hero h1 {
    font-size: 2.2rem;
  }
  .hero p {
    font-size: 1rem;
  }
  .nav-links a {
    margin-left: 1rem;
  }
  .container {
    padding: 0 1rem;
  }
  .chat-container {
    height: 500px;
    margin-top: 1rem;
  }
}
