/* ============================================================
   Regent POS — Premium Glassmorphism Sidebar
   sidebar-premium.css
   ============================================================ */

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

/* ── CSS Custom Properties ── */
:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
  --gold: #c9a84c;
  --gold-light: #e0be72;
  --gold-glow: rgba(201, 168, 76, 0.35);
  --gold-subtle: rgba(201, 168, 76, 0.12);
  --sidebar-bg-1: #0a0f2e;
  --sidebar-bg-2: #12183d;
  --sidebar-bg-3: #1a1f4e;
  --sidebar-gradient: linear-gradient(160deg, #0a0f2e 0%, #12183d 40%, #1a1f4e 100%);
  --nav-text: rgba(255, 255, 255, 0.85);
  --nav-text-dim: rgba(255, 255, 255, 0.55);
  --nav-text-sub: rgba(255, 255, 255, 0.62);
  --nav-hover-bg: rgba(201, 168, 76, 0.12);
  --nav-active-bg: rgba(201, 168, 76, 0.18);
  --transition-fast: 200ms ease;
}

/* ============================================================
   CRITICAL BOOTSTRAP OVERRIDE
   ============================================================ */
#sidebar,
#sidebar.bg-secondary-subtle,
aside.tt-sidebar,
aside.tt-sidebar.bg-secondary-subtle {
  background: var(--sidebar-gradient) !important;
  background-color: transparent !important;
}

/* ============================================================
   SIDEBAR BASE
   ============================================================ */
#sidebar,
aside.tt-sidebar {
  /* KEEP the layout from main.css intact — only override visual styling */
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  height: 100% !important;
  width: 16rem !important;  /* matches main.css max-width: 16rem */
  max-width: 16rem !important;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.45), 1px 0 0 rgba(255, 255, 255, 0.04);
  z-index: 999 !important;
}

/* Subtle dot-grid overlay */
#sidebar::before,
aside.tt-sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: 0;
}

/* Decorative blurred gold orb — bottom left */
#sidebar::after,
aside.tt-sidebar::after {
  content: '';
  position: absolute;
  bottom: 80px;
  left: -60px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.18) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}

/* Second decorative gold orb — bottom right */
#sidebar .tt-sidebar-nav::before,
aside.tt-sidebar .tt-sidebar-nav::before {
  content: '';
  position: absolute;
  bottom: 20px;
  right: -40px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.12) 0%, transparent 70%);
  border-radius: 50%;
  filter: blur(35px);
  pointer-events: none;
  z-index: 0;
}

/* Ensure all direct children stack above pseudo-elements */
#sidebar > *,
aside.tt-sidebar > * {
  position: relative;
  z-index: 1;
}

/* ============================================================
   BRAND AREA
   ============================================================ */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

@keyframes goldPulse {
  0%, 100% { box-shadow: 0 1px 0 0 rgba(201, 168, 76, 0.5), 0 2px 8px rgba(201, 168, 76, 0.15); }
  50%       { box-shadow: 0 1px 0 0 rgba(201, 168, 76, 0.8), 0 2px 16px rgba(201, 168, 76, 0.3); }
}

.tt-brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 16px;
  border-bottom: 1px solid rgba(201, 168, 76, 0.5);
  background: rgba(255, 255, 255, 0.03);
  animation: goldPulse 3s ease-in-out infinite;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 2;
}

/* Shimmer sweep */
.tt-brand::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(201, 168, 76, 0.08) 50%,
    transparent 70%
  );
  background-size: 400px 100%;
  animation: shimmer 4s ease-in-out infinite;
  pointer-events: none;
}

.tt-brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

/* Logo image styling */
.tt-brand-link .tt-brand-logo {
  max-height: 36px;
  width: auto;
  object-fit: contain;
  filter: brightness(1.1) drop-shadow(0 0 6px rgba(201, 168, 76, 0.4));
}

.tt-brand-link .tt-brand-favicon {
  max-height: 32px;
  width: auto;
  object-fit: contain;
}

/* Fallback title text (when no logo) — rendered via data attribute or ::after trick */
/* Applied if .tt-brand-link has no visible <img> shown */
.tt-brand-link:not(:has(img:not(.d-none)))::after {
  content: 'Regent POS';
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 15px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Flag pill — positioned via sibling or standalone element */
/* Sidebar toggle doubles as anchor for flag via sibling selector trick;
   we inject the flag using .tt-brand::before content */
.tt-brand::before {
  content: '🇬🇧';
  position: absolute;
  right: 52px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  padding: 2px 8px;
  line-height: 1.6;
  pointer-events: none;
  z-index: 3;
}

/* ============================================================
   TOGGLE SIDEBAR BUTTON
   ============================================================ */
.tt-toggle-sidebar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast),
              box-shadow var(--transition-fast);
  flex-shrink: 0;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
  z-index: 3;
}

.tt-toggle-sidebar:hover {
  background: rgba(201, 168, 76, 0.18);
  border-color: rgba(201, 168, 76, 0.5);
  box-shadow: 0 0 10px rgba(201, 168, 76, 0.25);
  color: #ffffff;
}

.tt-toggle-sidebar:focus,
.tt-toggle-sidebar:focus-visible {
  outline: 2px solid rgba(201, 168, 76, 0.6);
  outline-offset: 2px;
}

.tt-toggle-sidebar span {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tt-toggle-sidebar svg,
.tt-toggle-sidebar i[data-feather] {
  width: 16px;
  height: 16px;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 2.5;
  transition: stroke var(--transition-fast);
}

.tt-toggle-sidebar:hover svg,
.tt-toggle-sidebar:hover i[data-feather] {
  stroke: #ffffff;
}

/* ============================================================
   SIDEBAR NAV SCROLL CONTAINER
   ============================================================ */
.tt-sidebar-nav {
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Ultra-thin gold scrollbar */
.tt-sidebar-nav::-webkit-scrollbar,
.tt-custom-scrollbar::-webkit-scrollbar {
  width: 3px;
}

.tt-sidebar-nav::-webkit-scrollbar-track,
.tt-custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 2px;
}

.tt-sidebar-nav::-webkit-scrollbar-thumb,
.tt-custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 2px;
}

.tt-sidebar-nav::-webkit-scrollbar-thumb:hover,
.tt-custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--gold-light);
}

/* Firefox scrollbar */
.tt-sidebar-nav,
.tt-custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(255, 255, 255, 0.04);
}

/* ============================================================
   NAVBAR / VERTICAL NAV RESETS
   ============================================================ */
.tt-sidebar .navbar,
.tt-sidebar .navbar-vertical {
  padding: 0;
  width: 100%;
}

.tt-sidebar .navbar-collapse,
.tt-sidebar .collapse.navbar-collapse {
  display: block !important;
  width: 100%;
}

.tt-sidebar #leftside-menu-container {
  width: 100%;
  padding: 0 8px;
}

/* ============================================================
   MAIN SIDE NAV LIST
   ============================================================ */
ul.tt-side-nav {
  list-style: none;
  padding: 4px 0;
  margin: 0;
  width: 100%;
}

ul.tt-side-nav .side-nav-item,
ul.tt-side-nav .nav-item {
  margin: 2px 0;
}

/* ============================================================
   NAV LINKS — BASE STATE
   ============================================================ */
.tt-sidebar .side-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--nav-text);
  text-decoration: none;
  border-left: 3px solid transparent;
  background: transparent;
  transition:
    background var(--transition-fast),
    border-left-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast);
  position: relative;
  /* overflow/text-overflow moved to text span — flex+overflow:hidden clips ::after arrow */
}

/* ── Icon default state ── */
.tt-sidebar .side-nav-link .tt-nav-link-icon {
  color: var(--nav-text-dim);
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
}
.tt-sidebar .side-nav-link .tt-nav-link-icon svg,
.tt-sidebar .side-nav-link .tt-nav-link-icon i[data-feather] {
  color: var(--nav-text-dim);
  stroke: var(--nav-text-dim);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: color var(--transition-fast), stroke var(--transition-fast);
}

/* ── Nav link text ── */
.tt-sidebar .side-nav-link .tt-nav-link-text {
  flex: 1;
  min-width: 0;          /* required: lets flex item shrink below content size */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--transition-fast);
}

/* ============================================================
   NAV LINKS — HOVER STATE
   ============================================================ */
.tt-sidebar .side-nav-link:hover,
.tt-sidebar .side-nav-link:focus {
  background: var(--nav-hover-bg);
  border-left-color: var(--gold);
  color: rgba(255, 255, 255, 0.98);
  box-shadow: inset 0 0 0 1px rgba(201, 168, 76, 0.1);
  outline: none;
  text-decoration: none;
}

.tt-sidebar .side-nav-link:hover .tt-nav-link-icon,
.tt-sidebar .side-nav-link:hover .tt-nav-link-icon svg,
.tt-sidebar .side-nav-link:hover .tt-nav-link-icon i[data-feather],
.tt-sidebar .side-nav-link:focus .tt-nav-link-icon,
.tt-sidebar .side-nav-link:focus .tt-nav-link-icon svg,
.tt-sidebar .side-nav-link:focus .tt-nav-link-icon i[data-feather] {
  color: var(--gold);
  stroke: var(--gold);
}

.tt-sidebar .side-nav-link:hover .tt-nav-link-text,
.tt-sidebar .side-nav-link:focus .tt-nav-link-text {
  text-shadow: 0 0 12px rgba(201, 168, 76, 0.4);
}

/* ============================================================
   NAV LINKS — ACTIVE STATE
   ============================================================ */

/* Active parent link (when collapsible is open or item is current) */
.tt-sidebar .tt-menu-toggle.active,
.tt-sidebar .tt-menu-toggle[aria-expanded="true"],
.tt-sidebar .side-nav-link.active,
.tt-sidebar .side-nav-item.active > .side-nav-link,
.tt-sidebar .nav-item.active > .side-nav-link,
.tt-sidebar li.tt-menu-item-active > .side-nav-link {
  background: var(--nav-active-bg);
  border-left-color: var(--gold);
  color: #ffffff;
  box-shadow:
    -3px 0 12px rgba(201, 168, 76, 0.3),
    inset 0 0 0 1px rgba(201, 168, 76, 0.15);
}

.tt-sidebar .tt-menu-toggle.active .tt-nav-link-icon,
.tt-sidebar .tt-menu-toggle.active .tt-nav-link-icon svg,
.tt-sidebar .tt-menu-toggle.active .tt-nav-link-icon i[data-feather],
.tt-sidebar .tt-menu-toggle[aria-expanded="true"] .tt-nav-link-icon,
.tt-sidebar .tt-menu-toggle[aria-expanded="true"] .tt-nav-link-icon svg,
.tt-sidebar .tt-menu-toggle[aria-expanded="true"] .tt-nav-link-icon i[data-feather],
.tt-sidebar .side-nav-link.active .tt-nav-link-icon,
.tt-sidebar .side-nav-link.active .tt-nav-link-icon svg,
.tt-sidebar .side-nav-link.active .tt-nav-link-icon i[data-feather],
.tt-sidebar .side-nav-item.active > .side-nav-link .tt-nav-link-icon,
.tt-sidebar .side-nav-item.active > .side-nav-link .tt-nav-link-icon svg,
.tt-sidebar .side-nav-item.active > .side-nav-link .tt-nav-link-icon i[data-feather] {
  color: var(--gold);
  stroke: var(--gold);
}

.tt-sidebar .tt-menu-toggle.active .tt-nav-link-text,
.tt-sidebar .tt-menu-toggle[aria-expanded="true"] .tt-nav-link-text,
.tt-sidebar .side-nav-link.active .tt-nav-link-text {
  text-shadow: 0 0 16px rgba(201, 168, 76, 0.5);
}

/* ============================================================
   COLLAPSE TOGGLE ARROW INDICATOR
   ============================================================ */
.tt-sidebar .tt-menu-toggle::after {
  content: '';
  display: block;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid rgba(255,255,255,0.4);
  border-bottom: 1.5px solid rgba(255,255,255,0.4);
  transform: rotate(-45deg) translateY(-1px);
  margin-left: auto;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.tt-sidebar .tt-menu-toggle[aria-expanded="true"]::after,
.tt-sidebar .tt-menu-toggle.active::after {
  transform: rotate(45deg);
  border-color: var(--gold);
}

.tt-sidebar .tt-menu-toggle:hover::after {
  border-color: var(--gold);
}

/* ============================================================
   SECTION TITLES
   ============================================================ */
.tt-sidebar .side-nav-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 10px;
  font-weight: 800;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 14px 16px 6px 20px;
  white-space: nowrap;
  overflow: visible;
  position: relative;
  display: block;
}

.tt-sidebar .side-nav-title::before,
.tt-sidebar .side-nav-title::after {
  display: none; /* Removed decorative lines - caused text overlap */
}

/* ============================================================
   SUB-MENU (SECOND LEVEL)
   ============================================================ */
.tt-sidebar .collapse,
.tt-sidebar .collapsing {
  background: transparent;
}

ul.side-nav-second-level {
  list-style: none;
  padding: 4px 0 4px 24px;
  margin: 0;
  position: relative;
  overflow: visible;
}

/* Vertical connecting line */
ul.side-nav-second-level::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: linear-gradient(180deg, rgba(201, 168, 76, 0.3), rgba(201, 168, 76, 0.05));
  z-index: 0;
  pointer-events: none;
}

ul.side-nav-second-level li {
  position: relative;
  margin: 1px 0;
  z-index: 1;
}

/* Connector tick from vertical line to item */
ul.side-nav-second-level li::before {
  content: '';
  position: absolute;
  left: -14px;
  top: 50%;
  width: 10px;
  height: 1px;
  background: rgba(201, 168, 76, 0.2);
  transform: translateY(-50%);
  z-index: 0;
  pointer-events: none;
}

ul.side-nav-second-level li a {
  display: block;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: var(--nav-text-sub);
  text-decoration: none;
  padding: 7px 12px 7px 8px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition:
    background var(--transition-fast),
    color var(--transition-fast),
    border-left-color var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

ul.side-nav-second-level li a:hover,
ul.side-nav-second-level li a:focus {
  background: rgba(201, 168, 76, 0.1);
  color: var(--gold-light);
  border-left-color: rgba(201, 168, 76, 0.5);
  outline: none;
  text-decoration: none;
}

/* Active sub-menu item */
ul.side-nav-second-level li.tt-menu-item-active a,
ul.side-nav-second-level li.active a {
  color: var(--gold);
  font-weight: 600;
  border-left-color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
}

ul.side-nav-second-level li.tt-menu-item-active a:hover,
ul.side-nav-second-level li.active a:hover {
  background: rgba(201, 168, 76, 0.15);
  color: var(--gold-light);
}

/* ============================================================
   LOGOUT / USER NAV AREA
   ============================================================ */
ul.tt-user-side-nav {
  list-style: none;
  padding: 0;
  margin: 12px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 12px;
  flex-shrink: 0;
}

/* Glassmorphism pill logout button */
.tt-user-side-nav .side-nav-link.btn,
.tt-user-side-nav .side-nav-link.btn.border,
.tt-user-side-nav .side-nav-link.btn.border-primary,
.tt-user-side-nav .side-nav-link.btn.rounded-pill {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 20px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  background-color: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 100px !important;
  text-decoration: none;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-left: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.tt-user-side-nav .side-nav-link.btn:hover,
.tt-user-side-nav .side-nav-link.btn.border:hover,
.tt-user-side-nav .side-nav-link.btn.border-primary:hover,
.tt-user-side-nav .side-nav-link.btn.rounded-pill:hover {
  background: rgba(201, 168, 76, 0.12) !important;
  background-color: transparent !important;
  border-color: var(--gold) !important;
  color: var(--gold) !important;
  box-shadow: 0 0 16px rgba(201, 168, 76, 0.2), inset 0 0 0 1px rgba(201, 168, 76, 0.15);
  text-decoration: none;
  border-left-color: var(--gold) !important;
}

.tt-user-side-nav .side-nav-link.btn:focus,
.tt-user-side-nav .side-nav-link.btn:focus-visible {
  outline: 2px solid rgba(201, 168, 76, 0.5);
  outline-offset: 2px;
  box-shadow: none;
}

.tt-user-side-nav .side-nav-link.btn:active {
  background: rgba(201, 168, 76, 0.2) !important;
  border-color: var(--gold-light) !important;
  color: var(--gold-light) !important;
  transform: scale(0.98);
}

/* ============================================================
   FEATHER ICON SVG GLOBAL RESETS WITHIN SIDEBAR
   ============================================================ */
.tt-sidebar svg[class*="feather"] {
  display: inline-block;
  vertical-align: middle;
}

.tt-sidebar .tt-nav-link-icon svg[class*="feather"],
.tt-sidebar .tt-nav-link-icon i[data-feather] svg {
  width: 18px;
  height: 18px;
  stroke: var(--nav-text-dim);
  stroke-width: 2;
  fill: none;
  transition: stroke var(--transition-fast);
}

.tt-sidebar .side-nav-link:hover .tt-nav-link-icon svg[class*="feather"],
.tt-sidebar .side-nav-link:hover .tt-nav-link-icon i[data-feather] svg,
.tt-sidebar .side-nav-link:focus .tt-nav-link-icon svg[class*="feather"],
.tt-sidebar .side-nav-link:focus .tt-nav-link-icon i[data-feather] svg {
  stroke: var(--gold);
}

.tt-sidebar .side-nav-link.active .tt-nav-link-icon svg[class*="feather"],
.tt-sidebar .side-nav-link.active .tt-nav-link-icon i[data-feather] svg,
.tt-sidebar .side-nav-item.active > .side-nav-link .tt-nav-link-icon svg[class*="feather"],
.tt-sidebar .side-nav-item.active > .side-nav-link .tt-nav-link-icon i[data-feather] svg,
.tt-sidebar .tt-menu-toggle[aria-expanded="true"] .tt-nav-link-icon svg[class*="feather"],
.tt-sidebar .tt-menu-toggle[aria-expanded="true"] .tt-nav-link-icon i[data-feather] svg,
.tt-sidebar .tt-menu-toggle.active .tt-nav-link-icon svg[class*="feather"],
.tt-sidebar .tt-menu-toggle.active .tt-nav-link-icon i[data-feather] svg {
  stroke: var(--gold);
}

.tt-toggle-sidebar svg[class*="feather"],
.tt-toggle-sidebar i[data-feather] svg {
  width: 16px;
  height: 16px;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 2.5;
  fill: none;
  transition: stroke var(--transition-fast);
}

.tt-toggle-sidebar:hover svg[class*="feather"],
.tt-toggle-sidebar:hover i[data-feather] svg {
  stroke: #ffffff;
}

/* ============================================================
   BOOTSTRAP NAVBAR COLLISION RESETS
   ============================================================ */
.tt-sidebar .navbar-vertical .navbar-nav .nav-link,
.tt-sidebar .navbar .nav-link {
  padding: 0;
  color: inherit;
}

.tt-sidebar .navbar-vertical .navbar-collapse {
  padding: 0;
}

.tt-sidebar .navbar-expand-lg .navbar-collapse {
  display: flex !important;
  flex-basis: auto;
}

/* Override Bootstrap's bg-secondary-subtle variable deeply */
.tt-sidebar .bg-secondary-subtle,
.tt-sidebar.bg-secondary-subtle {
  --bs-secondary-bg: transparent !important;
  background-color: transparent !important;
  background: transparent !important;
}

/* ============================================================
   KEYFRAME ANIMATIONS
   ============================================================ */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.tt-sidebar .side-nav-item {
  animation: fadeInLeft 220ms ease both;
}

.tt-sidebar .side-nav-item:nth-child(1)  { animation-delay: 30ms; }
.tt-sidebar .side-nav-item:nth-child(2)  { animation-delay: 60ms; }
.tt-sidebar .side-nav-item:nth-child(3)  { animation-delay: 90ms; }
.tt-sidebar .side-nav-item:nth-child(4)  { animation-delay: 120ms; }
.tt-sidebar .side-nav-item:nth-child(5)  { animation-delay: 150ms; }
.tt-sidebar .side-nav-item:nth-child(6)  { animation-delay: 180ms; }
.tt-sidebar .side-nav-item:nth-child(7)  { animation-delay: 210ms; }
.tt-sidebar .side-nav-item:nth-child(8)  { animation-delay: 240ms; }
.tt-sidebar .side-nav-item:nth-child(9)  { animation-delay: 270ms; }
.tt-sidebar .side-nav-item:nth-child(n+10) { animation-delay: 300ms; }

/* ============================================================
   COLLAPSED SIDEBAR STATE (if app uses .tt-sidebar-condensed)
   ============================================================ */
.tt-sidebar-condensed #sidebar,
.tt-sidebar-condensed aside.tt-sidebar {
  width: var(--sidebar-collapsed-width);
}

.tt-sidebar-condensed .tt-sidebar .tt-nav-link-text,
.tt-sidebar-condensed .tt-sidebar .side-nav-title,
.tt-sidebar-condensed .tt-sidebar .side-nav-second-level,
.tt-sidebar-condensed .tt-sidebar .tt-menu-toggle::after {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  width: 0;
}

.tt-sidebar-condensed .tt-sidebar .side-nav-link {
  justify-content: center;
  padding: 10px;
  border-left-width: 0;
  border-bottom: 2px solid transparent;
}

.tt-sidebar-condensed .tt-sidebar .side-nav-link:hover {
  border-bottom-color: var(--gold);
  border-left-color: transparent;
}

.tt-sidebar-condensed .tt-brand::before {
  display: none;
}

.tt-sidebar-condensed .tt-brand-link .tt-brand-logo {
  display: none;
}

.tt-sidebar-condensed .tt-brand-link .tt-brand-favicon {
  display: block !important;
}

/* ============================================================
   RESPONSIVE — mobile sidebar (below lg breakpoint)
   ============================================================ */
@media (max-width: 991.98px) {
  #sidebar,
  aside.tt-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    z-index: 1045 !important;
    transform: translateX(-100%);
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }

  #sidebar.show,
  aside.tt-sidebar.show {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0, 0, 0, 0.6);
  }
}

/* ============================================================
   UTILITIES — glass card helper (reusable)
   ============================================================ */
.tt-sidebar .glass-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ============================================================
   FOCUS-VISIBLE ACCESSIBILITY
   ============================================================ */
.tt-sidebar .side-nav-link:focus-visible {
  outline: 2px solid rgba(201, 168, 76, 0.7);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(201, 168, 76, 0.15);
}

ul.side-nav-second-level li a:focus-visible {
  outline: 2px solid rgba(201, 168, 76, 0.7);
  outline-offset: 1px;
}

/* ============================================================
   PRINT — hide sidebar
   ============================================================ */
@media print {
  #sidebar,
  aside.tt-sidebar {
    display: none !important;
  }
}

/* ============================================================
   SELECT BRANCH — Vendor Branch Switcher
   ============================================================ */

/* Label "Select Branch" */
#sidebar .side-nav-item label,
aside.tt-sidebar .side-nav-item label {
  display: block;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--gold) !important;
  padding: 0 4px 5px 4px;
  margin: 0;
}

/* The <select> dropdown */
#sidebar .side-nav-item .form-select.side-nav-link,
#sidebar .side-nav-item select.side-nav-link,
#sidebar .side-nav-item .updateUserBranch,
#sidebar #select-input2,
aside.tt-sidebar .side-nav-item .form-select.side-nav-link,
aside.tt-sidebar .side-nav-item select.side-nav-link,
aside.tt-sidebar .side-nav-item .updateUserBranch,
aside.tt-sidebar #select-input2 {
  width: 100% !important;
  font-family: 'Inter', -apple-system, sans-serif !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  color: rgba(255, 255, 255, 0.92) !important;
  background-color: rgba(255, 255, 255, 0.09) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c9a84c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  border: 1px solid rgba(201, 168, 76, 0.35) !important;
  border-radius: 8px !important;
  padding: 8px 32px 8px 12px !important;
  margin: 0 !important;
  cursor: pointer !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  transition: border-color 200ms ease, background-color 200ms ease, box-shadow 200ms ease !important;
  outline: none !important;
  /* Override Bootstrap form-select default white bg */
  --bs-form-select-bg-icon: none !important;
}

#sidebar .side-nav-item .updateUserBranch:hover,
#sidebar #select-input2:hover,
aside.tt-sidebar .side-nav-item .updateUserBranch:hover,
aside.tt-sidebar #select-input2:hover {
  border-color: rgba(201, 168, 76, 0.6) !important;
  background-color: rgba(255, 255, 255, 0.12) !important;
}

#sidebar .side-nav-item .updateUserBranch:focus,
#sidebar #select-input2:focus,
aside.tt-sidebar .side-nav-item .updateUserBranch:focus,
aside.tt-sidebar #select-input2:focus {
  border-color: var(--gold) !important;
  background-color: rgba(201, 168, 76, 0.08) !important;
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.18) !important;
  outline: none !important;
}

/* Dropdown options (native OS renders these, we style what we can) */
#sidebar .side-nav-item .updateUserBranch option,
#sidebar #select-input2 option,
aside.tt-sidebar .side-nav-item .updateUserBranch option,
aside.tt-sidebar #select-input2 option {
  background-color: #12183d !important;
  color: rgba(255, 255, 255, 0.9) !important;
  padding: 8px 12px !important;
}

/* The parent li that wraps Select Branch — give it breathing room */
#sidebar li:has(> label),
#sidebar li:has(> .updateUserBranch),
#sidebar li:has(> select.side-nav-link),
aside.tt-sidebar li:has(> label),
aside.tt-sidebar li:has(> .updateUserBranch),
aside.tt-sidebar li:has(> select.side-nav-link) {
  padding: 10px 10px 12px 10px !important;
  margin-bottom: 4px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border-radius: 10px !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
}
/* Clean section divider — replaces the broken ::before/::after lines */
.tt-sidebar .side-nav-title {
  border-top: 1px solid rgba(201, 168, 76, 0.15) !important;
  margin-top: 8px !important;
}

/* ============================================================
   OVERRIDE FIXES — beat main.css cascade conflicts
   ============================================================ */

/* main.css sets overflow:hidden on .side-nav-link — we must override */
.tt-sidebar .side-nav-link {
  overflow: visible !important;
  white-space: normal !important;
  text-overflow: clip !important;
}

/* main.css ::after chevron is position:absolute — ours is flex child
   Force the original tt-menu-toggle::after to be the flex child version */
.tt-sidebar .tt-menu-toggle::after,
.tt-sidebar .side-nav-item .tt-menu-toggle::after {
  content: '' !important;
  position: relative !important;
  display: block !important;
  top: auto !important;
  right: auto !important;
  transform: rotate(-45deg) translateY(-1px) !important;
  width: 7px !important;
  height: 7px !important;
  border: none !important;
  border-right: 1.5px solid rgba(255,255,255,0.4) !important;
  border-bottom: 1.5px solid rgba(255,255,255,0.4) !important;
  margin-left: auto !important;
  flex-shrink: 0 !important;
  transition: transform 0.2s ease, border-color 0.2s ease !important;
}

.tt-sidebar .tt-menu-toggle[aria-expanded="true"]::after,
.tt-sidebar .tt-menu-toggle.active::after {
  transform: rotate(135deg) !important;
  border-right-color: var(--gold) !important;
  border-bottom-color: var(--gold) !important;
}

/* Keep text ellipsis only on text span */
.tt-sidebar .side-nav-link .tt-nav-link-text {
  flex: 1 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* ============================================================
   SUB-MENU WHITE LINE FIX — kill ::before/::after connectors
   main.css injects tree-branch pseudo-elements on li items;
   these render as white shapes on the dark sidebar background.
   ============================================================ */
.side-nav-second-level li::before,
.side-nav-second-level li::after,
.side-nav-third-level li::before,
.side-nav-third-level li::after {
    display: none !important;
    content: none !important;
    border: none !important;
    background: none !important;
    width: 0 !important;
    height: 0 !important;
}

.side-nav-second-level li a::before,
.side-nav-second-level li a::after,
.side-nav-third-level li a::before,
.side-nav-third-level li a::after {
    display: none !important;
    content: none !important;
    border: none !important;
    background: none !important;
    width: 0 !important;
    height: 0 !important;
}

.side-nav-second-level,
.side-nav-third-level {
    overflow: visible !important;
}

.side-nav-second-level li a,
.side-nav-third-level li a {
    overflow: visible !important;
    position: relative !important;
}
