@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* --- Core Design System Tokens --- */
:root {
  --bg-primary: #0a0a0c;
  --bg-secondary: #111115;
  --bg-tertiary: #181820;
  --border-color: #22222a;
  --border-hover: #333340;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #475569;
  
  --accent: #4f46e5;         /* Vibrant Indigo */
  --accent-hover: #4338ca;
  --accent-bright: #6366f1;
  --accent-green: #10b981;        /* Emerald for E-commerce / Live indicators */
  --accent-green-hover: #059669;
  --accent-orange: #f97316;       /* Warm Orange for Studio/Kopi */
  --accent-cyan: #06b6d4;         /* Vila Agency / Sass */
  
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.6);
  --shadow-flat: 4px 4px 0px 0px #22222a;
  --shadow-flat-hover: 6px 6px 0px 0px #4f46e5;
}

/* --- Base & Reset --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  overflow-x: hidden;
}

body.preview-active {
  overflow: hidden; /* Hide main body scrollbar when demo is active */
}

a {
  text-decoration: none;
  color: inherit;
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

/* --- Layout Utility Classes --- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* --- Navigation / Header --- */
header {
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1.25rem 0;
  transition: padding var(--transition-fast);
}

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

.logo-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-dot {
  width: 12px;
  height: 12px;
  background-color: var(--accent);
  border-radius: 50%;
  position: relative;
  display: inline-block;
}

.logo-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}

.logo-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.badge {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge .count {
  color: var(--accent-bright);
  font-weight: 700;
}

/* --- Hero Section --- */
.hero-section {
  padding: 5rem 0 3.5rem 0;
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
}

.hero-section h1 {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin-bottom: 1.25rem;
}

.hero-section p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 2rem;
  line-height: 1.6;
}

/* --- Showcase Gallery Section --- */
.showcase-view {
  transition: opacity var(--transition-normal), transform var(--transition-normal);
  padding-bottom: 6rem;
}

.showcase-view.hidden {
  display: none;
}

/* --- Filters & Search Bar --- */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 3rem;
  padding: 1.5rem;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

@media(min-width: 768px) {
  .filter-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 450px;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
  border-color: var(--accent);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.filter-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.filter-btn.active {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--text-primary);
}

/* --- Showcase Template Grid --- */
.template-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

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

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

.template-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.template-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

/* Dynamic CSS Illustration Canvas */
.card-preview-area {
  height: 180px;
  background-color: var(--bg-tertiary);
  position: relative;
  border-bottom: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-illustration {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modern minimalist illustration styles using nested divs - zero images, pure clean layout */
.wireframe-browser {
  width: 85%;
  height: 75%;
  border: 1px solid var(--border-hover);
  border-radius: 6px;
  background-color: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal);
}

.template-card:hover .wireframe-browser {
  transform: scale(1.03);
}

.browser-header {
  height: 20px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-tertiary);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 4px;
}

.browser-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--border-hover);
}

.browser-dot.active {
  background-color: var(--accent);
}

.browser-content {
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Category-specific illustration components */
.wireframe-element {
  background-color: var(--bg-tertiary);
  border-radius: 3px;
}

.wf-hero {
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  gap: 6px;
}

.wf-avatar { width: 20px; height: 20px; border-radius: 50%; background-color: var(--border-hover); }
.wf-text-group { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.wf-line-sm { height: 4px; background-color: var(--border-hover); border-radius: 2px; }
.wf-line-md { height: 4px; width: 60%; background-color: var(--border-hover); border-radius: 2px; }

.wf-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.wf-card {
  height: 40px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.wf-img-placeholder {
  height: 20px;
  background-color: var(--border-hover);
  border-radius: 2px;
}

.wf-accent-btn {
  background-color: var(--accent);
  opacity: 0.7;
  height: 8px;
  border-radius: 4px;
  transition: opacity var(--transition-fast);
}

.template-card:hover .wf-accent-btn {
  opacity: 1;
}

/* Template Card Details */
.card-details {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-category {
  font-family: var(--font-heading);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--accent-bright);
  margin-bottom: 0.5rem;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.25rem;
  flex: 1;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.5rem;
}

.tag {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.card-actions {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 0.75rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary {
  background-color: var(--accent);
  color: var(--text-primary);
  border: 1px solid var(--accent);
}

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

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  background-color: var(--bg-secondary);
}

.btn-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 0;
}

/* --- Live Demo Simulator Wrapper --- */
.simulator-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg-primary);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.simulator-view.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Simulator Top Control Bar */
.simulator-topbar {
  height: 64px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.topbar-left, .topbar-center, .topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-center {
  background-color: var(--bg-primary);
  padding: 0.25rem;
  border: 1px solid var(--border-color);
  border-radius: 99px;
}

/* Back button in simulator */
.btn-back {
  font-weight: 500;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

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

/* Active Template Label and Quick Select dropdown */
.template-selector-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.current-template-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.05rem;
}

.template-dropdown-btn {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.template-dropdown-btn:hover {
  border-color: var(--border-hover);
}

.template-dropdown-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 250px;
  box-shadow: var(--shadow-md);
  z-index: 1010;
  display: none;
  overflow: hidden;
}

.template-dropdown-list.show {
  display: block;
}

.dropdown-item {
  width: 100%;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  border-bottom: 1px solid var(--border-color);
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.dropdown-item.active {
  background-color: var(--accent);
  color: var(--text-primary);
}

/* Device Viewport switchers */
.device-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.device-btn.active {
  background-color: var(--accent);
  color: var(--text-primary);
}

/* Simulator Canvas / Preview Frame */
.simulator-body {
  flex: 1;
  background-color: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.iframe-container {
  width: 100%;
  height: 100%;
  border-radius: 0px;
  border: none;
  background-color: #ffffff;
  box-shadow: var(--shadow-md);
  transition: width var(--transition-slow), height var(--transition-slow), border-radius var(--transition-normal), border var(--transition-normal);
  position: relative;
}

/* Tablet Simulator frame style */
.iframe-container.tablet {
  width: 768px;
  height: 100%;
  border-radius: 20px;
  border: 10px solid var(--bg-secondary);
  outline: 1px solid var(--border-color);
}

/* Mobile Simulator frame style */
.iframe-container.mobile {
  width: 375px;
  height: 700px;
  border-radius: 36px;
  border: 12px solid var(--bg-secondary);
  outline: 1px solid var(--border-color);
}

.demo-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background-color: #ffffff;
  border-radius: inherit;
}

/* --- Footer --- */
footer {
  border-top: 1px solid var(--border-color);
  padding: 3rem 0;
  text-align: center;
  background-color: var(--bg-primary);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.footer-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-link {
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--text-primary);
}

/* --- Simple Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.template-card {
  animation: fadeIn 0.4s ease-out both;
}

/* Delay grid items stagger */
.template-card:nth-child(1) { animation-delay: 0.05s; }
.template-card:nth-child(2) { animation-delay: 0.1s; }
.template-card:nth-child(3) { animation-delay: 0.15s; }
.template-card:nth-child(4) { animation-delay: 0.2s; }
.template-card:nth-child(5) { animation-delay: 0.25s; }
.template-card:nth-child(6) { animation-delay: 0.3s; }
.template-card:nth-child(7) { animation-delay: 0.35s; }
.template-card:nth-child(8) { animation-delay: 0.4s; }

/* --- Responsive Styles (Tablet & Mobile) --- */

/* Tablet and Smaller Viewports (max-width: 1024px) */
@media (max-width: 1024px) {
  .topbar-center {
    display: none !important; /* Hide device simulator switcher */
  }
  
  .simulator-body {
    padding: 0 !important; /* Full screen simulator preview */
  }
  
  .iframe-container {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    outline: none !important;
    border-radius: 0 !important;
  }
}

/* Tablet Viewports (max-width: 768px) */
@media (max-width: 768px) {
  .container {
    padding: 0 1.25rem;
  }
  
  .hero-section {
    padding: 3.5rem 0 2rem 0;
  }
  
  .hero-section h1 {
    font-size: 2.5rem;
  }
  
  .hero-section p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .filter-bar {
    padding: 1rem;
    gap: 1rem;
  }
  
  .search-wrapper {
    max-width: 100%;
    width: 100%;
  }
  
  .filter-categories {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  
  .filter-categories::-webkit-scrollbar {
    display: none;
  }
  
  .filter-btn {
    flex-shrink: 0;
    font-size: 0.85rem;
    padding: 0.45rem 0.85rem;
  }
}

/* Mobile Viewports (max-width: 580px) */
@media (max-width: 580px) {
  header {
    padding: 1rem 0;
  }
  
  .header-inner {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
  
  .hero-section {
    padding: 2.5rem 0 1.5rem 0;
  }
  
  .hero-section h1 {
    font-size: 2rem;
    letter-spacing: -0.03em;
  }
  
  .template-grid {
    gap: 1.5rem;
  }
  
  .card-preview-area {
    height: 150px;
  }
  
  .simulator-topbar {
    padding: 0 0.75rem;
    height: 56px;
  }
  
  .topbar-left {
    gap: 0.5rem;
  }
  
  .btn-back {
    font-size: 0.8rem;
    gap: 0.25rem;
  }
  
  .template-dropdown-btn {
    padding: 0.25rem 0.5rem;
  }
  
  .current-template-title {
    font-size: 0.85rem;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .topbar-right {
    gap: 0.5rem;
  }
  
  .btn-circle {
    width: 32px;
    height: 32px;
  }
  
  .btn-circle svg {
    width: 16px;
    height: 16px;
  }
  
  footer {
    padding: 2rem 0;
  }
}

/* --- Card Preview Image --- */
.card-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform var(--transition-normal);
}

.template-card:hover .card-preview-img {
  transform: scale(1.05);
}

/* Small Mobile Viewports (max-width: 380px) */
@media (max-width: 380px) {
  .card-actions {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .card-details {
    padding: 1.25rem;
  }
}
