/* =======================================================
   Custom Searchbar Styling (Bootstrap 5 + DataTables)
   Theme Color: #8fb73c (Fresh Green)
   ======================================================= */

/* === Search Input === */
.custom-search {
  border: 2px solid #8fb73c;
  border-radius: 50px;
  padding: 10px 16px 10px 45px !important; /* space for icon */
  background-color: #fffdf8;
  color: #333;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(143, 183, 60, 0.15);
}

.custom-search::placeholder {
  color: #7a7a7a;
  opacity: 0.85;
  letter-spacing: 0.5px;
}

.custom-search:hover {
  border-color: #7da43a;
  box-shadow: 0 2px 6px rgba(143, 183, 60, 0.2);
}

.custom-search:focus {
  outline: none;
  border-color: #6c9631;
  background-color: #ffffff;
  box-shadow: 0 0 0 4px rgba(143, 183, 60, 0.25);
}

/* === Search Icon === */
.search-icon {
  position: absolute;
  top: 50%;
  left: 18px;
  transform: translateY(-50%);
  font-size: 18px;
  color: #8fb73c;
  pointer-events: none;
  transition: color 0.3s ease;
}

.custom-search:hover + .search-icon,
.custom-search:focus + .search-icon {
  color: #6c9631;
}

/* === Dark Mode === */
[data-bs-theme="dark"] .custom-search {
  background-color: #2b2e2a;
  color: #f8f9fa;
  border-color: #8fb73c;
}

[data-bs-theme="dark"] .custom-search::placeholder {
  color: #cfcfcf;
}

[data-bs-theme="dark"] .search-icon {
  color: #a3d35a;
}

/* =======================================================
   DataTables Integration
   ======================================================= */

/* Top Controls: entries dropdown + searchbar */
.dataTables-top-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1rem;
}

/* Entries dropdown */
.dataTables_length {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dataTables_length label {
  font-weight: 500;
  color: #333;
  margin-bottom: 0;
}

.dataTables_length select {
  border-radius: 6px;
  border: 1px solid #ccc;
  padding: 5px 10px;
  color: #333;
  background-color: #fff;
  transition: border-color 0.2s ease;
}

.dataTables_length select:focus {
  border-color: #8fb73c;
  outline: none;
  box-shadow: 0 0 0 2px rgba(143, 183, 60, 0.2);
}

/* Custom searchbar wrapper */
.dataTables_custom_filter {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 280px;
  flex-grow: 1;
}

/* =======================================================
   Responsive Adjustments
   ======================================================= */
@media (max-width: 768px) {
  .dataTables-top-wrapper {
    flex-direction: column;
    align-items: stretch;
  }

  .dataTables_custom_filter {
    width: 100%;
    justify-content: stretch;
  }

  .custom-search {
    width: 100%;
  }

  .search-icon {
    left: 14px;
    font-size: 16px;
  }
}
