/**
 * BuzzShelf Shared Theme
 * Canonical design tokens and shared component styles.
 * Include on EVERY page via <link rel="stylesheet" href="/css/buzzshelf-theme.css">
 * Page-specific overrides go AFTER this file.
 */

/* ═══════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════ */

:root {
  /* ── Backgrounds ── */
  --bg:           #0a0a0f;
  --surface:      #12121a;
  --surface2:     #1a1a26;
  --surface3:     #222232;

  /* ── Borders ── */
  --border:       rgba(255,255,255,0.07);
  --border-med:   rgba(255,255,255,0.11);
  --border-solid: #1e1e2e;

  /* ── Text ── */
  --text:         #e8e8ef;
  --text-dim:     #8888a0;
  --text-muted:   #555570;

  /* ── Brand ── */
  --accent:        #00ff88;
  --accent-dim:    #00cc6a;
  --accent-bg:     rgba(0,255,136,0.08);
  --accent-border: rgba(0,255,136,0.18);

  /* ── Semantic colors ── */
  --green:        #10b981;
  --green-bg:     rgba(16,185,129,0.08);
  --green-border: rgba(16,185,129,0.2);

  --red:          #ef4444;
  --red-bg:       rgba(239,68,68,0.1);
  --red-border:   rgba(239,68,68,0.2);

  --yellow:       #f59e0b;
  --yellow-bg:    rgba(245,158,11,0.1);
  --yellow-border:rgba(245,158,11,0.2);

  --blue:         #3b82f6;
  --blue-bg:      rgba(59,130,246,0.1);
  --blue-border:  rgba(59,130,246,0.2);

  --purple:       #a855f7;
  --purple-bg:    rgba(168,85,247,0.1);
  --purple-border:rgba(168,85,247,0.2);

  --hot:          #ff3366;
  --hot-bg:       rgba(255,51,102,0.1);
  --hot-border:   rgba(255,51,102,0.2);

  --warm:         #ffaa00;
  --warm-bg:      rgba(255,170,0,0.1);
  --warm-border:  rgba(255,170,0,0.2);

  --cyan:         #06b6d4;

  /* ── Typography ── */
  --font-body:    'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Space Grotesk', sans-serif;

  /* ── Spacing ── */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* ── Radius ── */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;
  --radius-pill: 100px;
}

/* ═══════════════════════════════════════════
   BASE RESET & TYPOGRAPHY
   ═══════════════════════════════════════════ */

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
}

a { color: inherit; }

/* ═══════════════════════════════════════════
   GRID BACKGROUND (subtle green, consistent)
   ═══════════════════════════════════════════ */

.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,255,136,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,136,0.018) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ═══════════════════════════════════════════
   LAYOUT WRAPPERS
   ═══════════════════════════════════════════ */

.app { position: relative; z-index: 1; }

.main {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 28px 80px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════ */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-title span { color: var(--accent); }

.page-subtitle {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin-top: 3px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-dim);
  transform: translateY(-1px);
}

.btn-secondary,
.btn-ghost {
  background: var(--surface2);
  border: 1px solid var(--border-med);
  color: var(--text-dim);
}
.btn-secondary:hover:not(:disabled),
.btn-ghost:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239,68,68,0.18);
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }

/* Full-width submit button (used on forms) */
.btn-submit {
  width: 100%;
  background: var(--accent);
  color: #0a0a0f;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 24px;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-submit:hover:not(:disabled) {
  background: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0,255,136,0.25);
}
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* ═══════════════════════════════════════════
   STAT CARDS
   ═══════════════════════════════════════════ */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: border-color 0.15s;
}
.stat-card:hover { border-color: var(--border-med); }

.stat-card .label,
.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-card .value,
.stat-value {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.stat-card .sub,
.stat-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Colored stat variants */
.stat-card.green  { border-color: var(--green-border);  background: var(--green-bg); }
.stat-card.green .value  { color: var(--green); }
.stat-card.red    { border-color: var(--red-border);    background: var(--red-bg); }
.stat-card.red .value    { color: var(--red); }
.stat-card.blue   { border-color: var(--blue-border);   background: var(--blue-bg); }
.stat-card.blue .value   { color: var(--blue); }
.stat-card.yellow { border-color: var(--yellow-border); background: var(--yellow-bg); }
.stat-card.yellow .value { color: var(--yellow); }
.stat-card.purple { border-color: var(--purple-border); background: var(--purple-bg); }
.stat-card.purple .value { color: var(--purple); }

/* ═══════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════ */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

thead { background: var(--surface2); }

th {
  padding: 11px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  font-size: 0.84rem;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

tr:hover td { background: rgba(255,255,255,0.018); }

/* ═══════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════ */

.wide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}

.card-title {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ═══════════════════════════════════════════
   FORM INPUTS (shared across join, login, etc.)
   ═══════════════════════════════════════════ */

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  -webkit-appearance: none;
}

.filter-select {
  width: auto;
  flex: 0 0 auto;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px 32px 10px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%238888a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.filter-select:hover {
  border-color: var(--border-med);
}

.filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,255,136,0.08);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-dim);
  opacity: 0.7;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: var(--border-med);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,255,136,0.08);
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-heading);
  color: var(--text);
  margin-bottom: 7px;
}

.form-group { margin-bottom: 18px; }

/* ═══════════════════════════════════════════
   BADGES & PILLS
   ═══════════════════════════════════════════ */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

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

.status-available   { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-border); }
.status-unavailable { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border);   }
.status-active      { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-border); }
.status-pending     { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border);}
.status-error       { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border);   }

/* ═══════════════════════════════════════════
   SECTION HEADERS (admin dashboards)
   ═══════════════════════════════════════════ */

.section { margin-bottom: 36px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.section-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text-dim);
}

/* Section eyebrow (marketing pages) */
.section-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

/* ═══════════════════════════════════════════
   LOADING STATES
   ═══════════════════════════════════════════ */

.loading {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: bs-spin 0.7s linear infinite;
  margin-bottom: 12px;
}

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

/* Full-page loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,15,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  backdrop-filter: blur(4px);
}

.loading-card {
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-xl);
  padding: 28px 36px;
  text-align: center;
}

.loading-text {
  font-size: 0.88rem;
  color: var(--text-dim);
  font-weight: 500;
}

/* ═══════════════════════════════════════════
   EMPTY STATES
   ═══════════════════════════════════════════ */

.empty,
.no-data {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-dim);
}

.empty h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text);
}

.empty p,
.no-data p {
  font-size: 0.85rem;
}

.no-data-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

/* ═══════════════════════════════════════════
   ERROR STATES
   ═══════════════════════════════════════════ */

.error-banner {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: var(--red);
  display: none;
}

.error-message {
  display: none;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 0.85rem;
  color: var(--red);
  margin-top: 14px;
  line-height: 1.4;
}
.error-message.visible { display: block; }

.notice {
  background: var(--yellow-bg);
  border: 1px solid var(--yellow-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  color: var(--yellow);
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

/* ═══════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 9999;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.25s;
  max-width: 400px;
}
.toast.show    { transform: translateY(0); opacity: 1; }
.toast.success { border-color: var(--green-border); color: var(--green); }
.toast.error   { border-color: var(--red-border);   color: var(--red); }
.toast.warning { border-color: var(--yellow-border); color: var(--yellow); }

/* ═══════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}

.page-info { font-size: 0.82rem; color: var(--text-muted); }
.page-btns { display: flex; gap: 6px; }

.page-btn {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-med);
  background: var(--surface2);
  color: var(--text-dim);
  transition: all 0.15s;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ═══════════════════════════════════════════
   MODAL (shared pattern)
   ═══════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 10000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-panel {
  background: var(--surface);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  padding: 0;
  overflow: hidden;
  transform: translateY(-16px) scale(0.98);
  transition: transform 0.22s;
  flex-shrink: 0;
}
.modal-overlay.open .modal-panel { transform: translateY(0) scale(1); }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 24px 0;
  gap: 16px;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-heading);
  line-height: 1.35;
  flex: 1;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-med);
  background: var(--surface2);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.modal-close:hover { border-color: var(--accent); color: var(--accent); }

.modal-body { padding: 20px 24px 28px; }

/* ═══════════════════════════════════════════
   DIVIDER
   ═══════════════════════════════════════════ */

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-solid), transparent);
  margin: 72px 0;
}

/* ═══════════════════════════════════════════
   UTILITY HELPERS
   ═══════════════════════════════════════════ */

.two-col  { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.text-accent { color: var(--accent); }
.text-dim    { color: var(--text-dim); }
.text-muted  { color: var(--text-muted); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-yellow { color: var(--yellow); }
.text-blue   { color: var(--blue); }

.font-heading { font-family: var(--font-heading); }
.font-mono    { font-family: monospace; }

/* ═══════════════════════════════════════════
   RESPONSIVE FOUNDATIONS
   ═══════════════════════════════════════════ */

@media (max-width: 1100px) {
  .three-col { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .two-col, .three-col { grid-template-columns: 1fr; }
  .main { padding: 16px 16px 40px; }
}

@media (max-width: 500px) {
  .stats-row { grid-template-columns: 1fr; }
}
