#resources {
  padding: 40px 0;
}

.resources-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.resources-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

#resources h2 {
  font-size: 28px;
  margin: 0;
}

.filter-container {
  display: flex;
  gap: 10px;
  align-items: center;
}

#tag-select {
  padding: 10px;
  font-size: 16px;
  border: 1px solid #ccc; /* Retain borders on all sides */
  border-radius: 5px; /* Reinforce rounded corners with vendor prefixes */
  -webkit-border-radius: 5px; /* Safari/Chrome */
  -moz-border-radius: 5px; /* Firefox */
  background-color: #fff;
  cursor: pointer;
  width: auto;
  min-width: 150px;
  max-height: 200px; /* Retain scrollable height */
  overflow-y: auto; /* Ensure scrollability for >12 tags */
  /* [REVERTED] Removed -webkit-appearance: none; -moz-appearance: none; appearance: none; to restore default dropdown arrow */
}

#tag-select option {
  /* [REVERTED] Removed border-radius and padding styling for options since it doesn't affect the dropdown container */
}

#search-input {
  padding: 10px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 5px;
  width: 250px;
}

.resources-main {
  display: flex;
  gap: 20px;
}

.resources-sidebar {
  flex: 1;
  background-color: #f5f5f5;
  padding: 20px;
  border-radius: 5px;
}

.resources-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.resource-tab {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 5px;
  text-align: left;
  font-size: 16px;
  cursor: pointer;
}

.resource-tab:hover,
.resource-tab.active {
  background-color: #000;
  color: #fff;
  border-color: #000;
}

.resources-content {
  flex: 3;
  padding: 20px;
  background-color: #f5f5f5;
  border-radius: 5px;
}

.resource-details {
  display: none;
}

.resource-details.active {
  display: block;
}

.resource-details h3 {
  font-size: 24px;
  margin-bottom: 10px;
}

.resource-details p {
  font-size: 16px;
  margin-bottom: 20px;
}

.resource-item {
  background-color: #fff;
  padding: 20px;
  border-radius: 5px;
  margin-bottom: 20px;
  cursor: pointer;
  position: relative;
}

.resource-item:hover {
  background-color: #f0f0f0;
}

.resource-item h4 {
  font-size: 20px;
  margin-bottom: 10px;
}

.resource-item .timestamp {
  font-size: 14px;
  color: #666;
  margin: 0 0 10px;
}

.resource-item .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  align-items: center;
}

.resource-item .tag {
  background-color: #f5f5f5;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
}

.resource-item .pinned-icon {
  font-size: 18px;
  color: #666;
  margin-left: 6px;
}

.resource-item .content-preview {
  font-size: 16px;
  margin: 0;
  min-height: 2em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resource-item .content-preview a {
  color: #1a73e8;
  text-decoration: underline;
}

.resource-item .content-preview a:hover {
  color: #134c9e;
}

.resource-item .download-link {
  display: inline-block;
  margin-top: 10px;
  margin-right: 10px;
  color: #000;
  text-decoration: underline;
  transition: color 0.3s ease;
}

.resource-item .download-link:hover {
  color: #666;
}

.resource-item .expand-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.resource-item .expand-icon .material-icons {
  font-size: 18px;
  color: #666;
}

.popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.popup.active {
  display: flex;
}

.popup-content {
  background-color: #fff;
  padding: 20px;
  border-radius: 5px;
  width: 80%;
  margin: 0 10%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.popup-content .content p {
  font-size: 16px;
  margin-bottom: 10px;
}

.popup-content .content a {
  color: #1a73e8;
  text-decoration: underline;
}

.popup-content .content a:hover {
  color: #134c9e;
}

.popup-content .close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 36px;
  cursor: pointer;
  color: #666;
  padding: 4px;
  line-height: 1;
}

.popup-content h4 {
  font-size: 20px;
  margin-bottom: 10px;
}

.popup-content .timestamp {
  font-size: 14px;
  color: #666;
  margin-bottom: 10px;
}

.popup-content .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  align-items: center;
}

.popup-content .tag {
  background-color: #f5f5f5;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
}

.popup-content .pinned-icon {
  font-size: 18px;
  color: #666;
  margin-left: 6px;
}

.popup-content .download-link {
  display: inline-block;
  margin-top: 10px;
  margin-right: 10px;
  color: #000;
  text-decoration: underline;
  transition: color 0.3s ease;
}

.popup-content .download-link:hover {
  color: #666;
}

.clear-button {
  padding: 10px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background-color: #fff;
  cursor: pointer;
  margin-left: 10px;
}

.clear-button:hover {
  background-color: #f5f5f5;
}

.clear-button.active {
  background-color: #000 !important; /* !important to ensure override */
  color: #fff;
}

.resource-tab.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

#search-results {
  display: none;
}

#search-results.active {
  display: block;
}

@media (max-width: 768px) {
  .resources-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .filter-container {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  #tag-select,
  #search-input {
    width: 100%; /* Match widths on mobile */
    max-width: 100%; /* Prevent stretching beyond screen */
    box-sizing: border-box; /* Include padding in width calculation */
  }

  /* [REVERTED] Removed -webkit-appearance: none; -moz-appearance: none; appearance: none; and related mobile-specific styling to restore default dropdown arrow */
  /* [REVERTED] Removed #tag-select option styling for mobile since it doesn't affect the container */

  .clear-button {
    width: 60%; /* Retain 60% width */
    max-width: 60%; /* Prevent stretching beyond 60% */
    box-sizing: border-box; /* Include padding in width calculation */
    text-align: center; /* Center the button text */
    margin: 10px auto 0; /* Center with auto margins */
    margin-left: auto; /* Override desktop margin-left */
    margin-right: auto; /* Ensure both sides are auto for centering */
    display: block; /* Change from flex to block for better centering */
    align-self: center; /* Additional centering for flexbox parent */
  }

  .resources-main {
    flex-direction: column;
  }

  .resources-sidebar {
    padding: 15px;
  }

  .resources-content {
    padding: 15px;
  }

  .resource-details h3 {
    font-size: 20px;
  }

  .popup-content {
    width: 90%;
    margin: 0 5%;
    max-height: 90vh;
  }

  .resource-item .expand-icon,
  .popup-content .close-button {
    padding: 2px;
  }
}
