/* ====================================================
   Gamesboard — Shared Design System
   ==================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ---- Design Tokens ---- */
:root {
  --primary:    #0d9488;
  --primary-d:  #0f766e;
  --primary-l:  #ccfbf1;
  --danger:     #ef4444;
  --danger-d:   #dc2626;
  --success:    #22c55e;
  --warn:       #f59e0b;

  --nav-bg:   #0f172a;
  --text:     #1e293b;
  --muted:    #64748b;
  --hint:     #94a3b8;
  --border:   #e2e8f0;
  --bg:       #f8fafc;
  --card:     #ffffff;

  --font: 'Inter', system-ui, -apple-system, Arial, sans-serif;

  --r-sm:  6px;
  --r:     10px;
  --r-lg:  16px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* ---- Top Navigation Bar ---- */
.site-nav {
  background: var(--nav-bg);
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.site-nav__back {
  color: var(--hint);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  transition: color .15s, background .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.site-nav__back:hover { color: #fff; background: rgba(255,255,255,.1); }
.site-nav__title {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-nav__tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, transform .05s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }

.btn-primary  { background: var(--primary);  color: #fff; border-color: var(--primary); }
.btn-primary:hover  { background: var(--primary-d); border-color: var(--primary-d); }
.btn-secondary { background: var(--card); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f1f5f9; }
.btn-danger  { background: var(--danger);  color: #fff; border-color: var(--danger); }
.btn-danger:hover  { background: var(--danger-d); }
.btn-ghost   { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }
.btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-l); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 4px; }

/* ---- Inputs ---- */
.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 14px;
  font-family: var(--font);
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13,148,136,.15);
}
.input-label { font-size: 13px; font-weight: 500; color: var(--text); display: block; margin-bottom: 5px; }

/* ---- Cards / Panels ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 20px; }
.card-header {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2, .card-header h3 { font-size: 14px; font-weight: 600; color: var(--text); }

/* ---- Modal / Overlay ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 200;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: min(540px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { font-size: 17px; font-weight: 700; }
.modal-body { padding: 16px 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ---- Toast Notifications ---- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease;
}
.toast-success { background: #16a34a; }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--primary); }
@keyframes toast-in {
  from { opacity:0; transform: translateY(8px); }
  to   { opacity:1; transform: translateY(0); }
}

/* ---- Tables ---- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  background: var(--nav-bg);
  color: #fff;
  font-weight: 600;
  padding: 9px 10px;
  text-align: center;
  font-size: 12px;
}
.table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #f8fafc; }
.table .total-row td { font-weight: 700; background: #f0fdf4; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid;
}
.badge-teal   { background: var(--primary-l); color: var(--primary-d); border-color: #99f6e4; }
.badge-yellow { background: #fef9c3; color: #854d0e; border-color: #fde047; }
.badge-muted  { background: #f1f5f9; color: var(--muted); border-color: var(--border); }

/* ---- Reminder box ---- */
.reminder {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--r);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #92400e;
}

/* ---- Info box ---- */
.info-box {
  background: var(--primary-l);
  border: 1px solid #99f6e4;
  border-radius: var(--r);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--primary-d);
}

/* ---- Section title ---- */
.section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ---- Cloud status indicator ---- */
.cloud-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--hint);
}
.cloud-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--hint);
  transition: background .3s;
}
.cloud-dot.saved  { background: #16a34a; }
.cloud-dot.saving { background: var(--warn); }
.cloud-dot.error  { background: var(--danger); }

/* ---- Save list item ---- */
.save-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.save-item:last-child { border-bottom: none; }
.save-item-info { font-size: 13px; }
.save-item-name { font-weight: 600; color: var(--text); }
.save-item-meta { color: var(--muted); font-size: 11px; margin-top: 2px; }

/* ---- Page layout ---- */
.page-content { padding: 20px; max-width: 1280px; margin: 0 auto; }

/* ---- Layout utilities ---- */
.w-full { width: 100%; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.text-muted { color: var(--muted); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .site-nav { padding: 0 12px; height: 52px; }
  .site-nav__title { font-size: 14px; }
  .page-content { padding: 12px; }
  .modal { width: 100%; max-height: 90vh; }
}
