/*
 * GTARP UCP UI polish
 * Loaded after gtarp-2026.css and GTARP Mobile V2.
 */

/* Dashboard: full-width welcome + five statistics cards first. */
body.gtarp-ucp .gtarp-dashboard {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 305px !important;
  gap: 18px !important;
  align-items: start !important;
}

body.gtarp-ucp .gtarp-dashboard > .gtarp-welcome,
body.gtarp-ucp .gtarp-dashboard > .gtarp-kpis {
  grid-column: 1 / -1 !important;
  width: 100% !important;
}

body.gtarp-ucp .gtarp-dashboard > .gtarp-dashboard-main {
  grid-column: 1 !important;
  min-width: 0 !important;
}

body.gtarp-ucp .gtarp-dashboard > .gtarp-dashboard-side {
  grid-column: 2 !important;
  min-width: 0 !important;
}

body.gtarp-ucp .gtarp-kpis {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  gap: 14px !important;
}

body.gtarp-ucp .gtarp-kpi {
  min-width: 0 !important;
}

body.gtarp-ucp .gtarp-kpi-newest-member {
  align-items: center !important;
  padding: 15px !important;
}

body.gtarp-ucp .gtarp-newest-member-avatar {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  display: block;
  overflow: hidden;
  border: 2px solid rgba(185, 122, 145, .48);
  border-radius: 50%;
  background: var(--gt-panel-2);
}

body.gtarp-ucp .gtarp-newest-member-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

body.gtarp-ucp .gtarp-newest-member-copy {
  min-width: 0;
  flex: 1;
}

body.gtarp-ucp .gtarp-newest-member-name {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--gt-text) !important;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.gtarp-ucp .gtarp-newest-member-actions {
  min-height: 25px;
  margin-top: 7px;
  display: flex;
  align-items: center;
}

body.gtarp-ucp .gtarp-newest-member-actions form {
  margin: 0 !important;
}

body.gtarp-ucp .gtarp-newest-member-add,
body.gtarp-ucp .gtarp-newest-member-view,
body.gtarp-ucp .gtarp-newest-member-state {
  min-height: 25px !important;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 !important;
  padding: 5px 8px !important;
  color: #fff !important;
  background: linear-gradient(135deg, var(--gt-accent), var(--gt-accent-2));
  border: 1px solid var(--gt-border-strong);
  border-radius: 7px;
  font-size: 9px !important;
  font-weight: 850;
  line-height: 1;
  text-decoration: none !important;
  white-space: nowrap;
}

body.gtarp-ucp .gtarp-newest-member-state {
  color: var(--gt-text) !important;
  background: var(--gt-panel-2);
  border-color: var(--gt-border);
}

/* Friend remove button remains visible in both themes. */
body.gtarp-ucp .gtarp-profile-friend-grid .gtarp-icon-button {
  width: 31px !important;
  min-width: 31px !important;
  height: 31px !important;
  min-height: 31px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 !important;
  padding: 0 !important;
  color: #f4dbe6 !important;
  background: rgba(207, 85, 109, .13) !important;
  border: 1px solid rgba(222, 112, 134, .35) !important;
  border-radius: 8px !important;
  opacity: 1 !important;
}

body.gtarp-ucp .gtarp-profile-friend-grid .gtarp-icon-button i {
  color: inherit !important;
  opacity: 1 !important;
}

body.gtarp-ucp .gtarp-profile-friend-grid .gtarp-icon-button:hover {
  color: #fff !important;
  background: #b83f52 !important;
  border-color: #d95568 !important;
}

/* Custom confirmation modal. */
.gtarp-friend-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 8, 11, .72);
  opacity: 0;
  visibility: hidden;
  transition: opacity .17s ease, visibility .17s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.gtarp-friend-confirm-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.gtarp-friend-confirm-dialog {
  width: min(430px, 100%);
  padding: 22px;
  color: var(--gt-text);
  background: var(--gt-panel);
  border: 1px solid var(--gt-border);
  border-radius: 15px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .42);
  transform: translateY(8px) scale(.985);
  transition: transform .17s ease;
}

.gtarp-friend-confirm-overlay.is-open .gtarp-friend-confirm-dialog {
  transform: translateY(0) scale(1);
}

.gtarp-friend-confirm-dialog h2 {
  margin: 0 0 8px !important;
  color: var(--gt-text) !important;
  font-size: 18px !important;
}

.gtarp-friend-confirm-dialog p {
  margin: 0 !important;
  color: var(--gt-muted) !important;
  font-size: 12px !important;
  line-height: 1.6 !important;
}

.gtarp-friend-confirm-actions {
  margin-top: 19px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.gtarp-friend-confirm-actions button {
  min-height: 38px !important;
  margin: 0 !important;
}

/* Complete light-mode correction for previously hard-coded dark surfaces. */
html[data-theme="light"] body.gtarp-ucp,
html[data-theme="light"] body.gtarp-ucp #wrapper,
html[data-theme="light"] body.gtarp-ucp .main,
html[data-theme="light"] body.gtarp-ucp .main-content {
  color: var(--gt-text) !important;
  background: var(--gt-bg) !important;
}

html[data-theme="light"] body.gtarp-ucp .gtarp-sidebar-brand,
html[data-theme="light"] body.gtarp-ucp .tab-content .nav-tabs,
html[data-theme="light"] body.gtarp-ucp .gtarp-capacity,
html[data-theme="light"] body.gtarp-ucp .input-group-addon,
html[data-theme="light"] body.gtarp-ucp .switchery,
html[data-theme="light"] body.gtarp-ucp .modal-footer,
html[data-theme="light"] body.gtarp-ucp .permission-savebar {
  color: var(--gt-text) !important;
  background: var(--gt-panel-2) !important;
  border-color: var(--gt-border) !important;
}

html[data-theme="light"] body.gtarp-ucp table,
html[data-theme="light"] body.gtarp-ucp .table,
html[data-theme="light"] body.gtarp-ucp .dataTable,
html[data-theme="light"] body.gtarp-ucp .table > thead > tr > th,
html[data-theme="light"] body.gtarp-ucp table > thead > tr > th,
html[data-theme="light"] body.gtarp-ucp .dataTable > thead > tr > th,
html[data-theme="light"] body.gtarp-ucp .table > tbody > tr > td,
html[data-theme="light"] body.gtarp-ucp table > tbody > tr > td,
html[data-theme="light"] body.gtarp-ucp .dataTable > tbody > tr > td,
html[data-theme="light"] body.gtarp-ucp .table-hover > tbody > tr:hover > td,
html[data-theme="light"] body.gtarp-ucp .table-striped > tbody > tr:nth-of-type(odd) > td {
  color: var(--gt-text) !important;
  background: var(--gt-panel) !important;
  border-color: var(--gt-border-soft) !important;
}

html[data-theme="light"] body.gtarp-ucp .gtarp-item-card,
html[data-theme="light"] body.gtarp-ucp .gtarp-character-picker,
html[data-theme="light"] body.gtarp-ucp .gtarp-guestbook-entry,
html[data-theme="light"] body.gtarp-ucp .gtarp-profile-friend-grid article,
html[data-theme="light"] body.gtarp-ucp .gtarp-status-row,
html[data-theme="light"] body.gtarp-ucp .gtarp-list-row,
html[data-theme="light"] body.gtarp-ucp .alert,
html[data-theme="light"] body.gtarp-ucp .gtarp-inline-search-results,
html[data-theme="light"] body.gtarp-ucp .pagination > li > a,
html[data-theme="light"] body.gtarp-ucp .pagination > li > span {
  color: var(--gt-text) !important;
  background: var(--gt-panel) !important;
  border-color: var(--gt-border) !important;
}

html[data-theme="light"] body.gtarp-ucp label,
html[data-theme="light"] body.gtarp-ucp .control-label,
html[data-theme="light"] body.gtarp-ucp .checkbox label,
html[data-theme="light"] body.gtarp-ucp .radio label,
html[data-theme="light"] body.gtarp-ucp .gtarp-kpi-value,
html[data-theme="light"] body.gtarp-ucp .gtarp-status-row span:first-of-type,
html[data-theme="light"] body.gtarp-ucp .gtarp-quick-link span,
html[data-theme="light"] body.gtarp-ucp .gtarp-feed-item b,
html[data-theme="light"] body.gtarp-ucp .gtarp-item-name,
html[data-theme="light"] body.gtarp-ucp .gtarp-account-profile-meta dd,
html[data-theme="light"] body.gtarp-ucp .gtarp-property-character strong,
html[data-theme="light"] body.gtarp-ucp .gtarp-property-tenant-row b,
html[data-theme="light"] body.gtarp-ucp .gtarp-mastodon-post-head strong,
html[data-theme="light"] body.gtarp-ucp .gtarp-mastodon-post p,
html[data-theme="light"] body.gtarp-ucp .gtarp-guestbook-entry p,
html[data-theme="light"] body.gtarp-ucp .modal-title,
html[data-theme="light"] body.gtarp-ucp .modal-body,
html[data-theme="light"] body.gtarp-ucp .close {
  color: var(--gt-text) !important;
}

html[data-theme="light"] body.gtarp-ucp .form-control,
html[data-theme="light"] body.gtarp-ucp input,
html[data-theme="light"] body.gtarp-ucp select,
html[data-theme="light"] body.gtarp-ucp textarea {
  color: var(--gt-text) !important;
  background: var(--gt-input) !important;
  border-color: var(--gt-border) !important;
}

html[data-theme="light"] body.gtarp-ucp .nav-tabs,
html[data-theme="light"] body.gtarp-ucp .tab-content,
html[data-theme="light"] body.gtarp-ucp .character-content,
html[data-theme="light"] body.gtarp-ucp .modal-content,
html[data-theme="light"] body.gtarp-ucp .modal-header {
  color: var(--gt-text) !important;
  background: var(--gt-panel) !important;
  border-color: var(--gt-border) !important;
}

html[data-theme="light"] body.gtarp-ucp .nav-tabs > li > a {
  color: var(--gt-muted) !important;
}

html[data-theme="light"] body.gtarp-ucp .nav-tabs > li.active > a,
html[data-theme="light"] body.gtarp-ucp .nav-tabs > li > a:hover {
  color: var(--gt-text) !important;
}

html[data-theme="light"] body.gtarp-ucp .gtarp-profile-friend-grid .gtarp-icon-button {
  color: #8f2f59 !important;
  background: rgba(184, 63, 82, .08) !important;
  border-color: rgba(184, 63, 82, .24) !important;
}

@media (max-width: 1280px) {
  body.gtarp-ucp .gtarp-kpi {
    padding: 13px !important;
    gap: 10px !important;
  }

  body.gtarp-ucp .gtarp-kpi-icon,
  body.gtarp-ucp .gtarp-newest-member-avatar {
    width: 46px !important;
    height: 46px !important;
    flex-basis: 46px !important;
  }

  body.gtarp-ucp .gtarp-kpi-value {
    font-size: 21px !important;
  }

  body.gtarp-ucp .gtarp-kpi-note {
    font-size: 9px !important;
  }
}

@media (max-width: 1040px) {
  body.gtarp-ucp .gtarp-dashboard {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.gtarp-ucp .gtarp-dashboard > .gtarp-dashboard-main,
  body.gtarp-ucp .gtarp-dashboard > .gtarp-dashboard-side {
    grid-column: 1 !important;
  }

  body.gtarp-ucp .gtarp-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 560px) {
  body.gtarp-ucp .gtarp-kpis {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.gtarp-ucp .gtarp-kpi {
    min-height: 92px !important;
  }

  .gtarp-friend-confirm-actions {
    flex-direction: column-reverse;
  }

  .gtarp-friend-confirm-actions button {
    width: 100% !important;
  }
}
