/* Main Styles */
@import "https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700";



#qrCodeModal .modal-body {
  padding: 2rem;
}

#qrCodeContainer {
  min-height: 320px;
  align-items: center;
}

.share-qr {
  color: #6f42c1;
}

.share-qr:hover {
  color: #5a32a3;
  background-color: #f8f9fa;
}

#qrCodeModal canvas {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.skiptranslate {
  z-index: 999 !important;
}

/* Optional: Style the dropdown better */
#google_translate_element .goog-te-gadget-simple {
  background-color: transparent !important;
  border: 1px solid #ccc !important;
  padding: 5px !important;
  border-radius: 4px !important;
}

#google_translate_element {
  position: relative;
  z-index: 1049 !important;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 8px;
  min-width: 150px;
}

.goog-te-menu-frame {
  z-index: 1049 !important;
  max-height: 400px !important;
  overflow-y: auto !important;
}

#closeTranslateBtn {
  position: absolute;
  top: 2px;
  right: 2px;
  padding: 2px 6px;
  font-size: 10px;
  z-index: 1050;
}

body,
html {
  font-family: 'Poppins', sans-serif;
  background: white;
  height: 100%;
  font-size: 0.8rem;
  */
}

/* Typography */
p,
td,
th,
tr {
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem !important;
}

a,
a:hover,
a:focus {
  color: inherit;
  text-decoration: none;
  transition: all 0.3s;
}


/* Utility Classes */
.bd-placeholder-img {
  font-size: 1.125rem;
  text-anchor: middle;
  user-select: none;
}

@media (min-width: 768px) {
  .bd-placeholder-img-lg {
    font-size: 3.5rem;
  }
}

/* Content Style */
#mainpage {
  width: calc(100% - 210px);
  transition: all 0.3s ease-in-out;
  padding: 10px;
  min-height: 100vh;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  margin-left: 210px;
  /* Add this line */
}

#mainpage.active {
  width: 100%;
  margin-left: 0;
}

/* Autocomplete UI section */
.ui-menu {
  font-size: 12px !important;
  ;
  /* Increases font size - adjust this value as needed */
  font-family: inherit !important;
  ;
  /* Inherits font family from body */
}

.ui-menu-item {
  font-family: inherit !important;
  ;
}

.ui-menu-item-wrapper {
  font-family: inherit !important;
  ;
  padding: 8px 12px;
  /* Optional: adds some padding for better readability */
}


/* Sidebar */

/* Modern Sidebar Styles */
#sidebar {
  width: 200px;
  background: linear-gradient(145deg, #1a1a1a, #000000);
  color: #ffffff;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: fixed;
  height: 100vh;
  z-index: 1000;
  left: 0;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #333 #1a1a1a;
}

#sidebar::-webkit-scrollbar {
  width: 6px;
}

#sidebar::-webkit-scrollbar-track {
  background: #1a1a1a;
}

#sidebar::-webkit-scrollbar-thumb {
  background-color: #333;
  border-radius: 3px;
}


#sidebar.active {
  left: -200px;
}

#sidebar .sidebar-header {
  padding: 20px;
  background-color: black;
  color: white;
  text-align: center;
}

#sidebar ul.components {
  padding: 5px 0;
  background-color: black;
  color: white;
}

#sidebar ul p {
  color: white;
  padding: 10px;
  text-align: center;
}

#sidebar ul li a {
  padding: 8px;
  font-size: 1.2em;
  display: block;
  color: black !important;
  text-align: left !important;
}

#sidebar ul li a:hover {
  color: #007bff;
  /* background: rgba(255, 255, 255, 0.1); */
}

#sidebar ul li.active>a,
a[aria-expanded="true"] {
  color: white;
  /* background: rgba(255, 255, 255, 0.2); */
}

/* Dropdown styles */
#sidebar .dropdown-container {
  width: 100%;
  background-color: black;
}


#sidebar .btn-light {
  background-color: black;
  color: white;
  border: none;
  width: 100%;
  text-align: center;
}

#sidebar .dropdown-menu-custom {
  list-style-type: none;
  padding: 0;
}

#sidebar .dropdown-item-custom {
  color: white;
  text-align: center;
}

#sidebar .dropdown-item-custom:hover {
  /* background-color: rgba(255, 255, 255, 0.1); */
  /* pop out a button */
  transform: translateY(-2px);
}

/* Media Queries */
@media (max-width: 768px) {
  #sidebar {
    left: -250px;
  }

  #sidebar.active {
    left: 0;
  }

  #sidebarCollapse span {
    display: none;
  }

  #mainpage {
    width: 100%;
    margin-left: 0;
  }

  #mainpage.active {
    margin-left: 250px;
  }

  /* New full screen class for mobile */
  .active1 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    z-index: 2000;
    /* Higher than sidebar to ensure it's on top */
    background-color: white;
    /* Or whatever background color you prefer */
    overflow-y: auto;
    /* Allow scrolling if content is taller than viewport */
    transition: all 0.3s ease-in-out;
    /* Match your existing transitions */
  }

  /* Optional: Adjust sidebar behavior when active1 is present */
  .active1~#sidebar {
    display: none;
  }

  /* Optional: Hide any scrollbars on the main body when active1 is present */
  body:has(.active1) {
    overflow: hidden;
  }
}


/* modal */
/* for xs screen, set modal width to 90% */
@media (max-width: 575.98px) {
  .modal-dialog {
    max-width: 90%;
    margin: 1.75rem auto;
  }
}


/* Navbar */
.navbar-brand {
  padding-top: .75rem;
  padding-bottom: .75rem;
  background-color: rgba(0, 0, 0, .25);
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, .25);
}

.navbar .navbar-toggler {
  top: .25rem;
  right: 1rem;
}

.navbar .form-control {
  padding: .75rem 1rem;
}

.nav-link {
  padding: .5rem 1rem;
}

/* nav link on hover */
.nav-link:hover {
  background-color: rgba(0, 0, 0, .1);
}


label {
  font-weight: bold;

}

/* Base table styles */
.searchable-table {
  width: 100%;
  margin-bottom: 1rem;
  background-color: transparent;
  padding: 5px;
}

/* Desktop view */
@media screen and (min-width: 601px) {
  .searchable-table {
    /* display: block; */
    max-height: calc(100vh - 400px);
    overflow-y: auto;
    overflow-x: auto;
    width: 100% !important;
    min-width: 100% !important;
  }

  .searchable-table table {
    width: 100% !important;
    min-width: 100% !important;
  }
}

/* Badges */
.badge-custom {
  display: inline-block;
  padding: 0.25em 0.6em;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.25rem;
  color: #fff;
  background-color: #007bff;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.badge-custom:hover {
  color: #fff;
  text-decoration: none;
  background-color: #0056b3;
}

.dropdown-item-custom .badge-custom {
  margin-left: 5px;
}

/* date range filter section */

.date-range-list {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
}

.date-range-list ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.date-range-list li {
  padding: 10px 15px;
  cursor: pointer;
  color: #333;
  background: #fff;
  transition: all 0.2s ease;
  border-bottom: 1px solid #f0f0f0;
  font-size: 12px;
}

.date-range-list li:last-child {
  border-bottom: none;
}

.date-range-list li:hover {
  background-color: #f8f9fa;
}

.date-range-list li.active {
  background-color: #e7f3ff;
  color: #0d6efd;
  font-weight: 500;
}

.date-range-list .custom-range {
  background-color: #f8f9fa;
  font-weight: 500;
  color: #0d6efd;
}

.date-range-list .custom-range.active {
  background-color: #e7f3ff;
}

/* Style for date inputs */
input[type="date"] {
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #212529;
  background-color: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}



/* Date Filter Card Styles */
.card {
  border: 1px solid rgba(0, 0, 0, 0.125);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

.card-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
  padding: 1rem 1.25rem;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}

.card-body {
  padding: 1.25rem;
}


.accordion-item {
  border: 1px solid rgba(0, 0, 0, 0.125);
  margin-bottom: 0.5rem;
  border-radius: 0.375rem;
  overflow-x: auto !important;
  /* Add this */
}

.accordion-button {
  border: none;
  background-color: #e8f0fe;
  font-weight: 600;
  padding: 1rem 1.25rem;
  color: #333;
}

.accordion-button:not(.collapsed) {
  background-color: #e8f0fe;
  color: #000;
  box-shadow: none;
}

.accordion-button::after {
  color: #333;
}

.accordion-button:focus {
  box-shadow: none;
  border-color: rgba(0, 0, 0, 0.125);
}

.accordion-body {
  padding: 1rem 1.25rem;
  background-color: #ffffff;
}

.accordion-button:hover {
  background-color: #d3e3fd;
}

/* Status Background Styles */
.status-draft,
.status-archived {
  background-color: lightgrey !important;
  font-weight: bold !important;
  border-radius: 20px !important;
}



.status-confirmed,
.status-active,
.status-in-transit,
.e_invoice_status_Valid {
  background-color: #17a2b8 !important;
  color: white !important;
  font-weight: bold !important;
  border-radius: 20px !important;
}

.status-cancelled,
.status-closed,
.status-could-not-deliver,
.status-overdue .e_invoice_status_Invalid {
  background-color: #dc3545 !important;
  color: white !important;
  font-weight: bold !important;
  border-radius: 20px !important;
}

.status-pending,
.status-due {
  background-color: #ffc107 !important;
  color: black !important;
  font-weight: bold !important;
  border-radius: 20px !important;
}

.status-pending-stock,
.status-partially-paid {
  background-color: #ff9800 !important;
  color: white !important;
  font-weight: bold !important;
  border-radius: 20px !important;
}


.status-delivered,
.status-paid,
.status-completed {
  background-color: #3cb371 !important;
  color: white !important;
  font-weight: bold !important;
  border-radius: 20px !important;
}

/* Text Status Styles */
.text-status-draft,
.text-status-archived .e_invoice_status_Submitted {
  color: lightgrey !important;
  font-weight: bold !important;
}

.text-status-active,
.text-status-paid {
  color: #28a745 !important;
  font-weight: bold !important;
}

.text-status-cancelled,
.text-status-closed,
.text-status-could-not-deliver,
.status-overdue {
  color: #dc3545 !important;
  font-weight: bold !important;
}

.text-status-completed,
.text-status-in-transit,
.text-status-partially-paid {
  color: #17a2b8 !important;
  font-weight: bold !important;
}

.text-status-pending {
  color: #ffc107 !important;
  font-weight: bold !important;
}

.text-status-pending-stock {
  color: #ff9800 !important;
  font-weight: bold !important;
}

.text-status-confirmed,
.text-status-delivered {
  color: #28a745 !important;
  font-weight: bold !important;
}

/* custom css for status - change */

.filter-section {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.filter-toggle {
  cursor: pointer;
  user-select: none;
}

.filter-content {
  transition: all 0.3s ease;
}

.filter-content.collapsed {
  display: none;
}


.filter-row {
  row-gap: 0.5rem;
}

/*  NEW SECTION */

/* Updated card styles to match status colors */
.card-draft {
  border-color: lightgrey !important;
  border-width: 2px !important;
}

.card-draft .card-title {
  color: lightgrey !important;
}

.card-draft .btn-outline-draft {
  color: lightgrey !important;
  border-color: lightgrey !important;
}

.card-draft .btn-outline-draft:hover {
  background-color: lightgrey !important;
  color: black !important;
}

.card-active {
  border-color: #17a2b8 !important;
  border-width: 2px !important;
}

.card-active .card-title {
  color: #17a2b8 !important;
}

.card-active .btn-outline-active {
  color: #17a2b8 !important;
  border-color: #17a2b8 !important;
}

.card-active .btn-outline-active:hover {
  background-color: #17a2b8 !important;
  color: white !important;
}

.card-pending {
  border-color: #ffc107 !important;
  border-width: 2px !important;
}

.card-pending .card-title {
  color: #ffc107 !important;
}

.card-pending .btn-outline-pending {
  color: #ffc107 !important;
  border-color: #ffc107 !important;
}

.card-pending .btn-outline-pending:hover {
  background-color: #ffc107 !important;
  color: black !important;
}

/* Card Lost - lighter red */
.card-lost,
.card-cancelled {
  border-color: #ff7b7b !important;
  border-width: 2px !important;
}

.card-lost .card-title,
.card-cancelled .card-title {
  color: #ff7b7b !important;
}

.card-lost .btn-outline-lost,
.card-cancelled .btn-outline-cancelled {
  color: #ff7b7b !important;
  border-color: #ff7b7b !important;
}

.card-lost .btn-outline-lost:hover,
.card-cancelled .btn-outline-cancelled:hover {
  background-color: #ff7b7b !important;
  color: white !important;
}

.card-paid,
.card-completed,
.card-delivered {
  border-color: #3cb371 !important;
  border-width: 2px !important;
}

.card-paid .card-title,
.card-completed .card-title,
.card-delivered .card-title {
  color: #3cb371 !important;
}

.card-paid .btn-outline-paid,
.card-completed .btn-outline-completed,
.card-delivered .btn-outline-delivered {
  color: #3cb371 !important;
  border-color: #3cb371 !important;
}

.card-paid .btn-outline-paid:hover,
.card-completed .btn-outline-completed:hover,
.card-delivered .btn-outline-delivered:hover {
  background-color: #3cb371 !important;
  color: white !important;
}

.payable_amount {
  display: block;
  width: 100%;
  padding: 10px 0;
  color: black !important;
  font-weight: bold;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.payable_amount:hover,
.payable_amount:focus {
  background-color: #0056b3;
  color: #fff;
  text-decoration: none;
}


/* Root Theme Variables */
:root {
  --bg-light: #f9f9f9;
  --bg-dark: #1e1e1e;
  --text-light: #333;
  --text-dark: #f0f0f0;
  --card-radius: 12px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --transition: all 0.3s ease;
  --accent-color: #4bc0c0;
  --error-bg: #ffe0e0;
  --error-text: #d32f2f;
}

/* Chart Container */
.chart-container {
  background-color: var(--bg-light);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
  transition: var(--transition);
}

/* Heading */
.chart-container h4 {
  color: var(--text-light);
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 20px;
}

/* Responsive Wrapper */
.chart-wrapper {
  height: 320px;
  width: 100%;
  position: relative;
}

.chart-wrapper.small {
  height: 200px;
}

.chart-wrapper.large {
  height: 400px;
}

/* Canvas */
.chart-container canvas {
  width: 100%;
  height: 100% !important;
}

/* Message State Styles */
.no-data-message,
.chart-error,
.chart-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: 14px;
  color: var(--text-light);
}

/* Error State */
.chart-error {
  background-color: var(--error-bg);
  color: var(--error-text);
  border-radius: 8px;
  padding: 16px;
}

/* Loading Spinner */
.chart-loading::after {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #ccc;
  border-top: 3px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-top: 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Chart Legend */
.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .chart-container {
    padding: 16px;
  }

  .chart-wrapper {
    height: 260px;
  }

  .chart-container h4 {
    font-size: 16px;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background: #f8f9fa;
  overflow-x: hidden;
}

/* Collections Sidebar */
.collections-sidebar {
  position: fixed;
  left: 0;
  top: 36px;
  width: 280px;
  height: 100vh;
  background: linear-gradient(145deg, #1a1a1a, #000000);
  color: white;
  z-index: 1000;
  overflow-y: auto;
  transition: transform 0.3s ease;
  box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
}

.collections-sidebar.collapsed {
  transform: translateX(-280px);
}

/* Products Sidebar */
.products-sidebar {
  position: fixed;
  left: 280px;
  top: 80px;
  width: 320px;
  height: calc(100vh - 80px);
  background: linear-gradient(145deg, #f8f9fa, #ffffff);
  border-right: 1px solid #dee2e6;
  z-index: 999;
  overflow-y: auto;
  transition: all 0.3s ease;
  transform: translateX(-100%);
  box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
}

.products-sidebar.active {
  transform: translateX(0);
}

/* Sidebar Headers */
.sidebar-header {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  z-index: 10;
}

.collections-sidebar .sidebar-header {
  background: rgba(0, 0, 0, 0.3);
}

.products-sidebar .sidebar-header {
  background: rgba(248, 249, 250, 0.95);
  color: #333;
  border-bottom: 1px solid #dee2e6;
}

/* Collection Items */
.collection-item {
  padding: 15px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.collection-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(5px);
}

.collection-item.active {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.collection-info h5 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.collection-info .item-count {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 2px;
}

.collection-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* Product Items */
.product-item {
  padding: 12px 15px;
  margin: 8px 15px;
  background: white;
  border-radius: 12px;
  cursor: grab;
  transition: all 0.3s ease;
  border: 1px solid #e9ecef;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

.product-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: #4f46e5;
}

.product-item:active {
  cursor: grabbing;
  transform: scale(0.98);
}

.product-item.dragging {
  opacity: 0.8;
  transform: rotate(5deg) scale(1.05);
  z-index: 9999;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
  border-color: #4f46e5;
}

.product-item.selected {
  border-color: #4f46e5;
  background: rgba(79, 70, 229, 0.05);
}

.product-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.product-name {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  line-height: 1.3;
  flex: 1;
  margin-right: 10px;
}

.product-price {
  border-color: linear-gradient(135deg, #10b981, #059669);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.product-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #6b7280;
  margin-top: 8px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  cursor: grab;
}

.product-code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.product-uom {
  font-weight: 500;
}

/* Main Content */
.main-content {
  margin-left: 280px;
  padding: 20px;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.main-content.expanded {
  margin-left: 0;
}

.main-content.with-products {
  margin-left: 600px;
}

.collections-toggle {
  left: 20px;
}

.products-toggle {
  left: 300px;
  opacity: 0;
  pointer-events: none;
}

.products-toggle.visible {
  opacity: 1;
  pointer-events: all;
}

.main-toggle-btn,
.toggle-btn:hover {
  background: #3730a3;
  transform: scale(1.05);
}

/* Search Box */
.search-box {
  padding: 15px;
  background: rgba(248, 249, 250, 0.95);
  border-bottom: 1px solid #dee2e6;
  position: sticky;
  top: 65px;
  z-index: 9;
}

.search-input {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Invoice Form Styles */
.invoice-header {
  background: white;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.invoice-lines {
  background: white;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Enhanced Table for Django Formset Integration */
.formset-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.formset-table th,
.formset-table td {
  padding: 12px 8px;
  border: 1px solid #dee2e6;
  text-align: left;
}

.formset-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #495057;
  font-size: 12px;
  white-space: nowrap;
}

.formset-table input,
.formset-table select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 13px;
}

.formset-table input:focus,
.formset-table select:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 0.1rem rgba(79, 70, 229, 0.25);
}

.formset-table .line-number {
  background: #4f46e5;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  margin: 0 auto;
}

.formset-table .remove-btn {
  background: #dc3545;
  color: white;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.formset-table .remove-btn:hover {
  background: #c82333;
  transform: scale(1.1);
}

/* Drop Zone Enhancement */
.drop-zones-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 20px 0;
}

.drop-zone {
  border: 2px dashed #9ca3af;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
  transition: all 0.3s ease;
  background: #e5e7eb;
}

.drop-zone.simple {
  border-color: #10b981;
}

.drop-zone.custom {
  border-color: #f59e0b;
  cursor: pointer;
}

.drop-zone.custom:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.drop-zone.dragover {
  border-color: #4f46e5;
  background-color: rgba(79, 70, 229, 0.1);
  color: #4f46e5;
}

.drop-zone-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.6;
}

.drop-zone h4 {
  margin-bottom: 5px;
  font-size: 16px;
  font-weight: 600;
}

/* Summary Section */
.invoice-summary {
  background: white;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #e9ecef;
}

.summary-row:last-child {
  border-bottom: none;
  font-weight: 600;
  font-size: 18px;
  color: #4f46e5;
}

.add-line-btn {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 20px;
}

.add-line-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(40, 167, 69, 0.3);
}


/* Mobile Responsive */
@media (max-width: 768px) {

  .collections-sidebar,
  .products-sidebar {
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    z-index: 9999;
  }

  .collections-sidebar.active,
  .products-sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 60px 10px 10px 10px;
  }

  .collections-toggle {
    left: 10px;
  }

  .products-toggle {
    left: 70px;
  }

  .drop-zones-container {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 10px 0;
  }

  .invoice-header,
  .invoice-lines,
  .invoice-summary,
  .action-buttons {
    padding: 15px;
    margin-bottom: 15px;
  }

  .action-buttons {
    flex-direction: column;
    gap: 10px;
  }

  .formset-table {
    font-size: 12px;
  }

  .formset-table th,
  .formset-table td {
    padding: 8px 4px;
  }
}

.search-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 15px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 12px;
}

.results-count {
  font-weight: 500;
  color: #495057;
}


/* Tablet-specific styles */
/* Tablet-specific styles */
@media (min-width: 769px) and (max-width: 1024px) {

  .tablet-back-section {
    display: block !important;
    position: sticky;
    top: 0;
    padding: 15px;
    border-bottom: 2px solid #e9ecef;
    background: #f8f9fa;
    z-index: 10;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  /* Hide mobile cart section on tablet */
  .mobile-cart-section {
    display: none;
  }

  /* Hide collections toggle on tablet */
  .collections-toggle {
    display: none !important;
  }

  /* Products sidebar positioning for tablet */
  .products-sidebar {
    left: 0 !important;
    /* Position where collections sidebar was */
  }

  /* Collections sidebar hidden when collapsed on tablet */
  .collections-sidebar.collapsed {
    transform: translateX(-100%);
  }

  /* Main content adjustment for tablet */
  .main-content.expanded.with-products {
    margin-left: 300px;
    /* Same as collections sidebar width */
  }

  .product-item {
    touch-action: none;
    /* Prevent default touch behaviors */
    -webkit-user-select: none;
    user-select: none;
  }

  .product-item.dragging {
    opacity: 0.7;
    transform: scale(0.95);
    z-index: 1000;
    transition: none;
    /* Remove transitions during drag */
  }

  .drop-zone.dragover {
    background: rgba(40, 167, 69, 0.2);
    border-color: #28a745;
    transform: scale(1.05);
  }

  .drop-zone {
    transition: all 0.2s ease;
  }

  /* Prevent text selection during drag */
  .dragging * {
    -webkit-user-select: none !important;
    user-select: none !important;
  }


}

/* Show tablet back button only on tablet */
.tablet-back-section {
  display: none;
}

/* CSS Updates for Mobile Quantity Controls */

/* Mobile Cart Section */
.mobile-cart-section {
  padding: 15px;
  border-bottom: 2px solid #e9ecef;
  background: #f8f9fa;
  display: none;
  position: sticky;
  top: 0;
  z-index: 10;
}

@media (max-width: 768px) {
  .mobile-cart-section {
    display: block;
  }

  #productsContainer {
    padding-top: 10px;
  }
}

.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
}

.cart-count {
  background: #dc3545;
  color: white;
  border-radius: 50%;
  padding: 2px 8px;
  font-size: 12px;
  min-width: 20px;
  text-align: center;
}

/* Enhanced Product Item for Mobile */
.product-item {
  position: relative;
  padding: 12px;
  margin-bottom: 8px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  max-width: 90%;
}

@media (max-width: 768px) {
  .product-item {
    padding: 15px;
  }
}

.product-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.product-item.in-cart {
  border: 2px solid #28a745;
  background: #f8fff9;
}

.product-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.product-name {
  font-weight: 600;
  color: #2c3e50;
  flex: 1;
  margin-right: 8px;
}

.product-price {
  font-weight: bold;
  color: #e74c3c;
  white-space: nowrap;
}

.product-details {
  display: flex;
  justify-content: space-between;
  color: #6c757d;
  font-size: 12px;
  margin-bottom: 10px;
}

/* Mobile Quantity Controls */
.mobile-quantity-controls {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 768px) {
  .mobile-quantity-controls {
    display: flex;
  }
}

.quantity-display {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  min-width: 60px;
  text-align: center;
}


@media (max-width: 768px) {
  .quick-add-btn {
    display: none;
  }
}

.quick-add-btn:hover {
  background: #28a745;
  color: white;
}

/* Cart Badge */
.cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Mobile responsive table - hide columns except No, Product Name, Total with Tax */
@media (max-width: 768px) {
  #invoiceLineTable {
    font-size: 12px;
  }

  /* Hide UOM column (3rd column) */
  #invoiceLineTable th:nth-child(3),
  #invoiceLineTable td:nth-child(3) {
    display: none !important;
  }
  
  /* Adjust colspan for empty state message */
  #invoiceTableBody td[colspan="5"] {
    display: table-cell !important;
  }
  
  /* After hiding UOM, adjust remaining columns */
  #invoiceLineTable th:nth-child(1),
  #invoiceLineTable td:nth-child(1) {
    width: 40px;
    text-align: center;
  }
  
  #invoiceLineTable th:nth-child(2),
  #invoiceLineTable td:nth-child(2) {
    min-width: 100px;
  }
  
  #invoiceLineTable th:nth-child(4),  /* Amount (was 4th, now shows as 3rd) */
  #invoiceLineTable td:nth-child(4) {
    min-width: 90px;
    font-weight: 700;
    white-space: nowrap;
    text-align: right;
  }
  
  #invoiceLineTable th:nth-child(5),  /* Actions (was 5th, now shows as 4th) */
  #invoiceLineTable td:nth-child(5) {
    width: 50px;
    min-width: 50px;
    text-align: center;
  }

  /* Adjust remaining visible columns width */
  #invoiceLineTable th:nth-child(1),
  /* No */
  #invoiceLineTable td:nth-child(1) {
    width: 10%;
    text-align: center;
  }

  #invoiceLineTable th:nth-child(2),
  /* Product Name */
  #invoiceLineTable td:nth-child(2) {
    width: 20%;
  }

  #invoiceLineTable th:nth-child(10),
  /* Total with Tax */
  #invoiceLineTable td:nth-child(10) {
    width: 20%;
    text-align: right;
  }

  #invoiceLineTable th:nth-child(11),
  /* Actions */
  #invoiceLineTable td:nth-child(11) {
    width: 5%;
    text-align: center;
  }

  /* Make table scrollable horizontally if needed */
  .table-responsive {
    overflow-x: auto;
  }

  /* Adjust form inputs in visible cells for mobile */
  #invoiceLineTable .form-control {
    font-size: 12px;
    padding: 4px 6px;
  }

  /* Make line numbers smaller */
  #invoiceLineTable .line-number {
    width: 25px;
    height: 25px;
    font-size: 12px;
  }

  /* Make remove button smaller */
  #invoiceLineTable .remove-btn {
    width: 25px;
    height: 25px;
    font-size: 12px;
  }
}


/* Mobile responsive table - show only checkbox (1st) and retail_price (6th) columns */
@media (max-width: 768px) {
  #tblItems {
    font-size: 12px;
  }

  /* Make table scrollable if needed */
  .table-responsive {
    overflow-x: auto;
  }

  /* Adjust form inputs for mobile */
  #tblItems .form-control {
    font-size: 12px;
    padding: 4px 6px;
  }

}


/* pagination fix */
/* Mobile pagination optimizations */
@media (max-width: 768px) {

  /* Stack pagination info and controls */
  .d-flex.justify-content-between.align-items-center {
    flex-direction: column;
    gap: 10px;
    align-items: stretch !important;
  }

  /* Compact pagination info */
  .text-muted {
    font-size: 0.85rem;
    text-align: center;
  }

  /* Hide "entries" text and simplify */
  .text-muted::after {
    content: none;
  }

  /* Center pagination controls */
  nav[aria-label="Page navigation"] {
    align-self: center;
  }

  /* Hide First/Last buttons on mobile */
  .pagination .page-item:first-child,
  .pagination .page-item:last-child {
    display: none;
  }

  /* Only show current page and adjacent pages */
  .pagination .page-item:not(.active) {
    display: none;
  }

  /* Show Previous/Next */
  .pagination .page-item:nth-child(2),
  .pagination .page-item:nth-last-child(2) {
    display: block !important;
  }

  /* Show current page and one before/after if they exist */
  .pagination .page-item.active,
  .pagination .page-item.active+.page-item,
  .pagination .page-item:has(+ .page-item.active) {
    display: block !important;
  }

  /* Smaller pagination buttons */
  .pagination-sm .page-link {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {

  /* Hide filtered count on very small screens */
  .text-muted {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Even more compact */
  .pagination-sm .page-link {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
  }
}


.table-danger {
  background-color: rgba(220, 53, 69, 0.1) !important;
}

.card {
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.card.border-danger {
  border-width: 2px;
}

.card.border-warning {
  border-width: 2px;
}

.card.border-success {
  border-width: 2px;
}

.card.border-info {
  border-width: 2px;
}

.card-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

.card-header h6 {
  font-weight: 600;
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.form-control.is-valid,
.form-select.is-valid {
  border-color: #198754;
  box-shadow: 0 0 0 0.2rem rgba(25, 135, 84, 0.25);
}

.invalid-feedback {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  font-size: 0.875em;
  color: #dc3545;
}

/* Card animation */
.card {
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.text-muted {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    white-space: normal;
}

/* More specific mobile targeting */
@media (max-width: 768px) {
    .text-muted {
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: anywhere;
        hyphens: auto;
        line-height: 1.4;
        font-size: 0.875rem; /* Slightly smaller on mobile if needed */
    }
}

/* For very small screens */
@media (max-width: 480px) {
    .text-muted {
        word-break: break-all; /* More aggressive breaking if needed */
        overflow-wrap: anywhere;
        hyphens: auto;
        line-height: 1.5;
    }
}

/* making the small icon larger in phone */
@media (max-width: 768px) {
    .m-3.d-flex.justify-content-center img {
        width: 75px;
        height: 51px;
    }
}