:root {
  --primary-blue: #00bcd4;
  /* Cyan accent from ThemePanda */
  --sidebar-dark: #2c3b41;
  --sidebar-header: #222d32;
  --sidebar-hover: #1e282c;
  --text-main: #201f1e;
  --text-muted: #605e5c;
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

html,
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f3f2f1;
  color: var(--text-main);
  margin: 0;
  padding: 0;
}

a,
.btn-link {
  color: #0078d4;
  text-decoration: none;
  transition: color 0.2s ease;
}

/* Search Results Popover */
.search-results-container {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  min-width: 250px;
  z-index: 2000 !important;
  /* Higher than everything */
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
  max-height: 250px;
  overflow-y: auto;
  display: none;
  min-height: 50px;
  /* Ensure it has some height even when empty/loading */
}

.search-results-container:not(:empty) {
  border: 2px solid var(--primary-blue);
  /* Visual indicator it's active */
}

.search-result-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid #f8f9fa;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background-color: #f0f7ff;
}

.search-result-title {
  font-weight: 600;
  font-size: 0.9rem;
  display: block;
  color: #212529;
}

.search-result-sub {
  font-size: 0.75rem;
  color: #6c757d;
}

.search-result-price {
  float: right;
  font-weight: 700;
  color: #0d6efd;
}

a:hover {
  color: #005a9e;
}

.btn-primary {
  background-color: #0078d4;
  border-color: #0078d4;
  padding: 0.5rem 1.2rem;
  font-weight: 500;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 120, 212, 0.2);
}

.btn-primary:hover {
  background-color: #106ebe;
  border-color: #106ebe;
}

/* Layout Structure */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Sidebar Styling - Dark ThemePanda Style */
.sidebar {
  background-color: var(--sidebar-dark);
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
  z-index: 10;
  color: #b8c7ce;
}

.sidebar .top-row {
  background-color: var(--sidebar-header);
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: center;
  /* Centered brand */
  align-items: center;
  height: auto;
  padding: 1.5rem 1rem;
}

.sidebar .brand-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Center text */
}

.sidebar .navbar-brand {
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffffff !important;
  font-size: 1.25rem;
  text-transform: uppercase;
  margin-bottom: 0;
  padding: 0;
}

.sidebar .navbar-brand span {
  color: var(--primary-blue);
}

.sidebar .sidebar-subtitle {
  font-size: 0.7rem;
  color: #8aa4af;
  text-transform: uppercase;
  margin-top: 4px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.sidebar .navbar-toggler {
  color: var(--primary-blue);
  border: 1px solid rgba(0, 188, 212, 0.2);
  padding: 0.25rem 0.5rem;
}

.sidebar .nav-item {
  padding: 0;
}

.sidebar .nav-link {
  color: #b8c7ce;
  border-radius: 8px;
  transition: all 0.3s ease;
  padding: 0.8rem 1.5rem;
  display: flex;
  align-items: center;
  text-decoration: none;
  font-size: 0.95rem;
  margin: 0.2rem 1rem;
  border-left: 4px solid transparent;
}

.sidebar .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.sidebar .nav-link.active {
  background-color: var(--primary-blue);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 188, 212, 0.2);
}

.sidebar .bi {
  margin-right: 1rem;
  font-size: 1.2rem;
  width: 1.5rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.rotate-icon {
  transition: transform 0.3s ease;
  margin-left: auto;
  margin-right: 0 !important;
  font-size: 0.8rem !important;
}

[aria-expanded="true"] .rotate-icon {
  transform: rotate(180deg);
}

.submenu-items {
  padding-left: 0.5rem;
  overflow: hidden;
  background-color: rgba(0, 0, 0, 0.1);
  /* Subtle dark background for submenus */
  margin: 0 1rem;
  border-radius: 8px;
}

.submenu-items .nav-link {
  font-size: 0.88rem;
  padding: 0.6rem 1rem;
  margin: 0.1rem 0;
  border-left: none;
  /* No border for sub-items */
}

/* Scrollbar Style for Sidebar */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: var(--sidebar-dark);
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}


/* Main Content Area */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.top-row {
  background-color: white;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.content {
  padding: 2rem;
  overflow: visible;
}

/* Card Improvements */
.card {
  border: none;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
  overflow: visible;
  /* Allow absolute search results to appear */
  background-color: white;
}

.card-header {
  background-color: white;
  border-bottom: 1px solid #edebe9;
  padding: 1.25rem 1.5rem;
}

.card-body {
  padding: 1.5rem;
}

/* Table Styling */
.table-responsive {
  overflow: visible !important;
}

.input-group {
  position: relative !important;
  /* Critical for positioning search results */
}

.table {
  margin-bottom: 0;
}

.table thead th {
  background-color: #faf9f8;
  border-bottom: 2px solid #edebe9;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 700;
  padding: 0.75rem 1rem;
}

.table tbody td {
  padding: 1rem;
  border-bottom: 1px solid #edebe9;
}

/* Responsive adjustments */
@media (min-width: 641px) {
  .page {
    flex-direction: row;
  }

  .sidebar {
    width: 280px;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }
}

@media (max-width: 640.98px) {
  .sidebar .collapse {
    background-color: var(--sidebar-dark);
  }
}

/* Badges */
.badge {
  padding: 0.5em 0.8em;
  border-radius: 4px;
  font-weight: 600;
}

.bg-success {
  background-color: #107c10 !important;
}

.bg-info {
  background-color: #eef6fc !important;
  color: #0078d4 !important;
}

.bg-danger {
  background-color: #a4262c !important;
}

/* Transaction Grid - Modern & Premium */
.transaction-grid {
  border: 1px solid #edebe9;
  border-radius: 12px;
  overflow: visible !important;
  background-color: white;
}

.transaction-grid thead th {
  background-color: #f8f9fa !important;
  color: #8a8886 !important;
  font-size: 0.7rem !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px !important;
  border-bottom: 2px solid #edebe9 !important;
}

.transaction-row {
  transition: all 0.2s ease;
}

.transaction-row:hover {
  background-color: #fbfbfb;
}

.transaction-row.row-active {
  background-color: #fcfcfc;
}

/* Minimal Inputs for Grid */
.input-minimal {
  border: 1px solid transparent;
  background-color: transparent;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.2s;
  width: 100%;
}

.input-minimal:focus {
  background-color: white;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.1);
  outline: none;
}

.input-minimal:hover:not(:focus) {
  background-color: #f3f3f3;
}

.transaction-row td {
  vertical-align: middle;
  padding: 8px 16px !important;
  overflow: visible !important;
}

/* Special styling for specific cells */
.cell-product {
  min-width: 300px;
  overflow: visible !important;
}

.cell-lot {
  min-width: 140px;
}

.cell-price {
  min-width: 120px;
}

.cell-qty {
  min-width: 90px;
}

.cell-tax {
  min-width: 90px;
}

.cell-total {
  min-width: 120px;
  text-align: right;
  font-weight: 700;
  color: #323130;
}

/* Lot Badge Modern */
.lot-badge-modern {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background-color: #eef6fc;
  color: #0078d4;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(0, 120, 212, 0.1);
}

.lot-badge-modern i {
  font-size: 0.9rem;
  margin-right: 6px;
}

/* Stock Indicator */
.stock-indicator {
  font-size: 0.72rem;
  margin-top: 4px;
  display: flex;
  align-items: center;
}

.stock-indicator.stock-ok {
  color: #107c10;
}

.stock-indicator.stock-low {
  color: #d83b01;
  font-weight: 600;
}

/* Trash Button Premium */
.btn-remove-row {
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: #a4262c;
  background-color: transparent;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.btn-remove-row:hover {
  background-color: #fde7e9;
  border-color: #fde7e9;
  color: #a4262c;
}

/* Totals Card Modern */
.totals-card {
  background: #fdfdfd;
  border: 1px solid #edebe9;
  border-radius: 12px;
  padding: 20px;
}

.totals-card .total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.totals-card .total-label {
  color: #605e5c;
  font-size: 0.9rem;
}

.totals-card .total-value {
  font-weight: 700;
  font-size: 1.1rem;
  color: #323130;
}

.totals-card .grand-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #edebe9;
}

.totals-card .grand-total-label {
  font-size: 1.1rem;
  color: #201f1e;
  font-weight: 800;
}

/* Custom Searchable Dropdown */
.searchable-dropdown {
  position: relative;
}

.searchable-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  display: none;
  max-height: 200px;
  overflow-y: auto;
  background: white;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.searchable-item {
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
  color: #212529;
}

.searchable-item:hover {
  background-color: #f8f9fa;
}

.searchable-item.active {
  background-color: var(--primary-blue);
  color: white;
}

.totals-card .grand-total-value {
  color: var(--primary-blue);
  font-size: 1.5rem;
  font-weight: 800;
}

/* Notification Styles */
.notif-animation {
  animation: bell-shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
  transform: translate3d(0, 0, 0);
  color: #ffc107;
}

@keyframes bell-shake {

  10%,
  90% {
    transform: translate3d(-1px, 0, 0) rotate(-10deg);
  }

  20%,
  80% {
    transform: translate3d(2px, 0, 0) rotate(10deg);
  }

  30%,
  50%,
  70% {
    transform: translate3d(-2px, 0, 0) rotate(-15deg);
  }

  40%,
  60% {
    transform: translate3d(2px, 0, 0) rotate(15deg);
  }
}

.hover-bg-light:hover {
  background-color: #f8f9fa;
  cursor: pointer;
}

.transition-all {
  transition: all 0.2s ease-in-out;
}

.btn-icon:hover {
  background-color: #e9ecef !important;
  color: var(--primary-blue) !important;
}

.breadcrumb-item+.breadcrumb-item::before {
  content: "›";
  color: #adb5bd;
}

#notifList {
  border-radius: 12px;
  margin-left: 10px;
}

#notifList li:last-child {
  border-bottom: none !important;
}

/* Bell trigger styling */
#notifDropdown {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
  color: var(--text-muted) !important;
}

#notifDropdown:hover {
  background-color: #f3f2f1;
  color: var(--primary-blue) !important;
}

#bellIcon {
  font-size: 1.25rem;
}