/* =============================================================
   doc-page.css — styles สำหรับหน้าเอกสาร/ไฟล์ดาวน์โหลด
   ใช้ร่วมกันได้กับทุก section ที่เป็นประเภทรายการเอกสาร
   ============================================================= */

/* ---------- Year filter pills ---------- */
.doc-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 1.5rem;
  padding-bottom: 15px;
  scrollbar-width: thin;
}

.doc-filter::-webkit-scrollbar {
  height: 5px;
}
.doc-filter::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 9999px;
}
.doc-filter::-webkit-scrollbar-track {
  background: transparent;
}

.doc-filter__label {
  font-size: 13px;
  color: #6b7280;
  margin-right: 4px;
  white-space: nowrap;
}

.yr-pill {
  padding: 4px 16px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 9999px;
  cursor: pointer;
  background: #fff;
  color: #6b7280;
  transition:
    background 0.12s,
    color 0.12s,
    border-color 0.12s;
  user-select: none;
  line-height: 1.6;
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}

.yr-pill:hover:not(.yr-pill--active) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.yr-pill--active {
  background: #1e40af;
  color: #fff;
  border-color: #1e40af;
  font-weight: 500;
}

/* ---------- Document list ---------- */
.doc-list {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

.doc-list__empty {
  padding: 2.5rem;
  text-align: center;
  font-size: 13px;
  color: #9ca3af;
}

.doc-row {
  display: flex;
  align-items: flex-start; /* เดิม center — เปลี่ยนรองรับข้อความหลายบรรทัด */
  gap: 12px;
  padding: 13px 18px;
  background: #fff;
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f3f4f6;
  min-width: 0;
  max-width: 100%;
}

.doc-row:last-child {
  border-bottom: none;
}

.doc-row:hover {
  background: #eff6ff;
}

.doc-row:hover .doc-row__name {
  color: #1d4ed8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* icon — กรอบ+พื้นหลังตามประเภทไฟล์ เป็นมาตรฐานเดียวกับ .pdf-icon
   ในหน้าโฮม (ตกลงกับ EK 2026-07-28) สีจริงกำหนดผ่าน inline style
   จาก doc_file_type_color()/doc_file_type_bg() ใน doc-functions.php
   ไม่ใช้ modifier class --pdf/--word/--xls เดิมแล้ว (ไม่เคยถูกเรียกใช้
   จริงในโค้ด HTML — inline style แม่นยำกว่าเพราะรองรับทุกประเภทไฟล์
   รวม ppt ที่ modifier เดิมไม่มี) */
.doc-row__icon {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

/* text block */
.doc-row__body {
  flex: 1;
  min-width: 0;
}

.doc-row__name {
  font-size: 14px;
  color: #111827;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.5;
}

.doc-row__meta {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 2px;
}

/* right side */
.doc-row__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-top: 2px;
}

.doc-row__size {
  font-size: 12px;
  color: #9ca3af;
}

.doc-row__arrow {
  font-size: 15px;
  color: #d1d5db;
}

/* ---------- Badges ---------- */
.doc-badge {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 9999px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}

.doc-badge--new {
  background: #dcfce7;
  color: #166534;
}
.doc-badge--updated {
  background: #fef9c3;
  color: #854d0e;
}
.doc-badge--current {
  background: #dbeafe;
  color: #1e40af;
}
.doc-badge--old {
  background: #f3f4f6;
  color: #6b7280;
}

/* ---------- Per-page selector ---------- */
.doc-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 1rem;
  font-size: 13px;
  color: #6b7280;
}

.doc-perpage {
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-perpage select {
  padding: 4px 10px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.doc-perpage select:focus {
  border-color: #1e40af;
}

/* ---------- Pagination controls ---------- */
.doc-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.doc-pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-size: 13px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  transition:
    background 0.1s,
    border-color 0.1s;
  user-select: none;
  text-decoration: none;
}

.doc-pagination__btn:hover:not(:disabled):not(.doc-pagination__btn--active) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.doc-pagination__btn--active {
  background: #1e40af;
  color: #fff;
  border-color: #1e40af;
  font-weight: 500;
}

.doc-pagination__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.doc-pagination__dots {
  font-size: 13px;
  color: #9ca3af;
  padding: 0 4px;
}

/* ---------- Filelist dropdown (เมื่อเอกสารมีหลายไฟล์แนบ) ---------- */
/* ย้ายมารวมจาก inline <style> ใน doc-list.php — รวมศูนย์กลาง CSS
   ไว้ที่ doc-list.css ที่เดียว ไม่ให้ซ้ำซ้อนกัน 2 ที่ (ตกลงกับ EK 2026-07-28) */
.doc-row__filelist {
  margin: 4px 44px 8px 44px;
  border: 0.5px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #fafafa;
}

.doc-row__filelist-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 0.5px solid #eee;
  min-width: 0;
}

.doc-row__filelist-item:last-child {
  border-bottom: none;
}

.doc-row__filelist-item:hover {
  background: #f0f4f8;
}

.doc-row__filelist-name {
  flex: 1;
  min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
  color: #374151;
  line-height: 1.5;
}

.doc-row__filelist-size {
  color: #9ca3af;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ---------- Filelist dropdown icon (เมื่อเอกสารมีหลายไฟล์แนบ) ---------- */
/* กรอบเล็ก 20x20px เป็นมาตรฐานเดียวกับ .doc-row__icon แต่ย่อขนาดลง
   เพราะอยู่ในแถวย่อยของ dropdown ไม่ใช่แถวเอกสารหลัก (ตกลงกับ EK 2026-07-28) */
.doc-row__filelist-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
