/* ==============================
   RESOURCE LIST MAIN STYLES
   ============================== */
#resource-list {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  padding: 20px;
  max-width: 1000px;
  margin: 20px auto;
  font-family: system-ui, sans-serif;
}

#resource-list h2 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.4rem;
  font-weight: 600;
}

#resource-list input[type="text"],
#resource-list input[type="email"],
#resource-list input[type="search"],
#resource-list input[type="tel"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin: 8px 0;
  font-size: 0.95em;
}

#total-cost {
  font-weight: 600;
  color: #0066cc;
  font-size: 1.05em;
  margin-top: 10px;
}

#submit-selection {
  background: #0066cc;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 10px;
  font-size: 0.95em;
  width: auto; /* ✅ normal width instead of full width */
}

#submit-selection:hover {
  background: #004b99;
}

/* ==============================
   TABLE STYLING
   ============================== */
.resource-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  table-layout: fixed;
  font-size: 0.93em;
}

.resource-table th,
.resource-table td {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: left;
  vertical-align: top;
  word-wrap: break-word;
}

.resource-table th {
  background-color: #f2f2f2;
  font-weight: 600;
}

/* Alternate row color */
.resource-table tr:nth-child(even) {
  background-color: #fafafa;
}

.resource-table tr:hover {
  background-color: #f5f5f5;
}

/* Make columns visually balanced */
.resource-table th:first-child,
.resource-table td:first-child {
  width: 8%; /* Select column */
}

.resource-table th:nth-child(2),
.resource-table td:nth-child(2) {
  width: 12%; /* Image column */
}

.resource-table th.title-col,
.resource-table td.title-col {
  width: 22%;
}

.resource-table th.desc-col,
.resource-table td.desc-col {
  width: 35%;
}

/* ==============================
   IMAGE STYLING
   ============================== */
.resource-table img.resource-thumb {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #ddd;
}

.resource-table .no-thumb {
  color: #999;
  font-size: 0.9em;
}

/* ==============================
   DESCRIPTION WITH READ MORE / SHOW LESS
   ============================== */
.desc-cell {
  position: relative;
  max-width: 280px;
}

.desc-text {
  overflow: hidden;
  line-height: 1.4em;
  max-height: 2.8em; /* ≈ 2 lines */
  transition: max-height 0.3s ease;
  color: #333;
  font-size: 0.93em;
}

.desc-text.expanded {
  max-height: 1000px;
}

.desc-cell .read-more {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.88em;
  color: #0066cc;
  cursor: pointer;
  text-decoration: underline;
  font-weight: 500;
}

.desc-cell .read-more:hover {
  color: #004b99;
}

/* ==============================
   USER INFO FIELDS LAYOUT
   ============================== */
.user-info {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.user-info input {
  flex: 1;
}

/* ==============================
   MOBILE VIEW: CARD LAYOUT
   ============================== */
@media (max-width: 768px) {
  #resource-list {
    padding: 15px;
  }

  .resource-table {
    border: none;
  }

  /* Hide table headers */
  .resource-table thead {
    display: none;
  }

  /* Each row becomes a card */
  .resource-table tr {
    display: block;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    margin-bottom: 15px;
    padding: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  }

  /* Each cell stacks vertically */
  .resource-table td {
    display: flex;
    align-items: flex-start;
    border: none;
    padding: 6px 0;
    font-size: 0.85em;
  }

  /* Data labels (before each value) */
  .resource-table td::before {
    content: attr(data-label);
    font-weight: 600;
    width: 90px;
    flex-shrink: 0;
    color: #333;
  }

  /* Image styling */
  .resource-table img.resource-thumb {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    margin-right: 10px;
  }

  /* Description area */
  .desc-cell {
    max-width: 100%;
  }

  .desc-text {
    font-size: 0.83em;
    line-height: 1.4em;
  }

  .desc-cell .read-more {
    font-size: 0.8em;
    margin-top: 5px;
    color: #0073e6;
  }

  /* Form inputs stack vertically */
  #resource-list .user-info {
    flex-direction: column;
  }

  #resource-list .user-info input {
    width: 100%;
  }
}

/* ==============================
   🔍 Search & Filter Styling
   ============================== */
.resource-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.resource-filters select {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  min-width: 160px;
  background: #fff;
  color: #333;
}

/* Search box with icon */
.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-box input[type="search"] {
  width: 100%;
  padding: 8px 35px 8px 12px; /* space for icon */
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
}

.search-box .search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: #555;
  transition: color 0.2s ease;
}

.search-box .search-btn:hover {
  color: #0066cc;
}

/* Responsive tweaks */
@media (max-width: 600px) {
  .resource-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .search-box {
    width: 100%;
  }
}

/* ==============================
   Load More Button
   ============================== */
.load-more-wrap {
  text-align: right;
  margin-top: 10px;
}

#load-more-resources,
#load-more-professionals {
  background: #fff;
  color: #000;
  border: 1px solid #000;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 0.9em;
  cursor: pointer;
  transition: background 0.2s ease;
}

#load-more-resources:hover,
#load-more-professionals:hover {
  background: #f3f3f3;
}

@media (max-width: 768px) {
  .load-more-wrap {
    text-align: center;
  }
}