:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #a5b4fc;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-dark: #0f172a;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.07);
  --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1);
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(255,255,255,0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border); padding: 0 2rem; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
}
.header-content { display: flex; align-items: center; gap: 2rem; max-width: 1440px; margin: 0 auto; width: 100%; }
.logo { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; font-weight: 700; font-size: 1.15rem; color: var(--text); }
.logo-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), #ec4899); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: white; font-size: 1rem; }
.nav-menu { display: flex; list-style: none; gap: 0.25rem; align-items: center; }
.nav-menu a { text-decoration: none; padding: 0.5rem 1rem; border-radius: 0.5rem; color: var(--text-secondary); font-size: 0.875rem; font-weight: 500; transition: var(--transition); }
.nav-menu a:hover, .nav-menu a.active { color: var(--text); background: var(--bg); }
.mobile-toggle { display: none; background: none; border: none; font-size: 1.5rem; color: var(--text); cursor: pointer; padding: 0.5rem; }

.hero-section {
  padding: 8rem 2rem 4rem; text-align: center; max-width: 800px; margin: 0 auto;
}
.hero-section h1 { font-size: 3rem; font-weight: 800; letter-spacing: -0.025em; margin-bottom: 1rem; background: linear-gradient(135deg, var(--text), var(--primary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-section p { font-size: 1.125rem; color: var(--text-secondary); margin-bottom: 2rem; }
.stats-bar { display: flex; justify-content: center; gap: 3rem; margin-top: 2rem; }
.stat-item { text-align: center; }
.stat-number { font-size: 2rem; font-weight: 800; color: var(--primary); display: block; }
.stat-label { font-size: 0.875rem; color: var(--text-secondary); }

.main-layout { display: flex; gap: 2rem; max-width: 1440px; margin: 0 auto; padding: 0 2rem 4rem; min-height: 60vh; }

.sidebar {
  width: 260px; flex-shrink: 0; position: sticky; top: 88px; height: fit-content;
  background: var(--bg-card); border-radius: var(--radius-lg); padding: 1.5rem;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.sidebar h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-light); margin-bottom: 0.75rem; margin-top: 1.25rem; }
.sidebar h3:first-child { margin-top: 0; }
.filter-group { display: flex; flex-direction: column; gap: 0.25rem; }
.filter-btn {
  text-align: left; padding: 0.5rem 0.75rem; border: none; background: transparent;
  border-radius: 0.5rem; cursor: pointer; font-size: 0.875rem; color: var(--text-secondary);
  transition: var(--transition); font-family: inherit;
}
.filter-btn:hover { background: var(--bg); color: var(--text); }
.filter-btn.active { background: var(--primary); color: white; font-weight: 500; }
.search-input {
  width: 100%; padding: 0.625rem 0.875rem; border: 1px solid var(--border);
  border-radius: 0.5rem; font-size: 0.875rem; font-family: inherit;
  background: var(--bg); color: var(--text); outline: none; transition: var(--transition);
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

.content-area { flex: 1; min-width: 0; }
.content-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.result-count { font-size: 0.875rem; color: var(--text-secondary); }
.view-toggle { display: flex; gap: 0.25rem; }
.view-btn {
  padding: 0.5rem; border: 1px solid var(--border); background: var(--bg-card);
  border-radius: 0.5rem; cursor: pointer; color: var(--text-secondary); transition: var(--transition); line-height: 1;
}
.view-btn:hover { border-color: var(--primary); color: var(--primary); }
.view-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.template-grid { display: grid; gap: 1.5rem; }
.template-grid.grid-view { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.template-grid.list-view { grid-template-columns: 1fr; }
.template-grid.list-view .template-card { flex-direction: row; }
.template-grid.list-view .template-card .card-img { width: 280px; min-height: 180px; }

.template-card {
  background: var(--bg-card); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow); border: 1px solid var(--border);
  transition: var(--transition); cursor: pointer; display: flex; flex-direction: column;
}
.template-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-img { position: relative; overflow: hidden; aspect-ratio: 16/10; background: var(--bg); }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: var(--transition); }
.template-card:hover .card-img img { transform: scale(1.03); }
.card-number { position: absolute; top: 0.75rem; right: 0.75rem; background: rgba(0,0,0,0.7); color: white; padding: 0.2rem 0.6rem; border-radius: 0.375rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; backdrop-filter: blur(4px); z-index: 2; }
.card-badges { position: absolute; top: 0.75rem; left: 0.75rem; display: flex; gap: 0.375rem; flex-wrap: wrap; z-index: 1; }
.badge {
  padding: 0.2rem 0.5rem; border-radius: 0.375rem; font-size: 0.7rem; font-weight: 600;
  background: rgba(255,255,255,0.9); backdrop-filter: blur(4px); color: var(--text);
  letter-spacing: 0.01em;
}
.badge-dark { background: rgba(0,0,0,0.75); color: white; }
.card-body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; }
.card-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.5rem; }
.card-meta { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.meta-tag {
  padding: 0.2rem 0.6rem; background: var(--bg); border-radius: 0.375rem;
  font-size: 0.75rem; color: var(--text-secondary);
}
.card-desc { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 1rem; flex: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 1rem; }
.tag {
  padding: 0.15rem 0.5rem; background: rgba(99,102,241,0.08); border-radius: 0.375rem;
  font-size: 0.7rem; color: var(--primary); font-weight: 500;
}
.card-actions { display: flex; gap: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.btn {
  padding: 0.5rem 1rem; border-radius: 0.5rem; font-size: 0.8rem; font-weight: 600;
  text-decoration: none; transition: var(--transition); display: inline-flex; align-items: center; gap: 0.375rem;
  border: none; cursor: pointer; font-family: inherit;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border: 1px solid var(--border); color: var(--text-secondary); background: transparent; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }
.btn-ghost { background: transparent; color: var(--text-secondary); padding: 0.375rem 0.75rem; }
.btn-ghost:hover { background: var(--bg); }
.btn-disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.footer {
  background: var(--bg-card); border-top: 1px solid var(--border);
  padding: 3rem 2rem; text-align: center; color: var(--text-secondary); font-size: 0.875rem;
}

@media (max-width: 1024px) {
  .main-layout { flex-direction: column; }
  .sidebar { width: 100%; position: static; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
}
@media (max-width: 768px) {
  .hero-section h1 { font-size: 2rem; }
  .header { padding: 0 1rem; }
  .mobile-toggle { display: block; }
  .nav-menu { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg-card); border-bottom: 1px solid var(--border); flex-direction: column; padding: 1rem; }
  .nav-menu.open { display: flex; }
  .template-grid.grid-view { grid-template-columns: 1fr; }
  .template-grid.list-view .template-card { flex-direction: column; }
  .template-grid.list-view .template-card .card-img { width: 100%; }
  .stats-bar { gap: 1.5rem; flex-wrap: wrap; }
  .sidebar { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .hero-section { padding: 6rem 1rem 2rem; }
  .main-layout { padding: 0 1rem 2rem; }
  .content-header { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
}
