/* ==========================================================================
   Issue Tracker design system
   Shared tokens, base, buttons, forms, badges and modal styles.
   Page files (home.css, details.css, ...) only hold page layout.
   ========================================================================== */

:root {
  --font-display: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Brand */
  --accent: #7c3aed;
  --accent-2: #db2777;
  --accent-3: #f59e0b;
  --accent-soft: rgba(124, 58, 237, 0.10);
  --accent-ring: rgba(124, 58, 237, 0.28);
  --gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 45%, #ec4899 100%);
  --gradient-warm: linear-gradient(135deg, #f43f5e 0%, #f97316 100%);
  --danger: #ef4444;
  --success: #10b981;

  /* Surfaces (light) */
  --bg: #f5f6fb;
  --bg-elev: #ffffff;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --surface-hover: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 10px 30px -8px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 20px 50px -12px rgba(76, 29, 149, 0.25);
  --aurora-1: rgba(139, 92, 246, 0.22);
  --aurora-2: rgba(236, 72, 153, 0.16);
  --aurora-3: rgba(56, 189, 248, 0.16);
  --grid-line: rgba(15, 23, 42, 0.035);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* Legacy aliases still referenced inline in some templates */
  --text-title: var(--text);
  --border-color: var(--border);
}

[data-theme="dark"] {
  --bg: #07070d;
  --bg-elev: #0f0f1a;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-strong: #12121e;
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f1f5f9;
  --text-muted: #a1a1b5;
  --text-subtle: #6b6b80;
  --accent-soft: rgba(168, 85, 247, 0.14);
  --accent-ring: rgba(168, 85, 247, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 25px 60px -15px rgba(124, 58, 237, 0.35);
  --aurora-1: rgba(124, 58, 237, 0.28);
  --aurora-2: rgba(219, 39, 119, 0.18);
  --aurora-3: rgba(14, 165, 233, 0.14);
  --grid-line: rgba(255, 255, 255, 0.03);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
  position: relative;
  overflow-x: hidden;
}

/* Aurora glow + faint grid behind everything */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(40rem 28rem at 10% -5%, var(--aurora-1), transparent 70%),
    radial-gradient(36rem 26rem at 95% 5%, var(--aurora-2), transparent 70%),
    radial-gradient(40rem 30rem at 50% 110%, var(--aurora-3), transparent 70%);
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
  pointer-events: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text);
  letter-spacing: -0.02em;
}

a { color: inherit; }

::selection { background: rgba(168, 85, 247, 0.3); }

.bodymain {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 72px;
  display: flex;
  flex-direction: column;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Entrance animation, staggered with --i */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rise { animation: rise 0.6s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Surfaces ---------- */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ---------- Buttons ---------- */
.btncreate,
.btn-glass-outline,
.btn-glass-danger,
.btn-primary-grad {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 44px;
  padding: 0 20px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.25s var(--ease),
              background 0.25s ease, border-color 0.25s ease, color 0.2s ease;
}

.btncreate {
  position: relative;
  color: #fff !important;
  border: none;
  background: var(--gradient);
  background-size: 160% 160%;
  background-position: 0% 50%;
  box-shadow: 0 8px 24px -6px rgba(168, 85, 247, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btncreate:hover {
  background-position: 100% 50%;
  transform: translateY(-2px);
  box-shadow: 0 14px 30px -8px rgba(219, 39, 119, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btncreate:active { transform: translateY(0); }

.btn-danger-gradient {
  background: var(--gradient-warm);
  box-shadow: 0 8px 24px -6px rgba(244, 63, 94, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-danger-gradient:hover {
  box-shadow: 0 14px 30px -8px rgba(249, 115, 22, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-glass-outline {
  color: var(--text) !important;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(8px);
}
.btn-glass-outline:hover {
  border-color: var(--accent);
  color: var(--accent) !important;
  background: var(--accent-soft);
  transform: translateY(-1px);
}
[data-theme="dark"] .btn-glass-outline:hover { color: #d8b4fe !important; }

.btn-glass-danger {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.btn-glass-danger:hover {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -8px rgba(239, 68, 68, 0.6);
}

.btncreate:focus-visible,
.btn-glass-outline:focus-visible,
.btn-glass-danger:focus-visible,
.btngetDetails:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-ring);
}

/* ---------- Badges / chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.chip i { font-size: 11px; }

.chip-accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
[data-theme="dark"] .chip-accent { color: #d8b4fe; }

.label-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}
.label-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.label-ui   { color: #7c3aed; background: rgba(124, 58, 237, 0.10); border-color: rgba(124, 58, 237, 0.2); }
.label-bug  { color: #e11d48; background: rgba(225, 29, 72, 0.10);  border-color: rgba(225, 29, 72, 0.2); }
.label-docs { color: #0284c7; background: rgba(2, 132, 199, 0.10);  border-color: rgba(2, 132, 199, 0.2); }
.label-none { color: var(--text-muted); background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .label-ui   { color: #c4b5fd; }
[data-theme="dark"] .label-bug  { color: #fda4af; }
[data-theme="dark"] .label-docs { color: #7dd3fc; }

/* Avatar monogram */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 800;
  color: #fff;
  background: var(--gradient);
  text-transform: uppercase;
}

/* ---------- Forms ---------- */
.form-group { display: flex; flex-direction: column; gap: 8px; }

.labelClass {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.input-with-icon,
.custom-select-wrapper { position: relative; }

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  font-size: 15px;
  pointer-events: none;
  transition: color 0.2s ease;
}
.input-with-icon:focus-within .input-icon { color: var(--accent); }

.modern-input {
  width: 100%;
  padding: 13px 16px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
[data-theme="dark"] .modern-input { background: rgba(255, 255, 255, 0.03); }
.modern-input.with-icon { padding-left: 44px; }
.modern-input::placeholder { color: var(--text-subtle); }
.modern-input:hover { border-color: var(--text-subtle); }
.modern-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}
textarea.modern-input { resize: vertical; min-height: 120px; line-height: 1.6; }

/* ---------- Modals (Bootstrap) ---------- */
.modal-backdrop.show { opacity: 0.6; backdrop-filter: blur(4px); }

.modern-modal {
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.modern-modal .modal-header,
.modern-modal .modal-footer { border-color: var(--border); padding: 18px 24px; }
.modern-modal .modal-body { padding: 22px 24px; color: var(--text-muted); }
.modern-modal .modal-title { font-family: var(--font-display); font-weight: 800; }
.modern-modal h6 { margin-top: 18px; font-weight: 700; }
[data-theme="dark"] .modern-modal .btn-close { filter: invert(1); }

/* ---------- Empty states ---------- */
.empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 64px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.empty-glyph {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 8px;
  border-radius: 22px;
  font-size: 30px;
  color: #fff;
  background: var(--gradient);
  box-shadow: var(--shadow-lg);
}
.empty h2, .empty h4 { margin: 0; font-size: 22px; font-weight: 800; }
.empty p { margin: 0 0 12px; max-width: 420px; color: var(--text-muted); }

@media (max-width: 640px) {
  .bodymain { padding: 24px 16px 56px; }
}
