.invoice-list-container {
  width: 90%;
  margin: 30px auto;
  font-family: "Poppins", sans-serif;
  background: #f8f9fb;
  padding: 30px;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  /* changed overflow-y to visible to prevent dropdown clipping */
  overflow: visible;
}

.invoice-list-container h2 {
  text-align: center;
  color: #11d0e1;
  margin-bottom: 28px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.entries-search-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.search-bar {
  padding: 10px 14px;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  outline: none;
  font-size: 14px;
  flex: 1;
  min-width: 200px;
  transition: all 0.2s ease;
}

.search-bar:focus {
  border-color: #001f3f;
  box-shadow: 0 0 6px #001f3f33;
}

.entries-select {
  display: flex;
  align-items: center;
  gap: 10px;
}

.entries-select select {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1.5px solid #ccc;
  outline: none;
  background: white;
  font-size: 14px;
  transition: all 0.3s ease;
}

.entries-select select:hover {
  border-color: #10add1;
}

.add-invoice-btn {
  background: linear-gradient(#b8ffd0);
  color: rgb(58, 57, 57);
  padding: 15px 15px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.3s;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.3px;
  margin-left: auto;
  display: block;
  width: auto;
  min-width: 90px;
  text-align: center;
}

.add-invoice-btn:hover {
  background: linear-gradient(135deg, #7ad0e4, #b2fcff);
  transform: translateY(-2px);
}

.invoice-list-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
  border-radius: 10px;
  /* added overflow: visible to allow dropdowns to overflow */
  overflow: visible;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.invoice-list-table th,
.invoice-list-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid #f1f1f1;
  /* allow content to overflow the cell */
  overflow: visible;
}

.invoice-list-table th {
  background: linear-gradient(#c2fcf6);
  color: rgb(53, 52, 52);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.5px;
}

.invoice-list-table tbody tr:hover {
  background: #f4f6fc;
  transition: 0.3s;
}

.no-invoices {
  text-align: center;
  padding: 25px;
  color: #888;
  font-size: 15px;
}

.action-btn {
  padding: 7px 16px;
  background: linear-gradient(#84f2d6);
  border: none;
  border-radius: 8px;
  color: rgb(14, 14, 14);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.action-btn:hover {
  background: linear-gradient(#3b9a9c, #4bc2c5);
  transform: scale(1.08);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  min-width: 170px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  overflow: visible;
  pointer-events: auto;
}

/* Updated dropdown-up class to use bottom positioning without recalculation */
.dropdown-menu.dropdown-up {
  top: auto;
  bottom: 100%;
  margin-bottom: 6px;
  margin-top: 0;
}

.dropdown-menu button {
  border: none;
  background: transparent;
  padding: 12px 16px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.3s ease;
}

.dropdown-menu button:hover {
  background: #f4f6fc;
}

.dropdown-menu button:nth-child(1) {
  color: #ef0d55;
}
.dropdown-menu button:nth-child(2) {
  color: #0b666a;
}
.dropdown-menu button:nth-child(3) {
  color: #e114b4;
}
.dropdown-menu button:nth-child(4) {
  color: #f2940f;
}
.dropdown-menu button:nth-child(5) {
  color: #0b1c1c;
}

/* Pagination */
.pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 25px;
  margin-top: 25px;
  width: 95%;
  margin-left: auto;
  margin-right: auto;
  flex-wrap: wrap;
}

.page-info {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

.pagination {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.pagination button {
  background: white;
  border: 2px solid #7cc2de;
  color: #39393a;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pagination button:hover {
  background: #47e4e0;
  color: white;
  transform: scale(1.1);
}

.pagination button.active {
  background: linear-gradient(135deg, #00ad7c, #6bebeb);
  color: white;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.modal-content {
  background: #fff;
  padding: 25px;
  border-radius: 10px;
  width: 420px;
  max-width: 90%;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
  color: #001f3f;
  margin-top: 0;
  margin-bottom: 15px;
}

.close-btn {
  margin-top: 20px;
  padding: 8px 15px;
  background: #cc1a14;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.3s;
}

.close-btn:hover {
  background: #f1592b;
}

.modal-buttons {
  display: flex;
  justify-content: space-around;
  margin-top: 20px;
  gap: 10px;
}

.confirm-btn {
  background: #7fd59c;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.3s;
}

.confirm-btn:hover {
  background: #41cf7f;
}

.cancel-btn {
  background: #ec3c06;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.3s;
}

.cancel-btn:hover {
  background: #bd4848;
}

/* Extra Small Devices (< 480px) */
@media screen and (max-width: 479px) {
  .invoice-list-container {
    width: 95%;
    padding: 16px;
    margin: 15px auto;
  }

  .invoice-list-container h2 {
    font-size: 18px;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
  }

  .list-header {
    flex-direction: column;
    gap: 12px;
  }

  .entries-search-wrapper {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }

  .search-bar,
  .add-invoice-btn {
    width: 100%;
    font-size: 13px;
    padding: 10px 12px;
  }

  .entries-select {
    width: 100%;
    justify-content: space-between;
  }

  .entries-select select {
    flex: 1;
    font-size: 13px;
    padding: 8px 10px;
  }

  .add-invoice-btn {
    margin-left: 0;
    padding: 12px;
    min-width: 100%;
  }

  /* Table becomes a card layout on small screens */
  .invoice-list-table {
    display: block;
    overflow: visible;
  }

  .invoice-list-table thead {
    display: none;
  }

  .invoice-list-table tbody,
  .invoice-list-table tr {
    display: block;
    width: 100%;
  }

  .invoice-list-table tr {
    background: white;
    margin-bottom: 12px;
    border-radius: 8px;
    overflow: visible;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }

  .invoice-list-table td {
    display: block;
    text-align: left;
    padding: 10px 12px;
    border: none;
    border-bottom: 1px solid #f1f1f1;
    position: relative;
    padding-left: 40%;
    overflow: visible;
  }

  .invoice-list-table td::before {
    content: attr(data-label);
    position: absolute;
    left: 12px;
    font-weight: 600;
    color: #11d0e1;
    width: 35%;
  }

  .invoice-list-table td:last-child {
    border-bottom: none;
  }

  .no-invoices {
    padding: 16px;
    font-size: 13px;
  }

  .action-btn {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
  }

  .dropdown-menu {
    position: absolute;
    top: 110%;
    left: 0;
    min-width: 130px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    overflow: visible;
    z-index: 9999;
    transform-origin: top center;
    transition: all 0.25s ease;
    animation: fadeIn 0.2s ease-in-out;
    visibility: visible;
  }

  .dropdown-menu.dropdown-up {
    top: auto;
    bottom: 110%;
  }

  .dropdown-menu button {
    padding: 14px 16px;
    font-size: 14px;
  }

  .pagination-wrapper {
    flex-direction: column;
    width: 100%;
    padding: 12px;
    gap: 12px;
  }

  .page-info {
    font-size: 12px;
    width: 100%;
    text-align: center;
  }

  .pagination {
    width: 100%;
    justify-content: center;
  }

  .pagination button {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .modal-content {
    width: 95%;
    padding: 20px;
  }

  .modal-content h3 {
    font-size: 16px;
  }

  .modal-content p {
    font-size: 14px;
  }

  .modal-buttons {
    gap: 8px;
  }

  .confirm-btn,
  .cancel-btn {
    flex: 1;
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* Small Devices (480px - 768px) */
@media screen and (min-width: 480px) and (max-width: 768px) {
  .invoice-list-container {
    width: 95%;
    padding: 20px;
    margin: 20px auto;
  }

  .invoice-list-container h2 {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .list-header {
    flex-direction: column;
    gap: 14px;
  }

  .entries-search-wrapper {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }

  .search-bar,
  .add-invoice-btn {
    width: 100%;
    font-size: 13px;
  }

  .entries-select {
    width: 100%;
    justify-content: space-between;
  }

  .entries-select select {
    flex: 1;
    font-size: 13px;
  }

  .add-invoice-btn {
    margin-left: 0;
  }

  .invoice-list-table th,
  .invoice-list-table td {
    padding: 12px 10px;
    font-size: 13px;
  }

  .invoice-list-table th {
    font-size: 13px;
  }

  .action-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .dropdown-menu {
    min-width: 150px;
    font-size: 13px;
  }

  .dropdown-menu button {
    padding: 10px 14px;
    font-size: 13px;
  }

  .pagination-wrapper {
    padding: 14px 15px;
    width: 98%;
  }

  .page-info {
    font-size: 12px;
  }

  .pagination button {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .modal-content {
    width: 95%;
    max-width: 400px;
    padding: 20px;
  }

  .confirm-btn,
  .cancel-btn {
    padding: 10px 16px;
    font-size: 13px;
  }
}

/* Medium Devices (768px - 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .invoice-list-container {
    width: 95%;
    padding: 24px;
  }

  .list-header {
    gap: 16px;
  }

  .entries-search-wrapper {
    flex: 1;
  }

  .search-bar {
    min-width: 150px;
  }

  .invoice-list-table th,
  .invoice-list-table td {
    padding: 12px 14px;
    font-size: 14px;
  }

  .action-btn {
    padding: 8px 14px;
    font-size: 13px;
  }

  .pagination-wrapper {
    width: 97%;
  }
}

/* Large Devices (> 1024px) */
@media screen and (min-width: 1025px) {
  .invoice-list-container {
    width: 90%;
    max-width: 1400px;
  }

  .list-header {
    gap: 20px;
  }
}
