/* =======================================
   IssueTrack — Global Styles
   ======================================= */

/* --- Fonts --- */
* {
  font-family: 'Space Grotesk', sans-serif;
  box-sizing: border-box;
}
code, .demo-code, .modal-id-badge {
  font-family: 'JetBrains Mono', monospace;
}

/* --- CSS Variables --- */
:root {
  --bg-base: #0b0f1a;
  --bg-surface: #111827;
  --bg-surface2: #1a2236;
  --bg-card: #141c2f;
  --bg-card-hover: #1a2436;
  --border: #1e2d45;
  --border-light: #263348;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.12);
  --green-border: rgba(34, 197, 94, 0.3);
  --purple: #a855f7;
  --purple-bg: rgba(168, 85, 247, 0.12);
  --purple-border: rgba(168, 85, 247, 0.3);
  --red: #ef4444;
  --orange: #f97316;
  --yellow: #eab308;
  --blue: #3b82f6;
}

/* =======================================
   LOGIN PAGE
   ======================================= */
.login-body {
  background-color: var(--bg-base);
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.bg-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background: radial-gradient(ellipse, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.login-card {
  animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.logo-wrap {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 8px;
}

.login-title {
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.login-subtitle {
  color: var(--text-muted);
}

.login-form-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.login-input {
  background: var(--bg-surface2) !important;
  border-color: var(--border-light) !important;
  color: var(--text-primary) !important;
  border-radius: 10px !important;
  transition: all 0.2s ease;
}

.login-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
  outline: none;
}

.login-input::placeholder {
  color: var(--text-muted) !important;
}

.login-btn {
  background: linear-gradient(135deg, var(--accent), #8b5cf6) !important;
  border: none !important;
  color: white !important;
  border-radius: 10px !important;
  height: 48px !important;
  font-size: 15px !important;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5) !important;
}

.login-btn:active {
  transform: translateY(0);
}

.eye-btn {
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

.eye-btn:hover {
  color: var(--text-secondary);
}

.demo-creds {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

.demo-creds-box {
  background: var(--bg-surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.demo-code {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 13px;
}

.demo-fill-btn {
  background: var(--bg-surface2) !important;
  border: 1px solid var(--border-light) !important;
  color: var(--text-secondary) !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  transition: all 0.2s;
}

.demo-fill-btn:hover {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

/* =======================================
   DASHBOARD
   ======================================= */
.dashboard-body {
  background-color: var(--bg-base);
  min-height: 100vh;
  color: var(--text-primary);
}

/* --- Navbar --- */
.navbar-custom {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 15, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 64px;
}

.navbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-logo-icon {
  flex-shrink: 0;
}

.nav-brand {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.nav-search-wrap {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  height: 40px;
  background: var(--bg-surface2);
  border: 1px solid var(--border-light);
  border-radius: 10px 0 0 10px;
  color: var(--text-primary);
  padding: 0 40px 0 36px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-btn {
  height: 40px;
  padding: 0 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 0 10px 10px 0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.search-btn:hover {
  background: var(--accent-hover);
}

.clear-search-btn {
  position: absolute;
  right: 90px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.clear-search-btn:hover {
  color: var(--text-secondary);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-name {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
}

/* --- Main Content --- */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* --- Stats Row --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
  animation: fadeInUp 0.4s ease;
}

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

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  transition: border-color 0.2s;
}

.stat-card:hover {
  border-color: var(--border-light);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.all-icon {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.open-icon {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.closed-icon {
  background: var(--purple-bg);
  color: var(--purple);
  border: 1px solid var(--purple-border);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  font-family: 'JetBrains Mono', monospace;
}

.open-val { color: var(--green); }
.closed-val { color: var(--purple); }

/* --- Issues Section --- */
.issues-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  animation: fadeInUp 0.5s ease 0.1s both;
}

/* --- Tab Header --- */
.tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tabs-wrap {
  display: flex;
  gap: 4px;
  background: var(--bg-base);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid var(--border);
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: 'Space Grotesk', sans-serif;
}

.tab-btn:hover:not(.active) {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.tab-badge {
  background: var(--bg-surface2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
}

.tab-btn.active .tab-badge {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

.open-badge {
  background: var(--green-bg) !important;
  color: var(--green) !important;
}

.closed-badge {
  background: var(--purple-bg) !important;
  color: var(--purple) !important;
}

.status-markers {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.marker {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.marker-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.open-dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
.closed-dot { background: var(--purple); box-shadow: 0 0 6px var(--purple); }

/* --- Search Info --- */
.search-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.75rem 1.25rem;
  background: rgba(99, 102, 241, 0.06);
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
  color: var(--text-secondary);
  font-size: 13.5px;
}

/* --- Loading Spinner --- */
.loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  gap: 1.25rem;
}

.spinner-ring {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.spinner-text {
  color: var(--text-muted);
  font-size: 14px;
}

/* --- Issue Grid --- */
.issues-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  padding: 1px;
}

@media (max-width: 1200px) {
  .issues-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

@media (max-width: 560px) {
  .issues-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Issue Card --- */
.issue-card {
  background: var(--bg-card);
  padding: 1.125rem;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
  border-top: 3px solid transparent;
  animation: cardIn 0.35s ease both;
}

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

.issue-card:hover {
  background: var(--bg-card-hover);
}

.issue-card.open-card {
  border-top-color: var(--green);
}

.issue-card.closed-card {
  border-top-color: var(--purple);
}

/* Stagger delays */
.issue-card:nth-child(1) { animation-delay: 0ms; }
.issue-card:nth-child(2) { animation-delay: 30ms; }
.issue-card:nth-child(3) { animation-delay: 60ms; }
.issue-card:nth-child(4) { animation-delay: 90ms; }
.issue-card:nth-child(5) { animation-delay: 120ms; }
.issue-card:nth-child(6) { animation-delay: 150ms; }
.issue-card:nth-child(7) { animation-delay: 180ms; }
.issue-card:nth-child(8) { animation-delay: 210ms; }

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}

.card-id {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

.card-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}

.status-open { background: var(--green); box-shadow: 0 0 6px rgba(34, 197, 94, 0.5); }
.status-closed { background: var(--purple); box-shadow: 0 0 6px rgba(168, 85, 247, 0.5); }

.card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.card-meta-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.card-meta-label {
  font-size: 11px;
  color: var(--text-muted);
  width: 50px;
  flex-shrink: 0;
}

.card-meta-value {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.card-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 0.75rem;
}

.card-label {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.label-bug { background: rgba(239, 68, 68, 0.12); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.2); }
.label-enhancement { background: rgba(99, 102, 241, 0.12); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.2); }
.label-documentation { background: rgba(59, 130, 246, 0.12); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.2); }
.label-good-first-issue { background: rgba(34, 197, 94, 0.12); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.2); }
.label-help-wanted { background: rgba(234, 179, 8, 0.12); color: #facc15; border: 1px solid rgba(234, 179, 8, 0.2); }
.label-default { background: var(--bg-surface2); color: var(--text-muted); border: 1px solid var(--border); }

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.625rem;
  border-top: 1px solid var(--border);
}

.card-author {
  display: flex;
  align-items: center;
  gap: 5px;
}

.card-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.card-author-name {
  font-size: 11px;
  color: var(--text-muted);
}

.card-date {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.priority-badge {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.priority-high { background: rgba(239, 68, 68, 0.12); color: #f87171; }
.priority-medium { background: rgba(249, 115, 22, 0.12); color: #fb923c; }
.priority-low { background: rgba(34, 197, 94, 0.12); color: #4ade80; }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--text-muted);
}

/* =======================================
   MODAL
   ======================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-backdrop.hidden {
  display: none;
}

.modal-box-custom {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 1;
}

.modal-status-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.open-status-icon {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.closed-status-icon {
  background: var(--purple-bg);
  color: var(--purple);
  border: 1px solid var(--purple-border);
}

.modal-id-badge {
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--bg-surface2);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.modal-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.open-badge-modal {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.closed-badge-modal {
  background: var(--purple-bg);
  color: var(--purple);
  border: 1px solid var(--purple-border);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  letter-spacing: -0.2px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: all 0.15s;
}

.modal-close-btn:hover {
  background: var(--bg-surface2);
  color: var(--text-primary);
}

.modal-body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.modal-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.65;
  background: var(--bg-surface2);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.modal-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.875rem;
}

@media (max-width: 480px) {
  .modal-meta-grid {
    grid-template-columns: 1fr;
  }
}

.modal-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 600;
}

.meta-value {
  font-size: 13.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.mini-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
}

/* Modal label styles */
.modal-label {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Hidden util */
.hidden { display: none !important; }
