/* ============================================================
   ARTZA ASSETS - TABLES
   Admin listing tables, toolbars, search/filter, pagination,
   badges, row actions, responsive mobile card conversion
   ============================================================ */

/* ============================================================
   1. TOOLBAR
   ============================================================ */

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding: 20px 22px;
  background: #ffffff;
  border: 1px solid var(--artza-border, #DCE5EA);
  box-shadow: 0 12px 30px rgba(6, 26, 40, .04);
}

.admin-toolbar-title {
  min-width: 0;
}

.admin-toolbar-title strong {
  display: block;
  color: var(--artza-dark, #061A28);
  font-size: 16px;
  line-height: 1.35;
  font-weight: 850;
}

.admin-toolbar-title span {
  display: block;
  margin-top: 5px;
  color: var(--artza-muted, #6B7D88);
  font-size: 10px;
  line-height: 1.55;
}

.admin-toolbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

/* ============================================================
   2. SEARCH & FILTERS
   ============================================================ */

.admin-search {
  position: relative;
  width: 350px;
  max-width: 100%;
}

.admin-search input {
  width: 100%;
  height: 48px;
  padding: 0 46px 0 16px;
  border: 1px solid var(--artza-border, #DCE5EA);
  outline: none;
  border-radius: 0;
  background: #ffffff;
  color: var(--artza-text, #163041);
  font-size: 12.5px;
  line-height: 1;
  transition:
    border-color .22s ease,
    box-shadow .22s ease,
    background .22s ease;
}

.admin-search input::placeholder {
  color: #9da9af;
}

.admin-search input:hover {
  border-color: #c7d4da;
}

.admin-search input:focus {
  border-color: var(--artza-gold, #FE7E04);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(254, 126, 4, .09);
}

.admin-search span {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--artza-muted, #6B7D88);
  font-size: 13px;
  pointer-events: none;
}

.admin-filter {
  min-width: 145px;
  height: 48px;
  padding: 0 36px 0 14px;
  outline: none;
  border: 1px solid var(--artza-border, #DCE5EA);
  border-radius: 0;
  background: #ffffff;
  color: var(--artza-text, #163041);
  font-size: 11px;
  cursor: pointer;
  transition:
    border-color .22s ease,
    box-shadow .22s ease,
    background .22s ease;
}

.admin-filter:hover {
  border-color: #c7d4da;
}

.admin-filter:focus {
  border-color: var(--artza-gold, #FE7E04);
  box-shadow: 0 0 0 4px rgba(254, 126, 4, .09);
}

/* ============================================================
   3. TABLE SHELL
   ============================================================ */

.admin-table-shell {
  width: 100%;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--artza-border, #DCE5EA);
  box-shadow: var(--artza-shadow, 0 18px 45px rgba(6, 26, 40, .08));
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  border-spacing: 0;
}

.admin-table thead {
  background: var(--artza-dark, #061A28);
}

.admin-table th {
  padding: 15px 16px;
  text-align: left;
  vertical-align: middle;
  color: rgba(255, 255, 255, .72);
  font-size: 9px;
  line-height: 1.35;
  font-weight: 850;
  letter-spacing: .85px;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-table-status-col {
  width: 42px;
}

.admin-table td {
  padding: 16px;
  border-bottom: 1px solid var(--artza-border, #DCE5EA);
  vertical-align: middle;
  color: var(--artza-text, #163041);
  font-size: 12px;
  line-height: 1.55;
}

.admin-table td:first-child,
.admin-table th:first-child {
  padding-left: 18px;
}

.admin-table td:last-child,
.admin-table th:last-child {
  padding-right: 18px;
}

.admin-table tbody tr {
  background: #ffffff;
  transition:
    background .2s ease,
    box-shadow .2s ease;
}

.admin-table tbody tr:hover {
  background: #F8FAFB;
}

.admin-table tbody tr.unread {
  background: #FFF4ED;
}

.admin-table tbody tr.unread:hover {
  background: #FFE9D6;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

/* Keep long cells under control */
.admin-table td,
.admin-table th {
  min-width: 0;
}

.admin-table td a:not(.admin-action) {
  overflow-wrap: anywhere;
}

/* ============================================================
   4. ROW ACTIONS
   ============================================================ */

.admin-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.admin-action {
  min-height: 33px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--artza-border, #DCE5EA);
  border-radius: 0;
  background: #ffffff;
  color: var(--artza-text, #163041);
  font-size: 9px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .25px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background .2s ease,
    color .2s ease,
    border-color .2s ease,
    transform .2s ease;
}

.admin-action:hover {
  transform: translateY(-1px);
  border-color: var(--artza-gold, #FE7E04);
  color: var(--artza-gold-dark, #E30719);
}

.admin-action.disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

.admin-action.disabled:hover {
  transform: none;
  border-color: var(--artza-border, #DCE5EA);
  color: var(--artza-text, #163041);
}

.admin-action.view,
.admin-action.edit {
  background: var(--artza-dark, #061A28);
  border-color: var(--artza-dark, #061A28);
  color: #ffffff;
}

.admin-action.view:hover,
.admin-action.edit:hover {
  background: var(--artza-gold, #FE7E04);
  border-color: var(--artza-gold, #FE7E04);
  color: var(--artza-dark, #061A28);
}

.admin-action.delete {
  background: var(--artza-danger-soft, #FFF0F1);
  border-color: #F7C7CA;
  color: var(--artza-danger, #E30719);
}

.admin-action.delete:hover {
  background: var(--artza-danger, #E30719);
  border-color: var(--artza-danger, #E30719);
  color: #ffffff;
}

/* ============================================================
   5. BADGES / STATUS
   ============================================================ */

.admin-status-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.admin-badge {
  min-height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border: 1px solid transparent;
  font-size: 9px;
  line-height: 1.2;
  font-weight: 850;
  letter-spacing: .4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-badge.read,
.admin-badge.completed,
.admin-badge.published,
.admin-badge.active,
.admin-badge.admin,
.admin-badge.verified {
  background: var(--artza-success-soft, #EDF8EF);
  color: var(--artza-success, #2F8F49);
}

.admin-badge.unread {
  background: var(--artza-danger-soft, #FFF0F1);
  color: var(--artza-danger, #E30719);
}

.admin-badge.ongoing,
.admin-badge.unverified {
  background: var(--artza-warning-soft, #FFF3E5);
  color: var(--artza-warning, #FE7E04);
}

.admin-badge.draft,
.admin-badge.hidden,
.admin-badge.inactive,
.admin-badge.standard {
  background: var(--artza-light-2, #F1F5F7);
  color: var(--artza-muted, #6B7D88);
}

.admin-badge.featured,
.admin-badge.category {
  background: var(--artza-gold-soft, #FFF3E5);
  color: var(--artza-gold-dark, #E30719);
}

.admin-badge.featured,
.admin-badge.you {
  margin-left: 5px;
}

.admin-badge.you,
.admin-badge.current {
  background: var(--artza-info-soft, #EDF3FF);
  color: var(--artza-info, #3867D6);
}

/* ============================================================
   6. EMPTY STATE
   ============================================================ */

.admin-empty {
  padding: clamp(55px, 7vw, 85px) 30px;
  text-align: center;
}

.admin-empty-icon {
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  background: var(--artza-gold-soft, #FFF3E5);
  color: var(--artza-gold-dark, #E30719);
  font-size: 24px;
  font-weight: 900;
}

.admin-empty h3 {
  margin: 0 0 9px;
  color: var(--artza-dark, #061A28);
  font-size: 21px;
  line-height: 1.3;
  font-weight: 850;
}

.admin-empty p {
  max-width: 520px;
  margin: 0 auto 22px;
  color: var(--artza-muted, #6B7D88);
  font-size: 12px;
  line-height: 1.7;
}

/* ============================================================
   7. PAGINATION
   ============================================================ */

.admin-pagination {
  padding: 19px 20px;
  border-top: 1px solid var(--artza-border, #DCE5EA);
  background: #ffffff;
  text-align: center;
}

.admin-pager-inner,
.admin-page-numbers {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.admin-pager-inner {
  gap: 7px;
}

.admin-page-numbers {
  gap: 6px;
}

.admin-page-link {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--artza-border, #DCE5EA);
  background: #ffffff;
  color: var(--artza-text, #163041);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  transition:
    background .2s ease,
    color .2s ease,
    border-color .2s ease,
    transform .2s ease;
}

.admin-page-link:hover {
  transform: translateY(-1px);
  border-color: var(--artza-gold, #FE7E04);
  color: var(--artza-gold-dark, #E30719);
}

.admin-page-link.active {
  background: var(--artza-dark, #061A28);
  border-color: var(--artza-dark, #061A28);
  color: #ffffff;
  cursor: default;
  pointer-events: none;
}

.admin-page-link.disabled {
  opacity: .42;
  cursor: not-allowed;
  pointer-events: none;
}

.admin-page-dots {
  min-width: 24px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--artza-muted, #6B7D88);
  font-size: 10px;
  font-weight: 800;
}

/* ============================================================
   8. MOBILE CARD BASE
   ============================================================ */

/* Desktop: mobile-card views stay hidden unless their page CSS
   explicitly requires otherwise. */
.message-mobile-card,
.team-mobile-card,
.user-mobile-card {
  display: none;
}

.admin-mobile-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.full-width {
  width: 100%;
}

/* ============================================================
   9. ACCESSIBILITY
   ============================================================ */

.admin-search input:focus-visible,
.admin-filter:focus-visible,
.admin-action:focus-visible,
.admin-page-link:focus-visible {
  outline: 2px solid var(--artza-gold, #FE7E04);
  outline-offset: 2px;
}

/* ============================================================
   10. LARGE TABLET
   ============================================================ */

@media (max-width: 1100px) {
  .admin-toolbar {
    gap: 18px;
  }

  .admin-search {
    width: 300px;
  }

  .admin-table {
    min-width: 980px;
  }

  .admin-table th,
  .admin-table td {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* ============================================================
   11. TABLET
   ============================================================ */

@media (max-width: 900px) {
  .admin-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-toolbar-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .admin-search {
    flex: 1 1 320px;
    width: auto;
  }

  .admin-filter {
    flex: 0 1 180px;
  }

  .admin-table {
    min-width: 920px;
  }
}

/* ============================================================
   12. MOBILE / SMALL TABLET
   ============================================================ */

@media (max-width: 760px) {
  .admin-toolbar {
    padding: 17px;
    gap: 16px;
  }

  .admin-toolbar-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 145px;
    gap: 9px;
  }

  .admin-search {
    width: 100%;
  }

  .admin-filter {
    width: 100%;
    min-width: 0;
  }

  /*
   * Mobile converts table listings into dedicated mobile cards.
   * The page should render the card markup alongside the table.
   */
  .admin-table-wrap {
    display: none;
  }

  .message-mobile-card,
  .team-mobile-card,
  .user-mobile-card {
    display: block;
  }

  .message-mobile-card,
  .user-mobile-card {
    margin-bottom: 10px;
    padding: 16px;
    background: #ffffff;
    border: 1px solid var(--artza-border, #DCE5EA);
    box-shadow: 0 8px 22px rgba(6, 26, 40, .04);
  }

  .message-mobile-card.unread {
    background: #FFF4ED;
    border-color: #FFD7B5;
  }

  .team-mobile-card {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 15px;
    margin-bottom: 10px;
    padding: 15px;
    background: #ffffff;
    border: 1px solid var(--artza-border, #DCE5EA);
    box-shadow: 0 8px 22px rgba(6, 26, 40, .04);
  }

  /* display:grid must come after desktop display:none */
  .team-mobile-card {
    display: grid;
  }

  .admin-mobile-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    margin-top: 14px;
  }

  .admin-mobile-actions .admin-action {
    width: 100%;
    min-height: 38px;
  }

  .full-width {
    grid-column: 1 / -1;
  }

  .admin-status-badges {
    justify-content: flex-start;
  }

  .admin-pagination {
    padding: 16px 12px;
  }
}

/* ============================================================
   13. SMALL MOBILE
   ============================================================ */

@media (max-width: 560px) {
  .admin-toolbar {
    margin-bottom: 15px;
    padding: 15px;
  }

  .admin-toolbar-title strong {
    font-size: 15px;
  }

  .admin-toolbar-controls {
    grid-template-columns: 1fr;
  }

  .admin-search input,
  .admin-filter {
    height: 46px;
  }

  .admin-empty {
    padding: 50px 18px;
  }

  .admin-page-link {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
  }

  .admin-page-dots {
    height: 32px;
  }

  .message-mobile-card,
  .user-mobile-card {
    padding: 14px;
  }

  .team-mobile-card {
    grid-template-columns: 66px minmax(0, 1fr);
    gap: 12px;
    padding: 13px;
  }
}

/* ============================================================
   14. VERY SMALL MOBILE
   ============================================================ */

@media (max-width: 410px) {
  .admin-mobile-actions {
    grid-template-columns: 1fr;
  }

  .admin-mobile-actions .admin-action {
    min-height: 40px;
  }

  .admin-pager-inner {
    gap: 5px;
  }

  .admin-page-numbers {
    gap: 4px;
  }

  .admin-page-link {
    min-width: 30px;
    height: 30px;
    padding: 0 7px;
    font-size: 9px;
  }

  .team-mobile-card {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 10px;
  }
}

/* ============================================================
   15. REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

  .admin-search input,
  .admin-filter,
  .admin-table tbody tr,
  .admin-action,
  .admin-page-link {
    transition: none !important;
  }

  .admin-action:hover,
  .admin-page-link:hover {
    transform: none !important;
  }
}