/* ==========================================================================
   Design System & Global CSS Tokens
   Personal Portfolio - Vishnu Ram Sachin D
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  /* Color Palette - Dark Oceanic & Sky Blue */
  --bg-primary: #0a1120;
  --bg-secondary: #0f172a;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-glass: rgba(255, 255, 255, 0.04);

  --border-color: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(56, 189, 248, 0.45);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-accent: #38bdf8;

  --accent-gradient: linear-gradient(135deg, #0284c7 0%, #38bdf8 50%, #60a5fa 100%);
  --accent-cyan: #38bdf8;
  --accent-indigo: #0284c7;
  --accent-pink: #60a5fa;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.3);

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;

  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-primary: #f0f7ff;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-card-hover: rgba(255, 255, 255, 0.98);
  --bg-glass: rgba(0, 0, 0, 0.02);

  --border-color: rgba(2, 132, 199, 0.12);
  --border-hover: rgba(2, 132, 199, 0.45);

  --text-main: #0f172a;
  --text-muted: #334155;
  --text-accent: #0284c7;

  --accent-gradient: linear-gradient(135deg, #0369a1 0%, #0284c7 50%, #2563eb 100%);

  --shadow-sm: 0 2px 8px rgba(2, 132, 199, 0.08);
  --shadow-lg: 0 10px 30px -10px rgba(2, 132, 199, 0.15);
  --shadow-glow: 0 0 25px rgba(2, 132, 199, 0.2);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-main);
  line-height: 1.25;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* Layout Utilities */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 5rem 0;
  position: relative;
}

.section-title {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 3rem;
}

/* Header & Sticky Nav */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(11, 15, 25, 0.75);
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-smooth), border-color var(--transition-smooth);
}

[data-theme="light"] .header {
  background: rgba(248, 250, 252, 0.85);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 4.5rem;
}

.logo {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.4rem;
  text-decoration: none;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  letter-spacing: -0.02em;
  transition: transform var(--transition-fast);
}

.logo:hover {
  transform: scale(1.03);
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-accent);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.logo:hover .logo-icon {
  background: rgba(56, 189, 248, 0.2);
  box-shadow: var(--shadow-glow);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  padding: 0.25rem 0;
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-accent);
}

.nav-link.active {
  color: var(--text-accent);
  font-weight: 600;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent-gradient);
  border-radius: 2px;
  animation: navLinkFade 0.25s ease-in-out;
}

@keyframes navLinkFade {
  from {
    opacity: 0;
    transform: scaleX(0);
  }
  to {
    opacity: 1;
    transform: scaleX(1);
  }
}

.theme-toggle-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
  border-color: var(--text-accent);
  box-shadow: var(--shadow-glow);
  transform: scale(1.05);
}

.mobile-menu-btn {
  display: none;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
  border-color: var(--text-accent);
  color: var(--text-accent);
}

/* Hero Section */
.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 3rem;
  align-items: center;
  padding-top: 6rem;
  padding-bottom: 3rem;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 50px;
  color: var(--text-accent);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: 3.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.5rem;
  color: var(--text-accent);
  font-weight: 600;
  margin-bottom: 1.5rem;
  min-height: 2.2rem;
}

.typewriter-cursor {
  display: inline-block;
  margin-left: 2px;
  color: var(--text-accent);
  font-weight: 300;
  animation: blinkCursor 0.75s step-end infinite;
  transition: opacity 0.4s ease;
}

@keyframes blinkCursor {
  from, to { opacity: 1; }
  50% { opacity: 0; }
}
.hero-bio {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-muted);
  margin-top: 1.5rem;
  margin-bottom: 2.25rem;
  max-width: 620px;
}

.hero-actions {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  margin-top: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 35px rgba(99, 102, 241, 0.4);
}

.btn-outline {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--text-accent);
  background: rgba(99, 102, 241, 0.08);
  transform: translateY(-2px);
}

/* Rounded Theme-Responsive Photo Frame */
.hero-avatar-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-avatar-frame {
  position: relative;
  padding: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #38bdf8, #60a5fa);
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.4), inset 0 0 15px rgba(56, 189, 248, 0.25);
  transition: all var(--transition-smooth);
}

.hero-avatar-frame:hover {
  transform: scale(1.03);
  box-shadow: 0 0 45px rgba(56, 189, 248, 0.55), inset 0 0 20px rgba(56, 189, 248, 0.35);
}

.hero-avatar {
  width: 310px;
  height: 310px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 4px solid var(--bg-primary);
  background: var(--bg-card);
  transition: border-color var(--transition-smooth);
}

[data-theme="light"] .hero-avatar-frame {
  background: linear-gradient(135deg, #0369a1, #0284c7, #3b82f6);
  box-shadow: 0 12px 30px rgba(2, 132, 199, 0.25), 0 0 0 1px rgba(2, 132, 199, 0.15);
}

[data-theme="light"] .hero-avatar {
  border-color: #ffffff;
}

/* Cards & Glassmorphic Container */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  backdrop-filter: blur(12px);
  transition: all var(--transition-smooth);
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Skills Grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.75rem;
}

.skill-category-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-accent);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.tag {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--text-main);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.tag:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--text-accent);
}

/* Experience Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  position: relative;
}

.timeline-card {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid var(--border-color);
}

.timeline-card::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 0.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-accent);
  box-shadow: 0 0 10px var(--text-accent);
}

.timeline-role {
  font-size: 1.35rem;
  font-weight: 700;
}

.timeline-company {
  color: var(--text-accent);
  font-weight: 600;
  font-size: 1.05rem;
}

.timeline-date {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.timeline-bullets {
  list-style-type: disc;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.timeline-bullets li {
  margin-bottom: 0.4rem;
}

/* Projects Grid & Modal */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  overflow: hidden;
}

.project-card-img-container {
  width: 100%;
  height: 180px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 1.25rem;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-smooth);
}

.project-card:hover .project-card-img {
  transform: scale(1.05);
}

/* Certificate Cards Grid & Verification Buttons */
.certs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
}

.cert-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.cert-header-badge {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.cert-badge-img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid var(--border-color);
}

.cert-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-main);
}

.cert-issuer {
  color: var(--text-accent);
  font-weight: 600;
  font-size: 0.9rem;
}

.cert-date {
  color: var(--text-muted);
  font-size: 0.825rem;
}

.btn-verify-cert {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--text-accent);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.btn-verify-cert:hover {
  background: var(--text-accent);
  color: #ffffff;
  box-shadow: var(--shadow-glow);
}

.project-summary {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2.5rem;
  position: relative;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95);
  transition: transform var(--transition-smooth);
}

.modal-backdrop.active .modal-content {
  transform: scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--text-main);
}

/* Certificates Table */
.cert-table-container {
  overflow-x: auto;
}

.cert-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.cert-table th, .cert-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.cert-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cert-table td {
  font-size: 0.95rem;
}

/* Contact Section */
.contact-card {
  text-align: center;
  padding: 3.5rem 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

/* Responsive Breakdown */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-bio {
    margin: 0 auto 2rem auto;
  }

  .hero-actions {
    justify-content: center;
  }

  .hero-avatar {
    width: 240px;
    height: 240px;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: 4.5rem;
    left: 0;
    right: 0;
    background: rgba(11, 15, 25, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    flex-direction: column;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    gap: 0;
    display: none;
  }
  
  [data-theme="light"] .nav-links {
    background: rgba(248, 250, 252, 0.95);
  }

  .nav-links.mobile-active {
    display: flex;
    animation: slideDown 0.3s ease-out;
  }

  .nav-link {
    display: block;
    width: 100%;
    padding: 1rem;
    text-align: center;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  [data-theme="light"] .nav-link {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }

  .nav-link.active::after {
    display: none; /* Hide the bottom border line in mobile menu */
  }
  
  .nav-link.active {
    background: rgba(56, 189, 248, 0.1);
  }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   AI Chatbot Widget Styles
   ========================================================================== */

.chat-launcher {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 990;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: all var(--transition-smooth);
}

.chat-launcher.hidden {
  opacity: 0;
  transform: scale(0.5);
  pointer-events: none;
}

.chat-launcher:hover:not(.hidden) {
  transform: scale(1.08) rotate(5deg);
  box-shadow: 0 12px 35px rgba(99, 102, 241, 0.6);
}

.chat-widget-panel {
  position: fixed;
  bottom: 5.5rem;
  right: 1.75rem;
  z-index: 995;
  width: 380px;
  max-width: calc(100vw - 2rem);
  height: 540px;
  max-height: calc(100vh - 7rem);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all var(--transition-smooth);
}

.chat-widget-panel.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-header {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-avatar-mini {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--text-accent);
}

.chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.chat-messages-area {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.925rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-bubble-bot {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-bubble-user {
  background: var(--accent-gradient);
  color: #ffffff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-bubble-bot a {
  color: var(--text-accent);
  text-decoration: underline;
  font-weight: 600;
}

.suggested-chips-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.5rem 0;
  margin-top: 0.25rem;
  width: 100%;
}

.chip-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.55rem 1.1rem;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  max-width: 92%;
  word-break: break-word;
}

.chip-btn:hover {
  border-color: var(--text-accent);
  color: var(--text-accent);
  background: rgba(56, 189, 248, 0.12);
  transform: translateX(4px);
}

.chat-input-bar {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-input-field {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.85rem;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
}

.chat-input-field:focus {
  border-color: var(--text-accent);
}

.chat-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chat-send-submit-btn {
  background: var(--text-accent);
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.chat-send-submit-btn:hover {
  transform: scale(1.06);
  box-shadow: var(--shadow-glow);
}

.chat-action-btn:hover {
  color: var(--text-accent);
  background: var(--bg-glass);
}

.chat-action-btn.active-mic {
  color: #ef4444;
  animation: pulse-recording 1.5s infinite;
}

@keyframes pulse-recording {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@media (max-width: 480px) {
  .chat-widget-panel {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: 100vh;
    border-radius: 0;
    z-index: 9999;
    border: none;
    transform: translateY(100%);
  }

  .chat-widget-panel.active {
    transform: translateY(0);
  }

  .chat-header {
    padding-top: calc(1rem + env(safe-area-inset-top, 1rem));
  }

  .chat-input-bar {
    gap: 0.5rem;
    padding: 0.75rem;
  }

  .chat-action-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .chat-send-submit-btn {
    width: 42px;
    height: 42px;
    font-size: 1.05rem;
    flex-shrink: 0;
  }

  .chat-input-field {
    padding: 0.75rem 0.85rem;
    font-size: 16px; /* Prevents iOS auto-zoom on focus */
    min-width: 0; /* Crucial to prevent overflow on 320px screens */
  }
}

/* -------------------------------------------------------------------------- */
/* Floating Animated Bot Character                                            */
/* -------------------------------------------------------------------------- */
.bot-avatar-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 994;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  cursor: pointer;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.bot-avatar-container.hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.75);
  pointer-events: none;
}

.bot-speech-bubble {
  background: #11151c;
  color: #ffffff;
  border: 2px solid #00f0ff;
  padding: 0.6rem 1rem;
  border-radius: 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.4), inset 0 0 10px rgba(0, 240, 255, 0.2);
  margin-bottom: 0.75rem;
  max-width: 220px;
  text-align: center;
  animation: speechPulse 3s ease-in-out infinite alternate;
  position: relative;
  z-index: 10;
}

.bot-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  right: 40px;
  width: 10px;
  height: 10px;
  background: #11151c;
  border-right: 2px solid #00f0ff;
  border-bottom: 2px solid #00f0ff;
  transform: rotate(45deg);
  box-shadow: 3px 3px 5px rgba(0, 240, 255, 0.3);
}

.bot-character-wrapper {
  width: 140px;
  height: 140px;
  position: relative;
  filter: drop-shadow(0 10px 20px rgba(0, 240, 255, 0.25));
  animation: botFloat 4s ease-in-out infinite;
  transition: transform var(--transition-fast);
}

.bot-avatar-container:hover .bot-character-wrapper {
  transform: scale(1.1) translateY(-4px);
}

/* ==========================================================================
   Dynamic SVG Bot Animation Styles
   ========================================================================== */
#svg-bot {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 8px 12px rgba(0,240,255,0.15));
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#bot-head, #bot-arm-left, #bot-arm-right {
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bot-prop, #bot-prop-pencil {
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Eye Blinking & Base Eye Styles */
#bot-eye-left ellipse, #bot-eye-right ellipse {
  fill: #00f0ff;
  stroke: none;
  stroke-width: 0;
  opacity: 1;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.12s ease-in-out,
              ry 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              rx 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.2s ease,
              fill 0.2s ease;
}

#bot-eyes.eye-blink #bot-eye-left ellipse,
#bot-eyes.eye-blink #bot-eye-right ellipse {
  transform: scaleY(0.08);
  transform-box: fill-box;
  transform-origin: center;
}

/* 1. WAVING STATE */
.state-waving #bot-arm-right {
  transform: rotate(-130deg);
  animation: waveAnim 1s ease-in-out infinite alternate;
}
.state-waving #bot-head {
  transform: rotate(5deg);
}
.state-waving #bot-eye-left ellipse, .state-waving #bot-eye-right ellipse {
  ry: 8px;
  rx: 9px;
  fill: #00f0ff;
  opacity: 1;
}
@keyframes waveAnim {
  0% { transform: rotate(-110deg); }
  100% { transform: rotate(-150deg); }
}

/* 2. READING STATE (Book reading with Left-to-Right Eye Movement) */
.state-reading #bot-head {
  transform: rotate(10deg) translate(0, 8px);
}
.state-reading #bot-arm-left {
  transform: rotate(-60deg) translate(6px, -2px);
}
.state-reading #bot-arm-right {
  transform: rotate(60deg) translate(-6px, -2px);
}
.state-reading #bot-prop-book {
  opacity: 1;
  transform: translate(40px, 120px) scale(1.1);
}

/* 3. LAPTOP STATE (Natural Typing Pose on Keyboard) */
.state-laptop #bot-head {
  transform: rotate(8deg) translate(0, 8px);
}
.state-laptop #bot-arm-left {
  transform: rotate(-70deg) translate(8px, -4px);
  animation: typeLeft 0.22s ease-in-out infinite alternate;
}
.state-laptop #bot-arm-right {
  transform: rotate(70deg) translate(-8px, -4px);
  animation: typeRight 0.22s ease-in-out infinite alternate-reverse;
}
.state-laptop #bot-prop-laptop {
  opacity: 1;
  transform: translate(40px, 118px) scale(1.1);
}
@keyframes typeLeft {
  0% { transform: rotate(-68deg) translate(8px, -4px); }
  100% { transform: rotate(-74deg) translate(8px, -2px); }
}
@keyframes typeRight {
  0% { transform: rotate(68deg) translate(-8px, -4px); }
  100% { transform: rotate(74deg) translate(-8px, -2px); }
}

/* 4. SLEEPING STATE (Lying down, closed eyes - smooth instant transition) */
.state-sleeping #svg-bot {
  transform: rotate(-75deg) translate(-35px, -35px) scale(0.95);
}
.state-sleeping #bot-head {
  transform: rotate(25deg) translate(0, 5px);
}
.state-sleeping #bot-arm-right {
  transform: rotate(-140deg) translate(20px, 15px);
}
.state-sleeping #bot-arm-left {
  transform: rotate(30deg) translate(-5px, 15px);
}
.state-sleeping #bot-eye-left ellipse, .state-sleeping #bot-eye-right ellipse {
  fill: #00f0ff;
  ry: 1.5px;
  rx: 11px;
  opacity: 0.85;
}

@keyframes hoverProp {
  0% { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}


@keyframes botFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes speechPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

@media (max-width: 768px) {
  .bot-avatar-container {
    bottom: 5.25rem;
    right: 1.25rem;
  }
  .bot-character-wrapper {
    width: 75px;
    height: 75px;
  }
  .bot-speech-bubble {
    font-size: 0.75rem;
    max-width: 170px;
    padding: 0.4rem 0.65rem;
  }
}

/* Typing Indicator Animation */
.typing-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 6px;
  height: 24px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background-color: var(--text-accent);
  border-radius: 50%;
  animation: typingDotBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes typingDotBounce {
  0%, 80%, 100% { 
    transform: scale(0);
    opacity: 0.5;
  }
  40% { 
    transform: scale(1);
    opacity: 1;
  }
}
