/* style.css
  ========================================
   ROOT VARIABLES & BASE STYLES
   ======================================== */
html {
  font-feature-settings: "cv05", "cv08", "cv11";
}

:root {
  --sidebar-bg: linear-gradient(135deg, #667eea, #764ba2);
  --sidebar-color: #ffffff;
  --accent-color: #ff7b39;
  --header-bg: #ffffff;
  --header-text: #0B2F4E;
  --main-bg: #ffffff;
  --font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --bs-body-font-family: var(--font-family);
  --nav-hover: #E4F2FB;
  --accent-blue: #44A7E1;
  --accent-blue-d: #44A7E1;
  --hero-bg: #ffffff;
  --hero-inner-bg: #F4F8F4;
  --shadow-light: rgba(0, 0, 0, 0.05);
  --shadow-medium: rgba(0, 0, 0, 0.08);
  --sidebar-collapsed: 60px;
  --sidebar-expanded: 255px;
}

body {
  background-color: var(--main-bg) !important;
  font-family: var(--font-family);
  margin: 0;
  padding: 0;
  font-variant-numeric: normal;
  font-feature-settings: "zero" 0;
}

body, html {
  overflow-x: hidden;
}

a {
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ========================================
   FORMS & AUTH
   ======================================== */
.form-container {
  background: #fff;
  max-width: 450px;
  width: 100%;
  border-radius: 10px;
  box-shadow: 0 5px 30px rgba(0, 0, 0, .05);
  padding: 30px;
}

.header-btn {
  padding: 6px 16px;
  border: 2px solid #0B2F4E;
  border-radius: 6px;
  background-color: transparent;
  color: #0B2F4E;
  font-size: 15px;
  font-weight: 500;
  transition: all .3s ease;
}

.header-btn:hover {
  background-color: #0B2F4E;
  color: #fff;
}

.header-btn.signup {
  border-color: #dc3545;
  color: #dc3545;
}

.header-btn.signup:hover {
  background-color: #dc3545;
  color: #fff;
}

/* ========================================
   NAVBAR & HEADER
   ======================================== */
.navbar {
  background-color: #fff !important;
  border: none !important;
}

.avatar-button.dropdown-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background-color: transparent;
  color: #0B2F4E;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: transform .1s, box-shadow .1s;
  position: relative;
}

.avatar-button.dropdown-toggle::after {
  display: none !important;
}

.avatar-button.dropdown-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}

/* Desktop CTAs */
.navbar .btn-login,
.navbar .btn-signup {
  --btn-h: 30px;
  height: var(--btn-h) !important;
  padding: 0 16px !important;
  border-radius: 999px !important;
  font-weight: 700 !important;
  line-height: var(--btn-h) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: none !important;
  transition: transform .15s ease, box-shadow .2s ease,
              background .2s ease, color .2s ease, border-color .2s ease;
}

.navbar .btn-login {
  background: #0B2F4E !important;
  color: #F9FCff !important;
  backdrop-filter: saturate(140%) blur(6px);
  transition: transform 0.2s ease, box-shadow 0.25s ease, background 0.25s ease;
  position: relative;
  overflow: hidden;
  border-radius: 8px !important;
  border: 1px solid;
  font-weight: 350 !important;
  font-size: 0.89rem;
  font-family: sans-serif !important;
  padding: 15px 20px !important;
}

.navbar .btn-login::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.08);
  opacity: 0;
  border-radius: inherit;
}

.navbar .btn-login:hover::after {
  opacity: 1;
}

.navbar .btn-login:hover {
  background: #0B2F4E !important;
}

.navbar .btn-signup {
  background: linear-gradient(135deg, #1769ff 0%, var(--accent-blue) 100%) !important;
  color: #fff !important;
  border: 0 !important;
  box-shadow: 0 8px 20px rgba(68, 167, 225, .35), 0 2px 6px rgba(0, 0, 0, .06);
  position: relative;
}

.navbar .btn-signup:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(68, 167, 225, .45), 0 4px 10px rgba(0, 0, 0, .06);
}

.navbar .btn-login:focus-visible,
.navbar .btn-signup:focus-visible {
  outline: 2px solid rgba(68, 167, 225, .55);
  outline-offset: 2px;
}

/* ========================================
   MOBILE NAVIGATION
   ======================================== */
@media (max-width: 767.98px) {
  .mobile-menu-wrapper {
    width: 100%;
    max-width: 100%;
    padding: 1rem !important;
    border-radius: 0 0 1.5rem 1.5rem;
    box-shadow: none;
    box-sizing: border-box;
    margin-bottom: 11px;
  }

  .mobile-menu-item {
    display: block;
    padding: 0.5rem 0.75rem !important;
    margin: 0.2rem 0 !important;
    font-size: 0.9rem !important;
    font-weight: 500;
    color: #0c3b56;
    background-color: transparent;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    text-decoration: none !important;
    text-align: left;
  }

  .mobile-menu-item:hover,
  .mobile-menu-item:focus {
    background-color: #f0f4fc;
    color: #0a2e45;
    text-decoration: none;
    transform: translateX(3px);
  }

  #mobileNavbar {
    background-color: #0071E30D !important;
    padding: 0;
    width: 100%;
    border-radius: 0 0 1rem 1rem !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05) !important;
    margin-top: -1px;
  }

  #mobileNavbar.collapsing {
    transition: height 0.2s ease;
  }

  .mobile-menu-wrapper .btn-login,
  .mobile-menu-wrapper .btn-signup {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    font-weight: 600;
    border-radius: 50px;
  }

  .mobile-menu-wrapper .btn.logout1 {
    width: 100%;
    padding: 0.5rem 0.75rem !important;
    margin: 0.2rem 0 !important;
    font-size: 0.9rem !important;
    font-weight: 500;
    background-color: transparent;
    border: none;
    border-radius: 0.5rem;
    color: #dc3545 !important;
    transition: all 0.2s ease;
    text-align: left;
  }

  .mobile-menu-wrapper .btn.logout1:hover {
    background-color: #fee;
    color: #c82333 !important;
  }

  #mobileNavbar .d-grid {
    gap: .75rem !important;
  }

  #mobileNavbar .btn {
    width: 100% !important;
    height: 48px !important;
    padding: 0 16px !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    -webkit-appearance: none;
  }

  #mobileNavbar .btn-login {
    background: #1769ff !important;
    color: #fff !important;
    border: 0 !important;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .04) inset;
  }

  #mobileNavbar .btn-signup {
    background: #fff !important;
    color: #0c3b56 !important;
    border: 1px solid #e5e7eb !important;
  }

  #mobileNavbar .btn-login:active,
  #mobileNavbar .btn-signup:active {
    transform: translateY(1px);
  }

  .navbar .mobile-nav-toggle {
    font-size: 1.4rem;
    padding: 0.25rem;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #0c3b56;
  }

  .navbar-brand img {
    height: 30px !important;
    width: auto !important;
  }

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


.user-avatar {
  width: 38px;
  height: 38px;
  background-color: #2f3b53;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
}

.user-avatar:hover {
  background-color: #1f2a3d;
}

/* ========================================
   ACCORDION & ALERTS
   ======================================== */
.accordion-body,
.accordion-item {
  background-color: #fff;
  color: #0B2F4E;
  border-radius: 10px;
  border: 1px solid #dee2e6;
}

.alert {
  font-size: .95rem;
  border-radius: 6px;
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
  font-size: .9rem;
  background-color: #0d3b5b;
}

.footer a.footer-link {
  color: rgba(255, 255, 255, .75);
  text-decoration: none;
  transition: color .2s;
  display: inline-block;
  padding: 6px 0;
  line-height: 1.35;
}

.footer a.footer-link:hover {
  color: #fff;
}

.footer hr {
  border-color: rgba(255, 255, 255, .2);
}

.footer h6 {
  font-weight: 700;
}

.footer .footer-cookie-note {
  display: inline-block;
  margin-top: .25rem;
  font-size: 0.6rem;
  color: rgba(255, 255, 255, 0.75);
}

.footer .footer-cookie-note a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}

.footer .footer-cookie-note a:hover {
  text-decoration: underline;
  color: #0071e3;
}

/* ========================================
   ICONS & UTILITIES
   ======================================== */
svg.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  cursor: pointer;
  margin-left: 0.1em;
  transition: box-shadow .2s, transform .1s;
  width: 0.6em;
  position: relative;
  top: -0.125em;
  height: 1.25em;
  left: -0.2rem;
}

svg.info-icon:hover,
svg.info-icon:focus {
  transform: scale(1.05);
  outline: none;
}

svg.info-icon .info-svg {
  width: 0.75em;
  height: 0.75em;
  color: #111;
}

.ai-home-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary, #6b7280);
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.8rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}

.ai-home-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary, #2d2d2d);
}

.ai-home-btn i {
  font-size: 16px;
}

@media (max-width: 768px) {
  .ai-home-btn .label {
    display: none !important;
  }

  .ai-home-btn {
    padding: 0.35rem 0.55rem;
    min-width: 32px;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .ai-home-btn i {
    font-size: 18px;
  }
}

/* ========================================
   HISTORY & SIDEBAR
   ======================================== */
.history-main-title {
  display: inline-block;
  font-family: bootstrap-icons !important;
  font-style: normal;
  font-weight: normal !important;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  position: relative;
  right: 12px;
  vertical-align: -.125em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.history-full-subtitle {
  border-top: 2px solid #d7eaf5 !important;
  background-color: rgba(68, 167, 225, .15) !important;
}

.history-subtitle-text {
  font-size: .71rem !important;
  flex: 1 !important;
  margin-left: 18px;
  margin-right: 5px;
}

.history-plus-icon {
  display: inline-block;
  font-family: bootstrap-icons !important;
  font-style: normal;
  font-weight: normal !important;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  position: relative;
  right: 13px;
  vertical-align: -.125em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.history-search-wrapper {
  padding: 6px 12px;
}

.history-search-box {
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #d0d4da;
  font-size: 13px;
  outline: none;
}

.history-search-box:focus {
  border-color: #3a7afe;
  box-shadow: 0 0 0 1px #3a7afe33;
}

.ai-chats .entry-list,
.ai-chats .sub-tools,
ul.ai-chats-list {
  padding-left: 0 !important;
  margin-left: 0 !important;
}

.ai-chats-list {
  padding-left: 0rem !important;
}

.ai-chat-item a {
  display: block;
  padding: 6px 10px;
}

.ai-chat-item.pending a.pending-link {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  background-color: #f3f6fb;
  color: #6b7280;
  font-size: 14px;
  text-decoration: none;
  cursor: default;
}

.pending-text .dot-one,
.pending-text .dot-two,
.pending-text .dot-three {
  animation: blinkDots 1.4s infinite both;
  opacity: 0.3;
}

.pending-text .dot-two {
  animation-delay: .2s;
}

.pending-text .dot-three {
  animation-delay: .4s;
}

@keyframes blinkDots {
  0% { opacity: 0.2; }
  25% { opacity: 1; }
  100% { opacity: 0.2; }
}

.tools-history-list.search-results,
.ai-chats-list.search-results {
  padding: 0;
  margin: 0;
}

.tools-history-list.search-results li,
.ai-chats-list.search-results li {
  list-style: none;
  padding: 10px 14px;
  background: #e9f3ff;
  border-bottom: 1px solid #d7e6f5;
  cursor: pointer;
  width: 100%;
  font-size: 14px;
  color: #1a3d6f;
}

.tools-history-list.search-results li:hover,
.ai-chats-list.search-results li:hover {
  background: #d8eaff;
}

.tools-history-list.search-results li a,
.ai-chats-list.search-results li a {
  display: block;
  width: 100%;
  color: #1a3d6f;
  text-decoration: none;
  font-size: 14px;
}

.ai-chats-list .no-results {
  opacity: 0.7;
  cursor: default;
  font-style: italic;
}

.ai-chats-original.hidden {
  display: none;
}

.tools-expanded {
  transform-origin: left var(--sidebar-origin-y, center);
  transform: scaleX(0);
  transition: transform .25s ease;
  display: block;
}

/* ========================================
   MENU & LISTS
   ======================================== */
.menu-title {
  font-weight: 600;
  margin-bottom: 1rem;
}

.menu-list li {
  margin-bottom: .5rem;
}

.menu-link {
  display: block;
  background: #fff;
  padding: .5rem 1rem;
  border-radius: 6px;
  color: #1a1a1a;
  box-shadow: 0 1px 4px var(--shadow-light);
  transition: background .2s;
}

.menu-link:hover {
  background: #f0f0f0;
}

/* ========================================
   GLOBAL SIDEBAR LAYOUT
   ======================================== */
.main-content-wrapper {
  margin-left: var(--sidebar-collapsed, 60px);
  transition: margin-left 0.3s ease;
}

.main-content-wrapper.sidebar-expanded {
  margin-left: var(--sidebar-expanded, 235px);
}

/* Reset for pages WITHOUT sidebar */
body.no-sidebar .main-content-wrapper {
  margin-left: 0 !important;
}

/* Mobile: No margin, sidebar overlays */
@media (max-width: 768px) {
  .main-content-wrapper {
    margin-left: 0 !important;
  }

  .main-content-wrapper.sidebar-expanded {
    margin-left: 0 !important;
  }
}
/* ===== HOME HEADER NAV LINK HOVER EFFECTS ===== */
.home-header-wrapper .nav-link,
.home-header-wrapper .nav-link.line {
  position: relative;
  color: #081F5C !important;
  font-weight: 500;
  transition: all 0.3s ease;
}

.home-header-wrapper .nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0%;
  height: 2px;
  background-color: #0071e3; /* accent blue */
  transition: width 0.3s ease;
}

.home-header-wrapper .nav-link:hover {
  color: #0071e3 !important;
  text-decoration: none;
}

.home-header-wrapper .nav-link:hover::after {
  width: 80%;
}
.navbar {
  padding: 0;
}

/* ===== GUEST BODY - Padding for header ===== */
body.ai-assistant-guest {
  padding-top: 80px !important;
  min-height: 100vh;
  margin: 0;
}

/* ===== Main content wrapper ===== */
body.ai-assistant-guest #mainContent {
  padding-top: 0 !important;
  position: relative;
  z-index: 1; /* Below header */
}

/* ===== Chat messages container - padding to prevent hiding behind header ===== */
body.ai-assistant-guest #chatMessages,
body.ai-assistant-guest .messages-container,
body.ai-assistant-guest .chat-messages-wrapper {
  padding-top: 100px !important;
  min-height: calc(100vh - 80px) !important;
}

/* ===== Individual message items ===== */
body.ai-assistant-guest .message,
body.ai-assistant-guest .message-item {
  margin-bottom: 1rem;
}

/* ===== After interaction - full height chat ===== */
body.ai-assistant-guest.chat-active {
  padding-top: 0;
}

body.ai-assistant-guest.chat-active #mainContent {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  overflow-y: auto;
}

body.ai-assistant-guest.chat-active .guest-header {
  z-index: 100;
}

body.ai-assistant-guest.chat-active #chatMessages,
body.ai-assistant-guest.chat-active .messages-container {
  padding-top: 71px !important;
}
/* Prevent header overlap for logged-in users */
body.ai-assistant-logged-in .chat-container {
  padding-top: 45px;  /* ← Reduced from 70px - tighter gap below header */
  min-height: 100vh; /* Add this */
}

/* Adjust messages container top padding to account for body padding */
body.ai-assistant-logged-in .messages-container {
  padding-top: 0.5rem;  /* ← Reduced from 1rem - less top space */
  min-height: calc(100vh - 45px);
}

/* Mobile */
@media (max-width: 768px) {
  body.ai-assistant-logged-in .chat-container {
    padding-top: 50px;
    min-height: 0;
  }

  body.ai-assistant-logged-in .messages-container {
    min-height: 0 !important; /* Natural height - no fixed size */
    height: auto !important;
    padding-bottom: 250px !important; /* Space for input */
  }
}

/* Keep sticky nav in correct position */
body.ai-assistant-logged-in .chat-nav {
  top: -45px;  /* ← Matches padding-top above */
  position: sticky;
}
body.ai-assistant-logged-in .ai-custom-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  /* box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06); */
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
}
@media (max-width: 768px) {
  /* Show backdrop when sidebar is open on mobile */
  body.sidebar-open #sidebarBackdrop {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  /* Blur content when sidebar is open */
  body.sidebar-open .main-content-wrapper,
  body.sidebar-open #mainContent {
    filter: blur(4px);
    pointer-events: none;
  }

  /* Make sidebar slide in from left */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease !important;
  }

  .sidebar.expanded {
    transform: translateX(0) !important;
  }
}
/* Main content positioning */
.main-content-wrapper {
    margin-left: 60px; /* Collapsed sidebar width */
    transition: margin-left 0.3s ease;
    min-height: 50vh;
}

/* No sidebar pages */
body.no-sidebar .main-content-wrapper {
    margin-left: 0 !important;
}

/* Expanded sidebar */
body.sidebar-open .main-content-wrapper.with-sidebar {
    margin-left: 235px; /* Expanded sidebar width */
}

/* Mobile - no margin */
@media (max-width: 768px) {
    .main-content-wrapper {
        margin-left: 0 !important;
    }
}

/* SPA transition styles */
.main-content-wrapper.loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.page-transition-enter {
    animation: fadeIn 0.2s ease;
}

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

/* ===============================
   UNIVERSAL PAGE FRAME
   =============================== */

.app-shell {
  display: flex;
  justify-content: center;
  width: 100%;
}

.app-page {
  width: 100%;
  max-width: 880px;
  padding: 24px 24px 96px;
  transition: transform 0.3s ease;
}

/* Slide effect with sidebar */
body.sidebar-open .app-page {
  transform: translateX(0);
}

/* Page header */
.app-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  margin-bottom: 12px;
}

.app-page-header h1 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
}

/* Content area */
.app-page-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Mobile */
@media (max-width: 768px) {
  .app-page {
    padding: 16px 16px 80px;
  }
}

/* Header User Profile Dropdown Styling */
#headerProfileDropdown .dropdown-item {
  transition: background 0.15s ease;
  color: #2d2d2d;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#headerProfileDropdown .dropdown-item:hover {
  background: #F3F4F6;
  color: #0B2F4E;
}

#headerProfileDropdown .dropdown-item:hover i {
  color: #0B2F4E;
}

#headerProfileDropdown .dropdown-item:active {
  background-color: transparent !important;
  color: inherit !important;
  filter: none !important;
  transform: none !important;
}

/* User avatar hover */
.user-avatar:hover {
  background: transparent !important;
}

.user-initial:hover {
  background: #D4E8FF !important;
}
/* ===== HEADER USER PROFILE DROPDOWN - MATCH SIDEBAR STYLE ===== */
#headerProfileDropdown {
  min-width: 180px !important;
  max-width: 180px;
  border-radius: 10px !important;
  border: 1px solid #E5E7EB !important;
  padding: 6px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08) !important;
  background: white !important;
  margin-top: 8px !important;
}

#headerProfileDropdown .dropdown-item {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 9px 12px !important;
  border-radius: 6px !important;
  text-decoration: none !important;
  color: #2d2d2d !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  transition: background 0.15s ease !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
}

#headerProfileDropdown .dropdown-item i {
  width: 18px !important;
  height: 18px !important;
  font-size: 14px !important;
  color: #6B7280 !important;
  flex-shrink: 0 !important;
}

#headerProfileDropdown .dropdown-item:hover {
  background: #F3F4F6 !important;
  color: #0B2F4E !important;
}

#headerProfileDropdown .dropdown-item:hover i {
  color: #0B2F4E !important;
}

/* Remove default Bootstrap active state */
#headerProfileDropdown .dropdown-item:active {
  background-color: transparent !important;
  color: inherit !important;
  filter: none !important;
  transform: none !important;
}

/* Divider styling */
#headerProfileDropdown .dropdown-divider {
  height: 1px !important;
  background: #E5E7EB !important;
  margin: 4px 0 !important;
  border: none !important;
  opacity: 1 !important;
}

/* Logout button specific styling */
#headerProfileDropdown form button.dropdown-item {
  width: 100% !important;
  text-align: left !important;
}

/* Remove any default button styling */
#headerProfileDropdown button.dropdown-item:focus {
  outline: none !important;
  box-shadow: none !important;
}






/* Header user profile button */
.user-profile {
  background: transparent !important;
  border: none !important;
  padding: 0.5rem !important;
  border-radius: 8px !important;
  transition: background 0.2s ease !important;
  cursor: pointer !important;
}



.user-profile:focus,
.user-profile:active {
  outline: none !important;
  box-shadow: none !important;
}

/* User avatar in header */
.user-profile .user-avatar {
  width: 32px !important;
  height: 32px !important;
  background: #E8F1FF !important;
  color: #0B2F4E !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 600 !important;
  font-size: 14px !important;
}

.user-profile .user-avatar img {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover !important;
}

/* ========================================
   MOBILE SAFE AREA FIXES
   ======================================== */

/* Support for notched phones and mobile browser toolbars */
@supports (padding: max(0px)) {
  body {
    padding-bottom: env(safe-area-inset-bottom) !important;
  }
}

/* iOS Safari - handle bottom toolbar overlap */
@media screen and (max-width: 768px) {

  /* Main content should not go under browser UI */
  .main-content-wrapper,
  #mainContentWrapper,
  .app-shell {
    padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    min-height: 100vh;
  }

  /* Chat interface - add bottom padding */
  .chat-container,
  .messages-container {
    padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
  }

  /* Input areas - stay above toolbar */
  .input-wrapper,
  .chat-input-container,
  .message-input-wrapper {
    padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important;
    margin-bottom: 0 !important;
  }

  /* Fixed bottom elements */
  .fixed-bottom,
  .sticky-bottom {
    bottom: env(safe-area-inset-bottom) !important;
  }
}

/* Specific fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
  @media screen and (max-width: 768px) {
    body {
      padding-bottom: env(safe-area-inset-bottom) !important;
    }

    /* Ensure viewport height accounts for iOS bars */
    .main-content-wrapper,
    #mainContentWrapper {
      min-height: -webkit-fill-available;
    }
  }
}
/* ===== MOBILE VIEWPORT HEIGHT FIX ===== */

/* Fix for iOS Safari dynamic viewport */
:root {
  --vh: 1vh;
}

@media screen and (max-width: 768px) {
  /* Use custom --vh instead of vh units */
  .settings-modal .modal-dialog,
  .settings-modal .modal-content,
  #settingsModal .modal-dialog {
    height: calc(var(--vh, 1vh) * 100) !important;
  }
}
/* ========================================
   UNIVERSAL MODAL styling SYSTEM- CONSISTENT STYLING
   ======================================== */

/* Base modal styling for all small action modals */
.action-modal .modal-dialog {
    max-width: 500px !important;
}

.action-modal .modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.action-modal .modal-header {
    border-bottom: 0px solid #F3F7FC;
    padding: 1.25rem 1.5rem;
    flex-shrink: 0;
}

.action-modal .modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.action-modal .modal-body {
    padding: 0 1.5rem 0.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 80px;
}

.action-modal .modal-footer {
    border-top: none;
    padding: 0rem 1.5rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Text content styling */
.action-modal .modal-description {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.action-modal .modal-description strong {
    color: #111827;
    font-weight: 600;
}

/* List styling (for items like projects, options, etc.) */
.action-modal .action-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
    flex: 1;
    margin-bottom: 1rem;
}

.action-modal .action-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: 0.5px solid #E5E7EB !important;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    width: 100%;
    font-family: var(--font-inter);
}

.action-modal .action-list-item:hover {
  border: 0.5px solid rgba(27, 145, 248, 0.4) !important;
}

.action-modal .action-list-item i {
    font-size: 1rem;
    color: #6b7280;
    width: 20px;
    flex-shrink: 0;
}

.action-modal .action-list-item span {
    font-size: 0.875rem;
    color: #111827;
    font-weight: 400;
}

/* Primary action button (right-aligned) */
.action-modal .btn-primary-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: #0B2F4E;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    width: auto;
    min-width: 120px;
    margin-left: auto;
    font-family: var(--font-inter);
}

.action-modal .btn-primary-action:hover {
    background: #0a2840;
    transform: none !important;
}

.action-modal .btn-primary-action:active {
    transform: none !important;
}

.action-modal .btn-primary-action:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
    opacity: 0.6;
}

.action-modal .btn-primary-action i {
    font-size: 0.875rem;
    color: #ffffff;
    width: auto;
    flex-shrink: 0;
}

/* Secondary/Cancel button */
.action-modal .btn-secondary-action {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.25rem;
    background: transparent;
    border: 0.5px solid #E5E7EB;
    border-radius: 8px;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    min-width: 100px;
    font-family: var(--font-inter);
    transition: all 0.2s;
    cursor: pointer;
    /* outline: 0.5px solid transparent; */
}

.action-modal .btn-secondary-action:hover {
    transform: none !important;
    /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
    border: 0.5px solid rgba(27, 145, 248, 0.4);
}

.action-modal .btn-secondary-action:active {
    transform: none !important;
}

/* Danger/Delete button */
.action-modal .btn-danger-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    color: #EC404E;
    font-size: 0.875rem;
    font-weight: 400;
    white-space: nowrap;
    width: auto;
    min-width: 100px;
    font-family: var(--font-inter);
    border: 0.5px solid #EC404E;
    outline: 0.5px solid transparent;
    /* border: 0.5px solid transparent; */
    background-color: transparent;
}

.action-modal .btn-danger-action:hover {
    transform: none !important;
    outline: 0.5px solid #EC404E;
border: 0.5px solid #EC404E;

}

.action-modal .btn-danger-action:active {
    transform: none !important;
}

.action-modal .btn-danger-action:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Form inputs in modals */
.action-modal .form-control {
    padding: 0.625rem 0.875rem;
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px;
    font-size: 0.875rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}

.action-modal .form-control:focus {
    border: 1px solid rgba(27, 145, 248, 0.5) !important;
    box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.05);
    color: #1a1a1a;
}

.action-modal textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Helper text */
.action-modal .form-help-text {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: #6b7280;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

.action-modal .form-help-text i {
    color: #6b7280;
    margin-top: 0.125rem;
}

/* No results/empty state */
.action-modal .no-results {
    text-align: center;
    padding: 2rem 1rem;
    color: #6b7280;
    font-size: 0.875rem;
}

/* ========================================
   AI CUSTOM HEADER - CHAT TITLE
   ======================================== */

/* Ensure ai-header-left allows flexible sizing */
.ai-custom-header .ai-header-left {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  flex: 1 !important; /* Allow it to grow */
  min-width: 0 !important; /* Allow shrinking */
}

/* Chat title in AI header */
.ai-custom-header .chat-title {
  /* Display & visibility */
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;

  /* Sizing - CRITICAL FIX */
  flex: 0 1 auto !important; /* Don't grow, allow shrink, auto width */
  min-width: 100px !important; /* Minimum width so it's visible */
  max-width: 300px !important;
  width: auto !important;
  height: auto !important;

  /* Typography */
  font-size: 14px !important;
  font-weight: 400 !important;
  color: #1f2937 !important;
  line-height: 1.4 !important;

  /* Spacing */
  margin: 0 !important;
  padding: 0 !important;

  /* Text overflow */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Ensure title is visible in AI assistant pages */
body.ai-assistant-logged-in .ai-custom-header .chat-title {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  color: #1f2937 !important;
  min-width: 100px !important;
}


/* Header Chat Title with Chevron Dropdown */
.header-chat-title-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  max-width: 100%;
  position: relative;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background-color 0.2s;
  min-height: 32px;
  max-width: none; /* Remove width restriction */
  flex-shrink: 0; /* Prevent shrinking */
  /* outline: 0.5px solid transparent; */
  border: 0.5px solid transparent;
}

/* Make entire wrapper clickable when it has dropdown */
.header-chat-title-wrapper[data-bs-toggle="dropdown"] {
  cursor: pointer;
}

/* Hover effect on entire wrapper */
.header-chat-title-wrapper[data-bs-toggle="dropdown"]:hover {
  /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
  border: 0.5px solid rgba(27, 145, 248, 0.4);
}

/* Active state */
.header-chat-title-wrapper[data-bs-toggle="dropdown"]:active {
  /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
  border: 0.5px solid rgba(27, 145, 248, 0.4);
}

.header-chat-title-wrapper .chat-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1f2937;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  transition: color 0.2s ease;
  pointer-events: none;
  line-height: 1.5;
}

/* Editable state */
.header-chat-title-wrapper .chat-title.editing {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 4px;
  padding: 2px 6px;
  background: #fff;
  cursor: text;
  pointer-events: auto;
}

.header-chat-title-wrapper .chat-title[contenteditable="true"] {
  cursor: text;
  user-select: text;
}

/* Chevron Container - Match sidebar exactly */
.chat-title-dropdown {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--text-secondary, #6b7280);
}

.chat-title-dropdown i {
  font-size: 0.75rem; /* 12px */
  color: #6b7280;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.15s ease;
  line-height: 1;
}

/* Show chevron on hover */
.header-chat-title-wrapper:hover .chat-title-dropdown {
  opacity: 1;
}

.header-chat-title-wrapper:hover .chat-title-dropdown i {
  color: #374151;
}

/* Always show when dropdown is open */
.header-chat-title-wrapper[aria-expanded="true"] .chat-title-dropdown {
  opacity: 1 !important;
  transform: rotate(180deg);
}

/* Rotate chevron when open */
.header-chat-title-wrapper[aria-expanded="true"] .chat-title-dropdown i {
  transform: rotate(180deg);
}

/* Dropdown menu styling - No movement, just fade in */
.header-chat-title-wrapper .dropdown-menu {
  min-width: 160px;
  max-width: 200px;
  padding: 6px;
  border: none;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1),
              0 2px 8px rgba(0, 0, 0, 0.06);
  background: #fff;

  /* Fixed position - stays in place */
  position: absolute !important;
  top: 100% !important;
  left: auto !important;
  right: 0 !important;
  transform-origin: top right !important;
  margin-top: 4px !important;

  /* Only opacity animation - NO transform/movement */
  opacity: 0;
  transform: scale(0.98); /* Only scale, no translateY */
  transition: opacity 0.12s ease,
              transform 0.12s ease;
  visibility: hidden;
  pointer-events: none;
}

/* Show state - just fade in and scale up, no sliding */
.header-chat-title-wrapper .dropdown-menu.show {
  opacity: 1;
  transform: scale(1);
  visibility: visible;
  pointer-events: auto;
}

/* Override Bootstrap's inline styles if they appear */
.header-chat-title-wrapper .dropdown-menu[style*="position"] {
  position: absolute !important;
  inset: auto !important;
  top: 100% !important;
  left: auto !important;
  right: 0 !important;
}

/* Dropdown items */
.header-chat-title-wrapper .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8125rem; /* 13px */
  font-weight: 500;
  color: #374151;
  transition: all 0.12s ease;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  white-space: nowrap;
}

.header-chat-title-wrapper .dropdown-item:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.header-chat-title-wrapper .dropdown-item:active {
  background: #e5e7eb;
  transform: scale(0.98);
}

.header-chat-title-wrapper .dropdown-item i {
  font-size: 0.875rem; /* 14px */
  width: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-chat-title-wrapper .dropdown-item span {
  flex: 1;
  min-width: 0;
}

.header-chat-title-wrapper .dropdown-item.text-danger {
  color: #dc2626;
}

.header-chat-title-wrapper .dropdown-item.text-danger:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.header-chat-title-wrapper .dropdown-divider {
  margin: 4px 0;
  border-color: #e5e7eb;
  opacity: 1;
  height: 1px;
}

/* Prevent background color when editing */
.header-chat-title-wrapper.editing-mode {
  background: transparent !important;
  cursor: default !important;
  pointer-events: none;
  background-color: rgba(59, 130, 246, 0.1);
}

.header-chat-title-wrapper.editing-mode .chat-title {
  pointer-events: auto;
}

/* Chat Breadcrumb (Project Path) */
.chat-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6b7280;
  font-size: 0.8125rem;
  font-weight: 500;
  flex-shrink: 0;
  pointer-events: none;
}

.chat-breadcrumb i.bi-folder {
  font-size: 0.875rem;
  color: #9ca3af;
}

.chat-breadcrumb .project-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-breadcrumb i.bi-chevron-right {
  font-size: 0.625rem; /* 10px - small chevron */
  color: #9ca3af;
}

/* Adjust wrapper to accommodate breadcrumb */
.header-chat-title-wrapper:has(.chat-breadcrumb) {
  gap: 8px;
}

/* Make title slightly smaller when breadcrumb is present */
.header-chat-title-wrapper:has(.chat-breadcrumb) .chat-title {
  font-size: 0.875rem;
}
/* Mobile adjustments */
@media (max-width: 768px) {
  .header-chat-title-wrapper {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
  }

  .header-chat-title-wrapper .chat-title {
    font-size: 0.875rem;
  }

  /* Always show chevron on mobile */
  .chat-title-dropdown {
    opacity: 1;
  }

  /* ✅ MOBILE DROPDOWN - Aligned to LEFT (start of title) */
  .header-chat-title-wrapper .dropdown-menu {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important; /* ✅ Align to left edge */
    right: auto !important;
    transform: scale(0.98) !important;
    transform-origin: top left !important; /* ✅ Origin at top-left */
    margin-top: 4px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;

    /* Proper width - starts at min-width, expands if needed */
    min-width: 200px !important;
    width: max-content !important;
    max-width: calc(100vw - 32px) !important;

    /* Keep the fade animation */
    opacity: 0;
    transition: opacity 0.12s ease, transform 0.12s ease;
    visibility: hidden;
    pointer-events: none;
  }

  /* Show state - scaled from top-left */
  .header-chat-title-wrapper .dropdown-menu.show {
    opacity: 1;
    transform: scale(1) !important;
    visibility: visible;
    pointer-events: auto;
  }

  /* Override any inline styles from Bootstrap/Popper */
  .header-chat-title-wrapper .dropdown-menu[style*="position"],
  .header-chat-title-wrapper .dropdown-menu[style*="inset"],
  .header-chat-title-wrapper .dropdown-menu[style] {
    position: absolute !important;
    inset: auto !important;
    top: 100% !important;
    left: 0 !important; /* ✅ Force left alignment */
    right: auto !important;
    transform: scale(0.98) !important;
  }

  .header-chat-title-wrapper .dropdown-menu.show[style] {
    transform: scale(1) !important;
  }

  /* Slightly larger touch targets on mobile */
  .header-chat-title-wrapper .dropdown-item {
    padding: 10px 14px;
    font-size: 0.875rem;
    /* outline: 0.5px solid transparent; */
    border: 0.5px solid transparent;
  }

  /* ✅ SHOW PROJECT NAME ON MOBILE */
  .chat-breadcrumb {
    display: flex !important;
    align-items: center;
    gap: 6px;
  }

  .chat-breadcrumb .project-name {
    display: block !important;
    max-width: 120px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-breadcrumb i.bi-chevron-right {
    display: inline-block !important;
    font-size: 0.625rem;
  }

  .chat-breadcrumb i.bi-folder {
    font-size: 0.875rem;
    flex-shrink: 0;
  }

  /* Adjust title wrapper when breadcrumb is present */
  .header-chat-title-wrapper:has(.chat-breadcrumb) {
    gap: 6px;
  }

  .header-chat-title-wrapper:has(.chat-breadcrumb) .chat-title {
    font-size: 0.8125rem;
  }
}

/* Very small mobile devices */
@media (max-width: 400px) {
  .header-chat-title-wrapper .dropdown-menu {
    min-width: 180px !important;
    max-width: calc(100vw - 24px) !important;
  }

  .chat-breadcrumb .project-name {
    max-width: 80px !important;
  }

  .header-chat-title-wrapper .dropdown-item {
    padding: 9px 12px;
    font-size: 0.8125rem;
  }
}

.header-chat-title-wrapper:hover {
   /* outline: 0.5px solid rgba(27, 145, 248, 0.4); */
  border: 0.5px solid rgba(27, 145, 248, 0.4);
}

.chat-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary, #1f2937);
    margin: 0;
    white-space: nowrap; /* ✅ Prevent wrapping */
    overflow: visible; /* ✅ Show full text */
    text-overflow: clip; /* ✅ No ellipsis */
    max-width: none; /* ✅ Remove any width limits */
}

/* ✅ When editing, make it scrollable */
.chat-title[contenteditable="true"] {
    white-space: pre-wrap;
    overflow-x: auto;
    max-width: 600px; /* Reasonable max when editing */
    padding: 4px 8px;
    border: 2px solid #3b82f6;
    border-radius: 4px;
    background: white;
}

.header-chat-title-wrapper.editing-mode .chat-title-dropdown {
    display: none; /* Hide dropdown arrow when editing */
}
