/* ============================================================
   buddo.css — Shared stylesheet for Buddo platform portal apps
   BuddoWeb · User Portal · Operator Portal
   ============================================================ */

/* ── 1. CUSTOM PROPERTIES ─────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:           #0a0a0a;
  --bg-surface:   #1a1a1a;
  --bg-hover:     #2a2a2a;

  /* Text */
  --text:         #e0e0e0;
  --text-muted:   #999;
  --text-dim:     #555;

  /* Accent — Bitcoin orange */
  --accent:       #f7931a;
  --accent-hover: #e8850f;

  /* Semantic colours */
  --success:      #4ade80;
  --success-bg:   #1a3a1a;
  --error:        #ff4444;
  --error-bg:     #3a1a1a;

  /* Borders */
  --border:        #333;
  --border-subtle: #1a1a1a;

  /* Shape */
  --radius:    4px;
  --radius-lg: 8px;

  /* Typography */
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── 2. BASE RESET ────────────────────────────────────────── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-stack);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.1rem; margin-bottom: 1rem; color: var(--text-muted); }

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

::selection {
  background: var(--accent);
  color: #000;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Scrollbar — dark theme */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius); }
::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); }

/* ── 3. LAYOUT ────────────────────────────────────────────── */
.container {
  max-width: min(640px, 100% - 2rem);
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* ── 4. NAVIGATION ────────────────────────────────────────── */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.nav-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}
.nav-brand:hover { color: var(--accent-hover); }

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s ease;
}
.nav-link:hover { color: var(--text); }

.nav-badge {
  background: var(--bg-surface);
  color: var(--accent);
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  margin-left: 0.5rem;
}

/* ── 5. BUTTONS ───────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); color: #000; }

.btn-secondary {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text); }

.btn-danger {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid #5a2a2a;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
  text-decoration: none;
}
.btn-danger:hover { background: #4a1a1a; color: var(--error); }

/* ── 6. FORMS ─────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.form-group input {
  width: 100%;
  padding: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font-stack);
  transition: border-color 0.2s ease;
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── 7. FLASH MESSAGES ────────────────────────────────────── */
.flash {
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
}

.flash-info {
  background: var(--success-bg);
  border: 1px solid #2a5a2a;
  color: var(--success);
}

.flash-error {
  background: var(--error-bg);
  border: 1px solid #5a2a2a;
  color: var(--error);
}

/* ── 8. STATS ─────────────────────────────────────────────── */
.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.stat-label { color: var(--text-muted); }
.stat-value { font-weight: 600; }

/* ── 9. CARD ──────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

/* ── 10. DATA TABLE ───────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
}

.data-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table tbody tr:hover td { background: var(--bg-surface); }

.data-table .col-right { text-align: right; }

/* ── 11. BADGE ────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

/* ── 12. NAV LIST (portal sidebar-style) ──────────────────── */
.nav-list {
  list-style: none;
  padding: 0;
}
.nav-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

/* ── 13. EMPTY STATE ──────────────────────────────────────── */
.empty-state {
  color: var(--text-dim);
  font-size: 0.875rem;
  text-align: center;
  padding: 2rem 0;
}

/* ── 14. UTILITIES — SPACING ──────────────────────────────── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* ── 15. UTILITIES — FLEX ─────────────────────────────────── */
.flex         { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; justify-content: center; align-items: center; }
.flex-wrap    { flex-wrap: wrap; }
.gap-1        { gap: 0.5rem; }
.gap-2        { gap: 1rem; }
.gap-3        { gap: 1.5rem; }

/* ── 16. UTILITIES — TYPOGRAPHY ───────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-dim     { color: var(--text-dim); }
.text-accent  { color: var(--accent); }
.text-success { color: var(--success); }
.text-error   { color: var(--error); }
.text-sm      { font-size: 0.875rem; }
.text-xs      { font-size: 0.75rem; }
.text-lg      { font-size: 1.25rem; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.font-bold    { font-weight: 700; }
.font-mono    { font-family: monospace; }

/* ── 17. RESPONSIVE — 768px breakpoint ───────────────────── */
@media (max-width: 768px) {
  .nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .nav-links { gap: 1rem; }

  .container { padding: 1.5rem 1rem; }

  h1 { font-size: 1.25rem; }

  /* Wrap tables in a scrollable container via a wrapper class */
  .data-table-wrap { overflow-x: auto; }

  .btn,
  .btn-secondary,
  .btn-danger { padding: 0.6rem 1.25rem; }
}
/* ── Cosmetic Shop ──────────────────────────────────────────── */
.cosmetic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.cosmetic-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s;
}

.cosmetic-card:hover {
  border-color: var(--accent);
}

.cosmetic-placeholder {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--bg-elevated, #2a2a2a);
  border: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.cosmetic-placeholder.rarity-common    { border-color: #888; }
.cosmetic-placeholder.rarity-uncommon  { border-color: #4ade80; }
.cosmetic-placeholder.rarity-rare      { border-color: #60a5fa; }
.cosmetic-placeholder.rarity-legendary { border-color: #f7931a; box-shadow: 0 0 8px rgba(247,147,26,0.3); }

.rarity-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rarity-badge.common    { background: #333; color: #aaa; }
.rarity-badge.uncommon  { background: rgba(74,222,128,0.15); color: #4ade80; }
.rarity-badge.rare      { background: rgba(96,165,250,0.15); color: #60a5fa; }
.rarity-badge.legendary { background: rgba(247,147,26,0.15); color: #f7931a; }

.filter-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.filter-bar select {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary, #e0e0e0);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 360px;
  width: 90%;
}

.modal h3 {
  margin: 0 0 0.5rem;
}

.modal .modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* Avatar composite */
.avatar-composite {
  position: relative;
  overflow: hidden;
  border-radius: 50%;
  background: var(--bg-elevated, #2a2a2a);
  border: 2px solid var(--border-subtle);
}

.avatar-composite.size-lg { width: 120px; height: 120px; }
.avatar-composite.size-xl { width: 160px; height: 160px; }
.avatar-composite.size-sm { width: 36px; height: 36px; }

.avatar-thumb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
  display: block;
}
