/* --- START: ALL STYLES (THEME + CHAT) --- */

/* --- ROOT & VARIABLES --- */
:root {
  --primary-color: #00e0ff;
  --secondary-color: #4effb5;
  --primary-grad: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  --bg-dark: #020409;
  --bg-light: #0d1117;
  --bg-glass: rgba(13, 17, 23, 0.7);
  --text: #f0f6fc;
  --muted: #a0acb8;
  --border-color: rgba(255, 255, 255, 0.08);
  --radius: 16px;
  --maxw: 1200px;
}

/* --- BASE & SCROLLBAR --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  /* This is critical for the panel animation */
  overflow: hidden; 
  height: 100vh;
  width: 100vw;
  scroll-behavior: smooth;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Base scrollbar styling for chat window */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-light);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}
::selection {
  background: rgba(0, 224, 255, 0.3);
  color: var(--text);
}

/* --- ACCESSIBILITY: KEYBOARD FOCUS --- */
:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --- START: HERO PANEL STYLES (from sym-x.com) --- */

.hero {
  position: fixed; /* Changed to fixed */
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 100vh; /* Full viewport height */
  padding: 0 1rem;
  background: radial-gradient(circle at 50% 10%, #0a1220 0%, #020409 80%);
  overflow: hidden;
  
  /* Animation styles */
  z-index: 10;
  transition: transform 0.7s cubic-bezier(0.86, 0, 0.07, 1);
  will-change: transform;
}
/* This class moves the hero panel up */
.hero.chat-open {
  transform: translateY(-100%);
}

.hero::before {
  content: "";
  position: absolute;
  top: calc(50% - 100vmax);
  left: calc(50% - 100vmax);
  width: 200vmax;
  height: 200vmax;
  background: conic-gradient(from 90deg at 50% 50%, rgba(0, 224, 255, 0.08), transparent 40%);
  animation: spin 20s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* This is the "Bespoke Web Design..." typewriter */
.hero h2 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  background: var(--primary-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 1rem;
  font-weight: 700;
  z-index: 1; 
}
.hero p {
  color: var(--muted);
  max-width: 650px;
  margin-bottom: 2.5rem;
  z-index: 1;
  font-size: 1.15rem;
}
.typewrite > .wrap {
  border-right: .1em solid var(--primary-color);
}

/* START: New Button Container */
.hero-buttons {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap; /* Allows buttons to stack on small screens */
  z-index: 1;
}
/* END: New Button Container */


/* --- BUTTONS --- */
.btn {
  display: inline-block;
  background: var(--primary-grad);
  color: #020409;
  padding: .9rem 2.2rem;
  border-radius: 30px;
  font-weight: 600;
  text-decoration: none;
  transition: .3s;
  /* z-index: 1; <-- Removed, parent container .hero-buttons handles this */
  border: 2px solid transparent; /* Added for outline button consistency */
  font-size: 1rem;
  cursor: pointer;
}
.btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 0 25px rgba(0, 224, 255, 0.5);
}

/* Special AI button style */
.btn-ai {
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  animation: pulse-glow-premium 1.7s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  border: none; /* AI button has no border */
}
.btn-ai i {
  margin-right: 0.5rem;
}
@keyframes pulse-glow-premium {
  0% { box-shadow: 0 0 0 0 rgba(0, 224, 255, 0.5); }
  70% { box-shadow: 0 0 0 12px rgba(0, 224, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 224, 255, 0); }
}

/* START: New Secondary Button Style */
.btn-secondary {
  background: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  padding: 1rem 2.5rem; /* Match AI button padding */
  font-size: 1.1rem; /* Match AI button font size */
}
.btn-secondary:hover {
  background: var(--primary-color);
  color: var(--bg-dark);
}
.btn-secondary i {
  margin-right: 0.5rem;
}
/* END: New Secondary Button Style */

/* --- END: HERO PANEL STYLES --- */


/* --- START: NEW AI CHATBOT PANEL STYLES --- */

.chat-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-dark);
  z-index: 20; /* Sits on top of the hero */
  display: flex;
  flex-direction: column;
  
  /* Animation styles */
  transform: translateY(100%); /* Start off-screen at the bottom */
  transition: transform 0.7s cubic-bezier(0.86, 0, 0.07, 1);
  will-change: transform;
}
/* This class brings the chat panel up */
.chat-container.open {
  transform: translateY(0%);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2.5rem;
  background: var(--bg-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  z-index: 1;
}
/* This is the "Symbol-X" title in the chat header */
.chat-header h1 {
  background: var(--primary-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 1.5rem;
  font-weight: 700;
}
/* This is the "Close" button */
.chat-close-btn {
  font-size: 1.8rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: .3s;
}
.chat-close-btn:hover {
  color: var(--primary-color);
  transform: rotate(90deg);
}

.chat-messages {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto; /* Center the message column */
}

.message {
  display: flex;
  max-width: 80%;
  animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  align-self: flex-end;
  /* flex-direction: row-reverse; <-- REMOVED */
}
.message.model {
  align-self: flex-start;
}
.message .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin-right: 0.75rem;
  flex-shrink: 0;
}
/* START: Removed .message.user .avatar styles */
/* (The block that styled the "You" avatar is gone) */
/* END: Removed .message.user .avatar styles */

.message.model .avatar i {
  background: var(--primary-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 1.2rem;
}

.message-content {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.8rem 1.2rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
}
.message.user .message-content {
  background: var(--primary-color);
  color: var(--bg-dark);
  border-color: var(--primary-color);
}
.message.user .message-content p {
  color: var(--bg-dark);
}
.message-content p {
  color: var(--text);
  line-height: 1.7;
  white-space: pre-wrap; /* Respects newlines */
  margin: 0;
}
/* Markdown formatting */
.message-content p + p {
  margin-top: 0.5rem;
}
.message-content strong, .message-content b {
  color: var(--primary-color);
  font-weight: 600;
}
.message.user .message-content strong,
.message.user .message-content b {
  color: var(--bg-dark);
}
.message-content ul, .message-content ol {
  margin: 0.75rem 0 0.75rem 1.25rem;
}
.message-content li {
  margin-bottom: 0.25rem;
}
.message-content a {
  color: var(--secondary-color);
  text-decoration: underline;
}
.message.user .message-content a {
  color: var(--bg-dark);
  font-weight: 600;
}


/* Loading bubble */
.message.loading .message-content {
  padding: 1rem 1.2rem;
}
.loading-dots {
  display: flex;
  gap: 4px;
}
.loading-dots div {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  animation: bounce 1.2s infinite ease-in-out;
}
.loading-dots div:nth-child(1) { animation-delay: -0.32s; }
.loading-dots div:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1.0); }
}

/* Handoff Buttons */
.contact-buttons {
  display: flex;
  flex-direction: row; /* Horizontal for chat */
  gap: 1rem;
  align-items: flex-start;
  margin-top: 1rem;
}
/* Re-use your exact button styles */
.btn-whatsapp {
  background: #25d366;
  color: #fff;
  padding: 0.7rem 1.2rem; /* Slightly smaller for chat */
  font-size: 0.9rem;
  border-radius: 20px; /* Match other buttons */
}
.btn-whatsapp:hover {
  background: #1da851;
  box-shadow: 0 0 20px rgba(37, 211, 102, 0.4);
  transform: translateY(-2px) scale(1.03);
}
.btn-email {
  background: var(--bg-dark);
  color: var(--text);
  border: 1px solid var(--border-color);
  padding: 0.7rem 1.2rem;
  font-size: 0.9rem;
  border-radius: 20px;
}
.btn-email:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  box-shadow: 0 0 20px rgba(0, 224, 255, 0.2);
  transform: translateY(-2px) scale(1.03);
}

/* START: Modified Chat Input Form */
.chat-input-form {
  display: flex;
  align-items: flex-end; /* Aligns button to bottom when textarea grows */
  padding: 1rem;
  background: var(--bg-light); /* Different from chat bg */
  border-top: 1px solid var(--border-color);
  gap: 0.75rem;
  flex-shrink: 0;
  z-index: 1; 
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
}
.chat-input-form textarea {
  flex-grow: 1;
  padding: 0.9rem 1.2rem; /* More horizontal padding */
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 30px; /* Pill shape */
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  transition: .3s;
  resize: none;
  height: 54px; /* Default height (JS will override) */
  max-height: 150px; /* Max height before scrolling */
  line-height: 1.6; /* Added for better text alignment */
}
.chat-input-form textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  /* box-shadow: 0 0 10px rgba(0, 224, 255, 0.2); <-- Removed for cleaner look */
}
.chat-send-btn {
  background: var(--primary-color);
  color: var(--bg-dark);
  border: none;
  border-radius: 50%; /* Circle shape */
  width: 54px;
  height: 54px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: .3s;
  flex-shrink: 0;
}
/* END: Modified Chat Input Form */

.chat-send-btn:hover {
  background: var(--secondary-color);
  transform: scale(1.05);
}
.chat-send-btn:disabled {
  background: var(--border-color);
  color: var(--muted);
  cursor: not-allowed;
  transform: none;
}

/* --- RESPONSIVE STYLES --- */

@media (max-width: 992px) {
  .chat-header {
    padding: 1rem 1.5rem;
  }
  .chat-messages, .chat-input-form {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (max-width: 768px) {
  .hero h2 {
    font-size: clamp(1.8rem, 8vw, 2.2rem);
  }
  .hero p {
    font-size: 1rem;
  }
  /* START: Responsive Button Stacking */
  .hero-buttons {
    gap: 0.75rem; /* Smaller gap on mobile */
  }
  .btn, .btn-ai, .btn-secondary {
    padding: 0.8rem 1.8rem; /* Slightly smaller buttons on mobile */
    font-size: 1rem;
  }
  /* END: Responsive Button Stacking */

  .chat-header {
    padding: 1rem 1.5rem;
  }
  .chat-messages {
    padding: 1rem;
    gap: 1rem;
  }
  .message {
    max-width: 95%;
  }
  .chat-input-form {
    padding: 0.75rem 1rem;
    gap: 0.5rem; /* Tighter gap on mobile */
  }
  .chat-input-form textarea {
    height: 50px;
    padding: 0.7rem 1rem; /* Adjust padding for smaller height */
  }
  .chat-send-btn {
    width: 50px;
    height: 50px;
  }
  .contact-buttons {
    flex-direction: column; /* Stack buttons on small screens */
  }
}

/* --- ACCESSIBILITY: REDUCE MOTION --- */
@media (prefers-reduced-motion: reduce) {
  html, body { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero::before { animation: none; }
}
