:root {
  --navy: #0c2a3f;
  --teal: #22c5b7;
  --ink: #0f172a;
  --muted: #6b7280;
  --bg: #f7f9fb;
  --card: #ffffff;
  --ring: rgba(34, 197, 183, 0.3);
  --radius: 14px;
  --shadow: 0 10px 25px rgba(2, 22, 37, 0.08);
}

/* Sticky Footer Layout */
html,
body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
}

main {
  flex: 1;
  /* Push footer down when not enough content */
}

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

/* Sidebar Layout */
body {
  display: block;
  min-height: 100vh;
  overflow-x: hidden;
  background-color: #f8f9fa; /* Light grey background for app */
}

/* Sidebar Container */
#sidebar {
  width: 260px;
  background-color: #ffffff;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  transition: transform 0.3s ease;
}

/* Main Content Area */
/* Main Content Area */
main {
  margin-left: 260px; /* Offset by sidebar width */
  padding: 0;
  width: auto;
  background: #f8f9fa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Brand/Logo */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  font-weight: 800;
  font-size: 1.4rem;
  margin-bottom: 32px;
  padding: 0 12px;
  text-decoration: none;
}

.sidebar-brand i {
  color: var(--teal);
  font-size: 1.6rem;
}

/* Navigation Groups */
.nav-group {
  margin-bottom: 24px;
}

.nav-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8; /* Muted text */
  margin-bottom: 12px;
  padding: 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Nav Links */
.nav-link-custom {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: #64748b; /* Slate 500 */
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  margin-bottom: 4px;
  position: relative;
}

.nav-link-custom:hover {
  background-color: #f8fafc; /* Slate 50 */
  color: var(--navy);
}

.nav-link-custom.active {
  background-color: #f0fdf9; /* Teal 50 */
  color: var(--teal);
  font-weight: 600;
}

.nav-link-custom i {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
  transition: color 0.2s;
}

.nav-link-custom.active i {
  color: var(--teal);
}

/* User Profile (Bottom) */
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid #e2e8f0;
  padding-top: 16px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.user-profile:hover {
  background-color: #f1f5f9;
}

.user-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Ensure text truncation works */
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.8rem;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Main Footer */
.main-footer {
  margin-top: auto;
  padding: 20px 0;
  text-align: center;
  border-top: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 0.9rem;
}

/* Mobile Toggle */
.mobile-toggle {
  display: none; /* Hidden on desktop */
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  background: white;
  border: 1px solid #e2e8f0;
  padding: 8px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Responsive */
@media (max-width: 992px) {
  #sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
  }

  #sidebar.show {
    transform: translateX(0);
  }

  main {
    margin-left: 0;
    width: 100%;
    padding: 16px;
    padding-top: 70px; /* Space for mobile header */
  }

  .mobile-toggle {
    display: block;
  }
}

/* Guest User Styles (No Sidebar) */
.guest-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: transparent; /* Changed from white to transparent */
  z-index: 1000;
  padding: 16px 0;
  transition: all 0.3s ease;
}

.guest-navbar .container-fluid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.navbar-brand-guest {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  font-weight: 800;
  font-size: 1.5rem;
  text-decoration: none;
  transition: opacity 0.2s;
}

.navbar-brand-guest:hover {
  opacity: 0.8;
}

.navbar-brand-guest i {
  color: var(--teal);
  font-size: 1.8rem;
}

.btn-login {
  display: inline-flex;
  align-items: center;
  padding: 10px 24px;
  background: var(--teal);
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(34, 197, 183, 0.2);
}

.btn-login:hover {
  background: #1eb3a6;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 197, 183, 0.3);
}

/* Guest Main Content (No Sidebar Margin) */
.guest-main {
  margin-left: 0 !important;
  padding-top: 70px; /* Space for fixed navbar */
  width: 100%;
}

@media (max-width: 768px) {
  .navbar-brand-guest {
    font-size: 1.3rem;
  }
  
  .navbar-brand-guest i {
    font-size: 1.5rem;
  }
  
  .btn-login {
    padding: 8px 16px;
    font-size: 0.9rem;
  }
}

/* Chatbot Widget Styles */
.chat-widget-fab {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--teal), #16a34a);
  border: none;
  box-shadow: 0 8px 24px rgba(34, 197, 183, 0.4);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1000;
}

.chat-widget-fab:hover {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: 0 12px 32px rgba(34, 197, 183, 0.6);
}

.chat-card {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  border: none;
  animation: slideInUp 0.3s ease-out forwards;
  z-index: 999;
}

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

.chat-header {
  background: white;
  padding: 16px 20px;
  border-bottom: none;
}

.chat-body-area {
  background: white;
  height: 350px;
  padding: 0 20px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  position: relative;
  word-wrap: break-word;
}

.msg-user {
  background: var(--teal);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.msg-ai {
  background: white;
  color: var(--ink);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.chat-footer {
  padding: 12px;
  background: white;
  border-top: 1px solid #f1f5f9;
}

.chat-input-group {
  background: #f1f5f9;
  border-radius: 24px;
  padding: 4px 6px 4px 16px;
  display: flex;
  align-items: center;
}

.chat-input {
  border: none;
  background: transparent;
  width: 100%;
  outline: none;
  font-size: 0.9rem;
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--teal);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  background: #1eb3a6;
  transform: scale(1.05);
}

/* Utility Classes */
.bg-navy { background-color: var(--navy) !important; color: white; }
.text-navy { color: var(--navy) !important; }
.bg-teal { background-color: var(--teal) !important; }
.text-teal { color: var(--teal) !important; }

.btn-teal {
  background-color: var(--teal);
  color: white;
  border: none;
  transition: all 0.2s ease;
}

.btn-teal:hover {
  background-color: #1ba398;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(34, 197, 183, 0.3);
}