/* ================================================================
   Papp Shared Styles — Modern Design System
   ================================================================
   Used by all papp apps via <link rel="stylesheet" href="/shared.css">
   ================================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Palette */
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --border: #e1e4e8;
  --border-subtle: #eef0f2;
  --text: #1f2328;
  --text-secondary: #57606a;
  --text-muted: #8b949e;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-subtle: rgba(37, 99, 235, 0.08);
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --success: #16a34a;
  --warning: #d97706;

  /* Geometry */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.05);

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code',
    'Consolas', monospace;
  --leading: 1.6;
  --tracking: -0.011em;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 150ms;
}

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

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: var(--leading);
  letter-spacing: var(--tracking);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Layout ---------- */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ---------- Top navigation ---------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 52px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.85);
}

.topnav a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: opacity var(--duration) var(--ease);
}
.topnav a:hover { opacity: 0.8; }

/* ---------- Typography ---------- */
h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 16px;
  color: var(--text);
}
h2 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  color: var(--text);
}
h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  color: var(--text);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration) var(--ease);
  user-select: none;
}
.btn:hover {
  background: var(--bg);
  border-color: #d0d4da;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-xs), 0 1px 2px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: var(--radius-sm); }

/* ---------- Inputs & Controls ---------- */
input[type="text"],
input[type="number"],
input[type="url"],
input[type="email"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
  appearance: none;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-subtle);
}
textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2357606a' viewBox='0 0 16 16'%3E%3Cpath d='M4.427 5.427a.75.75 0 011.146 0L8 7.854l2.427-2.427a.75.75 0 111.146 1.146l-3 3a.75.75 0 01-1.146 0l-3-3a.75.75 0 010-1.146z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}
.card:hover {
  /* Only lift if the card is an anchor/clickable */
}
a.card:hover,
.card.clickable:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ---------- Tags / chips ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 2px;
  transition: all var(--duration) var(--ease);
}
.tag.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.tag:hover:not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn var(--duration) var(--ease);
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 90%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 200ms var(--ease);
}
.modal h2 { margin-bottom: 20px; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Form groups ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

/* ---------- Utility classes ---------- */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.hidden { display: none !important; }

/* ---------- Scrollbar (Webkit) ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #d0d4da;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: #b0b4ba; }
