/* --- Global Styles & Resets --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg-color: #0f172a;
  --surface-color: #1e293b;
  --surface-border: #334155;
  --surface-hover: #2d3b55;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-primary: #38bdf8;
  --accent-hover: #0ea5e9;
  --accent-glow: rgba(56, 189, 248, 0.25);
  
  /* Stack Badges */
  --badge-html: #f97316;
  --badge-react: #06b6d4;
  --badge-django: #10b981;
  --badge-angular: #ef4444;
  --badge-flask: #a855f7;
  --badge-fullstack: #eab308;
  
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.55;
  user-select: none;
  -webkit-user-select: none;
}

/* Subtle background grid pattern */
body {
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.08) 0%, transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
}

/* Fixed Reset Control (outside falling container flow once triggered) */
#reset-btn {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #3b82f6;
  color: #ffffff;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
  transition: all 0.2s ease;
}

#reset-btn:hover {
  background-color: #2563eb;
  transform: translateY(-2px);
}

.hidden {
  display: none !important;
}

/* Container */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: relative;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 1.6rem;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.5));
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}

.badge-gravity {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 999px;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  box-shadow: 0 4px 18px rgba(14, 165, 233, 0.4);
  transform: translateY(-1px);
}

/* Main Content */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Search Section */
.search-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--surface-border);
  padding: 24px;
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
}

.search-box-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 16px;
  font-size: 1.1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  background: #0b1120;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 1.05rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pill {
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  padding: 6px 15px;
  background: rgba(51, 65, 85, 0.4);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.filter-pill:hover, .filter-pill.active {
  color: #ffffff;
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.card {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s, transform 0.2s, opacity 0.25s ease;
}

.card.card-filtered-out {
  opacity: 0.12 !important;
  pointer-events: none !important;
  filter: grayscale(80%);
}

.card:hover {
  border-color: rgba(56, 189, 248, 0.5);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stack-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge-html { background: rgba(249, 115, 22, 0.15); color: var(--badge-html); border: 1px solid rgba(249, 115, 22, 0.3); }
.badge-react { background: rgba(6, 182, 212, 0.15); color: var(--badge-react); border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-django { background: rgba(16, 185, 129, 0.15); color: var(--badge-django); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-angular { background: rgba(239, 68, 68, 0.15); color: var(--badge-angular); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-flask { background: rgba(168, 85, 247, 0.15); color: var(--badge-flask); border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-fullstack { background: rgba(234, 179, 8, 0.15); color: var(--badge-fullstack); border: 1px solid rgba(234, 179, 8, 0.3); }

.card-num {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0.6;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.version-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent-primary);
  opacity: 0.9;
}

.card-desc {
  font-size: 0.94rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Card Technical Specs & Features */
.card-specs {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 4px 0;
  font-size: 0.88rem;
}

.spec-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: #cbd5e1;
  line-height: 1.42;
}

.spec-bullet {
  color: var(--accent-primary);
  font-weight: 700;
  flex-shrink: 0;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.tech-tag {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(51, 65, 85, 0.5);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  cursor: pointer;
}

.live-link {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-primary);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.live-link:hover {
  background: rgba(56, 189, 248, 0.25);
  border-color: var(--accent-primary);
}

.repo-link {
  background: rgba(148, 163, 184, 0.1);
  color: #cbd5e1;
  border: 1px solid var(--surface-border);
}

.repo-link:hover {
  background: rgba(148, 163, 184, 0.2);
  border-color: #94a3b8;
  color: #fff;
}

.pdf-link {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.pdf-link:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #f87171;
  color: #fff;
}

/* Milestones & Progress Updates */
.card-milestones {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed rgba(51, 65, 85, 0.6);
}

.milestones-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 5px;
}

.milestones-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.milestone-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  padding: 4px 9px;
  border-radius: 4px;
  background: rgba(10, 102, 194, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(10, 102, 194, 0.35);
  transition: all 0.2s ease;
  cursor: pointer;
}

.milestone-badge:hover {
  background: rgba(10, 102, 194, 0.3);
  border-color: #60a5fa;
  color: #ffffff;
}

.milestone-badge.launch {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
}

.milestone-badge.launch:hover {
  background: rgba(16, 185, 129, 0.3);
  border-color: #34d399;
  color: #ffffff;
}

/* Ensure links in card are always interactive */
.card a,
.card button {
  pointer-events: auto !important;
}

.status-pill {
  font-size: 0.84rem;
  font-weight: 600;
  color: #fbbf24;
  padding: 6px 14px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: var(--radius-sm);
}

/* Clean Centered Footer */
.app-footer {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--surface-border);
  padding: 18px 24px;
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.footer-text {
  font-size: 0.98rem;
  color: var(--text-main);
  font-weight: 500;
}

.footer-text strong {
  color: var(--accent-primary);
  font-weight: 600;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-link {
  color: #93c5fd;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  pointer-events: auto !important;
}

.footer-link:hover {
  color: #ffffff;
  text-decoration: underline;
}

.footer-divider {
  color: var(--surface-border);
  font-size: 0.8rem;
  user-select: none;
}

/* Physics Mode States */
body.physics-active {
  overflow: hidden;
}

.physics-body-active {
  position: fixed !important;
  margin: 0 !important;
  z-index: 1000;
  cursor: grab;
  touch-action: none;
  will-change: transform;
}

.physics-body-active:active {
  cursor: grabbing;
}

