/* ─── SoulTrader — Dark Theme ────────────────────────────────────────────── */

:root {
  --bg-primary: #0d0d0d;
  --bg-secondary: #151515;
  --bg-tertiary: #1c1c1c;
  --bg-card: #181818;
  --bg-card-hover: #1f1f1f;
  --bg-input: #141414;
  --border-color: #2a2a2a;
  --border-subtle: #222;
  --text-primary: #e8e8e8;
  --text-secondary: #999;
  --text-muted: #666;
  --accent: var(--game-accent, #c91010);
  --accent-rgb: var(--game-accent-rgb, 201, 16, 16);
  --secondary: var(--game-secondary, #0061ff);
  --secondary-rgb: var(--game-secondary-rgb, 0, 97, 255);
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --transition: 0.2s ease;
  --font: 'Spectral', Georgia, serif;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scrollbar-color: #2e2e2f #141414;
  scrollbar-width: thin;
  font-family: var(--font);
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent);
}

button, input, select, textarea {
  font-family: var(--font);
}

/* ─── Navbar ─────────────────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 2000;
  backdrop-filter: blur(12px);
}

.navbar .brand {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.navbar .brand a {
  color: var(--text-primary);
}

.navbar .brand a:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links a {
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: color var(--transition);
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-links .nav-active {
  color: var(--accent);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

/* ─── Main Content ───────────────────────────────────────────────────────── */
.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 80px 1.5rem 3rem;
}

/* ─── Header Logo ────────────────────────────────────────────────────────── */
.header-logo {
  text-align: center;
  padding: 1.5rem 0 1rem;
}

.header-logo img {
  max-width: 400px;
  width: 100%;
  height: auto;
  opacity: 0.95;
}

/* ─── Section Titles ─────────────────────────────────────────────────────── */
.section-title {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  letter-spacing: 0.5px;
}

/* ─── Filter Bar ─────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── Form Controls ──────────────────────────────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  transition: border-color var(--transition);
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--text-muted);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.85;
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.btn-success:hover {
  opacity: 0.85;
}

.btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-full {
  width: 100%;
}

/* ─── Trade Card Grid ────────────────────────────────────────────────────── */
.offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
}

.trade-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.trade-card:hover {
  border-color: var(--border-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.offer-heading {
  text-align: center;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.offer-heading .time-ago {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.trade-card-inner {
  display: flex;
  gap: 2px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.offered-col,
.requested-col {
  flex: 1;
  padding: 0.75rem;
  min-height: 60px;
}

.offered-col {
  background: rgba(var(--accent-rgb), 0.12);
  border: 2px solid rgba(var(--accent-rgb), 0.4);
  border-radius: var(--radius) 0 0 var(--radius);
}

.requested-col {
  background: rgba(var(--secondary-rgb), 0.12);
  border: 2px solid rgba(var(--secondary-rgb), 0.4);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.offered-col h2,
.requested-col h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-align: center;
}

.offered-col ul,
.requested-col ul {
  list-style: none;
  text-align: center;
  font-size: 0.85rem;
}

.offered-col li,
.requested-col li {
  padding: 0.15rem 0;
}

.trade-details {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.trade-details .platform {
  margin-bottom: 0.25rem;
}

.trade-details .notes {
  color: var(--text-muted);
  font-style: italic;
}

.trade-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.trade-actions .btn {
  flex: 1;
}

.game-badge {
  display: inline-block;
  background: rgba(var(--accent-rgb), 0.2);
  color: var(--accent);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ─── Status Badges ──────────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-open { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.status-awaiting { background: rgba(234, 179, 8, 0.15); color: var(--warning); }
.status-completed { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.status-declined { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.status-cancelled { background: rgba(107, 114, 128, 0.15); color: #6b7280; }

/* ─── Tooltip ────────────────────────────────────────────────────────────── */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.tooltip .tooltiptext {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 8px);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  min-width: 120px;
  text-align: center;
  line-height: 1.4;
  transition: visibility 0.2s, opacity 0.2s;
  z-index: 999;
  white-space: nowrap;
}

.tooltip .tooltiptext::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: var(--bg-tertiary) transparent transparent transparent;
}

.tooltip:hover .tooltiptext,
.tooltip:focus-within .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 3000;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.modal-content h2 {
  margin-bottom: 1.25rem;
  text-align: center;
  font-size: 1.2rem;
}

.modal-content label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  margin-top: 0.75rem;
}

.modal-content .close-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-content .close-btn:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* ─── Flash Messages ─────────────────────────────────────────────────────── */
.flash-message {
  background: var(--bg-secondary);
  border-left: 3px solid var(--success);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.flash-message.flash-success {
  border-left-color: var(--success);
}

.flash-message.flash-error {
  border-left-color: var(--danger);
  color: var(--danger);
}

.flash-message.flash-warning {
  border-left-color: var(--warning);
  color: var(--warning);
}

/* Legacy alias */
.flash-message.error {
  border-left-color: var(--danger);
  color: var(--danger);
}

.flash-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.85;
  transition: opacity var(--transition);
}

.flash-link:hover {
  opacity: 1;
  color: inherit;
}

/* Inline button styled as a link (for resend forms) */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity var(--transition);
}

.link-btn:hover {
  opacity: 1;
}

/* ─── No Offers Card ─────────────────────────────────────────────────────── */
.no-offers-card {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 1rem;
}

/* ─── Dropdown (item search) ─────────────────────────────────────────────── */
.dropdown {
  list-style: none;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  position: absolute;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  width: 100%;
  border-radius: var(--radius);
  scrollbar-color: #2e2e2f var(--bg-secondary);
  scrollbar-width: thin;
}

.dropdown li {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background var(--transition);
}

.dropdown li:hover {
  background: var(--bg-tertiary);
}

/* ─── Item Grid (trade creation) ─────────────────────────────────────────── */
.item-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0.5rem;
}

.item-box {
  position: relative;
}

.item-box img {
  width: 48px;
  height: 48px;
  border-radius: 4px;
}

.remove-item {
  position: absolute;
  top: -4px;
  right: -4px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  cursor: pointer;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
}

.remove-item:hover {
  background: var(--danger);
}

/* ─── Homepage Grid ──────────────────────────────────────────────────────── */
.home-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 900px;
  margin: 2rem auto;
  gap: 1.5rem;
}

.home-grid .main-image {
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-lg);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
}

.game-grid a {
  display: block;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition);
}

.game-grid a:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.game-grid img {
  width: 100%;
  display: block;
}

/* ─── Profile Page ───────────────────────────────────────────────────────── */
.profile-header {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-color);
}

.profile-info h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.profile-info .profile-role {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.profile-stats {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.profile-stat {
  text-align: center;
}

.profile-stat .stat-value {
  font-size: 1.4rem;
  font-weight: 700;
}

.profile-stat .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.profile-linked {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.linked-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
}

.profile-bio {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

/* ─── Profile Sections (new unified style) ───────────────────────────────── */
.profile-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.profile-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.profile-subsection-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  margin-top: 0.5rem;
}

/* ─── Contact Details ────────────────────────────────────────────────────── */
.contact-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.contact-platform {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 52px;
  text-align: center;
  flex-shrink: 0;
}

.contact-discord { background: #5865f2; color: #fff; }
.contact-steam   { background: #1b2838; color: #c7d5e0; border: 1px solid #2a475e; }
.contact-psn     { background: #003087; color: #fff; }
.contact-xbox    { background: #107c10; color: #fff; }

.contact-value {
  color: var(--text-secondary);
  word-break: break-all;
}

.contact-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .contact-edit-grid {
    grid-template-columns: 1fr;
  }
}

.contact-edit-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ─── Auth pages (forgot/reset password) ────────────────────────────────── */
.auth-page-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 3rem 1rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%;
  max-width: 440px;
}

.auth-card-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.auth-card-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.modal-link {
  color: var(--text-secondary);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 0.85rem;
  transition: color var(--transition);
}

.modal-link:hover {
  color: var(--accent);
}

/* ─── Admin Dashboard ────────────────────────────────────────────────────── */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
}

.stat-card .stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-card .stat-title {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.25rem;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 3rem;
}
