/* ============================================
   blockAnim Demo Page - shadcn/Radix Style
   ============================================ */

/* CSS Variables */
:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --border: 240 5.9% 90%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --brand: 221 83% 53%;
  --brand-foreground: 0 0% 100%;
  --radius: 0.625rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  
  --sidebar-width: 280px;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: hsl(var(--foreground));
  background-color: hsl(var(--muted) / 0.5);
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: hsl(var(--background));
  border-right: 1px solid hsl(var(--border));
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid hsl(var(--border));
}

.logo {
  font-size: 1.125rem;
  font-weight: 600;
  text-decoration: none;
  color: hsl(var(--foreground));
  letter-spacing: -0.02em;
}

.logo-block {
  font-weight: 400;
}

.logo-anim {
  font-weight: 600;
}

.sidebar-badge {
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsl(var(--brand));
  background: hsl(var(--brand) / 0.1);
  padding: 4px 8px;
  border-radius: 9999px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.nav-group {
  padding: 0 16px;
  margin-bottom: 24px;
}

.nav-group-title {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: hsl(var(--muted-foreground));
  padding: 0 8px;
  margin-bottom: 8px;
}

.nav-item {
  display: block;
  padding: 8px 12px;
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  border-radius: var(--radius);
  transition: all 0.2s cubic-bezier(.8,0,0,1);
}

.nav-item:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--muted));
}

.nav-item.active {
  color: hsl(var(--brand));
  background: hsl(var(--brand) / 0.1);
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid hsl(var(--border));
}

.back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  transition: color 0.2s cubic-bezier(.8,0,0,1);
}

.back-link:hover {
  color: hsl(var(--foreground));
}

.back-link svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   Main Content
   ============================================ */
.main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 32px 48px;
}

.main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid hsl(var(--border));
}

.main-title {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.main-description {
  font-size: 0.9375rem;
  color: hsl(var(--muted-foreground));
}

.header-stats {
  display: flex;
  gap: 16px;
}

.header-stat {
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--background));
  padding: 6px 12px;
  border-radius: 9999px;
  border: 1px solid hsl(var(--border));
}

/* ============================================
   Demo Grid
   ============================================ */
.demos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.demo-section {
  scroll-margin-top: 32px;
}

.demo-card {
  position: relative;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 4px);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(.8,0,0,1);
}

/* Blue top border on hover */
.demo-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: hsl(var(--brand));
  transition: width 0.5s cubic-bezier(.8,0,0,1);
  z-index: 10;
}

.demo-card:hover::before {
  width: 100%;
}

.demo-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.demo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--muted) / 0.3);
}

.demo-number {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: hsl(var(--muted-foreground) / 0.5);
}

.demo-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-class {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(.8,0,0,1);
}

.demo-class:hover {
  background: hsl(var(--brand) / 0.1);
  border-color: hsl(var(--brand) / 0.3);
  color: hsl(var(--brand));
}

.demo-replay {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.4s cubic-bezier(.8,0,0,1);
}

.demo-replay:hover {
  background: hsl(var(--muted));
  transform: rotate(360deg);
}

.demo-replay svg {
  width: 14px;
  height: 14px;
  color: hsl(var(--muted-foreground));
}

.demo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  min-height: 280px;
  background: linear-gradient(135deg, hsl(var(--muted) / 0.3) 0%, hsl(var(--muted) / 0.1) 100%);
}

.demo-element {
  width: 200px;
  height: 200px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.demo-element img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================
   Toast
   ============================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transition: all 0.4s cubic-bezier(.8,0,0,1);
  z-index: 200;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast svg {
  width: 18px;
  height: 18px;
  color: hsl(150 60% 50%);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }
  
  .main {
    padding: 24px 32px;
  }
  
  .demos {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (max-width: 768px) {
    
    .main-title {
        font-size:1.4rem;
        line-height: 1.4;
    }
    .demo-class {
        font-size:10px;
    }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(.8,0,0,1);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main {
    margin-left: 0;
    padding: 20px;
  }
  
  .main-header {
    flex-direction: column;
    gap: 16px;
  }
  
  .demos {
    grid-template-columns: 1fr;
  }
  
  .demo-preview {
    padding: 32px 16px;
    min-height: 240px;
  }
  
  .demo-element {
    width: 160px;
    height: 160px;
  }
}

/* Scrollbar styling */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: hsl(var(--border));
  border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--muted-foreground) / 0.3);
}