*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --ebay-blue: #3665f3;
  --ebay-blue-hover: #2a4fcf;
  --ebay-dark: #191919;
  --ebay-gray: #707070;
  --ebay-light-gray: #e5e5e5;
  --ebay-bg: #f7f7f7;
  --ebay-white: #ffffff;
  --ebay-red: #e0103a;
  --ebay-green: #5ba71b;
  --ebay-orange: #f5af02;
  --ebay-yellow: #fdd835;
  --header-height: 120px;
  --max-width: 1280px;
}

body {
  font-family: "Market Sans", Arial, Helvetica, sans-serif;
  color: var(--ebay-dark);
  background: var(--ebay-bg);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ── Top Bar ── */
.top-bar {
  background: var(--ebay-white);
  border-bottom: 1px solid var(--ebay-light-gray);
  font-size: 12px;
  color: var(--ebay-gray);
}

.top-bar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 6px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.top-bar-left a,
.top-bar-right a {
  color: var(--ebay-gray);
  margin-right: 16px;
  transition: color 0.15s;
}

.top-bar-left a:hover,
.top-bar-right a:hover {
  color: var(--ebay-blue);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ── Header ── */
.site-header {
  background: var(--ebay-white);
  border-bottom: 1px solid var(--ebay-light-gray);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
  flex-shrink: 0;
}

.logo span:nth-child(1) { color: #e53238; }
.logo span:nth-child(2) { color: #0064d2; }
.logo span:nth-child(3) { color: #f5af02; }
.logo span:nth-child(4) { color: #86b817; }

.search-bar {
  flex: 1;
  display: flex;
  height: 44px;
}

.search-bar input {
  flex: 1;
  border: 2px solid var(--ebay-dark);
  border-right: none;
  border-radius: 8px 0 0 8px;
  padding: 0 16px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.search-bar input:focus {
  border-color: var(--ebay-blue);
}

.search-bar button {
  background: var(--ebay-blue);
  color: #fff;
  border: none;
  padding: 0 18px;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  font-size: 18px;
  transition: background 0.15s;
}

.search-bar button:hover {
  background: var(--ebay-blue-hover);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

.header-actions a {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  color: var(--ebay-gray);
  transition: color 0.15s;
}

.header-actions a:hover {
  color: var(--ebay-blue);
}

.header-actions a .icon {
  font-size: 22px;
  margin-bottom: 2px;
}

.header-actions .cart-badge {
  position: relative;
}

.header-actions .cart-badge .badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--ebay-red);
  color: #fff;
  font-size: 10px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Category Nav ── */
.category-nav {
  background: var(--ebay-white);
  border-bottom: 1px solid var(--ebay-light-gray);
}

.category-nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.category-nav a {
  padding: 10px 12px;
  font-size: 13px;
  white-space: nowrap;
  color: var(--ebay-dark);
  border-bottom: 3px solid transparent;
  transition: border-color 0.15s, color 0.15s;
}

.category-nav a:hover,
.category-nav a.active {
  border-bottom-color: var(--ebay-blue);
  color: var(--ebay-blue);
}

/* ── Hero Banner ── */
.hero-banner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px;
}

.hero-card {
  background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 50%, #dfe8ff 100%);
  border-radius: 16px;
  padding: 48px 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 280px;
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(54, 101, 243, 0.08) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-text h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.2;
}

.hero-text p {
  font-size: 16px;
  color: var(--ebay-gray);
  margin-bottom: 24px;
  max-width: 420px;
}

.btn {
  display: inline-block;
  padding: 12px 32px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--ebay-blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--ebay-blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(54, 101, 243, 0.3);
}

.btn-secondary {
  background: var(--ebay-white);
  color: var(--ebay-blue);
  border: 2px solid var(--ebay-blue);
}

.btn-secondary:hover {
  background: #f0f4ff;
}

.btn-dark {
  background: var(--ebay-dark);
  color: #fff;
}

.btn-dark:hover {
  background: #333;
}

/* ── Section Titles ── */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px 32px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-header h2 {
  font-size: 24px;
  font-weight: 700;
}

.section-header a {
  color: var(--ebay-blue);
  font-size: 14px;
  font-weight: 600;
}

/* ── Product Grid ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--ebay-white);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--ebay-light-gray);
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
}

.product-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.product-card .thumb {
  width: 100%;
  aspect-ratio: 1;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #ccc;
}

.product-card .info {
  padding: 14px;
}

.product-card .info h3 {
  font-size: 14px;
  font-weight: 400;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-card .info .price {
  font-size: 18px;
  font-weight: 700;
}

.product-card .info .old-price {
  font-size: 13px;
  color: var(--ebay-gray);
  text-decoration: line-through;
  margin-left: 8px;
}

.product-card .info .shipping {
  font-size: 12px;
  color: var(--ebay-green);
  margin-top: 4px;
}

/* ── Category Tiles ── */
.category-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.category-tile {
  background: var(--ebay-white);
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  border: 1px solid var(--ebay-light-gray);
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
}

.category-tile:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.category-tile .tile-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.category-tile .tile-label {
  font-size: 13px;
  font-weight: 600;
}

/* ── Footer ── */
.site-footer {
  background: var(--ebay-white);
  border-top: 1px solid var(--ebay-light-gray);
  margin-top: 40px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 40px 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}

.footer-col h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
}

.footer-col a {
  display: block;
  font-size: 13px;
  color: var(--ebay-gray);
  margin-bottom: 8px;
  transition: color 0.15s;
}

.footer-col a:hover {
  color: var(--ebay-blue);
}

.footer-bottom {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 24px;
  border-top: 1px solid var(--ebay-light-gray);
  font-size: 12px;
  color: var(--ebay-gray);
  text-align: center;
}

/* ── Login Page ── */
.auth-container {
  max-width: 460px;
  margin: 60px auto;
  padding: 0 24px;
}

.auth-card {
  background: var(--ebay-white);
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.auth-card h1 {
  font-size: 28px;
  text-align: center;
  margin-bottom: 8px;
}

.auth-card .subtitle {
  text-align: center;
  color: var(--ebay-gray);
  margin-bottom: 32px;
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--ebay-light-gray);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus {
  border-color: var(--ebay-blue);
  box-shadow: 0 0 0 3px rgba(54, 101, 243, 0.1);
}

.form-error {
  color: var(--ebay-red);
  font-size: 13px;
  margin-top: 6px;
  display: none;
}

.form-error.show {
  display: block;
}

.btn-block {
  width: 100%;
  text-align: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: var(--ebay-gray);
  font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ebay-light-gray);
}

.auth-divider span {
  padding: 0 16px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--ebay-gray);
}

.auth-footer a {
  color: var(--ebay-blue);
  font-weight: 600;
}

/* ── Profile Page ── */
.page-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 24px;
}

.profile-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}

.profile-sidebar {
  background: var(--ebay-white);
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  text-align: center;
  height: fit-content;
}

.avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ebay-blue), #6b8fff);
  color: #fff;
  font-size: 40px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.profile-sidebar .name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-sidebar .member-since {
  font-size: 13px;
  color: var(--ebay-gray);
  margin-bottom: 20px;
}

.profile-sidebar .nav-list {
  list-style: none;
  text-align: left;
}

.profile-sidebar .nav-list li {
  margin-bottom: 4px;
}

.profile-sidebar .nav-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--ebay-dark);
  transition: background 0.15s, color 0.15s;
}

.profile-sidebar .nav-list a:hover,
.profile-sidebar .nav-list a.active {
  background: #f0f4ff;
  color: var(--ebay-blue);
}

.profile-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.info-card {
  background: var(--ebay-white);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.info-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ebay-light-gray);
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 14px;
}

.info-row:last-child {
  border-bottom: none;
}

.info-row .label {
  color: var(--ebay-gray);
  min-width: 140px;
}

.info-row .value {
  font-weight: 600;
  text-align: right;
}

.balance-card {
  background: linear-gradient(135deg, #3665f3, #6b8fff);
  border-radius: 16px;
  padding: 32px;
  color: #fff;
  box-shadow: 0 4px 20px rgba(54, 101, 243, 0.3);
}

.balance-card .balance-label {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 8px;
}

.balance-card .balance-amount {
  font-size: 40px;
  font-weight: 700;
  margin-bottom: 20px;
}

.balance-actions {
  display: flex;
  gap: 12px;
}

.balance-actions .btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  font-size: 13px;
  padding: 8px 20px;
}

.balance-actions .btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ── Orders Page ── */
.order-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--ebay-white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.order-tab {
  flex: 1;
  padding: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--ebay-gray);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.order-tab:hover {
  color: var(--ebay-blue);
  background: #f8faff;
}

.order-tab.active {
  color: var(--ebay-blue);
  border-bottom-color: var(--ebay-blue);
}

.order-tab .tab-count {
  display: inline-block;
  background: var(--ebay-light-gray);
  color: var(--ebay-gray);
  font-size: 11px;
  min-width: 20px;
  height: 20px;
  line-height: 20px;
  border-radius: 10px;
  margin-left: 6px;
  padding: 0 6px;
}

.order-tab.active .tab-count {
  background: var(--ebay-blue);
  color: #fff;
}

.order-panel {
  display: none;
}

.order-panel.active {
  display: block;
}

.order-card {
  background: var(--ebay-white);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  margin-bottom: 16px;
  overflow: hidden;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #fafafa;
  border-bottom: 1px solid var(--ebay-light-gray);
  font-size: 13px;
  color: var(--ebay-gray);
}

.order-header .order-id {
  font-weight: 600;
  color: var(--ebay-dark);
}

.order-body {
  padding: 20px 24px;
  display: flex;
  gap: 20px;
  align-items: center;
}

.order-img {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
}

.order-details {
  flex: 1;
}

.order-details h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.order-details .order-meta {
  font-size: 13px;
  color: var(--ebay-gray);
  margin-bottom: 4px;
}

.order-details .order-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--ebay-dark);
}

.order-status {
  text-align: right;
  flex-shrink: 0;
}

.status-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.shipped {
  background: #e8f5e9;
  color: var(--ebay-green);
}

.status-badge.pending {
  background: #fff8e1;
  color: #f57f17;
}

.status-badge.purchased {
  background: #e3f2fd;
  color: var(--ebay-blue);
}

.order-footer {
  display: flex;
  justify-content: flex-end;
  padding: 14px 24px;
  border-top: 1px solid #f5f5f5;
  gap: 10px;
}

.btn-sm {
  padding: 8px 20px;
  font-size: 13px;
  border-radius: 20px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--ebay-dark);
  color: #fff;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: var(--ebay-green);
}

.toast.error {
  background: var(--ebay-red);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
  }

  .search-bar {
    order: 3;
    flex-basis: 100%;
  }

  .hero-card {
    padding: 32px;
    flex-direction: column;
    text-align: center;
  }

  .hero-text h1 {
    font-size: 24px;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    grid-template-columns: repeat(2, 1fr);
  }

  .order-body {
    flex-direction: column;
    align-items: flex-start;
  }

  .order-status {
    text-align: left;
  }
}
