/**
 * @file
 * Styles for Remote Directory module.
 */

/* Container for the entire remote directory component */
.remote-directory-table-container {
  position: relative;
  margin: 1em 0;
  padding: 0.5em;
  background-color: #f9f9f9;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  /* Remove fixed height to prevent double scrollbars */
}

/* Loading indicator overlay */
.remote-directory-table-container.refreshing::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  z-index: 10;
  border-radius: 4px;
}

.remote-directory-table-container.refreshing::after {
  content: "Loading...";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  padding: 1em 2em;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Controls wrapper for button and search */
.remote-directory-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  width: 100%;
  clear: both;
}

.remote-directory-controls-left {
  display: flex;
  align-items: center;
}

.remote-directory-controls-right {
  display: flex;
  align-items: center;
}

/* Manual refresh button - repositioned */
.remote-directory-manual-refresh {
  padding: 0.4em 0.75em;
  font-size: 0.85em;
  background-color: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.2s;
  /* Match height to search box */
  height: 35px;
  line-height: normal;
  margin-right: 10px;
  white-space: nowrap;
}

.remote-directory-manual-refresh:hover {
  background-color: #e9e9e9;
}

.remote-directory-manual-refresh i {
  margin-right: 0.25em;
}

/* Search filter styling */
.remote-directory-datatables .dataTables_filter {
  text-align: right;
  margin: 0;
  padding: 0;
}

.remote-directory-datatables .dataTables_filter input {
  margin-left: 0.5em;
  padding: 0.3em 0.5em;
  border: 1px solid #ddd;
  border-radius: 3px;
  height: 35px;
  box-sizing: border-box;
  min-width: 200px;
}

/* Table styles - remove display:block to prevent scroll issues */
.remote-directory-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

/* Configure single scrollable area */
.remote-directory-table-container .dataTables_wrapper .dataTables_scroll {
  clear: both;
  margin-top: 10px;
}

.remote-directory-table-container .dataTables_wrapper .dataTables_scrollBody {
  min-height: 200px;
  max-height: 600px !important;
  overflow-y: auto !important;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
}

/* Fix header alignment with correct table display properties */
.remote-directory-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f0f0f0;
}

/* Fix display properties to standard table layout */
.remote-directory-table,
.remote-directory-table tbody,
.remote-directory-table tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

/* Table headers and cells */
.remote-directory-table th,
.remote-directory-table td {
  padding: 0.75em;
  border: 1px solid #e0e0e0;
  text-align: left;
  vertical-align: middle;
  word-break: break-word;
}

.remote-directory-table th {
  background-color: #f0f0f0;
  font-weight: bold;
  position: sticky;
  top: 0;
  z-index: 2;
}

/* Column width adjustments */
.remote-directory-table th:nth-child(1) {
  width: 57%; /* Name column - twice as wide */
  text-align: center;
}

.remote-directory-table td:nth-child(1) {
  width: 57%; /* Name column - twice as wide */
  text-align: left;
}

.remote-directory-table th:nth-child(2),
.remote-directory-table td:nth-child(2) {
  width: 20%; /* Updated column - normal width */
  text-align: center;
}

.remote-directory-table th:nth-child(3),
.remote-directory-table td:nth-child(3) {
  width: 10%; /* Size column - half width */
  text-align: center;
}

.remote-directory-table th:nth-child(4),
.remote-directory-table td:nth-child(4) {
  width: 13%; /* Actions column - half width */
  text-align: center;
}

/* Zebra-striping for rows */
.remote-directory-table tbody tr:nth-child(odd) {
  background-color: #f9f9f9;
}

.remote-directory-table tbody tr:nth-child(even) {
  background-color: #ffffff;
}

/* Hover effect */
.remote-directory-table tbody tr:hover {
  background-color: #f0f7ff;
}

/* File type icons */
.remote-directory-table i {
  margin-right: 0.5em;
  font-size: 1.2em;
}

/* Download button - simplified */
.remote-directory-download {
  display: inline-block;
  padding: 0.3em 0.6em;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 3px;
  text-decoration: none;
  color: #333;
  font-size: 0.9em;
  transition: all 0.2s;
}

.remote-directory-download:hover {
  background-color: #e0e0e0;
  text-decoration: none;
}

/* Empty directory message */
.remote-directory-empty {
  padding: 2em;
  text-align: center;
  background-color: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  color: #707070;
}

/* Error message */
.remote-directory-error {
  padding: 1em;
  background-color: #fff6f6;
  border: 1px solid #e0b4b4;
  border-radius: 4px;
  color: #9f3a38;
  margin: 1em 0;
}

/* Information text */
.remote-directory-datatables .dataTables_info {
  margin-top: 0.5em;
  font-size: 0.9em;
  color: #666;
  padding: 0.5em 0;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
  .remote-directory-table th,
  .remote-directory-table td {
    padding: 0.5em;
    font-size: 0.9em;
  }
  
  .remote-directory-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .remote-directory-controls-left,
  .remote-directory-controls-right {
    width: 100%;
    margin-bottom: 10px;
  }
  
  .remote-directory-manual-refresh {
    width: 100%;
    margin-right: 0;
    text-align: center;
  }
  
  .remote-directory-datatables .dataTables_filter {
    text-align: left;
    width: 100%;
  }
  
  .remote-directory-datatables .dataTables_filter input {
    width: 100%;
    margin-left: 0;
    margin-top: 0.3em;
  }
}

/* Hide user profile link and media link from Remote Directory display */
.media--type-remote-directory .field--name-uid,
.media--type-remote-directory .field--name-created,
.media--type-remote-directory .views-field-uid,
.media--type-remote-directory .views-field-created,
.media--type-remote-directory .media__icon,
.media--type-remote-directory article > footer,
.media--type-remote-directory .node__meta {
  display: none !important;
}

/* Hide any submitted info that might appear in other contexts */
.media--type-remote-directory .media__submitted,
.media--type-remote-directory .media-submitted,
.media--type-remote-directory .node-submitted {
  display: none !important;
}

/* Hide any "Submitted by" text that might appear */
.media--type-remote-directory .submitted,
.media--type-remote-directory .submitted-by {
  display: none !important;
}

/* Ensure proper spacing without the footer elements */
.media--type-remote-directory {
  margin-bottom: 1em;
}