:root {
  --bg-deep: #0b0b10;
  --bg-main: #0f0f14;
  --bg-card: #15151d;
  --bg-card-hover: #1a1a24;
  --bg-elevated: #1c1c28;
  --bg-input: #15151d;
  --border: rgba(255, 255, 255, 0.05);
  --border-hover: rgba(255, 255, 255, 0.1);
  --accent: #9b5cff;
  --accent-dark: #6a00ff;
  --accent-gradient: linear-gradient(135deg, #9b5cff, #6a00ff);
  --accent-glow: rgba(155, 92, 255, 0.4);
  --text: #ffffff;
  --text-secondary: #aaa;
  --text-muted: #777;
  --success: #22C55E;
  --danger: #EF4444;
  --warning: #F59E0B;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 40px;
  --sidebar-w: 240px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  display: flex;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: #b77dff; }

/* ========== SIDEBAR ========== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-main);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  padding: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo a {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 4px;
  text-transform: uppercase;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding: 0.5rem 0;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.75rem 1.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.03);
}

.sidebar-nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(155,92,255,0.08);
  box-shadow: inset 0 0 20px rgba(155,92,255,0.05);
}

.sidebar-nav .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
}

.sidebar-bottom {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

.lang-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  justify-content: center;
}

.lang-toggle a {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 600;
  color: #777;
  transition: all 0.2s;
}

.lang-toggle a.active {
  color: #fff;
  background: rgba(155,92,255,0.3);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.75rem;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  box-shadow: 0 0 10px var(--accent-glow);
  flex-shrink: 0;
}

.sidebar-email {
  font-size: 0.8rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-action { width: 100%; }

/* Hamburger button */
.sidebar-hamburger {
  display: none;
  position: absolute;
  top: 22px;
  right: -48px;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  z-index: 1001;
}

.sidebar-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: 0.3s;
}

/* ========== MAIN CONTENT ========== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  background-image: radial-gradient(ellipse at 50% 0%, rgba(155,92,255,0.03) 0%, transparent 60%);
}

.content-wrap {
  flex: 1;
  padding: 2rem 2.5rem;
  max-width: 1400px;
  width: 100%;
}

/* ========== FOOTER ========== */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 2rem 2.5rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.footer h6 {
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.footer p, .footer a {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.8;
}

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

.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ========== HERO ========== */
.hero {
  text-align: center;
  padding: 4rem 0 2.5rem;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 0.75rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 1.5rem;
  line-height: 1.7;
}

.hero-search { max-width: 500px; margin: 0 auto; }

.input-group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
  display: flex;
  align-items: stretch;
}

.input-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group input {
  background: transparent !important;
  border: none !important;
  color: var(--text) !important;
  padding: 0.85rem 1.5rem !important;
  font-size: 0.95rem;
  font-family: var(--font);
  flex: 1;
  min-width: 0;
  outline: none;
}

.input-group input::placeholder { color: var(--text-muted); }

.input-group .btn {
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0 !important;
  padding: 0.85rem 1.8rem;
  font-weight: 600;
  border: none;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s;
  font-family: var(--font);
  margin: 0;
  height: auto;
  white-space: nowrap;
}

.input-group .btn-primary { background: var(--accent-gradient); }
.input-group .btn-primary:hover { filter: brightness(1.1); }

/* ========== BUTTONS ========== */
.btn {
  font-family: var(--font);
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
  transition: all 0.25s;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-primary { background: var(--accent-gradient); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 20px var(--accent-glow); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: rgba(155,92,255,0.1); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { transform: translateY(-1px); }

.btn-sm { padding: 0.35rem 1rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1rem; }

/* ========== CARDS ========== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all 0.3s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}

.card-img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: contain;
  padding: 1rem;
  background: rgba(0,0,0,0.3);
}

.card-img-placeholder {
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.card-body { padding: 1.1rem; flex: 1; display: flex; flex-direction: column; }
.card-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.4rem; line-height: 1.3; color: var(--text); }
.card-text { color: var(--text-secondary); font-size: 0.82rem; }
.card-price { font-size: 1.15rem; font-weight: 700; color: var(--text); }

.card-meta {
  margin-top: auto;
  padding-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ========== SECTIONS ========== */
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ========== STEPS ========== */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.step-card {
  text-align: center;
  padding: 2rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all 0.3s;
}

.step-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.step-number {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(155,92,255,0.12);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem; margin: 0 auto 1rem;
}

.step-card h5 { font-weight: 600; font-size: 1rem; margin-bottom: 0.5rem; }
.step-card p { color: var(--text-secondary); font-size: 0.85rem; margin: 0; line-height: 1.6; }

/* ========== FORMS ========== */
.form-control, .input-group-text {
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  font-family: var(--font);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
}

.form-control::placeholder { color: var(--text-muted); }
.form-label { font-weight: 500; font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 0.3rem; }
.form-text { color: var(--text-muted); font-size: 0.8rem; }

textarea.form-control { resize: vertical; min-height: 60px; }

/* ========== BADGES ========== */
.badge {
  font-weight: 500;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  display: inline-block;
}

.badge-active { background: rgba(34,197,94,0.12); color: var(--success); }
.badge-finished { background: rgba(119,119,119,0.2); color: var(--text-muted); }
.badge-bid { background: rgba(155,92,255,0.12); color: var(--accent); }

/* ========== TABLES ========== */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.table { width: 100%; color: var(--text); font-size: 0.88rem; border-collapse: collapse; --bs-table-bg: transparent; }
.table th {
  font-weight: 600; color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 1rem; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.5px; text-align: left;
  white-space: nowrap;
}
.table td { border-bottom: 1px solid rgba(255,255,255,0.03); padding: 0.7rem 1rem; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }

/* ========== ALERTS ========== */
.alert {
  border: none;
  border-radius: var(--radius-md);
  padding: 0.9rem 1.2rem;
  font-size: 0.88rem;
}
.alert-danger { background: rgba(239,68,68,0.08); color: var(--danger); border: 1px solid rgba(239,68,68,0.15); }
.alert-warning { background: rgba(245,158,11,0.08); color: var(--warning); border: 1px solid rgba(245,158,11,0.15); }
.alert-info { background: rgba(155,92,255,0.08); color: var(--accent); border: 1px solid rgba(155,92,255,0.15); }
.alert-success { background: rgba(34,197,94,0.08); color: var(--success); border: 1px solid rgba(34,197,94,0.15); }

/* ========== MISC ========== */
.countdown {
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.text-muted { color: var(--text-muted); }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem;
}

.page-header h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.3px; margin: 0; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state p { margin-bottom: 1rem; }

.auth-form {
  max-width: 400px; margin: 2rem auto;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 2rem;
}
.auth-form h2 { text-align: center; font-weight: 700; font-size: 1.35rem; margin-bottom: 1.25rem; }

.auth-link {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ========== AUCTION DETAIL ========== */
.auction-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.auction-main-image {
  background: rgba(0,0,0,0.4);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.auction-main-image img { width: 100%; max-height: 400px; object-fit: contain; padding: 1.5rem; display: block; margin: 0 auto; }
.auction-main-image .placeholder {
  height: 350px; display: flex; align-items: center;
  justify-content: center; color: var(--text-muted);
}

.auction-thumbs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.auction-thumbs .thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  background: rgba(0,0,0,0.3);
  transition: border-color 0.2s;
}

.auction-thumbs .thumb.active {
  border-color: var(--accent);
}

.auction-cardname {
  text-align: center;
  margin-top: 0.75rem;
  margin-bottom: 0;
}

.price-lg { font-size: 1.3rem; }

.auction-desc {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
}

.auction-ended {
  color: var(--text-secondary);
  margin-top: 1rem;
}

.contact-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.contact-section h6 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.contact-section .contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.contact-section .contact-item strong {
  color: var(--text);
  min-width: 80px;
}

.bid-form { margin-top: 1rem; }

.bid-input-wrap {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.25rem;
}

.bid-currency {
  padding: 0.6rem 0.8rem;
  color: var(--text-muted);
}

.bid-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 0.6rem 0.5rem;
  outline: none;
  font-size: 0.95rem;
  min-width: 0;
}

.bid-btn { white-space: nowrap; }

/* Upload section */
.upload-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 1rem;
}

.upload-section h6 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.upload-row label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  min-width: 50px;
}

.upload-row input[type="file"] {
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.pagination .page-info {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Profile */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.profile-card { padding: 1.25rem; }
.profile-card h5 { margin-bottom: 1rem; }
.profile-wins-header { margin: 1.5rem 0 1rem; }

/* Scryfall notice */
.scryfall-notice {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2rem;
  opacity: 0.6;
}

/* Auction new page */
.auction-new-wrap { max-width: 500px; margin: 0 auto; }

/* ========== ANIMATION ========== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.card, .step-card, .hero > * { animation: fadeUp 0.5s ease-out forwards; }
.step-card:nth-child(2) { animation-delay: 0.1s; }
.step-card:nth-child(3) { animation-delay: 0.2s; }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: rgba(155,92,255,0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(155,92,255,0.3); }

/* ========== RESPONSIVE ========== */
@media (max-width: 1100px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
  .steps-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .auction-layout { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 768px) {
  .sidebar {
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar.open ~ .sidebar-overlay,
  .sidebar-overlay:has(+ .sidebar.open) { display: block; }
  .sidebar-hamburger { display: flex; }
  .sidebar-logo { height: 80px; }
  .sidebar-logo a {
    writing-mode: horizontal-tb;
    font-size: 1.1rem;
  }
  .sidebar-nav a span { display: inline; }
  .sidebar-nav a { padding: 0.75rem 1.5rem; justify-content: flex-start; }
  .sidebar-bottom { display: flex; flex-direction: column; }
  .sidebar-user { flex-direction: column; text-align: center; }

  .main-content { margin-left: 0; }
  .content-wrap { padding: 1rem; }
  .footer { padding: 1.5rem 1rem; }
  .hero { padding: 2rem 0 1.5rem; }
  .hero h1 { font-size: clamp(1.4rem, 5vw, 2rem); }
  .hero p { font-size: 0.95rem; }
  .input-group { flex-wrap: nowrap; }
  .input-group input { padding: 0.7rem 1rem !important; font-size: 0.9rem !important; }
  .input-group .btn { padding: 0.7rem 1.2rem; font-size: 0.85rem; }
  .section-title { font-size: 1.1rem; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem; }
  .card-body { padding: 0.75rem; }
  .card-title { font-size: 0.82rem; }
  .card-price { font-size: 1rem; }
  .page-header h2 { font-size: 1.1rem; }
  .auth-form { padding: 1.25rem; }
  .auction-main-image img { max-height: 280px; }
  .bid-input-wrap { flex-wrap: wrap; }
  .bid-btn { width: 100%; }
  .table { font-size: 0.82rem; }
  .table th, .table td { padding: 0.5rem 0.75rem; }
}

@media (max-width: 480px) {
  .content-wrap { padding: 0.75rem; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.5rem; }
  .card-img { padding: 0.5rem; }
  .card-body { padding: 0.5rem; }
  .card-title { font-size: 0.75rem; }
  .card-price { font-size: 0.9rem; }
  .card-meta { flex-direction: column; gap: 4px; }
  .card-meta .btn { width: 100%; }
  .badge { font-size: 0.65rem; padding: 0.15rem 0.45rem; }
  .hero { padding: 1.5rem 0 1rem; }
  .section-title { font-size: 1rem; margin-bottom: 0.75rem; }
  .page-header h2 { font-size: 1rem; }
  .footer { padding: 1rem 0.75rem; }
  .footer-grid { gap: 1rem; }
}
