/* ============================================================
   BASE.CSS — Device Resale Portal
   Variables · Reset · Typography · Shared Components
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;1,400&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@300;400&display=swap');

/* ── CSS Variables ── */
:root {
  /* Colors */
  --ink:          #0c0f0e;
  --ink-soft:     #6b6b62;
  --ink-muted:    #a0a096;
  --cream:        #f5f4f0;
  --cream-dark:   #eceae4;
  --white:        #ffffff;
  --gold:         #b8974a;
  --gold-lt:      #d4b06a;
  --gold-bg:      rgba(184,151,74,0.08);
  --gold-border:  rgba(184,151,74,0.25);

  /* Sidebar */
  --sidebar-bg:   #0c0f0e;
  --sidebar-w:    240px;

  /* Status */
  --green:        #3ecf8e;
  --green-bg:     rgba(62,207,142,0.1);
  --red:          #f04e4e;
  --red-bg:       rgba(240,78,78,0.1);
  --amber:        #f5a623;
  --amber-bg:     rgba(245,166,35,0.1);
  --blue:         #4f8eff;
  --blue-bg:      rgba(79,142,255,0.1);

  /* Borders & Shadows */
  --border:       rgba(12,15,14,0.08);
  --border-med:   rgba(12,15,14,0.14);
  --shadow-sm:    0 2px 8px rgba(12,15,14,0.06);
  --shadow-md:    0 8px 24px rgba(12,15,14,0.09);
  --shadow-lg:    0 24px 64px rgba(12,15,14,0.12);

  /* Radius */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;

  /* Transitions */
  --ease:  cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
a { text-decoration: none; }
input, select, textarea { font-family: inherit; }

/* ── Typography ── */
body {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--cream);
}

h1, h2, h3, h4 {
  font-family: 'Playfair Display', serif;
  font-weight: 400;
  line-height: 1.2;
}

.mono { font-family: 'DM Mono', monospace; }

/* ── Shared: Badge / Pill ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.badge-green  { background: var(--green-bg);  color: var(--green); }
.badge-red    { background: var(--red-bg);    color: var(--red); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue); }
.badge-gold   { background: var(--gold-bg);   color: var(--gold); border: 1px solid var(--gold-border); }

.badge-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* ── Shared: Card ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

/* ── Shared: Button ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;
  border-radius: var(--r-sm);
  font-size: 0.82rem;
  font-weight: 500;
  border: none;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--ink);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { box-shadow: var(--shadow-md); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--border-med);
}
.btn-ghost:hover { background: var(--cream); color: var(--ink); }

.btn-gold {
  background: var(--gold);
  color: var(--white);
}
.btn-gold:hover { background: var(--gold-lt); }

.btn-sm { height: 32px; padding: 0 14px; font-size: 0.75rem; }
.btn-lg { height: 52px; padding: 0 28px; font-size: 0.9rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* ── Shared: Form ── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  background: var(--white);
  border: 1.5px solid var(--border-med);
  border-radius: var(--r-sm);
  font-size: 0.88rem;
  font-weight: 300;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.form-input::placeholder { color: #c0bfba; }
.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184,151,74,0.12);
}

.input-with-icon { position: relative; }
.input-with-icon .form-input { padding-left: 42px; }
.input-with-icon .input-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  stroke: var(--ink-muted);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: stroke 0.2s;
}
.input-with-icon:focus-within .input-icon { stroke: var(--gold); }

/* ── Shared: Table ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}
thead tr {
  border-bottom: 1px solid var(--border-med);
}
th {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 16px 12px;
  text-align: left;
  white-space: nowrap;
}
td {
  padding: 14px 16px;
  font-size: 0.83rem;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--cream); }

/* ── Shared: Stat Card ── */
.stat-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-card-label {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}
.stat-card-value {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 400;
  color: var(--ink);
  line-height: 1;
}
.stat-card-value.gold { color: var(--gold); }
.stat-card-sub {
  font-size: 0.75rem;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.stat-card-sub .up   { color: var(--green); }
.stat-card-sub .down { color: var(--red); }

/* ── Shared: Section Header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--ink);
}
.section-sub {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* ── Shared: Avatar ── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* ── Utility ── */
.text-muted  { color: var(--ink-muted); }
.text-soft   { color: var(--ink-soft); }
.text-gold   { color: var(--gold); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.fw-300      { font-weight: 300; }
.fw-500      { font-weight: 500; }
.fw-600      { font-weight: 600; }
.mono        { font-family: 'DM Mono', monospace; font-size: 0.82em; }
.gap-4       { gap: 4px; }
.gap-8       { gap: 8px; }
.flex        { display: flex; align-items: center; }
.flex-col    { display: flex; flex-direction: column; }
.ml-auto     { margin-left: auto; }

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.animate-up   { animation: fadeUp  0.8s var(--ease) both; }
.animate-fade { animation: fadeIn  0.6s var(--ease) both; }

.delay-1 { animation-delay: 0.06s; }
.delay-2 { animation-delay: 0.12s; }
.delay-3 { animation-delay: 0.18s; }
.delay-4 { animation-delay: 0.24s; }
.delay-5 { animation-delay: 0.30s; }
