/* Tenders Management Plugin Styles */

.tenders-management-container { 
  max-width: 1200px;
  margin: 20px auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  display: flex; /* Enable flexbox for main layout */
   /* Add shadow to the whole container */
}

.tenders-sidebar-wrapper {
  flex: 0 0 250px; /* Fixed width for sidebar */
  background-color: #fff;
  padding: 20px;
  border-right: 1px solid #eee; /* Separator line */
  box-sizing: border-box; /* Include padding in width */
}

.tenders-sidebar {
  background-color: #fff;
  padding: 20px;
  border-bottom: 1px solid #eee;
}

.tenders-tabs {
  display: flex;
  margin-bottom: 20px; 
}

.tenders-tabs .tab-button {
  background-color: transparent;
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  color: #555;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
}

.tenders-tabs .tab-button:hover {
  color: #0073aa;
}

.tenders-tabs .tab-button.active {
  color: #0073aa;
  border-bottom-color: #0073aa;
}

.tenders-filters {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.tenders-filters input[type="text"] {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box; /* Ensure padding doesn't increase total width */
}

.tenders-filters .date-filter {
  display: flex;
  gap: 10px;
}

.tenders-filters .search-filter {
  display: flex;
  gap: 10px;
  align-items: center; /* Align items vertically */
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 12px; /* Adjust as needed */
  color: #9ca3af; /* Icon color */
  font-size: 14px;
}

.search-input-wrapper input[type="text"].filter-search-query {
  padding-left: 35px; /* Make space for the icon */
}

.apply-filters-btn {
  background-color: #0073aa;
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease;
  display: flex; /* For arrow icon */
  align-items: center; /* For arrow icon */
  gap: 5px; /* Space between text and arrow */
}

.apply-filters-btn:hover {
  background-color: #005177;
}

.tenders-main-content-area {
  flex: 1; /* Takes remaining space */ 
  display: flex;
  flex-direction: column;
}

.tenders-list-area {
  flex: 1;
  padding: 20px; 
}

.tenders-list {
  min-height: 200px; /* To show spinner */
  position: relative;
}

.tenders-loading-spinner {
  display: none; /* Hidden by default, shown by JS */
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top: 4px solid #0073aa;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

.tenders-list.loading .tenders-loading-spinner {
  display: block;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.tender-item {
  background-color: #fff;
  border: 1px solid #686868;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.tender-item h3 {
  margin-top: 0;
  color: #0073aa;
  font-size: 20px;
  margin-bottom: 10px;
}

.tender-meta,
.tender-dates {
  font-size: 14px;
  color: #666;
  margin-bottom: 10px;
}

.tender-meta span,
.tender-dates span {
  margin-right: 15px;
  display: inline-block;
}

.remaining-time {
  font-weight: bold;
}

.remaining-time.active-tender {
  color: #28a745; /* Green for active */
}

.remaining-time.closed-tender {
  color: #dc3545; /* Red for closed */
}

.tender-documents,
.tender-addendums {
  margin-top: 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tender-addendums span {
  font-weight: bold;
  color: #333;
}

.tender-btn {
  background-color: #0073aa;
  color: white;
  padding: 8px 12px;
  border-radius: 0;
  text-decoration: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.3s ease;
}

.tender-btn:hover {
  background-color: #005177;
}

.tender-btn i {
  margin-right: 5px;
}
.load-more-btn {
  background-color: #194c9f;
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: 0;
  cursor: pointer;
  font-size: 16px;
  display: block;
  width: fit-content;
  margin: 20px auto 0;
  transition: background-color 0.3s ease;
  font-family: 'Poppins';
  line-height: normal;
  font-weight: 500;
}

.no-tenders {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 16px;
}

/* Responsive adjustments for mobile and tablet devices */
@media (max-width: 1024px) {
  .tenders-management-container {
    display: flex;
    flex-direction: column; /* Stack in column on mobile/tablet */
  }

  .tenders-main-content-area,
  .tenders-header {
    display: contents;
  }

  .tenders-tabs {
    order: 1;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 25px;
  }

  .tenders-sidebar-wrapper {
    order: 2;
    flex: none;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #eee; /* Add bottom border when stacked */
    margin-top: 0;
    margin-bottom: 25px;
  }

  .tender-main {
    order: 3;
    width: 100%;
  }

  .tenders-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .tenders-filters .date-filter,
  .tenders-filters .search-filter {
    width: 100%;
    flex-direction: column;
    gap: 10px;
  }

  .tenders-filters input[type="text"],
  .apply-filters-btn {
    width: 100%;
    box-sizing: border-box;
  }
}

/* Financial year disclosure.
   The year list is a secondary filter that runs to a dozen entries or more. On
   the desktop layout it sits in its own column, but once the container stacks
   it is collapsed behind a toggle so the tabs and the tender list are not
   pushed off the first screen. */
.tenders-fy-toggle {
  display: none;
}

.apply-filters-btn .apply-filters-arrow {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

@media (max-width: 768px) {
  .tenders-sidebar {
    border-bottom: none;
  }

  .tenders-sidebar h4 {
    display: none; /* The toggle carries the label on mobile */
  }

  .tenders-sidebar .tenders-fy-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 12px 15px;
    background-color: #fff;
    border: 1px solid #686868;
    cursor: pointer;
    font-size: 16px;
    line-height: 20px;
    text-align: left;
  }

  .tenders-sidebar .tenders-fy-current {
    font-weight: 700;
    color: #194c9f;
  }

  .tenders-sidebar .tenders-fy-chevron {
    flex: 0 0 auto;
    transition: transform 0.2s ease;
  }

  .tenders-sidebar.fy-open .tenders-fy-chevron {
    transform: rotate(180deg);
  }

  .tenders-sidebar > ul {
    display: none;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #686868;
    border-top: none;
    padding: 0 15px;
  }

  .tenders-sidebar.fy-open > ul {
    display: block;
  }
}


/* Utility states and the hidden DataTables transport table. */
.tenders-management-container .is-hidden {
  display: none !important;
}

.tenders-management-container .tenders-data-table-wrapper {
  display: none !important;
}

.tenders-management-container .tenders-data-table {
  display: none !important;
}

/* Notice-only approved addendums (without uploaded documents). */
.tender-addendum-notice { display: inline-block; padding: 9px 13px; color: #263b63; border: 1px solid #ccd4e2; margin: 5px 5px 0 0; }
