/* ============================================================
   HELVAST — Modernize Theme (Inspired by Modernize Admin Pro)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ============================================================
   1. CSS DESIGN TOKENS
   ============================================================ */
:root {
  /* Primary */
  --hv-primary:        #5D87FF;
  --hv-primary-light:  #ECF2FF;
  --hv-primary-dark:   #4570EA;
  /* Secondary */
  --hv-secondary:      #49BEFF;
  --hv-secondary-light:#E8F7FF;
  --hv-secondary-dark: #23afdb;
  /* Semantic */
  --hv-success:        #13DEB9;
  --hv-success-light:  #E6FFFA;
  --hv-error:          #FA896B;
  --hv-error-light:    #FDEDE8;
  --hv-warning:        #FFAE1F;
  --hv-warning-light:  #FEF5E5;
  --hv-info:           #539BFF;
  --hv-info-light:     #EBF3FE;
  /* Text & Surface */
  --hv-dark:           #2A3547;
  --hv-muted:          #5A6A85;
  --hv-muted-light:    #7C8FAC;
  --hv-body-bg:        #F2F6FA;
  --hv-surface:        #FFFFFF;
  --hv-border:         rgba(0,0,0,0.09);
  /* Shadows */
  --hv-shadow-card:    rgb(145 158 171/30%) 0px 0px 2px 0px,rgb(145 158 171/12%) 0px 12px 24px -4px;
  --hv-shadow-hover:   rgb(145 158 171/40%) 0px 0px 4px 0px,rgb(145 158 171/22%) 0px 16px 32px -4px;
  --hv-shadow-sidebar: 0 0 24px rgba(145,158,171,.12);
  --hv-shadow-header:  0 1px 0 rgba(0,0,0,.06);
  --hv-shadow-btn:     0 4px 14px 0 rgba(93,135,255,.4);
  /* Sizing */
  --hv-sidebar-w:      270px;
  --hv-sidebar-min:    80px;
  --hv-header-h:       64px;
  /* Radius */
  --hv-r:              7px;
  --hv-r-lg:           12px;
  --hv-r-xl:           20px;
  --hv-r-pill:         50px;
  /* Transition */
  --hv-tx:             all .2s ease;
  --hv-tx-fast:        all .1s ease-in;
  /* Bootstrap overrides */
  --bs-primary:        #5D87FF;
  --bs-secondary:      #49BEFF;
  --bs-success:        #13DEB9;
  --bs-danger:         #FA896B;
  --bs-warning:        #FFAE1F;
  --bs-info:           #539BFF;
  --bs-dark:           #2A3547;
  --bs-body-font-family: 'Plus Jakarta Sans', sans-serif;
  --bs-body-bg:        #F2F6FA;
  --bs-body-color:     #2A3547;
  --bs-border-color:   rgba(0,0,0,0.09);
}

/* ============================================================
   2. BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--hv-body-bg);
  color: var(--hv-dark);
  font-size: .875rem;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4,h5,h6 {
  color: var(--hv-dark);
  font-weight: 700;
  letter-spacing: -.01em;
}

p { color: #3D4E68; }

a { text-decoration: none; }

/* Page fade-in */
@keyframes hvFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
main, .page-content { animation: hvFadeIn .3s ease forwards; }

/* ============================================================
   3. SIDEBAR
   ============================================================ */
.sidebar {
  background: #fff;
  flex-shrink: 0;
  width: var(--hv-sidebar-w);
  min-width: var(--hv-sidebar-w);
  box-shadow: var(--hv-shadow-sidebar);
  transition: width .3s ease, min-width .3s ease;
  position: relative;
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.sidebar-inner {
  padding: 1.25rem 1rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}
/* Logo */
.sidebar .logo-box {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--hv-primary) 0%, var(--hv-primary-dark) 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(93,135,255,.3);
  flex-shrink: 0;
  transition: var(--hv-tx);
}
.sidebar .logo-box .ti { color: #fff; font-size: 1.25rem; }
.sidebar .logo-text {
  font-size: 1rem; font-weight: 800;
  color: #1A2540; letter-spacing: -.02em;
}
/* Section label */
.nav-section-label {
  font-size: .6875rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .09em;
  color: #7C8FAC; padding: .75rem .5rem .25rem;
  opacity: .9;
}
/* Nav links */
.sidebar .nav-link {
  color: #4A5568;
  border-radius: var(--hv-r) !important;
  font-size: .875rem; font-weight: 600;
  padding: .55rem .75rem;
  display: flex; align-items: center; gap: .6rem;
  transition: var(--hv-tx-fast);
  white-space: nowrap;
}
.sidebar .nav-link .ti { font-size: 1.125rem; line-height: 1; flex-shrink: 0; }
.sidebar .nav-link:hover {
  background: var(--hv-primary-light);
  color: var(--hv-primary);
  transform: scale(1.01);
}
.sidebar .nav-link.active {
  background: var(--hv-primary-light);
  color: var(--hv-primary) !important;
  font-weight: 700;
}
.sidebar .nav-link.active .ti { color: var(--hv-primary); }
/* Logout */
.sidebar .nav-link.nav-logout { color: var(--hv-error); }
.sidebar .nav-link.nav-logout:hover { background: var(--hv-error-light); color: var(--hv-error); }
/* Divider */
.sidebar hr { border-color: var(--hv-border); margin: .5rem 0; }

/* Collapsed */
.sidebar-icon-only {
  width: var(--hv-sidebar-min) !important;
  min-width: var(--hv-sidebar-min) !important;
}
.sidebar-icon-only .nav-text,
.sidebar-icon-only .logo-text,
.sidebar-icon-only .nav-section-label,
.sidebar-icon-only .sidebar-toggle-label { display: none !important; }
.sidebar-icon-only .logo-container { justify-content: center !important; }
.sidebar-icon-only .logo-container .logo-box { margin: 0 auto; }
.sidebar-icon-only .nav-link { justify-content: center; padding: .6rem; gap: 0; }
.sidebar-icon-only .nav-link .ti { font-size: 1.3rem; margin: 0; }

/* Sidebar toggle btn */
.sidebar-toggle-btn {
  background: transparent; border: none;
  color: var(--hv-muted); border-radius: var(--hv-r);
  padding: .55rem .75rem; display: flex; align-items: center;
  width: 100%; font-family: inherit; font-size: .875rem; font-weight: 500;
  cursor: pointer; transition: var(--hv-tx); gap: .6rem;
}
.sidebar-toggle-btn:hover { background: var(--hv-primary-light); color: var(--hv-primary); }
.sidebar-toggle-btn .ti { font-size: 1.125rem; }
.sidebar-icon-only .sidebar-toggle-btn { justify-content: center; padding: .6rem; }

/* ============================================================
   4. HEADER / TOPBAR
   ============================================================ */
header.sticky-top {
  background: #fff !important;
  border-bottom: 1px solid var(--hv-border) !important;
  box-shadow: var(--hv-shadow-header);
  height: var(--hv-header-h);
  display: flex; align-items: center;
}
header h5, header h6 { color: #1A2540 !important; font-weight: 700; }
.header-icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--hv-r);
  background: transparent; border: 1px solid var(--hv-border);
  color: var(--hv-muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--hv-tx); font-size: 1rem;
}
.header-icon-btn:hover { background: var(--hv-primary-light); color: var(--hv-primary); border-color: transparent; }
.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--hv-primary) 0%, var(--hv-primary-dark) 100%);
  border-radius: var(--hv-r); color: #fff; font-size: .875rem;
  font-weight: 700; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
/* Workspace badge */
#workspaceIndicator {
  background: var(--hv-primary-light) !important;
  color: var(--hv-primary) !important;
  border: none !important;
  border-radius: var(--hv-r-pill) !important;
  font-size: .72rem; padding: .3em .8em; font-weight: 600;
}

/* ============================================================
   5. CARDS
   ============================================================ */
.card {
  background: #fff; border: none !important;
  border-radius: var(--hv-r-lg) !important;
  box-shadow: var(--hv-shadow-card);
  transition: box-shadow .2s ease, transform .1s ease-in;
}
.card:hover { box-shadow: var(--hv-shadow-hover); }
.card-hover:hover { transform: scale(1.01); }
.card-header { background: transparent !important; border-bottom: 1px solid var(--hv-border) !important; }
/* Stat icon box */
.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--hv-r-lg);
  display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
}
.icon-primary   { background: var(--hv-primary-light);   color: var(--hv-primary); }
.icon-secondary { background: var(--hv-secondary-light); color: var(--hv-secondary-dark); }
.icon-success   { background: var(--hv-success-light);   color: var(--hv-success); }
.icon-warning   { background: var(--hv-warning-light);   color: var(--hv-warning); }
.icon-error     { background: var(--hv-error-light);     color: var(--hv-error); }
.icon-info      { background: var(--hv-info-light);      color: var(--hv-info); }

/* ============================================================
   6. BUTTONS
   ============================================================ */
.btn {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 500; border-radius: var(--hv-r) !important;
  transition: var(--hv-tx); font-size: .875rem;
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--hv-primary); border: none; color: #fff; }
.btn-primary:hover  { background: var(--hv-primary-dark); box-shadow: var(--hv-shadow-btn); color: #fff; transform: translateY(-1px); }
.btn-secondary { background: var(--hv-secondary); border: none; color: #fff; }
.btn-secondary:hover { background: var(--hv-secondary-dark); color: #fff; }
.btn-light     { background: var(--hv-primary-light); color: var(--hv-primary); border: none; }
.btn-light:hover    { background: var(--hv-primary); color: #fff; }

/* ============================================================
   Button Spacing & Group Overrides (User Preference)
   ============================================================ */
.btn + .btn { margin-left: 0.5rem; }
[class*="gap-"] > .btn + .btn { margin-left: 0; }

/* Override btn-group attached borders to make them separated */
.btn-group, .btn-group-sm, .btn-group-lg {
  display: inline-flex !important;
  gap: 0.4rem !important;
}
.btn-group > .btn {
  border-radius: var(--hv-r) !important;
  margin-left: 0 !important;
  flex: 0 1 auto;
}
.btn-group.w-100 {
  display: flex !important;
}
.btn-group.w-100 > .btn {
  flex: 1 1 auto;
}
.btn-group > .dropdown-toggle-split {
  padding-right: 0.5rem;
  padding-left: 0.5rem;
}

/* ============================================================
   7. FORMS
   ============================================================ */
.form-control {
  font-family: 'Plus Jakarta Sans', sans-serif;
  border-radius: var(--hv-r) !important;
  border: 1px solid rgba(0,0,0,.12); font-size: .875rem;
  background-color: #FAFBFC; transition: var(--hv-tx);
}
.form-control:focus { border-color: var(--hv-primary); box-shadow: 0 0 0 3px rgba(93,135,255,.12); background: #fff; }
.form-label { font-size: .8125rem; font-weight: 700; color: #2A3547; letter-spacing: -.01em; }
.form-text { color: #5A6A85 !important; font-size: .78rem; }
.input-group-text {
  border-radius: var(--hv-r) !important; border: 1px solid rgba(0,0,0,.12);
  background: #FAFBFC; color: #5A6A85; font-weight: 600;
}
.form-select {
  font-family: 'Plus Jakarta Sans', sans-serif;
  border-radius: var(--hv-r) !important;
  border: 1px solid rgba(0,0,0,.12); font-size: .875rem; background: #FAFBFC;
}
.form-select:focus { border-color: var(--hv-primary); box-shadow: 0 0 0 3px rgba(93,135,255,.12); }
.form-check-input:checked { background-color: var(--hv-primary); border-color: var(--hv-primary); }

/* Modern Switch Toggle styling */
.form-switch {
  padding-left: 2.8rem !important;
  min-height: 1.5rem;
  display: flex;
  align-items: center;
}
.form-switch .form-check-input {
  width: 2.5rem !important;
  height: 1.25rem !important;
  margin-left: -2.8rem !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba(0, 0, 0, 0.25)'/%3e%3c/svg%3e");
  background-color: #e9ecef;
  border-color: #dee2e6;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, background-position 0.15s ease-in-out;
}
.form-switch .form-check-input:focus {
  border-color: var(--hv-primary);
  box-shadow: 0 0 0 0.25rem rgba(93, 135, 255, 0.1);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='var(--hv-primary)'/%3e%3c/svg%3e");
}
.form-switch .form-check-input:checked {
  background-color: var(--hv-primary);
  border-color: var(--hv-primary);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}
.form-switch .form-check-label {
  margin-left: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  color: #2A3547;
  user-select: none;
  line-height: 1.2;
}

/* ============================================================
   8. NAV TABS
   ============================================================ */
.nav-tabs { border-bottom: 2px solid var(--hv-border) !important; }
.nav-tabs .nav-link {
  border: none !important; color: #4A5568; font-weight: 700; font-size: .875rem;
  padding: .75rem 1.25rem; border-bottom: 2px solid transparent !important;
  margin-bottom: -2px; border-radius: 0 !important; transition: var(--hv-tx);
}
.nav-tabs .nav-link:hover { color: var(--hv-primary); background: var(--hv-primary-light); border-radius: var(--hv-r) var(--hv-r) 0 0 !important; }
.nav-tabs .nav-link.active { color: var(--hv-primary) !important; background: transparent !important; border-bottom: 2px solid var(--hv-primary) !important; border-radius: 0 !important; }

/* ============================================================
   9. DROPDOWNS
   ============================================================ */
.dropdown-menu {
  border: none; box-shadow: var(--hv-shadow-hover);
  border-radius: var(--hv-r-lg); font-family: 'Plus Jakarta Sans', sans-serif; font-size: .875rem;
  color: #2A3547;
}
.dropdown-item { border-radius: var(--hv-r); padding: .5rem 1rem; transition: var(--hv-tx-fast); font-weight: 600; color: #2A3547; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--hv-primary-light); color: var(--hv-primary); }
.dropdown-item.active { background: var(--hv-primary); color: #fff; }

/* ============================================================
   10. MODALS
   ============================================================ */
.modal-content { border: none; border-radius: var(--hv-r-xl); box-shadow: var(--hv-shadow-hover); }
.modal-header { border-bottom: 1px solid var(--hv-border); padding: 1.25rem 1.5rem; }
.modal-header .modal-title { font-weight: 800; font-size: 1rem; color: #1A2540; }
.modal-body { padding: 1.5rem; }
.modal-footer { border-top: 1px solid var(--hv-border); padding: 1rem 1.5rem; }

/* ============================================================
   11. ALERTS & BADGES
   ============================================================ */
.alert { border-radius: var(--hv-r); border: none; font-size: .875rem; font-weight: 600; }
.alert-primary { background: var(--hv-primary-light); color: #3558C8; }
.alert-success { background: var(--hv-success-light); color: #009B8F; }
.alert-danger  { background: var(--hv-error-light);   color: #C0392B; }
.alert-warning { background: var(--hv-warning-light); color: #8A6000; }
.alert-info    { background: var(--hv-info-light);    color: #1E6FD9; }
.badge { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; border-radius: var(--hv-r-pill); font-size: .7rem; }

/* ============================================================
   12. PROGRESS
   ============================================================ */
.progress { border-radius: var(--hv-r-pill); background: var(--hv-primary-light); }
.progress-bar { border-radius: var(--hv-r-pill); }

/* ============================================================
   13. TABLES
   ============================================================ */
.table { font-family: 'Plus Jakarta Sans', sans-serif; font-size: .875rem; }
.table th { font-weight: 800; color: #4A5568; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; border-bottom: 2px solid var(--hv-border); }
.table td { color: #2A3547; font-weight: 500; vertical-align: middle; border-color: var(--hv-border); }
.table > tbody > tr:last-child > td { border-bottom: none; }

/* ============================================================
   14. GRADIENTS
   ============================================================ */
.bg-gradient-primary   { background: linear-gradient(135deg, var(--hv-primary) 0%, var(--hv-primary-dark) 100%); }
.bg-gradient-secondary { background: linear-gradient(135deg, var(--hv-secondary) 0%, var(--hv-secondary-dark) 100%); }
.bg-gradient-success   { background: linear-gradient(135deg, var(--hv-success) 0%, #02b3a9 100%); }

/* ============================================================
   15. CHAT BUBBLES (index.html — AI Assistant)
   ============================================================ */
.message { display: flex !important; flex-direction: row !important; margin-bottom: 1.25rem; gap: .75rem; align-items: flex-end; width: 100%; }
.message.user      { justify-content: flex-end; }
.message.assistant { justify-content: flex-start; }
.message .bubble   { max-width: 80%; padding: .8rem 1.1rem; font-size: .9rem; line-height: 1.5; position: relative; word-wrap: break-word; border-radius: 16px; }
.message.user      .bubble { background: var(--hv-primary-light); color: var(--hv-dark); border-radius: 16px 16px 4px 16px; }
.message.assistant .bubble { background: #fff; color: var(--hv-dark); border: 1px solid var(--hv-border); border-radius: 16px 16px 16px 4px; box-shadow: var(--hv-shadow-card); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1rem; }
.avatar-user      { background: linear-gradient(135deg, var(--hv-secondary) 0%, var(--hv-secondary-dark) 100%); color: #fff; }
.avatar-assistant { background: linear-gradient(135deg, var(--hv-primary) 0%, var(--hv-primary-dark) 100%); color: #fff; }
#chatMessages::-webkit-scrollbar { width: 5px; }
#chatMessages::-webkit-scrollbar-track { background: var(--hv-body-bg); border-radius: 10px; }
#chatMessages::-webkit-scrollbar-thumb { background: #c8d2e6; border-radius: 10px; }

/* ============================================================
   16. LOGO BOX (global)
   ============================================================ */
.logo-box {
  background: linear-gradient(135deg, var(--hv-primary) 0%, var(--hv-primary-dark) 100%);
  box-shadow: 0 4px 12px rgba(93,135,255,.25);
  display: flex; align-items: center; justify-content: center;
}

/* ============================================================
   17. UTILITIES
   ============================================================ */
.border-end   { border-color: var(--hv-border) !important; }
.border-top   { border-color: var(--hv-border) !important; }
.border-bottom { border-color: var(--hv-border) !important; }
.text-muted   { color: #5A6A85 !important; font-weight: 500; }
.btn-xs { padding: .125rem .375rem; font-size: .75rem; }
.d-contents { display: contents; }

/* small text utility */
small, .small { color: #5A6A85; font-weight: 500; }

/* Hover scale utility */
.hover-scale { transition: transform .1s ease-in; }
.hover-scale:hover { transform: scale(1.01); }

/* Micro animation for stat numbers */
@keyframes hvCountUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.animate-count { animation: hvCountUp .4s ease forwards; }

/* Skeleton loader */
@keyframes hvSkeleton { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.skeleton { animation: hvSkeleton 1.5s ease-in-out infinite; background: var(--hv-primary-light); border-radius: var(--hv-r); }

/* List group Modernize */
.list-group-item { border-color: var(--hv-border); font-size: .875rem; }
