/* ============================================================
   Matrix-Catalog — storefront look matched to matrixcomputers.net
   Class names unchanged so the PHP pages behave the same
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Dark palette ─────────────────────────────────────── */
  --white:      #0b1a44;          /* dark blue, visibly blue rather than black */
  --off-white:  #0b1a44;
  --light-gray: rgba(255,255,255,0.06);   /* subtle fills */
  --mid-gray:   rgba(255,255,255,0.13);   /* visible borders */
  --text-muted: #71717a;          /* zinc-500 */
  --text-body:  #a1a1aa;          /* zinc-400 */
  --text-dark:  #f4f4f5;          /* zinc-100 — inverted from original */

  /* Accent: main-site green, with the logo blue for secondary lines */
  --accent:     #4ade80;          /* green-400 */
  --accent-dk:  #22c55e;          /* green-500 */
  --logo-blue:  #4fc3f7;

  --danger:     #f87171;          /* red-400 */
  --success:    #4ade80;

  /* Radii — rounded cards like the homepage */
  --radius-sm:  12px;
  --radius-md:  18px;
  --radius-lg:  24px;

  /* Shadows */
  --shadow-sm:  0 1px 4px rgba(0,0,0,.4);
  --shadow-md:  0 4px 20px rgba(0,0,0,.5);
  --shadow-lg:  0 12px 48px rgba(0,0,0,.6);

  --trans: .25s ease;
}

html { scroll-behavior: smooth; background: #0b1a44; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-body);
  background: var(--off-white);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, textarea, select {
  font-family: inherit; font-size: inherit; line-height: inherit;
}

/* ── Typography ───────────────────────────────────────────── */
.serif { font-family: 'Inter', system-ui, sans-serif; }

h1, h2, h3, h4 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.15;
  color: var(--text-dark);
}

/* ── Grid background pattern ──────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(transparent 50%, rgba(0, 255, 0, 0.025) 50%);
  background-size: 100% 4px;
  pointer-events: none;
  z-index: -1;
  animation: matrix-scan 10s linear infinite;
}
@keyframes matrix-scan {
  0% { background-position: 0 0; }
  100% { background-position: 0 100px; }
}

/* ── Layout ───────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 1;
}

/* ── Site Header ──────────────────────────────────────────── */
.site-header {
  background: #0b1a44;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.site-logo {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.5px;
  color: var(--text-dark);
  transition: color var(--trans);
}
.site-logo:hover { color: var(--accent); }
.site-logo span { color: var(--accent); }

/* ── Page Hero ────────────────────────────────────────────── */
.page-hero {
  background: transparent;
  border-bottom: 1px solid rgba(79,195,247,0.18);
  padding: 56px 0 48px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.page-hero h1 {
  font-size: clamp(36px, 6vw, 64px);
  margin-bottom: 12px;
  color: #fff;
}
.page-hero p { color: var(--logo-blue); font-size: 18px; }

/* ── Product Page ─────────────────────────────────────────── */
.product-page {
  padding: 64px 0 120px;
  position: relative;
  z-index: 1;
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}

/* ── Gallery ──────────────────────────────────────────────── */
.gallery-wrap { position: sticky; top: 96px; }

.gallery-main {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #0b1a44;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: zoom-in;
  border: 1px solid rgba(255,255,255,0.07);
}
.gallery-main img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.gallery-main:hover img { transform: scale(1.04); }

/* Gallery arrows — dark glass style */
.gallery-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(11,26,68,0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 10;
  transition: background var(--trans), border-color var(--trans), box-shadow var(--trans);
  box-shadow: var(--shadow-sm);
}
.gallery-arrow:hover {
  background: rgba(11,26,68,0.94);
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 0 16px rgba(74,222,128,0.25);
}
.gallery-arrow.prev { left: 12px; }
.gallery-arrow.next { right: 12px; }
.gallery-arrow svg { width: 16px; height: 16px; stroke: #e4e4e7; fill: none; stroke-width: 2; }

/* Dots */
.gallery-dots { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.gallery-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.15); border: none; cursor: pointer; padding: 0;
  transition: background var(--trans), transform var(--trans);
}
.gallery-dot.active { background: var(--accent); transform: scale(1.4); }

/* Thumbnails */
.gallery-thumbs {
  display: flex; gap: 10px; margin-top: 16px;
  overflow-x: auto; scrollbar-width: none;
}
.gallery-thumbs::-webkit-scrollbar { display: none; }
.gallery-thumb {
  flex: 0 0 72px; height: 72px;
  border-radius: var(--radius-sm); overflow: hidden; cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--trans);
  background: #0b1a44;
}
.gallery-thumb.active { border-color: var(--accent); }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ── Product Info ─────────────────────────────────────────── */
.product-info { padding-top: 8px; }

.product-badge {
  display: inline-block; font-size: 10px; font-weight: 500;
  letter-spacing: .15em; text-transform: uppercase;
  color: var(--accent);
  background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.28);
  padding: 4px 12px; border-radius: 99px; margin-bottom: 20px;
}

.product-title {
  font-size: clamp(28px, 4vw, 44px); font-weight: 400;
  margin-bottom: 24px; line-height: 1.1;
  color: var(--text-dark);
}

.product-divider {
  width: 48px; height: 1px;
  background: var(--accent); margin-bottom: 28px;
}

.product-price {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 36px; font-weight: 700; color: #fff;
  margin-bottom: 32px;
}
.product-price .currency { font-size: 22px; vertical-align: super; margin-right: 2px; }

.product-description {
  font-size: 15px; line-height: 1.85; color: var(--text-body);
  margin-bottom: 40px; white-space: pre-line;
}

/* ── Payment Buttons ──────────────────────────────────────── */
.payment-buttons {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 24px; padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.payment-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all var(--trans);
  text-decoration: none; white-space: nowrap;
}
.payment-btn-primary {
  background: linear-gradient(to right, #4ade80, #4fc3f7);
  color: #000; font-weight: 700;
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(74,222,128,0.25);
}
.payment-btn-primary:hover { filter: brightness(1.08); }
.payment-btn-secondary {
  background: transparent; color: var(--text-dark);
  border-color: var(--mid-gray);
}
.payment-btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ── Specifics Table ──────────────────────────────────────── */
.specifics-table {
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 28px; margin-top: 8px;
}
.specifics-table h3 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 16px; font-weight: 500;
}
.specifics-row {
  display: flex; padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 14px;
}
.specifics-row .key { flex: 0 0 140px; color: var(--text-muted); font-weight: 400; }
.specifics-row .value { color: var(--text-dark); }

/* ── Condition Badge ──────────────────────────────────────── */
.condition-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--success);
  background: rgba(52,211,153,0.08);
  border: 1px solid rgba(52,211,153,0.2);
  padding: 4px 12px; border-radius: 99px; margin-bottom: 24px;
}
.condition-chip::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
}

/* ── Lightbox ─────────────────────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.94);
  z-index: 9999; display: none; align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: var(--radius-sm); }
.lightbox-close {
  position: absolute; top: 20px; right: 24px;
  background: none; border: none; color: #e4e4e7;
  font-size: 32px; cursor: pointer; line-height: 1; opacity: .6;
  transition: opacity var(--trans);
}
.lightbox-close:hover { opacity: 1; }
.lightbox-prev, .lightbox-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(11,26,68,0.9); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1); color: #e4e4e7; font-size: 28px;
  width: 52px; height: 52px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--trans), border-color var(--trans);
}
.lightbox-prev:hover, .lightbox-next:hover {
  background: rgba(11,26,68,0.95);
  border-color: rgba(74,222,128,0.35);
}
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* ── Site Footer ──────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid rgba(255,255,255,0.06);
  background: #0b1a44;
  padding: 36px 0; text-align: center;
  font-size: 13px; color: var(--text-muted); letter-spacing: .04em;
  position: relative; z-index: 1;
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 120px 20px;
  position: relative; z-index: 1;
}
.empty-state h2 { font-size: 40px; margin-bottom: 16px; color: var(--text-dark); }
.empty-state p { color: var(--text-muted); font-size: 16px; }

/* ── Item Cards (index listing) ───────────────────────────── */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px; padding: 64px 0 120px;
  position: relative; z-index: 1;
}

.item-card {
  background: #0b1a44;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(79,195,247,0.22);
  transition: border-color var(--trans), transform var(--trans), box-shadow var(--trans);
}
.item-card:hover {
  border-color: rgba(74,222,128,0.45);
  transform: translateY(-5px);
  box-shadow: 0 0 30px -8px rgba(74,222,128,0.25);
}
.item-card-img {
  aspect-ratio: 1 / 1; overflow: hidden;
  background: #0b1a44;
}
.item-card-img img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s ease;
}
.item-card:hover .item-card-img img { transform: scale(1.06); }

.item-card-body { padding: 20px 24px 24px; }
.item-card-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 18px; font-weight: 600; margin-bottom: 8px;
  line-height: 1.3; color: #fff;
}
.item-card-price {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 22px; font-weight: 700;
  color: var(--accent); margin-bottom: 16px;
}
.item-card-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--trans), gap var(--trans);
}
.item-card-link::after { content: '→'; }
.item-card:hover .item-card-link { color: var(--accent); }

/* ── Form Controls ────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 11px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 8px;
}
.form-control {
  width: 100%;
  background: #0b1a44;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  padding: 10px 14px; color: var(--text-dark);
  transition: border-color var(--trans), box-shadow var(--trans);
  outline: none;
  font-family: 'Inter', system-ui, sans-serif;
}
.form-control::placeholder { color: rgba(113,113,122,0.6); }
.form-control:focus {
  border-color: rgba(74,222,128,0.55);
  box-shadow: 0 0 0 3px rgba(74,222,128,0.12);
}
textarea.form-control { resize: vertical; min-height: 130px; }
select.form-control { cursor: pointer; }

/* ── Toggle Switches ──────────────────────────────────────── */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 14px; color: var(--text-dark); }
.toggle-sub { font-size: 12px; color: var(--text-muted); display: block; margin-top: 2px; }

.toggle-switch {
  position: relative; width: 44px; height: 24px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.12);
  border-radius: 99px; cursor: pointer;
  transition: background var(--trans);
}
.toggle-slider::before {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; background: #fff; border-radius: 50%;
  transition: transform var(--trans);
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent-dk); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; letter-spacing: .04em;
  cursor: pointer; border: 1px solid transparent;
  transition: all var(--trans); text-decoration: none; white-space: nowrap;
  font-family: 'Inter', system-ui, sans-serif;
}
.btn-primary {
  background: var(--text-dark);
  color: var(--off-white);
  border-color: var(--text-dark);
}
.btn-primary:hover { background: rgba(244,244,245,0.9); }

.btn-accent {
  background: linear-gradient(to right, #4ade80, #4fc3f7);
  color: #000; font-weight: 700; border-color: transparent;
  box-shadow: 0 8px 24px rgba(74,222,128,0.25);
}
.btn-accent:hover { filter: brightness(1.08); }

.btn-outline {
  background: transparent; color: var(--text-dark);
  border-color: var(--mid-gray);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
  background: transparent; color: var(--danger); border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 6px 14px; font-size: 12px; }

/* ── Alert Banners ────────────────────────────────────────── */
.alert {
  padding: 14px 18px; border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 20px; border-left: 3px solid transparent;
}
.alert-success {
  background: rgba(52,211,153,0.08); border-color: var(--success);
  color: var(--success);
}
.alert-error {
  background: rgba(248,113,113,0.08); border-color: var(--danger);
  color: var(--danger);
}
.alert-info {
  background: rgba(74,222,128,0.08); border-color: var(--accent);
  color: var(--accent);
}

/* ── Admin Styles ─────────────────────────────────────────── */
.admin-body {
  background: var(--off-white);
  min-height: 100vh;
}

.admin-nav {
  background: rgba(11,26,68,0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding: 0 32px;
  display: flex; align-items: center; gap: 0; height: 60px;
  position: sticky; top: 0; z-index: 100;
}
.admin-nav-brand {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px; color: var(--text-dark);
  letter-spacing: -.5px; margin-right: auto; font-weight: 600;
}
.admin-nav a {
  color: rgba(255,255,255,.45); font-size: 13px;
  letter-spacing: .04em; padding: 0 16px; height: 60px;
  display: flex; align-items: center; transition: color var(--trans);
}
.admin-nav a:hover, .admin-nav a.active { color: var(--text-dark); }
.admin-nav a.danger:hover { color: var(--danger); }

.admin-main {
  max-width: 1100px; margin: 40px auto;
  padding: 0 24px 80px;
  position: relative; z-index: 1;
}

.admin-card {
  background: #0b1a44;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-md);
  padding: 32px 36px; margin-bottom: 24px;
  backdrop-filter: blur(12px);
}

.admin-card h2 {
  font-size: 22px; margin-bottom: 24px; padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  color: var(--text-dark);
}

.admin-page-title {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px;
}
.admin-page-title h1 { font-size: 28px; color: var(--text-dark); }

/* ── Items Table ──────────────────────────────────────────── */
.items-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.items-table th {
  text-align: left; font-size: 11px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted);
  padding: 0 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  font-family: 'Inter', system-ui, sans-serif;
}
.items-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  vertical-align: middle; color: var(--text-body);
}
.items-table tr:last-child td { border-bottom: none; }
.items-table tr:hover td { background: rgba(255,255,255,0.02); }
.items-table .thumb {
  width: 52px; height: 52px; object-fit: cover; border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.06);
}

/* ── Login Page ───────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 20px;
  background: var(--off-white);
  position: relative; z-index: 1;
}
.login-card {
  background: #0b1a44;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 52px 48px; width: 100%; max-width: 420px;
  backdrop-filter: blur(20px);
}
.login-logo { text-align: center; margin-bottom: 36px; }
.login-logo h1 { font-size: 30px; color: var(--text-dark); }
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 6px; letter-spacing: .04em; }

/* ── Photo selector (admin add-item / edit-item) ──────────── */
.photo-selector { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.photo-item {
  position: relative; width: 80px; height: 80px; border-radius: 8px;
  overflow: hidden; cursor: pointer; border: 2px solid rgba(255,255,255,0.07);
  transition: border-color var(--trans);
}
.photo-item.selected { border-color: var(--accent-dk); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-item .check {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-dk); color: #fff;
  display: none; align-items: center; justify-content: center; font-size: 10px;
}
.photo-item.selected .check { display: flex; }

/* ── eBay search grid ─────────────────────────────────────── */
.ebay-results-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-top: 20px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .product-grid { grid-template-columns: 1fr; gap: 40px; }
  .gallery-wrap { position: static; }
}
@media (max-width: 640px) {
  .container     { padding: 0 20px; }
  .admin-card    { padding: 24px 20px; }
  .login-card    { padding: 36px 24px; }
  .admin-nav     { padding: 0 16px; }
  .admin-nav a   { padding: 0 10px; font-size: 12px; }
  .items-grid    { grid-template-columns: 1fr; }
}
