/* pvec/themes/default/css/research.css */

/* ── Semester Dropdown ── */
.semester-bar { margin-bottom: 1rem; }

.select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.select-field {
  appearance: none;
  -webkit-appearance: none;
  background: var(--clr-surface);
  border: 1.5px solid var(--clr-primary);
  border-radius: var(--radius);
  padding: 0.5rem 2.25rem 0.5rem 0.9rem;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--clr-primary);
  cursor: pointer;
  outline: none;
  min-width: 240px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.select-field:focus { box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

.select-arrow {
  position: absolute;
  right: 0.7rem;
  pointer-events: none;
  color: var(--clr-primary);
  font-size: 0.85rem;
}

/* ── Table Wrapper ── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ── Research Table ── */
.research-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: var(--clr-surface);
  table-layout: fixed;
}

.research-table thead tr {
  background: linear-gradient(135deg, var(--clr-primary) 0%, var(--clr-accent) 100%);
  color: #fff;
}

.research-table th {
  padding: 0.75rem 0.85rem;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.82rem;
  letter-spacing: .02em;
}

.research-table th.text-center,
.research-table td.text-center { text-align: center; }

.research-table tbody tr {
  border-bottom: 1px solid var(--clr-border);
  transition: background var(--transition);
}

.research-table tbody tr:last-child { border-bottom: none; }
.research-table tbody tr:hover { background: #f0f7ff; }

.research-table td {
  padding: 0.7rem 0.85rem;
  vertical-align: middle;
  line-height: 1.5;
}

/* ── Column widths (fixed) ── */
.col-no     { width: 52px; }
.col-title  { width: auto; }          /* กินพื้นที่เหลือ */
.col-author { width: 150px; }
.col-link   { width: 60px; }
.col-view   { width: 80px; }

/* ── ชื่อวิจัย: แสดง 1 บรรทัด ตัด ... + tooltip ── */
.research-name {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
}

/* ── View icon link ── */
.view-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  color: var(--clr-primary);
  background: #eff6ff;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  text-decoration: none;
}

.view-link:hover {
  background: var(--clr-primary);
  color: #fff;
  transform: scale(1.1);
}

.no-link {
  color: var(--clr-text-muted);
  font-size: 1.1rem;
  line-height: 1;
}

/* ── View count ── */
.view-count-badge {
  display: inline-block;
  font-weight: 700;
  font-size: 1rem;
  color: var(--clr-primary);
}

/* ── Mobile card layout ── */
@media (max-width: 600px) {
  .select-field { min-width: 100%; width: 100%; }
  .select-wrap  { width: 100%; }

  .research-table { table-layout: auto; }
  .research-table thead { display: none; }

  .research-table tbody tr {
    display: block;
    margin-bottom: 0.75rem;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius);
    padding: 0.75rem;
  }

  .research-table td {
    display: flex;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border: none;
    align-items: flex-start;
  }

  .research-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--clr-text-muted);
    min-width: 80px;
    flex-shrink: 0;
    font-size: 0.8rem;
    padding-top: 2px;
  }

  /* mobile: ชื่อวิจัยแสดงเต็ม (ไม่ตัด เพราะ card layout) */
  .research-name {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
}