/* OpenSoft - Open Source Software Directory */
/* CSS Custom Properties & Theme System */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-input: #f1f5f9;
  --bg-hover: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.05);
  --shadow-hover: 0 16px 40px rgba(0,0,0,0.12), 0 6px 12px rgba(0,0,0,0.06);
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #eef2ff;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --nav-height: 64px;
}

[data-theme="dark"] {
  --bg-primary: #0a0f1e;
  --bg-secondary: #0f172a;
  --bg-tertiary: #1e293b;
  --bg-card: #111827;
  --bg-input: #1e293b;
  --bg-hover: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  --text-inverse: #0a0f1e;
  --border: #1e293b;
  --border-hover: #334155;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.3);
  --shadow-hover: 0 16px 40px rgba(0,0,0,0.7), 0 6px 12px rgba(0,0,0,0.4);
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-light: #1e1b4b;
}

/* Base Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ======================== NAVBAR ======================== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.nav-brand .brand-icon {
  width: 40px; height: 40px;
  padding: 8px;
  background: rgba(236, 72, 153, 0.15);
  border: 1.5px solid rgba(236, 72, 153, 0.25);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.nav-brand .brand-icon svg {
  width: 24px;
  height: 24px;
  color: #f472b6;
  flex-shrink: 0;
}

.nav-brand:hover .brand-icon {
  background: rgba(236, 72, 153, 0.25);
  border-color: rgba(236, 72, 153, 0.4);
}

.nav-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.nav-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 38px;
  background: var(--bg-input);
  border: 1.5px solid transparent;
  border-radius: 10px;
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: var(--transition);
  outline: none;
}

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

.nav-search input:focus {
  background: var(--bg-card);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.nav-search .search-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 14px;
}

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

.nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

/* Theme Toggle */
.theme-toggle {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  transform: rotate(20deg);
}

/* ======================== SEARCH RESULTS OVERLAY ======================== */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  max-height: 420px;
  overflow-y: auto;
  display: none;
}

.search-results.visible { display: block; }

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); }

.search-result-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.search-result-info { flex: 1; min-width: 0; }
.search-result-name { font-weight: 600; font-size: 0.875rem; }
.search-result-category { font-size: 0.75rem; color: var(--text-muted); }

/* ======================== MAIN CONTENT ======================== */
.page-content {
  padding-top: calc(var(--nav-height) + 32px);
  min-height: 100vh;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ======================== HERO SECTION ======================== */
.hero {
  text-align: center;
  padding: 64px 24px 48px;
  max-width: 720px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 32px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-stat .stat-num {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--accent);
}

.hero-stat .stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ======================== SECTION TITLES ======================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1.5px solid var(--border);
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-link {
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 600;
  transition: var(--transition);
}

.section-link:hover { opacity: 0.8; }

/* ======================== CATEGORY GRID ======================== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.category-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: block;
  position: relative;
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: var(--transition);
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-hover);
}

.cat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin-bottom: 14px;
}

.cat-name {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
}

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

.cat-count {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
}

/* ======================== SOFTWARE CARDS ======================== */
.software-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.software-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.software-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.sw-header { display: flex; align-items: flex-start; gap: 14px; }

.sw-icon {
  width: 46px; height: 46px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 15px;
  flex-shrink: 0;
  letter-spacing: -0.05em;
  color: var(--accent);
}

.sw-info { flex: 1; min-width: 0; }

.sw-name {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sw-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sw-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.platform-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 100px;
  white-space: nowrap;
}

.sw-links {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.sw-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  transition: var(--transition);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}

.sw-link-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

.sw-link-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.sw-link-btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* ======================== SUBCATEGORY TABS ======================== */
.subcategory-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.subcat-btn {
  padding: 7px 16px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  transition: var(--transition);
}

.subcat-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.subcat-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ======================== BREADCRUMB ======================== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--accent);
  font-weight: 500;
  transition: var(--transition);
}

.breadcrumb a:hover { opacity: 0.8; }
.breadcrumb .sep { color: var(--border-hover); }
.breadcrumb .current { color: var(--text-primary); font-weight: 600; }

/* ======================== PAGE HEADER ======================== */
.page-header {
  padding: 40px 0 32px;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: 36px;
}

.page-header-inner {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.page-header-icon {
  width: 64px; height: 64px;
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  flex-shrink: 0;
}

.page-header-text h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 6px;
}

.page-header-text p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 600px;
}

.page-header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.meta-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

/* ======================== EMPTY STATE ======================== */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.9rem; }

/* ======================== FOOTER ======================== */
.footer {
  background: var(--bg-primary);
  border-top: 1.5px solid var(--border);
  padding: 40px 0;
  margin-top: 80px;
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
}

.footer-text {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: var(--transition);
}

.footer-links a:hover { color: var(--text-secondary); }

/* ======================== SCROLLBAR ======================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ======================== UTILITIES ======================== */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mb-48 { margin-bottom: 48px; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ======================== ANIMATIONS ======================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.animate-in { animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
.animate-in-delay-1 { animation-delay: 0.05s; }
.animate-in-delay-2 { animation-delay: 0.10s; }
.animate-in-delay-3 { animation-delay: 0.15s; }

/* ======================== RESPONSIVE ======================== */
@media (max-width: 768px) {
  .nav-inner { padding: 0 16px; gap: 12px; }
  .nav-search { max-width: 200px; }
  .nav-link { display: none; }
  
  .container { padding: 0 16px; }
  
  .hero { padding: 32px 16px 32px; }
  .hero h1 { font-size: 2rem; }
  
  .category-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  
  .software-grid { grid-template-columns: 1fr; }
  
  .page-header-inner { flex-direction: column; }
  .page-header-icon { width: 48px; height: 48px; font-size: 24px; }
  .page-header-text h1 { font-size: 1.5rem; }
  
  .hero-stats { gap: 20px; }
  .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .category-grid { grid-template-columns: 1fr 1fr; }
  .nav-search { max-width: 140px; }
}
