/* ==========================================================================
   FRIENDS SYSTEM & LIVE 3x3 CARD TRADING OVERLAYS
   ========================================================================== */

.sq-menu-badge {
  margin-left: auto;
  background: var(--green);
  color: #08131d;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  line-height: 1.4;
}

.sq-friends-modal {
  max-width: 560px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-x: hidden;
}

.sq-friends-search-box {
  flex: 1 1 auto;
  min-width: 0 !important;
  max-width: none !important;
}

.sq-friends-search-box .sq-search-input {
  width: 100%;
  min-width: 0;
}

.sq-friends-search-row #btn-friends-search-submit {
  flex-shrink: 0;
  white-space: nowrap;
}

.sq-friend-username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.sq-badge-befreundet {
  background: rgba(61, 204, 142, 0.16);
  border-color: rgba(61, 204, 142, 0.45);
  color: #3DCC8E;
}

.sq-friends-search-wrap {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sq-friends-section-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text2);
}

.sq-friends-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sq-friends-search-results {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sq-friends-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sq-friends-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
}

.sq-friends-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 2px;
}

.sq-friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.2s var(--silk);
}

.sq-friend-row:hover {
  border-color: var(--border2);
}

.sq-friend-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.sq-friend-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--sky3), var(--sky));
  border: 2px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text-on-accent);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.sq-friend-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.sq-friend-online-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text3);
  display: inline-block;
  flex-shrink: 0;
}

.sq-friend-online-dot.online {
  background: var(--green);
  box-shadow: 0 0 8px rgba(61, 204, 142, 0.8);
}

.sq-friend-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sq-friend-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.sq-friend-stats-line {
  font-size: 0.75rem;
  color: var(--text2);
}

.sq-friend-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sq-friends-modal .sq-modal-header {
  margin-bottom: 0;
}

.sq-friends-tabs {
  width: 100%;
}

.sq-friends-tabs .sq-seg-tab {
  flex: 1 1 0;
  justify-content: center;
}

.sq-friends-tab-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  margin-left: 4px;
}

.sq-friends-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.sq-friends-invite-wrap {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sq-friends-invite-help {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text2);
}

.sq-friends-invite-create-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sq-friends-invite-create-row .sq-input {
  flex: 1 1 auto;
  min-width: 0;
}

.sq-friends-invite-create-row button {
  flex-shrink: 0;
  white-space: nowrap;
}

.sq-friends-empty-hint {
  text-align: center;
  padding: 20px 12px;
  color: var(--text2);
  font-size: 0.82rem;
  background: var(--bg2);
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.sq-friends-token-row {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.sq-friends-token-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.sq-friends-token-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.sq-friends-token-desc {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sq-friends-token-meta {
  font-size: 0.72rem;
  color: var(--text2);
}

.sq-friends-token-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sq-badge-token-expired {
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.5);
  color: #f43f5e;
}

.sq-btn-token-revoke {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
}

/* Small Trade Wait / Incoming Modals */
.sq-trade-small-modal {
  max-width: 400px;
  text-align: center;
  padding: 26px 22px;
}

.sq-trade-spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 14px auto;
  border-radius: 50%;
  border: 3px solid rgba(var(--accent-rgb), 0.25);
  border-top-color: var(--sky);
  animation: sqSpin 0.9s linear infinite;
}

@keyframes sqSpin {
  to { transform: rotate(360deg); }
}

.sq-trade-wait-title,
.sq-trade-incoming-title {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.sq-trade-wait-sub {
  font-size: 0.83rem;
  color: var(--text2);
  margin-bottom: 16px;
}

/* Split 3x3 Trade Board Modal */
.sq-trade-board-modal {
  max-width: 940px;
  width: 95vw;
  max-height: 92vh;
  overflow-y: auto;
}

.sq-trade-split-layout {
  display: grid;
  grid-template-columns: 1fr 165px 1fr;
  gap: 14px;
  align-items: stretch;
  margin-top: 6px;
}

.sq-trade-half {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sq-trade-half.is-own-side {
  border-color: rgba(var(--accent-rgb), 0.5);
  box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.08);
}

.sq-trade-half-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sq-trade-player-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.sq-trade-slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.sq-trade-slot {
  aspect-ratio: 2 / 3;
  background: var(--bg2);
  border: 1.5px dashed var(--border2);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  font-size: 0.72rem;
  transition: all 0.2s var(--silk);
  padding: 0;
}

.sq-trade-slot.is-interactive {
  cursor: pointer;
}

.sq-trade-slot.is-interactive:hover {
  border-color: var(--sky);
  color: var(--sky);
  background: rgba(var(--accent-rgb), 0.08);
}

.sq-trade-slot.has-card {
  border-style: solid;
  border-color: var(--border2);
}

.sq-trade-slot.has-card[data-rarity="gewoehnlich"] {
  border-color: rgba(148, 163, 184, 0.7);
}

.sq-trade-slot.has-card[data-rarity="selten"] {
  border-color: #38bdf8;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.sq-trade-slot.has-card[data-rarity="episch"] {
  border-color: #c084fc;
  box-shadow: 0 4px 14px rgba(168, 85, 247, 0.32);
}

.sq-trade-slot.has-card[data-rarity="legendaer"] {
  border-color: #fbbf24;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
}

.sq-trade-slot.has-card[data-rarity="einzigartig"] {
  border-color: #f43f5e;
  box-shadow: 0 4px 18px rgba(244, 63, 94, 0.45);
}

.sq-trade-slot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sq-trade-slot-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 14, 22, 0.65) 0%, transparent 40%, rgba(10, 14, 22, 0.92) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px 6px;
  text-align: left;
}

.sq-trade-slot-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
}

.sq-trade-slot-cp {
  background: rgba(var(--bg-rgb), 0.88);
  border: 1px solid rgba(245, 176, 65, 0.55);
  color: #fde047;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 5px;
  white-space: nowrap;
}

.sq-trade-slot-elem-pill {
  background: rgba(var(--bg-panel-rgb), 0.88);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 1px 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sq-trade-slot-elem-img {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  object-fit: cover;
}

.sq-trade-slot-elem-svg {
  width: 10px;
  height: 10px;
  stroke: #38bdf8;
  stroke-width: 2.2px;
}

.sq-trade-slot-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(232, 90, 90, 0.92);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.sq-trade-slot-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sq-trade-half-footer {
  margin-top: auto;
}

.sq-trade-confirm-btn.is-confirmed {
  background: linear-gradient(135deg, #27ae60, var(--green)) !important;
  border-color: #ffffff !important;
  color: #071510 !important;
  font-weight: 800;
  box-shadow: 0 0 18px rgba(61, 204, 142, 0.5);
}

/* Center Container with Left CP, Vertical Arrows (Left & Right), and Right CP */
.sq-trade-center-container {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  align-self: center;
  width: 100%;
}

.sq-trade-center-cp {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sq-trade-cp-left {
  align-items: flex-start;
  text-align: left;
  padding-left: 2px;
}

.sq-trade-cp-right {
  align-items: flex-end;
  text-align: right;
  padding-right: 2px;
}

.sq-trade-cp-caption {
  font-size: 0.68rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sq-trade-center-cp strong {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: #fde047;
  font-weight: 800;
}

.sq-trade-arrows-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 0;
}

.sq-trade-arrow-row {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
  color: var(--sky);
}

.sq-trade-hint {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--text2);
  text-align: center;
}

/* Trade Card Picker Modal (Album Style) */
.sq-trade-picker-modal {
  max-width: 960px;
  width: 94vw;
  max-height: 88vh;
  height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 20px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(var(--bg-panel-rgb), 0.98) 0%, rgba(var(--bg-rgb), 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(var(--accent-vivid-rgb), 0.15);
  border-radius: 16px;
}

.sq-trade-picker-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(var(--bg-panel-rgb), 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  backdrop-filter: blur(8px);
}

.sq-trade-picker-toolbar .sq-search-box {
  flex: 1 1 200px;
  min-width: 170px;
  margin-bottom: 0;
}

.sq-trade-picker-filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sq-trade-picker-toolbar .sq-select {
  height: 36px;
  font-size: 0.8rem;
  padding: 0 28px 0 10px;
  background-color: rgba(var(--bg-elevated-rgb), 0.85);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.sq-trade-picker-body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding-right: 4px;
}

.sq-trade-picker-binder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  align-content: start;
}

/* Subtle Inspect Button on Mini Card */
.sq-mini-inspect-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(var(--bg-panel-rgb), 0.75);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 5;
}

.sq-mini-inspect-btn:hover {
  background: var(--sky);
  color: var(--text-on-accent);
  border-color: #ffffff;
  transform: scale(1.1);
}

.sq-mini-inspect-svg {
  width: 10px;
  height: 10px;
  stroke-width: 2.4px;
}

@media (max-width: 780px) {
  .sq-trade-picker-modal {
    padding: 12px 12px 16px;
    height: 90vh;
    max-height: 92vh;
  }
  .sq-trade-picker-toolbar {
    padding: 8px;
    gap: 8px;
  }
  .sq-trade-picker-toolbar .sq-search-box {
    flex: 1 1 100%;
  }
  .sq-trade-picker-filter-group {
    width: 100%;
    justify-content: space-between;
  }
  .sq-trade-picker-filter-group .sq-select {
    flex: 1 1 calc(50% - 4px);
    min-width: 120px;
  }
  .sq-trade-picker-binder-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }
  .sq-trade-split-layout {
    grid-template-columns: 1fr;
  }
  .sq-trade-center-container {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
  }
  .sq-trade-arrows-box {
    padding: 6px 14px;
  }
}
