/* =========================================================
   MODERN COLOR PALETTE & VARIABLES
========================================================= */
:root {
  /* Brand Colors */
  --hitachi-red: #E60012;
  --hitachi-dark: #B00010;
  --hitachi-light: #FF3347;
  
  /* Light Theme */
  --bg: #F8F9FC;
  --bg-gradient: linear-gradient(135deg, #F8F9FC 0%, #EEF1F8 100%);
  --sidebar-bg: rgba(255, 255, 255, 0.7);
  --sidebar-surface: #FFFFFF;
  --sidebar-text: #1A202C;
  --sidebar-muted: #64748B;
  --surface: rgba(255, 255, 255, 0.9);
  --text: #1A202C;
  --muted: #64748B;
  --border: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);
  
  /* Layout */
  --header-height: 64px;
  --input-area-bg: #F1F5F9;
  --overlay-bg: rgba(0, 0, 0, 0.5);
  
  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

/* =========================================================
   BASE STYLES
========================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
}

.mobile-only { display: none; }
.desktop-only { display: flex; }

/* =========================================================
   PROFESSIONAL LOGIN PAGE - NO SCROLL VERSION
========================================================= */
.login-page {
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Animated Background */
.animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.bg-shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.5;
  filter: blur(70px);
  animation: float 20s infinite ease-in-out;
}

.shape-1 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, var(--hitachi-red), var(--hitachi-dark));
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.shape-2 {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  bottom: -80px;
  right: -80px;
  animation-delay: 7s;
}

.shape-3 {
  width: 280px;
  height: 280px;
  background: linear-gradient(135deg, #f093fb, #f5576c);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: 14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -50px) scale(1.1); }
  66% { transform: translate(-20px, 30px) scale(0.9); }
}

/* Theme Toggle */
.floating-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  font-size: 22px;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-theme-toggle:hover {
  transform: translateY(-2px) rotate(20deg);
  box-shadow: var(--shadow-lg);
}

/* Professional Login Container - Fits in viewport */
.login-container-pro {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 50px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Brand Section - Compact */
.brand-section-pro {
  flex: 1;
  max-width: 450px;
  animation: slideInLeft 0.8s ease-out;
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

.brand-content-pro {
  display: flex;
  flex-direction: column;
}

.logo-container-pro {
  position: relative;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
}

.brand-logo-pro {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: white;
  padding: 10px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 2;
}

.logo-glow-pro {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--hitachi-red), var(--hitachi-dark));
  border-radius: 50%;
  filter: blur(25px);
  opacity: 0.3;
  z-index: 1;
}

.brand-heading-pro {
  margin: 0 0 10px 0;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
}

.gradient-text {
  background: linear-gradient(135deg, var(--hitachi-red), var(--hitachi-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-tagline-pro {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 30px;
  font-weight: 400;
}

/* Compact Features Grid */
.features-compact {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 30px;
}

.feature-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.feature-compact:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
  border-color: var(--hitachi-red);
}

.feature-compact svg {
  color: var(--hitachi-red);
  flex-shrink: 0;
}

.feature-compact div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feature-compact strong {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
}

.feature-compact span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}

.trust-indicators-pro {
  display: flex;
  gap: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.trust-item-pro {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.trust-item-pro svg {
  color: var(--hitachi-red);
}

/* Form Section - Compact */
.form-section-pro {
  flex: 1;
  max-width: 420px;
  width: 100%;
}

.form-container-pro {
  background: var(--glass-bg);
  backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 36px;
  box-shadow: var(--glass-shadow);
  animation: slideInRight 0.8s ease-out;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.form-header-pro {
  margin-bottom: 28px;
  text-align: center;
}

.form-header-pro h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px 0;
  letter-spacing: -0.5px;
}

.form-header-pro p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.login-form-pro {
  margin-bottom: 20px;
}

.form-group-pro {
  margin-bottom: 20px;
}

.form-group-pro label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: 0.2px;
}

.input-wrapper-pro {
  position: relative;
}

.input-wrapper-pro input {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
  transition: all 0.3s ease;
  font-weight: 400;
}

.input-wrapper-pro input:focus {
  outline: none;
  border-color: var(--hitachi-red);
  box-shadow: 0 0 0 4px rgba(230, 0, 18, 0.1);
}

.input-wrapper-pro input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.submit-button-pro {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--hitachi-red), var(--hitachi-dark));
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(230, 0, 18, 0.3);
}

.submit-button-pro:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(230, 0, 18, 0.4);
}

.submit-button-pro:active {
  transform: translateY(0);
}

.submit-button-pro:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-loader {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.submit-button-pro.loading .btn-icon {
  display: none;
}

.alert-message-pro {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 16px;
}

.alert-message-pro.success {
  background: rgba(16, 185, 129, 0.1);
  color: #065F46;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-message-pro.error {
  background: rgba(239, 68, 68, 0.1);
  color: #991B1B;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-message-pro svg {
  flex-shrink: 0;
}

.form-footer-pro {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.security-note-pro {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.security-note-pro svg {
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.6;
}

/* =========================================================
   COPILOT PAGE - IMPROVED FORMATTING
========================================================= */
.copilot-page { 
  height: 100vh; 
  overflow: hidden; 
  display: flex; 
  flex-direction: column;
  background: var(--bg-gradient);
  background-attachment: fixed;
}

/* Modern Header */
.modern-header {
  height: 64px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 100;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-menu-btn:hover {
  background: rgba(230, 0, 18, 0.1);
  border-color: var(--hitachi-red);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: white;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.header-subtitle {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* User Menu */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.user-menu-trigger:hover {
  border-color: var(--hitachi-red);
  box-shadow: 0 2px 8px rgba(230, 0, 18, 0.1);
}

.user-menu-trigger .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--hitachi-red), var(--hitachi-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
}

.user-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 260px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: var(--shadow-xl);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
}

.user-menu.open .user-menu-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.menu-item:hover {
  background: rgba(230, 0, 18, 0.1);
  color: var(--hitachi-red);
}

.menu-item.menu-info {
  cursor: default;
  font-size: 13px;
  color: var(--muted);
  padding: 10px 12px;
}

.menu-item.menu-info:hover {
  background: transparent;
  color: var(--muted);
}

.menu-item.logout {
  color: #EF4444;
}

.menu-item.logout:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #DC2626;
}

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* Chat Wrapper */
.chat-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 64px);
  position: relative;
}

/* Compact Sidebar */
.compact-sidebar {
  width: 280px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.compact-sidebar::-webkit-scrollbar {
  width: 6px;
}

.compact-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.compact-sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.compact-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.sidebar-close-btn {
  display: none;
}

.sidebar-section {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-section:last-of-type {
  border-bottom: none;
}

.sidebar-spacer {
  flex: 1;
  min-height: 20px;
}

.sidebar-bottom-section {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.session-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  padding: 10px;
  background: rgba(230, 0, 18, 0.05);
  border-radius: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.sidebar-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--hitachi-red), var(--hitachi-dark));
  border: none;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(230, 0, 18, 0.2);
}

.sidebar-logout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(230, 0, 18, 0.3);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
  text-align: left;
}

.action-btn:last-child {
  margin-bottom: 0;
}

.action-btn:hover {
  background: rgba(230, 0, 18, 0.05);
  border-color: var(--hitachi-red);
  color: var(--hitachi-red);
  transform: translateX(4px);
}

.action-btn svg {
  flex-shrink: 0;
}

.resource-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--hitachi-red);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-bottom: 6px;
}

.resource-link:hover {
  background: rgba(230, 0, 18, 0.1);
  transform: translateX(4px);
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--overlay-bg);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
}

.sidebar-open .sidebar-overlay {
  display: block;
  opacity: 1;
}

/* Chat Main */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  margin: 16px;
  margin-left: 0;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--glass-border);
}

.webchat-container {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* =========================================================
   WEBCHAT STYLING - IMPROVED TEXT FORMATTING
========================================================= */
#webchat {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
}

#webchat > * {
  flex: 1;
  min-height: 0;
}

/* Transcript Area */
#webchat .webchat__basic-transcript {
  padding: 16px 20px !important;
  max-width: 100% !important;
}

/* Hide bot avatar */
#webchat .webchat__bubble--from-bot .webchat__bubble__avatar {
  display: none !important;
  width: 0 !important;
  margin: 0 !important;
}

#webchat .webchat__bubble--from-bot .webchat__bubble__content {
  margin-left: 0 !important;
}

/* User avatar */
#webchat .webchat__bubble--from-user .webchat__bubble__avatar {
  width: 32px !important;
  height: 32px !important;
  border-radius: 10px !important;
}

/* CRITICAL: Fix text formatting - remove extra line spacing */
#webchat .webchat__bubble__content {
  padding: 12px 16px !important;
  font-size: 15px !important;
  line-height: 1.6 !important;
  max-width: 100% !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
}

/* Remove paragraph margins to fix spacing issues */
#webchat .webchat__bubble__content p {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.6 !important;
}

/* Add proper spacing between paragraphs only when needed */
#webchat .webchat__bubble__content p + p {
  margin-top: 12px !important;
}

/* Fix line breaks - no extra spacing */
#webchat .webchat__bubble__content br {
  content: '' !important;
  display: inline !important;
  margin: 0 !important;
}

/* Ensure text flows naturally */
#webchat .webchat__bubble__content {
  white-space: pre-wrap !important;
}

/* Message bubbles */
#webchat .webchat__bubble {
  max-width: 85% !important;
  margin-bottom: 12px !important;
}

#webchat .webchat__bubble--from-user {
  max-width: 75% !important;
}

/* Minimal spacing between messages */
#webchat .webchat__stacked-layout {
  margin-bottom: 12px !important;
}

#webchat .webchat__stacked-layout__content {
  margin-top: 4px !important;
}

/* Bot messages - clean transparent look */
#webchat .webchat__bubble--from-bot .webchat__bubble__content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding-left: 0 !important;
}

/* User messages */
/* =========================================================
   MODERN COLOR PALETTE & VARIABLES
========================================================= */
:root {
  /* Brand Colors */
  --hitachi-red: #E60012;
  --hitachi-dark: #B00010;
  --hitachi-light: #FF3347;
  
  /* Light Theme */
  --bg: #F8F9FC;
  --bg-gradient: linear-gradient(135deg, #F8F9FC 0%, #EEF1F8 100%);
  --sidebar-bg: rgba(255, 255, 255, 0.7);
  --sidebar-surface: #FFFFFF;
  --sidebar-text: #1A202C;
  --sidebar-muted: #64748B;
  --surface: rgba(255, 255, 255, 0.9);
  --text: #1A202C;
  --muted: #64748B;
  --border: #E2E8F0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);
  
  /* Layout */
  --header-height: 64px;
  --input-area-bg: #F1F5F9;
  --overlay-bg: rgba(0, 0, 0, 0.5);
  
  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

/* =========================================================
   BASE STYLES
========================================================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
}

.mobile-only { display: none; }
.desktop-only { display: flex; }

/* =========================================================
   PROFESSIONAL LOGIN PAGE - NO SCROLL VERSION
========================================================= */
.login-page {
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Animated Background */
.animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.bg-shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.5;
  filter: blur(70px);
  animation: float 20s infinite ease-in-out;
}

.shape-1 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, var(--hitachi-red), var(--hitachi-dark));
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.shape-2 {
  width: 300px;
  height: 300px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  bottom: -80px;
  right: -80px;
  animation-delay: 7s;
}

.shape-3 {
  width: 280px;
  height: 280px;
  background: linear-gradient(135deg, #f093fb, #f5576c);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: 14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -50px) scale(1.1); }
  66% { transform: translate(-20px, 30px) scale(0.9); }
}

/* Theme Toggle */
.floating-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  font-size: 22px;
  cursor: pointer;
  z-index: 1000;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-theme-toggle:hover {
  transform: translateY(-2px) rotate(20deg);
  box-shadow: var(--shadow-lg);
}

/* Professional Login Container - Fits in viewport */
.login-container-pro {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 50px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Brand Section - Compact */
.brand-section-pro {
  flex: 1;
  max-width: 450px;
  animation: slideInLeft 0.8s ease-out;
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

.brand-content-pro {
  display: flex;
  flex-direction: column;
}

.logo-container-pro {
  position: relative;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
}

.brand-logo-pro {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: white;
  padding: 10px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 2;
}

.logo-glow-pro {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--hitachi-red), var(--hitachi-dark));
  border-radius: 50%;
  filter: blur(25px);
  opacity: 0.3;
  z-index: 1;
}

.brand-heading-pro {
  margin: 0 0 10px 0;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
}

.gradient-text {
  background: linear-gradient(135deg, var(--hitachi-red), var(--hitachi-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-tagline-pro {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 30px;
  font-weight: 400;
}

/* Compact Features Grid */
.features-compact {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 30px;
}

.feature-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.feature-compact:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
  border-color: var(--hitachi-red);
}

.feature-compact svg {
  color: var(--hitachi-red);
  flex-shrink: 0;
}

.feature-compact div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feature-compact strong {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
}

.feature-compact span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
}

.trust-indicators-pro {
  display: flex;
  gap: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.trust-item-pro {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.trust-item-pro svg {
  color: var(--hitachi-red);
}

/* Form Section - Compact */
.form-section-pro {
  flex: 1;
  max-width: 420px;
  width: 100%;
}

.form-container-pro {
  background: var(--glass-bg);
  backdrop-filter: blur(30px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 36px;
  box-shadow: var(--glass-shadow);
  animation: slideInRight 0.8s ease-out;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

.form-header-pro {
  margin-bottom: 28px;
  text-align: center;
}

.form-header-pro h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px 0;
  letter-spacing: -0.5px;
}

.form-header-pro p {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.login-form-pro {
  margin-bottom: 20px;
}

.form-group-pro {
  margin-bottom: 20px;
}

.form-group-pro label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: 0.2px;
}

.input-wrapper-pro {
  position: relative;
}

.input-wrapper-pro input {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
  transition: all 0.3s ease;
  font-weight: 400;
}

.input-wrapper-pro input:focus {
  outline: none;
  border-color: var(--hitachi-red);
  box-shadow: 0 0 0 4px rgba(230, 0, 18, 0.1);
}

.input-wrapper-pro input::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.submit-button-pro {
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--hitachi-red), var(--hitachi-dark));
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(230, 0, 18, 0.3);
}

.submit-button-pro:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(230, 0, 18, 0.4);
}

.submit-button-pro:active {
  transform: translateY(0);
}

.submit-button-pro:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-loader {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.submit-button-pro.loading .btn-icon {
  display: none;
}

.alert-message-pro {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 16px;
}

.alert-message-pro.success {
  background: rgba(16, 185, 129, 0.1);
  color: #065F46;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-message-pro.error {
  background: rgba(239, 68, 68, 0.1);
  color: #991B1B;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-message-pro svg {
  flex-shrink: 0;
}

.form-footer-pro {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.security-note-pro {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.security-note-pro svg {
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.6;
}

/* =========================================================
   COPILOT PAGE - IMPROVED FORMATTING
========================================================= */
.copilot-page { 
  height: 100vh; 
  overflow: hidden; 
  display: flex; 
  flex-direction: column;
  background: var(--bg-gradient);
  background-attachment: fixed;
}

/* Modern Header */
.modern-header {
  height: 64px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 100;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-menu-btn:hover {
  background: rgba(230, 0, 18, 0.1);
  border-color: var(--hitachi-red);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: white;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.header-subtitle {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* User Menu */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.user-menu-trigger:hover {
  border-color: var(--hitachi-red);
  box-shadow: 0 2px 8px rgba(230, 0, 18, 0.1);
}

.user-menu-trigger .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--hitachi-red), var(--hitachi-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
}

.user-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 260px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: var(--shadow-xl);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
}

.user-menu.open .user-menu-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.menu-item:hover {
  background: rgba(230, 0, 18, 0.1);
  color: var(--hitachi-red);
}

.menu-item.menu-info {
  cursor: default;
  font-size: 13px;
  color: var(--muted);
  padding: 10px 12px;
}

.menu-item.menu-info:hover {
  background: transparent;
  color: var(--muted);
}

.menu-item.logout {
  color: #EF4444;
}

.menu-item.logout:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #DC2626;
}

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* Chat Wrapper */
.chat-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 64px);
  position: relative;
}

/* Compact Sidebar */
.compact-sidebar {
  width: 280px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.compact-sidebar::-webkit-scrollbar {
  width: 6px;
}

.compact-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.compact-sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.compact-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.sidebar-close-btn {
  display: none;
}

.sidebar-section {
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-section:last-of-type {
  border-bottom: none;
}

.sidebar-spacer {
  flex: 1;
  min-height: 20px;
}

.sidebar-bottom-section {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.session-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  padding: 10px;
  background: rgba(230, 0, 18, 0.05);
  border-radius: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.sidebar-logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--hitachi-red), var(--hitachi-dark));
  border: none;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(230, 0, 18, 0.2);
}

.sidebar-logout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(230, 0, 18, 0.3);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 8px;
  text-align: left;
}

.action-btn:last-child {
  margin-bottom: 0;
}

.action-btn:hover {
  background: rgba(230, 0, 18, 0.05);
  border-color: var(--hitachi-red);
  color: var(--hitachi-red);
  transform: translateX(4px);
}

.action-btn svg {
  flex-shrink: 0;
}

.resource-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--hitachi-red);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-bottom: 6px;
}

.resource-link:hover {
  background: rgba(230, 0, 18, 0.1);
  transform: translateX(4px);
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--overlay-bg);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
}

.sidebar-open .sidebar-overlay {
  display: block;
  opacity: 1;
}

/* Chat Main */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  margin: 16px;
  margin-left: 0;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--glass-border);
}

.webchat-container {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* =========================================================
   WEBCHAT STYLING - IMPROVED TEXT FORMATTING
========================================================= */
#webchat {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
}

#webchat > * {
  flex: 1;
  min-height: 0;
}

/* Transcript Area */
#webchat .webchat__basic-transcript {
  padding: 16px 20px !important;
  max-width: 100% !important;
}

/* Hide bot avatar */
#webchat .webchat__bubble--from-bot .webchat__bubble__avatar {
  display: none !important;
  width: 0 !important;
  margin: 0 !important;
}

#webchat .webchat__bubble--from-bot .webchat__bubble__content {
  margin-left: 0 !important;
}

/* User avatar */
#webchat .webchat__bubble--from-user .webchat__bubble__avatar {
  width: 32px !important;
  height: 32px !important;
  border-radius: 10px !important;
}

/* CRITICAL: Fix text formatting - remove extra line spacing */
#webchat .webchat__bubble__content {
  padding: 12px 16px !important;
  font-size: 15px !important;
  line-height: 1.6 !important;
  max-width: 100% !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
}

/* Remove paragraph margins to fix spacing issues */
#webchat .webchat__bubble__content p {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.6 !important;
}

/* Add proper spacing between paragraphs only when needed */
#webchat .webchat__bubble__content p + p {
  margin-top: 12px !important;
}

/* Fix line breaks - no extra spacing */
#webchat .webchat__bubble__content br {
  content: '' !important;
  display: inline !important;
  margin: 0 !important;
}

/* Ensure text flows naturally */
#webchat .webchat__bubble__content {
  white-space: pre-wrap !important;
}

/* Message bubbles */
#webchat .webchat__bubble {
  max-width: 85% !important;
  margin-bottom: 12px !important;
}

#webchat .webchat__bubble--from-user {
  max-width: 75% !important;
}

/* Minimal spacing between messages */
#webchat .webchat__stacked-layout {
  margin-bottom: 12px !important;
}

#webchat .webchat__stacked-layout__content {
  margin-top: 4px !important;
}

/* Bot messages - clean transparent look */
#webchat .webchat__bubble--from-bot .webchat__bubble__content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding-left: 0 !important;
}

/* User messages */
#webchat .webchat__bubble--from-user .webchat__bubble__content {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
}

/* Lists - proper spacing */
#webchat .webchat__bubble__content ul,
#webchat .webchat__bubble__content ol {
  margin: 8px 0 !important;
  padding-left: 24px !important;
}

#webchat .webchat__bubble__content li {
  margin: 4px 0 !important;
  line-height: 1.6 !important;
}

/* Send Box */
#webchat .webchat__send-box {
  padding: 16px 20px !important;
  background: transparent !important;
  border-top: 1px solid var(--border) !important;
}

#webchat .webchat__send-box__main {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(10px) !important;
  border: 2px solid var(--border) !important;
  border-radius: 16px !important;
  padding: 4px 8px !important;
  box-shadow: var(--shadow-sm) !important;
  transition: all 0.2s ease !important;
}

#webchat .webchat__send-box__main:focus-within {
  border-color: var(--hitachi-red) !important;
  box-shadow: 0 0 0 4px rgba(230, 0, 18, 0.1) !important;
}

#webchat .webchat__send-box__text-box {
  padding: 12px 16px !important;
  font-size: 15px !important;
  line-height: 1.5 !important;
  max-height: 120px !important;
}

#webchat .webchat__send-box__button {
  padding: 8px !important;
}

#webchat .webchat__send-box__button svg {
  width: 24px !important;
  height: 24px !important;
  fill: var(--hitachi-red) !important;
}

#webchat .webchat__send-box__button:hover svg {
  transform: scale(1.1) !important;
}

#webchat .webchat__send-box__button:disabled svg {
  fill: var(--muted) !important;
  opacity: 0.5 !important;
}

/* Scrollbar */
#webchat .webchat__basic-transcript__scrollable {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding-right: 8px !important;
}

#webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar {
  width: 6px;
}

#webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
  background: transparent;
}

#webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

#webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Scroll to bottom button */
#webchat .webchat__basic-transcript__scroll-to-end-button {
  bottom: 24px !important;
  right: 24px !important;
  width: 44px !important;
  height: 44px !important;
  border-radius: 22px !important;
  background: var(--hitachi-red) !important;
  box-shadow: 0 4px 12px rgba(230, 0, 18, 0.3) !important;
  border: none !important;
}

#webchat .webchat__basic-transcript__scroll-to-end-button:hover {
  background: var(--hitachi-dark) !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 16px rgba(230, 0, 18, 0.4) !important;
}

/* =========================================================
   RESPONSIVE DESIGN
========================================================= */
@media (max-width: 1024px) {
  .compact-sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    height: 100vh;
    z-index: 999;
    width: 300px;
    max-width: 85vw;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    border-radius: 0;
  }
  
  .sidebar-open .compact-sidebar {
    left: 0;
  }
  
  .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    z-index: 1000;
  }
  
  .chat-main {
    margin: 12px;
    border-radius: 16px;
  }
}

@media (max-width: 768px) {
  .mobile-only { display: flex !important; }
  .desktop-only { display: none !important; }
  
  .modern-header {
    height: 56px;
    padding: 0 12px;
  }
  
  .header-title {
    font-size: 16px;
  }
  
  .header-logo {
    width: 36px;
    height: 36px;
  }
  
  .chat-wrapper {
    height: calc(100vh - 56px);
  }
  
  .chat-main {
    margin: 10px;
    border-radius: 14px;
  }
  
  /* Login Page Mobile */
  .login-container-pro {
    flex-direction: column;
    gap: 30px;
    padding: 80px 16px 20px;
    height: auto;
    min-height: 100vh;
  }
  
  .brand-section-pro {
    text-align: center;
  }
  
  .logo-container-pro {
    margin: 0 auto 16px;
  }
  
  .brand-heading-pro {
    font-size: 28px;
  }
  
  .brand-tagline-pro {
    font-size: 14px;
    margin-bottom: 24px;
  }
  
  .features-compact {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .trust-indicators-pro {
    justify-content: center;
    gap: 16px;
  }
  
  .form-container-pro {
    padding: 28px 20px;
  }
}

@media (max-width: 640px) {
  .floating-theme-toggle {
    width: 44px;
    height: 44px;
    top: 16px;
    right: 16px;
    font-size: 20px;
  }
  
  .chat-main {
    margin: 8px;
  }
  
  .form-header-pro h2 {
    font-size: 22px;
  }
}

/* =========================================================
   DARK THEME
========================================================= */
html[data-theme="dark"] {
  --bg: #0B0E14;
  --bg-gradient: linear-gradient(135deg, #0B0E14 0%, #151921 100%);
  --surface: rgba(30, 35, 48, 0.9);
  --text: #E6E8EB;
  --muted: #9CA3AF;
  --border: #2A2F3A;
  --sidebar-bg: rgba(22, 26, 34, 0.8);
  --sidebar-surface: #1E2330;
  --sidebar-text: #E6E8EB;
  --sidebar-muted: #9AA0AA;
  --input-area-bg: #151A22;
  --glass-bg: rgba(26, 29, 36, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.6);
}

html[data-theme="dark"] #webchat .webchat__bubble--from-user .webchat__bubble__content {
  background: #374151 !important;
  border-color: #4B5563 !important;
  color: #F3F4F6 !important;
}

html[data-theme="dark"] #webchat .webchat__send-box__main {
  background: #1E2330 !important;
  border-color: #374151 !important;
}

html[data-theme="dark"] #webchat .webchat__send-box__text-box {
  color: #E6E8EB !important;
}

/* =========================================================
   FINAL SOLUTION - HIDE REFERENCES & PERFECT FORMATTING
   Modern LLM-Style Chat Interface
========================================================= */

/* ==================== HIDE ALL REFERENCES ==================== */

/* Nuclear option - Hide reference dropdowns, details, and adaptive cards */
#webchat .webchat__bubble__content details,
#webchat .webchat__bubble__content summary,
#webchat .webchat__bubble__content .ac-container,
#webchat .webchat__bubble__content .ac-textBlock,
#webchat .webchat__adaptive-card-renderer,
#webchat .ac-adaptiveCard,
#webchat [class*="adaptivecard"],
#webchat [class*="reference"],
#webchat [class*="citation-container"] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  position: absolute !important;
  left: -99999px !important;
  pointer-events: none !important;
}

/* Hide all PDF/document links and reference links */
#webchat .webchat__bubble__content a[href*=".pdf"],
#webchat .webchat__bubble__content a[href*="document"],
#webchat .webchat__bubble__content a[href*="reference"],
#webchat .webchat__bubble__content a[download] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  opacity: 0 !important;
  position: absolute !important;
  left: -99999px !important;
  pointer-events: none !important;
}

/* EXCEPTION: Keep citation numbers (superscript) visible */
#webchat .webchat__bubble__content sup,
#webchat .webchat__bubble__content sup a,
#webchat .webchat__bubble__content sup[data-citation] {
  display: inline !important;
  position: static !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  width: auto !important;
  left: auto !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  color: var(--hitachi-red) !important;
  background: rgba(230, 0, 18, 0.1) !important;
  padding: 2px 6px !important;
  border-radius: 4px !important;
  margin: 0 3px !important;
  line-height: 1 !important;
  vertical-align: baseline !important;
  cursor: default !important;
  text-decoration: none !important;
  pointer-events: none !important;
  border: none !important;
}

/* Dark mode citations */
html[data-theme="dark"] #webchat .webchat__bubble__content sup,
html[data-theme="dark"] #webchat .webchat__bubble__content sup a {
  color: #FF5555 !important;
  background: rgba(255, 85, 85, 0.15) !important;
}

/* ==================== PERFECT LINE SPACING ==================== */

/* Base bubble content - natural text flow */
#webchat .webchat__bubble__content {
  white-space: normal !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  text-rendering: optimizeLegibility !important;
  -webkit-font-smoothing: antialiased !important;
  font-size: 15px !important;
  line-height: 1.6 !important;
  padding: 12px 16px !important;
}

/* Remove ALL default margins from paragraphs */
#webchat .webchat__bubble__content p {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.6 !important;
}

/* Add controlled spacing between paragraphs only */
#webchat .webchat__bubble__content p + p {
  margin-top: 12px !important;
}

/* Line breaks - minimal visual spacing */
#webchat .webchat__bubble__content br {
  display: block !important;
  content: '' !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 0.3 !important;
  height: 0 !important;
}

/* Remove spacing from wrapper divs */
#webchat .webchat__bubble__content > div,
#webchat .webchat__bubble__content > span,
#webchat .webchat__bubble__content [class*="markdown"] {
  margin: 0 !important;
  padding: 0 !important;
}

/* No spacing between consecutive divs */
#webchat .webchat__bubble__content div + div {
  margin-top: 0 !important;
}

/* ==================== COMPACT MESSAGE SPACING ==================== */

/* Reduce vertical space between messages */
#webchat .webchat__stacked-layout {
  margin-bottom: 8px !important;
}

#webchat .webchat__stacked-layout__content {
  margin-top: 2px !important;
  padding-top: 0 !important;
}

#webchat .webchat__bubble {
  margin-bottom: 8px !important;
}

/* ==================== LISTS - COMPACT STYLE ==================== */

#webchat .webchat__bubble__content ul,
#webchat .webchat__bubble__content ol {
  margin: 8px 0 !important;
  padding-left: 24px !important;
}

#webchat .webchat__bubble__content li {
  margin: 3px 0 !important;
  line-height: 1.6 !important;
  padding: 0 !important;
}

#webchat .webchat__bubble__content li + li {
  margin-top: 4px !important;
}

/* Remove spacing from nested lists */
#webchat .webchat__bubble__content li > ul,
#webchat .webchat__bubble__content li > ol {
  margin-top: 4px !important;
  margin-bottom: 0 !important;
}

/* ==================== HEADINGS - COMPACT ==================== */

#webchat .webchat__bubble__content h1,
#webchat .webchat__bubble__content h2,
#webchat .webchat__bubble__content h3,
#webchat .webchat__bubble__content h4,
#webchat .webchat__content h5,
#webchat .webchat__bubble__content h6 {
  margin: 14px 0 8px 0 !important;
  line-height: 1.3 !important;
  font-weight: 600 !important;
  padding: 0 !important;
}

#webchat .webchat__bubble__content h1:first-child,
#webchat .webchat__bubble__content h2:first-child,
#webchat .webchat__bubble__content h3:first-child,
#webchat .webchat__bubble__content h4:first-child {
  margin-top: 0 !important;
}

/* ==================== CODE BLOCKS - CLAUDE STYLE ==================== */

#webchat .webchat__bubble__content pre {
  margin: 12px 0 !important;
  padding: 12px !important;
  line-height: 1.5 !important;
  background: rgba(0, 0, 0, 0.05) !important;
  border-radius: 6px !important;
  overflow-x: auto !important;
}

#webchat .webchat__bubble__content code {
  padding: 2px 5px !important;
  line-height: 1.4 !important;
  background: rgba(0, 0, 0, 0.05) !important;
  border-radius: 3px !important;
  font-size: 14px !important;
  font-family: 'Courier New', monospace !important;
}

#webchat .webchat__bubble__content pre code {
  background: transparent !important;
  padding: 0 !important;
}

/* Dark mode code blocks */
html[data-theme="dark"] #webchat .webchat__bubble__content pre {
  background: rgba(255, 255, 255, 0.05) !important;
}

html[data-theme="dark"] #webchat .webchat__bubble__content code {
  background: rgba(255, 255, 255, 0.08) !important;
}

/* ==================== TABLES - COMPACT ==================== */

#webchat .webchat__bubble__content table {
  margin: 12px 0 !important;
  border-collapse: collapse !important;
  width: 100% !important;
}

#webchat .webchat__bubble__content th,
#webchat .webchat__bubble__content td {
  padding: 8px 12px !important;
  line-height: 1.5 !important;
  border: 1px solid var(--border) !important;
}

#webchat .webchat__bubble__content th {
  background: rgba(0, 0, 0, 0.03) !important;
  font-weight: 600 !important;
}

/* ==================== BLOCKQUOTES - CLAUDE STYLE ==================== */

#webchat .webchat__bubble__content blockquote {
  margin: 12px 0 !important;
  padding: 12px 16px !important;
  line-height: 1.6 !important;
  border-left: 3px solid var(--hitachi-red) !important;
  background: rgba(230, 0, 18, 0.03) !important;
  border-radius: 0 6px 6px 0 !important;
}

#webchat .webchat__bubble__content blockquote p {
  margin: 0 !important;
}

/* ==================== BUBBLE STYLING ==================== */

/* Bot messages - transparent like Claude */
#webchat .webchat__bubble--from-bot .webchat__bubble__content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding-left: 0 !important;
}

/* User messages - subtle background */
#webchat .webchat__bubble--from-user .webchat__bubble__content {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
  border-radius: 18px !important;
}

/* Dark mode user messages */
html[data-theme="dark"] #webchat .webchat__bubble--from-user .webchat__bubble__content {
  background: #374151 !important;
  border-color: #4B5563 !important;
}

/* Wider bubbles - modern LLM style */
#webchat .webchat__bubble {
  max-width: 90% !important;
}

#webchat .webchat__bubble--from-user {
  max-width: 80% !important;
}

/* ==================== ENHANCED SCROLLING ==================== */

#webchat .webchat__basic-transcript__scrollable {
  scroll-behavior: smooth !important;
  padding-bottom: 20px !important;
}

/* Minimal scrollbar - modern style */
#webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar {
  width: 5px !important;
}

#webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
  background: transparent !important;
}

#webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2) !important;
  border-radius: 10px !important;
}

#webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3) !important;
}

/* Dark mode scrollbar */
html[data-theme="dark"] #webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2) !important;
}

html[data-theme="dark"] #webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

/* ==================== FALLBACK CLEANUP ==================== */

/* Remove any remaining unwanted spacing */
#webchat .webchat__bubble__content * {
  max-width: 100% !important;
}

/* Ensure text doesn't get cut off */
#webchat .webchat__bubble__content {
  overflow: visible !important;
}

/* Remove typing indicator spacing issues */
#webchat .webchat__basic-transcript__activity {
  margin: 0 !important;
}

/* Fix timestamp spacing */
#webchat .webchat__stacked-layout__timestamp {
  margin-top: 4px !important;
  font-size: 11px !important;
  opacity: 0.6 !important;
}
/* =========================================================
   WEBCHAT CLEANUP - HIDE REFERENCES & FIX FORMATTING
   Add this to the END of your style.css file
========================================================= */

/* ==================== NUCLEAR OPTION - HIDE ALL REFERENCES ==================== */

/* Hide details/summary (reference dropdowns) */
#webchat details,
#webchat summary,
#webchat details *,
#webchat summary * {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  position: absolute !important;
  left: -99999px !important;
  pointer-events: none !important;
}

/* Hide adaptive cards completely */
#webchat .ac-container,
#webchat .ac-adaptiveCard,
#webchat .webchat__adaptive-card-renderer,
#webchat [class*="adaptivecard"],
#webchat [class*="adaptive-card"],
#webchat .ac-textBlock {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  position: absolute !important;
  left: -99999px !important;
}

/* Hide all PDF and download links */
#webchat a[href*=".pdf"],
#webchat a[href*="PDF"],
#webchat a[download],
#webchat a[href*="Hitachi"] {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  opacity: 0 !important;
  font-size: 0 !important;
  position: absolute !important;
  left: -99999px !important;
  pointer-events: none !important;
}

/* EXCEPTION: Keep citation numbers visible */
#webchat sup,
#webchat sup a,
#webchat sup *,
#webchat .webchat__bubble__content sup,
#webchat .webchat__bubble__content sup a {
  display: inline !important;
  position: static !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  width: auto !important;
  left: auto !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  color: #E60012 !important;
  background: rgba(230, 0, 18, 0.12) !important;
  padding: 2px 5px !important;
  border-radius: 3px !important;
  margin: 0 2px !important;
  line-height: 1 !important;
  vertical-align: super !important;
  cursor: default !important;
  text-decoration: none !important;
  pointer-events: none !important;
  border: none !important;
}

html[data-theme="dark"] #webchat sup,
html[data-theme="dark"] #webchat sup a {
  color: #FF5555 !important;
  background: rgba(255, 85, 85, 0.18) !important;
}

/* ==================== PERFECT TEXT FORMATTING - ULTRA COMPACT ==================== */

/* Base content styling - TIGHT */
#webchat .webchat__bubble__content {
  white-space: normal !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  font-size: 15px !important;
  line-height: 1.5 !important;
  padding: 10px 14px !important;
}

/* CRITICAL FIX: Absolutely zero margins on paragraphs */
#webchat .webchat__bubble__content p {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.5 !important;
  display: inline !important;
}

/* Minimal space between actual paragraphs */
#webchat .webchat__bubble__content p + p {
  margin-top: 8px !important;
  display: block !important;
}

/* Line breaks - ZERO spacing */
#webchat .webchat__bubble__content br {
  display: none !important;
  content: "" !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 0 !important;
  height: 0 !important;
}

/* Force all text to flow naturally without breaks */
#webchat .webchat__bubble__content br + * {
  display: inline !important;
}

/* Remove ALL spacing from container divs */
#webchat .webchat__bubble__content > div,
#webchat .webchat__bubble__content > span,
#webchat .webchat__bubble__content div {
  margin: 0 !important;
  padding: 0 !important;
  display: inline !important;
}

/* Exception for actual content divs that should block */
#webchat .webchat__bubble__content > div:first-child {
  display: block !important;
}

#webchat .webchat__bubble__content div + div {
  margin-top: 0 !important;
}

/* ==================== ULTRA COMPACT MESSAGE SPACING ==================== */

#webchat .webchat__stacked-layout {
  margin-bottom: 6px !important;
}

#webchat .webchat__stacked-layout__content {
  margin-top: 0px !important;
  padding-top: 0 !important;
}

#webchat .webchat__bubble {
  margin-bottom: 6px !important;
}

/* Remove extra spacing between consecutive bubbles */
#webchat .webchat__stacked-layout + .webchat__stacked-layout {
  margin-top: 0 !important;
}

/* ==================== LISTS - TIGHT FORMATTING ==================== */

#webchat .webchat__bubble__content ul,
#webchat .webchat__bubble__content ol {
  margin: 6px 0 !important;
  padding-left: 24px !important;
  display: block !important;
}

#webchat .webchat__bubble__content li {
  margin: 2px 0 !important;
  line-height: 1.5 !important;
  padding: 0 !important;
  display: list-item !important;
}

#webchat .webchat__bubble__content li + li {
  margin-top: 3px !important;
}

/* No extra spacing inside list items */
#webchat .webchat__bubble__content li p {
  display: inline !important;
  margin: 0 !important;
}

#webchat .webchat__bubble__content li br {
  display: none !important;
}

/* ==================== HEADINGS - COMPACT ==================== */

#webchat .webchat__bubble__content h1,
#webchat .webchat__bubble__content h2,
#webchat .webchat__bubble__content h3,
#webchat .webchat__bubble__content h4 {
  margin: 12px 0 6px 0 !important;
  line-height: 1.3 !important;
  font-weight: 600 !important;
  padding: 0 !important;
  display: block !important;
}

#webchat .webchat__bubble__content h1:first-child,
#webchat .webchat__bubble__content h2:first-child,
#webchat .webchat__bubble__content h3:first-child {
  margin-top: 0 !important;
}

/* ==================== CODE BLOCKS ==================== */

#webchat .webchat__bubble__content pre {
  margin: 10px 0 !important;
  padding: 10px !important;
  line-height: 1.4 !important;
  background: rgba(0, 0, 0, 0.05) !important;
  border-radius: 6px !important;
  overflow-x: auto !important;
  display: block !important;
}

#webchat .webchat__bubble__content code {
  padding: 2px 5px !important;
  background: rgba(0, 0, 0, 0.05) !important;
  border-radius: 3px !important;
  font-size: 14px !important;
}

#webchat .webchat__bubble__content pre code {
  background: transparent !important;
  padding: 0 !important;
}

html[data-theme="dark"] #webchat .webchat__bubble__content pre,
html[data-theme="dark"] #webchat .webchat__bubble__content code {
  background: rgba(255, 255, 255, 0.06) !important;
}

/* ==================== TABLES ==================== */

#webchat .webchat__bubble__content table {
  margin: 10px 0 !important;
  border-collapse: collapse !important;
  width: 100% !important;
  display: table !important;
}

#webchat .webchat__bubble__content th,
#webchat .webchat__bubble__content td {
  padding: 6px 10px !important;
  line-height: 1.4 !important;
  border: 1px solid var(--border) !important;
}

#webchat .webchat__bubble__content th {
  background: rgba(0, 0, 0, 0.03) !important;
  font-weight: 600 !important;
}

/* ==================== BLOCKQUOTES ==================== */

#webchat .webchat__bubble__content blockquote {
  margin: 10px 0 !important;
  padding: 10px 14px !important;
  line-height: 1.5 !important;
  border-left: 3px solid var(--hitachi-red) !important;
  background: rgba(230, 0, 18, 0.04) !important;
  border-radius: 0 6px 6px 0 !important;
  display: block !important;
}

#webchat .webchat__bubble__content blockquote p {
  margin: 0 !important;
  display: inline !important;
}

/* ==================== STRONG/BOLD TEXT ==================== */

#webchat .webchat__bubble__content strong,
#webchat .webchat__bubble__content b {
  font-weight: 600 !important;
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Make bold text stand out more */
#webchat .webchat__bubble__content strong {
  color: var(--hitachi-red) !important;
  background: rgba(230, 0, 18, 0.08) !important;
  padding: 1px 4px !important;
  border-radius: 3px !important;
}

html[data-theme="dark"] #webchat .webchat__bubble__content strong {
  color: #FF6B6B !important;
  background: rgba(255, 107, 107, 0.15) !important;
}

/* ==================== BUBBLE STYLING ==================== */

/* Bot messages - transparent, ultra compact */
#webchat .webchat__bubble--from-bot .webchat__bubble__content {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 8px 0 !important;
}

/* User messages */
#webchat .webchat__bubble--from-user .webchat__bubble__content {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  box-shadow: none !important;
  border-radius: 16px !important;
  padding: 10px 14px !important;
}

html[data-theme="dark"] #webchat .webchat__bubble--from-user .webchat__bubble__content {
  background: #374151 !important;
  border-color: #4B5563 !important;
}

/* Maximum width for readability */
#webchat .webchat__bubble {
  max-width: 95% !important;
  margin-bottom: 4px !important;
}

#webchat .webchat__bubble--from-user {
  max-width: 75% !important;
}

/* ==================== SCROLLING ==================== */

#webchat .webchat__basic-transcript__scrollable {
  scroll-behavior: smooth !important;
  padding: 12px 16px 20px 16px !important;
}

#webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar {
  width: 4px !important;
}

#webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
  background: transparent !important;
}

#webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15) !important;
  border-radius: 10px !important;
}

#webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25) !important;
}

html[data-theme="dark"] #webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15) !important;
}

html[data-theme="dark"] #webchat .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25) !important;
}

/* ==================== FINAL CLEANUP - REMOVE ALL EXTRA SPACING ==================== */

/* Collapse all whitespace */
#webchat .webchat__bubble__content {
  overflow: visible !important;
}

/* Remove spacing from all child elements by default */
#webchat .webchat__bubble__content *:not(ul):not(ol):not(li):not(pre):not(table):not(h1):not(h2):not(h3):not(h4):not(blockquote) {
  margin: 0 !important;
  padding: 0 !important;
}

/* Ensure text flows inline */
#webchat .webchat__bubble__content span,
#webchat .webchat__bubble__content a:not([href*=".pdf"]) {
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* No gaps between elements */
#webchat .webchat__basic-transcript__activity {
  margin: 0 !important;
  padding: 0 !important;
}

/* Compact timestamp */
#webchat .webchat__stacked-layout__timestamp {
  margin-top: 2px !important;
  font-size: 10px !important;
  opacity: 0.5 !important;
}

/* Remove any trailing spaces */
#webchat .webchat__bubble__content::after {
  content: "" !important;
  display: none !important;
}

/* Force compact rendering */
#webchat .webchat__basic-transcript {
  line-height: 1 !important;
}

#webchat .webchat__basic-transcript > * {
  margin: 0 !important;
}

/* ==================== SPECIAL FIX FOR NUMBERED LISTS WITH BOLD HEADERS ==================== */

/* When bold text starts a list item, remove extra spacing */
#webchat .webchat__bubble__content li strong:first-child,
#webchat .webchat__bubble__content li b:first-child {
  display: inline !important;
  margin: 0 !important;
}

/* Ensure content after bold header flows naturally */
#webchat .webchat__bubble__content li strong + *,
#webchat .webchat__bubble__content li b + * {
  display: inline !important;
  margin: 0 !important;
}

/* Remove line breaks after bold text in lists */
#webchat .webchat__bubble__content li strong + br,
#webchat .webchat__bubble__content li b + br {
  display: none !important;
}