/* Code Vault — Design Tokens & Styles */
/* Terminal aesthetic: monochrome + amber accent, zero decoration */

:root {
  /* Neutral scale — warm gray, not blue-gray */
  --n-50: #fafaf9;
  --n-100: #f5f5f4;
  --n-200: #e7e5e4;
  --n-300: #d6d3d1;
  --n-400: #a8a29e;
  --n-500: #78716c;
  --n-700: #44403c;
  --n-900: #1c1917;

  /* Single accent — amber */
  --accent: #d97706;

  /* Semantic */
  --success: #16a34a;
  --warning: #ca8a04;
  --error: #dc2626;

  /* Type scale */
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Courier New', monospace;
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 16px;
  --text-lg: 20px;
  --text-xl: 24px;
  --text-2xl: 32px;
  --text-3xl: 48px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  /* Layout */
  --max-width: 720px;
  --nav-height: 48px;
}

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

html {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--n-500);
  background: var(--n-50);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Focus — terminal cursor style */
:focus-visible {
  outline: 2px solid var(--n-900);
  outline-offset: 2px;
}

/* Links */
a {
  color: var(--n-700);
  text-decoration: none;
}
a:hover {
  color: var(--n-900);
}

/* Layout */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
  width: 100%;
}

/* Navigation */
.nav {
  height: var(--nav-height);
  border-bottom: 1px solid var(--n-200);
  background: white;
  display: flex;
  align-items: center;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-weight: 700;
  font-size: var(--text-md);
  color: var(--n-900);
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: var(--space-6);
  font-size: var(--text-sm);
  font-weight: 500;
}

.nav-links a {
  color: var(--n-400);
}
.nav-links a:hover {
  color: var(--n-900);
}

/* Typography */
.text-muted {
  color: var(--n-400);
  font-size: var(--text-sm);
}

.text-small {
  font-size: var(--text-sm);
  color: var(--n-400);
}

/* Text formatting helpers */
.formatted-text {
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--n-700);
}

.formatted-text p {
  margin-bottom: var(--space-4);
  text-indent: 2em;
}

.formatted-text p:first-child {
  text-indent: 0;
}

.formatted-text p + p {
  margin-top: var(--space-3);
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid;
}

.status-pending {
  color: var(--warning);
  border-color: var(--warning);
}

.status-confirmed {
  color: var(--success);
  border-color: var(--success);
}

.status-expired {
  color: var(--error);
  border-color: var(--error);
}

/* Buttons */
.btn-primary {
  display: inline-block;
  padding: var(--space-3) var(--space-6);
  background: var(--accent);
  color: var(--n-900);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 500;
  border: none;
  border-radius: 0;
  cursor: pointer;
  text-align: center;
  line-height: 1.4;
}

.btn-primary:hover {
  opacity: 0.9;
  color: var(--n-900);
}

.btn-secondary {
  display: inline-block;
  padding: var(--space-3) var(--space-6);
  background: transparent;
  color: var(--n-700);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: 500;
  border: 1px solid var(--n-200);
  border-radius: 0;
  cursor: pointer;
  text-align: center;
  line-height: 1.4;
}

.btn-secondary:hover {
  border-color: var(--n-400);
  color: var(--n-900);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

/* Search bar */
.search-form {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
}

.search-input {
  flex: 1;
  padding: var(--space-3);
  border: 1px solid var(--n-200);
  background: white;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--n-900);
  border-radius: 0;
}

.search-input::placeholder {
  color: var(--n-400);
}

.search-input:focus {
  outline: 2px solid var(--n-900);
  outline-offset: -1px;
}

/* Copy button */
.copy-btn {
  padding: var(--space-1) var(--space-2);
  background: transparent;
  color: var(--n-400);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  border: 1px solid var(--n-200);
  border-radius: 0;
  cursor: pointer;
}

.copy-btn:hover {
  border-color: var(--n-400);
  color: var(--n-900);
}

/* Notices */
.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-left: 3px solid var(--accent);
  background: var(--n-50);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin-bottom: var(--space-6);
}

.notice-label {
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

/* Product list — row layout, no cards */
.product-list {
  border-top: 1px solid var(--n-200);
}

.product-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--n-200);
}

/* Thumbnail placeholder — monospace char-art style, no images */
.product-thumb {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--n-200);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--n-400);
  background: white;
}

.product-thumb-label {
  line-height: 1;
}

.product-row-info {
  flex: 1;
  min-width: 0;
}

.product-row-title {
  display: block;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--n-900);
  margin-bottom: var(--space-1);
}

.product-row-title:hover {
  color: var(--accent);
}

.product-row-desc {
  font-size: var(--text-sm);
  color: var(--n-400);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  white-space: normal;
}

.product-row-price {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--n-900);
  white-space: nowrap;
}

/* Product detail */
.product-detail {
  margin-bottom: var(--space-8);
}

.product-detail h1 {
  margin-bottom: var(--space-2);
}

.product-meta {
  font-size: var(--text-sm);
  color: var(--n-400);
  margin-bottom: var(--space-6);
}

.product-price {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--n-900);
  margin-bottom: var(--space-6);
}

.product-shot {
  display: block;
  width: 100%;
  max-width: 480px;
  border: 1px solid var(--n-200);
  margin-bottom: var(--space-6);
}

.product-desc {
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--n-700);
  margin-bottom: var(--space-6);
}

.product-desc p {
  margin-bottom: var(--space-4);
  text-indent: 2em;
}

.product-desc p:first-child {
  text-indent: 0;
}

.product-desc p + p {
  margin-top: var(--space-3);
}

/* Payment box */
.payment-box {
  border: 1px solid var(--n-200);
  padding: var(--space-4);
  margin-bottom: var(--space-6);
}

.payment-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--n-100);
}

.payment-row:last-child {
  border-bottom: none;
}

.payment-label {
  color: var(--n-400);
}

.payment-value {
  font-weight: 600;
  color: var(--n-900);
}

.payment-amount {
  font-size: var(--text-xl);
  color: var(--accent);
}

/* QR code */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6);
  border: 1px solid var(--n-200);
  margin-bottom: var(--space-6);
}

.qr-code {
  width: 200px;
  height: 200px;
}

/* Form styles */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--n-700);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--n-200);
  background: white;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--n-900);
  border-radius: 0;
}

.form-input:focus {
  outline: 2px solid var(--n-900);
  outline-offset: -1px;
}

/* Code block */
.code-block {
  background: var(--n-900);
  color: var(--accent);
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  overflow-x: auto;
  margin-bottom: var(--space-6);
  border-radius: 0;
}

/* Alert */
.alert {
  padding: var(--space-4);
  margin-bottom: var(--space-6);
  border-left: 3px solid;
}

.alert-error {
  border-color: var(--error);
  background: var(--error);
  color: white;
}

.alert-success {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

/* Admin table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-6);
}

.admin-table th,
.admin-table td {
  padding: var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--n-200);
}

.admin-table th {
  font-weight: 600;
  color: var(--n-700);
  background: var(--n-50);
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--n-200);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

/* Countdown timer */
.countdown {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Loading spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--n-200);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Footer */
.footer {
  margin-top: auto;
  padding: var(--space-6) 0;
  border-top: 1px solid var(--n-200);
  font-size: var(--text-sm);
  color: var(--n-400);
  text-align: center;
}

/* Section spacing */
.section {
  margin-bottom: var(--space-12);
}

/* Preview block (admin product preview) */
.preview-block {
  border: 1px solid var(--n-200);
  padding: var(--space-4);
  margin-top: var(--space-3);
  background: white;
}

.preview-block .preview-label {
  font-size: var(--text-xs);
  color: var(--n-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.preview-block .preview-content {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--n-500);
}

.preview-block .preview-content p {
  margin-bottom: var(--space-3);
  text-indent: 2em;
}

.preview-block .preview-content p:first-child {
  text-indent: 0;
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 0 var(--space-3);
  }
  
  .nav-links {
    gap: var(--space-4);
  }
  
  .product-row {
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .product-thumb {
    display: none;
  }
  
  .payment-row {
    flex-direction: column;
    gap: var(--space-1);
  }
}
