/* -- Profile page styles -- */

.page-header {
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.page-header .eyebrow {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 4px;
}
.page-title {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--strong);
  letter-spacing: -0.04em;
  line-height: 1.05;
}

/* not signed in */
.profile-unsigned {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding: 32px;
  background: var(--s1);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
}
.profile-google-btn {
  font-size: 0.95rem;
  min-height: 54px;
  padding: 8px 18px 8px 10px;
}

/* avatar card */
.profile-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  margin-bottom: 20px;
  position: relative;
}
.profile-signout-topright {
  margin: 0;
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 14px;
  font-size: 0.75rem;
}
.profile-avatar {
  border-radius: 50%;
  border: 2px solid var(--border2);
  object-fit: cover;
  flex-shrink: 0;
}
.profile-display-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--strong);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.profile-user-email {
  font-size: 0.8rem;
  color: var(--muted);
}

/* detail sections */
.profile-section {
  background: var(--s1);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.profile-section-title {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  font-weight: 700;
  padding: 9px 16px;
  background: var(--s2);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}

.profile-field {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.profile-field:last-child { border-bottom: none; }
.profile-field-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  /* High-contrast labels: white in dark mode, near-black in light mode. */
  color: var(--strong);
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Per-field origin pill in the My Hardware / Web prefill pane. Empty by
   default so untagged fields don't get a stray border. profile.js fills
   textContent + data-origin when it knows where a value came from. */
.profile-field-origin {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  padding: 1px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  line-height: 1.4;
}
.profile-field-origin:empty { display: none; }
.profile-field-origin[data-origin="default-system"] {
  color: #9ecbe8;
  border-color: rgba(74,159,208,0.35);
  background: rgba(74,159,208,0.1);
}
.profile-field-origin[data-origin="steam-paste"] {
  color: #a9d7b6;
  border-color: rgba(76,175,128,0.35);
  background: rgba(76,175,128,0.1);
}
.profile-field-origin[data-origin="manual"] {
  color: #d4b36a;
  border-color: rgba(212,168,67,0.4);
  background: rgba(212,168,67,0.1);
}
.profile-field-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--text);
  flex-wrap: wrap;
}
.profile-field-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}
.profile-prefill-source {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(74,159,208,0.28);
  background: rgba(74,159,208,0.08);
}
.profile-prefill-source--link {
  border-color: rgba(122,179,247,0.42);
  background:
    linear-gradient(135deg, rgba(74,159,208,0.16), rgba(122,179,247,0.08)),
    rgba(74,159,208,0.08);
}
.profile-link-entry {
  scroll-margin-top: 90px;
}
.profile-prefill-source-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--strong);
  margin-bottom: 6px;
}
.profile-prefill-source-body {
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.5;
}
.profile-select {
  background: var(--card-bg, var(--s1));
  border: 1px solid var(--border2);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.82rem;
  padding: 5px 10px;
  min-width: 180px;
}
.profile-select:focus { outline: none; border-color: var(--accent); }

.profile-textarea {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.78rem;
  font-family: var(--mono);
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.45;
}
.profile-textarea:focus { outline: none; border-color: var(--accent); }

.profile-parse-btn,
.profile-clear-btn {
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  background: none;
  border: 1px solid var(--border2);
  color: var(--text);
  cursor: pointer;
  transition: background .1s, border-color .1s, color .1s;
}
.profile-parse-btn { border-color: var(--accent); color: var(--accent); }
.profile-parse-btn:hover { background: rgba(74,159,208,0.12); }
.profile-clear-btn:hover { color: #e07070; border-color: #c85050; }

.profile-uid {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  background: rgba(74,159,208,0.07);
  border: 1px solid rgba(74,159,208,0.2);
  padding: 3px 8px;
  word-break: break-all;
}

.profile-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border2);
  color: var(--muted);
  font-size: 0.72rem;
  font-family: inherit;
  padding: 3px 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: color .1s, border-color .1s;
  position: relative;
}
.profile-copy:hover { color: var(--accent); border-color: var(--accent); }
.profile-copy.copied { color: var(--green); border-color: var(--green); }

.profile-provider-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(66,133,244,0.1);
  border: 1px solid rgba(66,133,244,0.3);
  color: #7ab3f7;
}

.profile-role-admin {
  background: rgba(220, 80, 80, 0.1);
  border-color: rgba(220, 80, 80, 0.35);
  color: #e88a8a;
}

.profile-admin-link {
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  margin-left: 10px;
}
.profile-admin-link:hover { text-decoration: underline; }

/* danger zone */
.profile-section-danger .profile-section-title {
  color: #c85050;
  border-left-color: #c85050;
}
.profile-danger-note {
  padding: 12px 16px 4px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}
.profile-signout-btn {
  margin: 8px 16px 16px;
  padding: 8px 20px;
  background: none;
  border: 1px solid rgba(200,80,80,0.4);
  color: #c85050;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .1s, border-color .1s, color .1s;
}
.profile-signout-btn:hover { background: rgba(200,80,80,0.1); border-color: #c85050; color: #e07070; }
.profile-delete-data-btn { border-color: rgba(200,50,50,0.6); color: #c83030; }
.profile-delete-data-btn:hover { background: rgba(200,50,50,0.15); border-color: #c83030; color: #e04040; }
.profile-delete-data-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.profile-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.profile-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.profile-toggle-track {
  width: 36px;
  height: 20px;
  background: var(--border2);
  border-radius: 999px;
  transition: background .15s;
  position: relative;
}
.profile-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
}
.profile-toggle input:checked + .profile-toggle-track { background: var(--accent); }
.profile-toggle input:checked + .profile-toggle-track::after { transform: translateX(16px); }

@media (max-width: 640px) {
  .profile-card { flex-direction: column; align-items: flex-start; }
  .profile-uid { word-break: break-all; }
  .profile-systems-details-grid { grid-template-columns: 1fr; }
}

.profile-refresh-btn {
  font-size: 0.7rem;
  font-family: inherit;
  background: none;
  border: 1px solid var(--border2);
  color: var(--muted);
  padding: 2px 10px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
}
.profile-refresh-btn:hover { color: var(--accent); border-color: var(--accent); }

.profile-tabs {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}
.profile-tab-btn {
  font-size: 0.7rem;
  font-family: inherit;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--muted);
  padding: 3px 10px;
  cursor: pointer;
}
.profile-tab-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(74,159,208,0.1);
}
.profile-tab-panel { display: none; }
.profile-tab-panel.active { display: block; }

.profile-systems-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.profile-systems-table th,
.profile-systems-table td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.profile-systems-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.profile-systems-table tbody tr:last-child td { border-bottom: none; }
.profile-systems-table td.col-default,
.profile-systems-table th.col-default {
  text-align: center;
  vertical-align: middle;
  width: 110px;
}
.profile-systems-table td.col-action,
.profile-systems-table th.col-action {
  vertical-align: middle;
  white-space: nowrap;
}
.profile-systems-label-input {
  background: transparent;
  border: 1px dashed transparent;
  color: var(--text);
  font-size: 0.82rem;
  font-family: inherit;
  padding: 2px 6px;
  width: 100%;
}
.profile-systems-label-input:hover,
.profile-systems-label-input:focus {
  border-color: var(--border2);
  outline: none;
}
.profile-systems-label-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}
.profile-systems-summary {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.45;
}
.profile-systems-default-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.profile-systems-default-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.profile-systems-default-switch {
  width: 34px;
  height: 18px;
  background: var(--border2);
  border-radius: 999px;
  position: relative;
  transition: background .15s;
}
.profile-systems-default-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
}
.profile-systems-default-toggle input:checked + .profile-systems-default-switch {
  background: rgba(212, 168, 67, 0.85);
}
.profile-systems-default-toggle input:checked + .profile-systems-default-switch::after {
  transform: translateX(16px);
}
.profile-systems-default-text {
  font-size: 0.7rem;
  color: var(--muted);
  /* Always reserve "Default" worth of horizontal space so the switch sits
     at the same x position whether the row is the current default or not.
     visibility:hidden keeps the layout but skips the text rendering when
     the row isn't default */
  visibility: hidden;
  min-width: 48px;
  text-align: left;
}
.profile-systems-default-toggle input:checked ~ .profile-systems-default-text {
  color: #e6c160;
  visibility: visible;
}
.profile-systems-details-row td {
  padding-top: 0;
  background: rgba(255,255,255,0.02);
}
.profile-systems-details-card {
  padding: 12px 0 14px;
}
.profile-systems-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
}
.profile-systems-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.profile-systems-detail-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.profile-systems-detail-value {
  font-size: 0.78rem;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}
.profile-systems-detail-note {
  margin-top: 10px;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.5;
}

/* -- My uploaded configs table -- */

.profile-configs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  table-layout: fixed;
}
.profile-configs-table th,
.profile-configs-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.profile-configs-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.profile-configs-table tbody tr:last-child td { border-bottom: none; }
/* Rating values are short (gold / platinum / dash), so cap the column small.
   The table is table-layout:fixed, so a wide Rating column was starving the
   actions column and wrapping the View/Publish/Edit/Delete buttons onto two
   rows. A narrow Rating column gives the actions room to stay on one line. */
.profile-configs-table th:nth-child(2),
.profile-configs-table td:nth-child(2) { width: 92px; }
.profile-configs-table td.col-action,
.profile-configs-table th.col-action {
  text-align: right;
  /* 210px was tight: 4 buttons / 5px gaps left ~46px per button which
     truncated Publish -> "Pu..." and Delete -> "Del..." on desktop.
     min-width plus a max keeps the column generous on wide screens but
     still flexible enough to share space when the table is squeezed */
  min-width: 320px;
  width: auto;
  max-width: 360px;
}
.profile-configs-game-link {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.profile-configs-game-link:hover { color: var(--accent); text-decoration: underline; }
.profile-configs-appid {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 2px;
}
.profile-configs-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.profile-configs-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.profile-configs-badge--cloud {
  color: #9ecbe8;
  border-color: rgba(74,159,208,0.35);
  background: rgba(74,159,208,0.1);
}
.profile-configs-badge--published {
  color: #a9d7b6;
  border-color: rgba(76,175,128,0.35);
  background: rgba(76,175,128,0.1);
}
.profile-configs-badge--unpublished {
  color: #d4b36a;
  border-color: rgba(212,168,67,0.4);
  background: rgba(212,168,67,0.1);
}
.profile-configs-badge--pending {
  color: #c0a8e0;
  border-color: rgba(160,120,200,0.4);
  background: rgba(160,120,200,0.1);
}
.profile-configs-badge--flagged {
  color: #e88a8a;
  border-color: rgba(220,80,80,0.4);
  background: rgba(220,80,80,0.1);
}
.profile-configs-flagged-details {
  margin-top: 6px;
  font-size: 0.75rem;
}
.profile-configs-flagged-details summary {
  cursor: pointer;
  color: #e88a8a;
  user-select: none;
}
.profile-configs-flagged-details summary:hover {
  text-decoration: underline;
}
.profile-configs-flagged-details p {
  margin: 4px 0 0;
  color: var(--text-muted, #aaa);
  line-height: 1.4;
  max-width: 280px;
}
.profile-configs-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  width: 100%;
}
.profile-configs-view-link,
.profile-configs-action {
  font-size: 0.7rem;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border2);
  padding: 3px 8px;
  display: inline-block;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  flex: 0 0 auto;
  text-align: center;
  white-space: nowrap;
}
.profile-configs-view-link:hover,
.profile-configs-action:hover { color: var(--accent); border-color: var(--accent); }
.profile-configs-view-disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}
.profile-configs-publish-btn,
.profile-configs-unpublish-btn {
  min-width: 72px;
}
.profile-configs-unpublish-btn {
  color: #d4b36a;
  border-color: rgba(212,168,67,0.45);
}
.profile-configs-publish-btn,
.profile-configs-view-link:not(.profile-configs-view-disabled),
.profile-configs-edit-btn {
  color: #9ecbe8;
  border-color: rgba(74,159,208,0.45);
}
.profile-configs-delete-btn {
  color: #d76f6f;
  border-color: rgba(200,80,80,0.45);
}

/* Edit report modal */
.edit-report-modal {
  background: #1a2535;
  color: #c8d4e0;
  border: 1px solid #2a3f55;
  border-radius: 8px;
  padding: 24px;
  min-width: 340px;
  max-width: 520px;
  width: 90vw;
}
.edit-report-modal::backdrop {
  background: rgba(0,0,0,0.65);
}
.edit-report-title {
  margin: 0 0 18px;
  font-size: 1.1em;
  color: #e8f0f8;
}
.edit-report-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.edit-report-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.85em;
  color: #8fa0b0;
}
.edit-report-input {
  background: #0f1a25;
  color: #c8d4e0;
  border: 1px solid #2a3f55;
  border-radius: 4px;
  padding: 7px 10px;
  font-size: 0.95em;
  font-family: inherit;
  resize: vertical;
}
.edit-report-input:focus {
  outline: none;
  border-color: #4a9fd0;
}
.edit-report-status {
  min-height: 1.2em;
  margin: 12px 0 0;
  font-size: 0.85em;
  color: #d76f6f;
}
.edit-report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.edit-report-cancel,
.edit-report-save {
  padding: 7px 18px;
  border-radius: 4px;
  border: 1px solid #2a3f55;
  cursor: pointer;
  font-size: 0.9em;
  background: transparent;
  color: #8fa0b0;
}
.edit-report-cancel:hover { color: #c8d4e0; border-color: #4a5f70; }
.edit-report-save {
  color: #66c0f4;
  border-color: rgba(74,159,208,0.5);
}
.edit-report-save:hover { background: rgba(74,159,208,0.12); }
.edit-report-save:disabled { opacity: 0.5; cursor: not-allowed; }

.edit-report-history-section {
  margin-top: 16px;
  border-top: 1px solid #2a3f55;
  padding-top: 12px;
}
.edit-report-history-toggle {
  background: none;
  border: none;
  color: #4a9fd0;
  cursor: pointer;
  font-size: 0.82em;
  padding: 0;
  text-decoration: underline;
}
.edit-report-history-toggle:hover { color: #66c0f4; }
.edit-report-history-panel {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.edit-report-history-entry {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  background: #0f1a25;
  border-radius: 4px;
  border-left: 3px solid #2a3f55;
}
.hist-date {
  font-size: 0.78em;
  color: #4a9fd0;
  margin-bottom: 2px;
}
.hist-field {
  font-size: 0.82em;
  color: #8fa0b0;
}
.hist-field b { color: #c8d4e0; font-weight: 500; }
.hist-notes {
  white-space: pre-wrap;
  word-break: break-word;
}
.edit-report-history-empty {
  font-size: 0.82em;
  color: #4a5f70;
  margin: 0;
}

@media (max-width: 640px) {
  .profile-configs-table,
  .profile-configs-table thead,
  .profile-configs-table tbody,
  .profile-configs-table tr,
  .profile-configs-table th,
  .profile-configs-table td {
    display: block;
    width: 100%;
  }
  .profile-configs-table thead { display: none; }
  .profile-configs-table tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
  .profile-configs-table tbody tr:last-child { border-bottom: none; }
  .profile-configs-table td {
    border-bottom: none;
    padding: 5px 0;
  }
  .profile-configs-table td.col-action,
  .profile-configs-table th.col-action {
    width: 100%;
    text-align: left;
  }
  .profile-configs-actions {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
  }
  .profile-configs-view-link,
  .profile-configs-action {
    text-align: center;
    padding: 5px 4px;
    font-size: 0.65rem;
  }
}

/* system-edit: page header row keeps the title block left and the
   Parse-from-Steam pill on the right (wraps below on narrow screens). */
.sys-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.sys-page-header-titles { min-width: 0; }
.sys-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.6);
}
.sys-modal-overlay[hidden] { display: none; }
.sys-modal {
  width: 100%;
  max-width: 560px;
  background: var(--s1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.sys-modal-title { margin: 0 0 10px; font-size: 1.05rem; color: var(--strong); }
.sys-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

/* "Parse from Steam info" stands out from the outlined Save/Cancel buttons:
   a filled, rounded accent pill with a soft glow. Uses the theme accent vars
   so it tracks light/dark automatically. */
#steam-parse-open {
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hi);
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 7px 18px;
  box-shadow: 0 0 12px var(--accent-glow);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
#steam-parse-open:hover {
  background: var(--accent);
  color: #08131f;
  box-shadow: 0 0 18px var(--accent-glow);
}
