/* src/assets/task-history.css */

/* --- General Layout & Responsiveness (Consistent Across Admin Pages) --- */
#wrapper {
  display: flex; /* Make the wrapper a flex container */
  min-height: 100vh; /* Ensure it takes full viewport height */
  padding-top: 56px; /* Space for the fixed navbar */
}

#sidebar-wrapper {
  width: 250px; /* Fixed width for the sidebar */
  flex-shrink: 0; /* Prevent sidebar from shrinking */
  background-color: #f8f9fa; /* Light background for sidebar */
}

.bg-lightblue {
  background-color: #1c78b2 !important; /* A common light blue color */
}

#page-content-wrapper {
  flex-grow: 1; /* Allow main content to grow and fill available space */
  background-color: #eef1f5; /* A consistent, slightly cooler light gray background */
  padding: 1.5rem; /* Consistent padding around the content */
  overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Ensure the main content is visible once loaded (for development) */
#mainContent {
  display: block !important; /* Override d-none for demonstration */
}

/* Headings and Horizontal Rule consistency */
h1 {
  color: #343a40; /* Darker text for main headings */
  font-weight: 700; /* Bolder headings */
  margin-bottom: 1.5rem; /* Consistent spacing below headings */
}

hr {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

/* --- Card Base Styling Consistency --- */
.card {
  border-radius: 0.75rem; /* Rounded corners */
  border: 1px solid #e9ecef; /* Light gray border */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* Subtle shadow for depth */
  overflow: hidden; /* Ensures header and body corners are rounded properly */
  transition: all 0.2s ease-in-out; /* Smooth transition for hover effects */
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); /* Slightly more prominent shadow on hover */
}

/* Card Header Styling */
.card-header {
  color: #ffffff; /* White text for headers */
  padding: 1.25rem 1.5rem; /* Ample padding */
  border-bottom: 1px solid rgba(0, 0, 0, 0.125); /* Subtle separator */
  display: flex;
  align-items: center; /* Align icon and title vertically */
  font-weight: 600; /* Bolder header text */
}

.card-header h5 {
  margin-bottom: 0;
  font-weight: 600;
}

/* Specific Card Header Gradients */
.card-header.bg-success {
  background: linear-gradient(
    135deg,
    #2ecc71,
    #27ae60
  ) !important; /* Green gradient */
}

/* Card Body Styling */
.card-body {
  background-color: #ffffff; /* White background for card content */
  padding: 1.5rem; /* Consistent padding */
}

/* --- Specific styles for task history list --- */
#adminTaskHistoryList .list-group-item {
  display: flex;
  flex-wrap: wrap; /* Allow items to wrap on smaller screens */
  align-items: center;
  justify-content: space-between;
  background-color: #ffffff;
  border: 1px solid #e9ecef;
  margin-bottom: 0.75rem;
  border-radius: 0.75rem;
  padding: 1.25rem;
  transition: all 0.2s ease-in-out;
}

#adminTaskHistoryList .list-group-item:hover {
  background-color: #f8f8f8; /* Light grey on hover */
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

#adminTaskHistoryList .list-group-item .history-details {
  flex-grow: 1; /* Allow details to take available space */
  margin-right: 15px;
}

.history-status-badge {
  font-size: 0.9em;
  padding: 0.4em 0.8em;
  border-radius: 0.5rem;
  font-weight: 600;
}

/* Enhancements for filter bar */
.history-filter-bar {
  background-color: #e9ecef;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
}

.filter-label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #495057;
}

/* Form controls consistency */
.form-control,
.form-select {
  border-radius: 0.5rem;
  border: 1px solid #ced4da;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.form-control:focus,
.form-select:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.25);
}

/* Buttons consistency */
.btn-outline-primary {
  color: #0d6efd;
  border-color: #0d6efd;
}
.btn-outline-primary:hover {
  background-color: #0d6efd;
  color: #fff;
}
.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 0.3rem;
}
.btn-outline-secondary {
  color: #6c757d;
  border-color: #6c757d;
}
.btn-outline-secondary:hover {
  background-color: #6c757d;
  color: #fff;
}

/* Scrollable history container */
#adminTaskHistoryContainer {
  max-height: 500px; /* Adjust height as needed for scrollability */
  overflow-y: auto;
  border: 1px solid #e9ecef;
  border-radius: 0.75rem;
  padding: 15px;
  background-color: #ffffff;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.03); /* Subtle inner shadow */
}

/* Alert for no items */
.alert.alert-info {
  border-radius: 0.75rem;
  background-color: #e0f7fa;
  color: #00796b;
  border-color: #b2ebf2;
}

/* --- Responsive adjustments for list items and filters --- */
@media (max-width: 768px) {
  #sidebar-wrapper {
    width: 0; /* Collapse sidebar on smaller screens */
    overflow: hidden;
    position: absolute; /* Take out of flow */
    height: 100%;
    z-index: 1000;
    transition: width 0.3s ease;
  }

  #page-content-wrapper {
    margin-left: 0; /* Remove margin when sidebar is collapsed */
    padding-left: 1rem; /* Smaller padding on mobile */
    padding-right: 1rem; /* Smaller padding on mobile */
    padding-top: calc(
      56px + 1rem
    ); /* Adjust for fixed navbar height + smaller padding */
  }

  #adminTaskHistoryList .list-group-item {
    flex-direction: column; /* Stack details vertically */
    align-items: flex-start; /* Align items to the start (left) */
    padding: 1rem;
  }
  #adminTaskHistoryList .list-group-item .history-details {
    margin-right: 0;
    width: 100%;
    margin-bottom: 10px; /* Space before potential next element */
  }
  .history-status-badge {
    /* Adjust position to float near the title when stacked */
    align-self: flex-end; /* Push badge to the right of its flex container */
    margin-top: -35px; /* Move it up to overlap the title line */
    margin-left: auto; /* Push it to the far right within its flex container */
  }

  .history-filter-bar .row > div[class*="col-"] {
    width: 100%; /* Make filter columns take full width and stack */
    margin-bottom: 1rem; /* Add space between stacked filters */
  }
  .history-filter-bar .row > div[class*="col-"]:last-child {
    margin-bottom: 0; /* No margin after the very last filter item */
  }
  .history-filter-bar .input-group .form-control,
  .history-filter-bar .input-group .btn {
    width: auto; /* Let input group manage its own width */
    flex-grow: 1;
  }
  .history-filter-bar .input-group .btn {
    flex-shrink: 0; /* Prevent button from shrinking too much */
  }
  .history-filter-bar .row.mt-3 {
    margin-top: 0 !important; /* Remove extra top margin if it conflicts */
  }
}

/* --- Loading Indicator Consistency --- */
#loadingIndicator {
  margin-top: 5rem !important; /* Ensure it's visually centered */
  color: #0d6efd; /* Bootstrap primary blue */
}

#loadingIndicator .spinner-border {
  width: 3rem;
  height: 3rem;
  border-width: 0.3em;
}

#loadingIndicator p {
  font-size: 1.1rem;
  color: #6c757d;
  margin-top: 1rem;
}

/* --- Added for Navbar & Sidebar Consistency --- */

/* Custom Primary Color for Navbar */
.bg-custom-primary {
  background-color: #1c78b2 !important; /* Your desired blue color */
}

/* Ensure navbar brand and links are white */
.navbar-brand,
.navbar-nav .nav-link,
.navbar-nav .dropdown-toggle {
  color: #fff !important; /* White color for all primary navbar text */
}

/* Sidebar active item styling to keep dark text and blue border */
.list-group-item.active {
  background-color: #e9ecef !important; /* Keep a light background for active state */
  color: #212529 !important; /* Force text color to black/dark gray for active item */
  border-color: #1c78b2 !important; /* Explicitly set border color to the navbar blue */
  border-left: 5px solid #1c78b2 !important; /* Thicker left border for emphasis */
}

.list-group-item.active .fas {
  color: #212529 !important; /* Ensure icon color is also dark */
}

/* Adjust hover state for consistent visual feedback */
.list-group-item.bg-light:hover {
  background-color: #e2e6ea !important; /* Slightly darker hover for light background */
}
