/* ========================================
   PUBLIC ACCESS PAGE
   ======================================== */

/* ========================================
   FILTER BAR
   ======================================== */
.pa-filters {
  padding: 20px 0;
  background-color: var(--ifa-dark-blue);
}

.pa-filters-bar {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ========================================
   SEARCH INPUT
   ======================================== */
.pa-search {
  position: relative;
  flex: 0 1 40%;
  min-width: 0;
}

.pa-search-input {
  width: 100%;
  padding: 14px 44px 14px 20px;
  border: none;
  border-radius: 28px;
  background-color: var(--ifa-white);
  font-family: var(--ifa-font-body);
  font-size: 15px;
  color: var(--ifa-black);
  outline: none;
}

.pa-search-input::placeholder {
  color: var(--ifa-black);
}

.pa-search-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ifa-green);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ========================================
   ACTIVE FILTER CHIPS
   ======================================== */
.pa-active-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 0 0;
}

.pa-active-filters:empty {
  display: none;
}

.pa-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: var(--ifa-white);
  border: none;
  border-radius: 24px;
  font-size: 14px;
  color: var(--ifa-black);
  white-space: nowrap;
}

.pa-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--ifa-black);
  cursor: pointer;
  padding: 0;
  transition: color var(--ifa-transition);
}

.pa-chip-remove:hover {
  color: var(--ifa-black);
}

.pa-chip-remove svg {
  width: 12px;
  height: 12px;
}

/* ========================================
   FILTER DROPDOWNS
   ======================================== */
.pa-filter-dropdown {
  position: relative;
  flex: 0 1 20%;
  min-width: 0;
}

.pa-filter-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 20px;
  background-color: var(--ifa-white);
  border: none;
  border-radius: 28px;
  font-family: var(--ifa-font-body);
  font-size: 15px;
  line-height: 18px;
  color: var(--ifa-black);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: box-shadow var(--ifa-transition);
}

.pa-filter-btn-full,
.pa-filter-btn-short {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.pa-filter-btn:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.pa-filter-btn svg {
  flex-shrink: 0;
  color: var(--ifa-black);
  transition: transform var(--ifa-transition);
}

.pa-filter-btn[aria-expanded="true"] .pa-filter-chevron svg {
  transform: rotate(180deg);
}

/* Show chevron by default, hide clear */
.pa-filter-chevron {
  display: flex;
  align-items: center;
}

.pa-filter-clear {
  display: none;
  align-items: center;
  cursor: pointer;
}

/* When filter is active: hide chevron, show clear */
.pa-filter-btn.has-value .pa-filter-chevron {
  display: none;
}

.pa-filter-btn.has-value .pa-filter-clear {
  display: flex;
  transform: scale(0.6);
  position: relative;
  left: 2.5px;
}

.pa-filters-dropdowns-row {
  display: contents;
}

.pa-filter-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 320px;
  max-height: 380px;
  overflow-y: auto;
  background-color: var(--ifa-white);
  border: 1px solid var(--ifa-grey-50);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 4px 0;
  z-index: 100;
  display: none;
  white-space: nowrap;
}

.pa-filter-menu.is-open {
  display: block;
}

.pa-filter-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--ifa-black);
  cursor: pointer;
  transition: background-color var(--ifa-transition);
}

.pa-filter-option:hover {
  background-color: var(--ifa-light);
}

.pa-filter-option.is-selected {
  background-color: var(--ifa-grey-50);
  font-weight: 600;
  padding-right: 12px;
}

.pa-filter-option.is-selected::after {
  content: "✕";
  font-size: 12px;
  font-weight: 400;
  color: var(--ifa-grey-600);
  margin-left: 12px;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

/* ========================================
   DOCUMENT TABLE
   ======================================== */
.pa-documents {
  padding: 0 0 60px;
}

.pa-documents .ifa-container {
  padding-left: 0;
  padding-right: 0;
}

.pa-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 20px;
}

.pa-table {
  width: 100%;
  min-width: 1200px;
  padding-left: var(--ifa-container-pad);
  padding-right: var(--ifa-container-pad);
  font-family:
    "Roboto",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.pa-table-head {
  display: grid;
  grid-template-columns: 1fr 350px 180px 120px;
  gap: 16px;
  padding: 24px 24px 20px;
}

.pa-th {
  font-size: 14px;
  font-weight: 700;
  color: var(--ifa-black);
}

.pa-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--ifa-font-body);
  font-size: 20px;
  font-weight: 700;
  color: var(--ifa-black);
  cursor: pointer;
}

.pa-sort-btn img {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.pa-sort-icon {
  flex-shrink: 0;
  width: 14px;
  height: 16px;
}

/* Default: both arrows muted */
.pa-sort-up,
.pa-sort-down {
  fill: var(--ifa-grey-200);
  transition: fill var(--ifa-transition);
}

/* Active sort: highlight the active direction */
.pa-sort-btn.is-active.is-asc .pa-sort-up {
  fill: var(--ifa-primary-600);
}

.pa-sort-btn.is-active.is-desc .pa-sort-down {
  fill: var(--ifa-primary-600);
}

/* ========================================
   DOCUMENT ROWS
   ======================================== */
.pa-table-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pa-row {
  display: grid;
  grid-template-columns: 1fr 350px 180px 120px;
  gap: 16px;
  padding: 16px 24px;
  border: 1px solid var(--ifa-grey-50);
  border-radius: 4px;
  box-shadow: 0px 3px 3px 0px #00000024;
  text-decoration: none;
  color: inherit;
  align-items: center;
  transition: background-color var(--ifa-transition);
}

.pa-row:hover {
  background-color: var(--ifa-light);
  color: var(--ifa-black);
}

.pa-td-name {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pa-doc-icon {
  flex-shrink: 0;
  width: 15px;
  height: 20px;
  margin-top: 2px;
}

.pa-doc-icon img {
  width: 100%;
  height: 100%;
  display: block;
}

.pa-doc-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pa-doc-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ifa-black);
}

.pa-doc-desc {
  font-size: 14px;
  font-weight: 400;
  font-style: italic;
  color: var(--ifa-black);
}

/* ========================================
   BADGES
   ======================================== */
.pa-td-category,
.pa-td-tag {
  display: flex;
  align-items: center;
}

.pa-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

/* Category badges — color set via inline styles */
.pa-badge-category {
  border: 1px solid currentColor;
  font-size: 14px;
  padding: 6px 12px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tag badges — neutral gray outlined */
.pa-badge-tag {
  background-color: var(--ifa-light);
  border: 1px solid var(--ifa-grey-500);
  color: var(--ifa-dark-500);
  font-size: 14px;
  padding: 6px 12px;
}

/* ========================================
   DATE COLUMN
   ======================================== */
.pa-td-date {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.pa-date-primary {
  font-size: 15px;
  color: var(--ifa-black);
}

.pa-date-time {
  font-size: 13px;
  font-style: italic;
  color: var(--ifa-black);
}

/* ========================================
   LOAD MORE
   ======================================== */
.pa-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 32px 0 0;
}

.pa-load-more-btn {
  font-family: var(--ifa-font-body);
  font-size: 17px;
  font-weight: 700;
  color: var(--ifa-white);
  background-color: var(--ifa-primary-600);
  border: 1px solid var(--ifa-primary-600);
  border-radius: 8px;
  padding: 8px 22px;
  cursor: pointer;
  transition: opacity var(--ifa-transition);
}

.pa-load-more-btn:hover {
  opacity: 0.9;
}

.pa-load-more-btn.is-hidden {
  display: none;
}

.pa-load-more-btn.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* ========================================
   LOADING STATE
   ======================================== */
.pa-table-body.is-loading {
  opacity: 0.5;
  pointer-events: none;
}

/* ========================================
   EMPTY STATE
   ======================================== */
.pa-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--ifa-black);
  font-size: 16px;
}

/* ========================================
   RESET BUTTON
   ======================================== */
.pa-reset-btn {
  flex-shrink: 0;
  padding: 14px 20px;
  background: transparent;
  border: 2px solid var(--ifa-white);
  border-radius: 28px;
  font-family: var(--ifa-font-body);
  font-size: 15px;
  line-height: 18px;
  font-weight: 600;
  color: var(--ifa-white);
  cursor: pointer;
  transition:
    background-color var(--ifa-transition),
    color var(--ifa-transition),
    opacity var(--ifa-transition);
}

.pa-reset-btn:hover:not(:disabled) {
  background-color: var(--ifa-white);
  color: var(--ifa-dark-blue);
}

.pa-reset-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Short labels — hidden on desktop, shown on mobile */
.pa-filter-btn-short {
  display: none;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
  .pa-filters-bar {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 12px;
  }

  .pa-search {
    width: 100%;
    flex: none;
    grid-column: 1;
  }

  .pa-search-input {
    height: 42px;
    padding: 0 44px 0 14px;
    font-size: 14px;
  }

  .pa-filters-dropdowns-row {
    display: flex;
    gap: 8px;
  }

  .pa-filter-dropdown {
    flex: 1;
    min-width: 0;
  }

  .pa-filter-btn {
    width: 100%;
    height: 42px;
    justify-content: space-between;
    padding: 0 12px;
    font-size: 14px;
  }

  .pa-reset-btn {
    height: 42px;
    padding: 0 16px;
    font-size: 14px;
  }

  .pa-filter-menu {
    min-width: 200px;
    max-width: calc(100vw - 40px);
  }

  .pa-filter-dropdown:first-child .pa-filter-menu {
    left: 0;
    right: auto;
  }

  .pa-filter-dropdown:nth-child(2) .pa-filter-menu {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .pa-filter-dropdown:last-child .pa-filter-menu {
    left: auto;
    right: 0;
  }

  .pa-doc-desc {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

@media (max-width: 549px) {
  .pa-filter-btn-full {
    display: none;
  }

  .pa-filter-btn-short {
    display: inline;
  }
}
