/* ============================================================
   EMERALD DIGITAL — DEMO PORTAL
   style.css  |  Dark glassmorphism theme
   ============================================================ */

/* ------------------------------------------------------------
   RESET & BASE
------------------------------------------------------------ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Brand */
  --emerald:        #10b981;
  --emerald-dim:    #059669;
  --emerald-glow:   rgba(16, 185, 129, 0.15);
  --emerald-glow-s: rgba(16, 185, 129, 0.08);

  /* Dark surfaces */
  --bg-base:        #0a0f0d;
  --bg-elevated:    #111916;
  --bg-card:        rgba(255, 255, 255, 0.04);
  --bg-card-hover:  rgba(255, 255, 255, 0.07);
  --bg-input:       rgba(255, 255, 255, 0.06);

  /* Text */
  --text-primary:   #f0faf6;
  --text-secondary: #8eab9e;
  --text-muted:     #4d6b5e;
  --text-accent:    #10b981;

  /* Borders */
  --border:         rgba(255, 255, 255, 0.08);
  --border-hover:   rgba(16, 185, 129, 0.3);
  --border-strong:  rgba(255, 255, 255, 0.14);

  /* Layout */
  --header-h:       68px;
  --radius-sm:      8px;
  --radius:         12px;
  --radius-lg:      18px;
  --max-w:          1280px;

  /* Category colours — pill backgrounds */
  --cat-restaurant:   rgba(251, 146, 60, 0.15);
  --cat-restaurant-t: #fb923c;
  --cat-trade:        rgba(59, 130, 246, 0.15);
  --cat-trade-t:      #60a5fa;
  --cat-medical:      rgba(168, 85, 247, 0.15);
  --cat-medical-t:    #c084fc;
  --cat-construction: rgba(245, 158, 11, 0.15);
  --cat-construction-t: #fbbf24;
  --cat-realestate:   rgba(236, 72, 153, 0.15);
  --cat-realestate-t: #f472b6;
  --cat-ecommerce:    rgba(16, 185, 129, 0.15);
  --cat-ecommerce-t:  #34d399;
  --cat-corporate:    rgba(100, 116, 139, 0.15);
  --cat-corporate-t:  #94a3b8;
  --cat-default:      rgba(255,255,255,0.08);
  --cat-default-t:    #8eab9e;

  /* Timing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 150ms;
  --dur-base: 240ms;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-base);
  min-height: 100vh;
  /* Subtle grid texture */
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(16,185,129,0.12) 0%, transparent 70%),
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 100% 100%, 48px 48px, 48px 48px;
  background-attachment: fixed;
}

/* ------------------------------------------------------------
   LAYOUT UTILITIES
------------------------------------------------------------ */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ------------------------------------------------------------
   HEADER
------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(10, 15, 13, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}

.logo-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 8px rgba(16,185,129,0.5));
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.logo-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Header right */
.header-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

/* Search */
.search-wrap {
  position: relative;
  width: 100%;
  max-width: 380px;
}

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

.search-input {
  width: 100%;
  height: 38px;
  padding: 0 36px 0 38px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out);
}

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

.search-input:focus {
  border-color: var(--emerald-dim);
  background: rgba(255,255,255,0.08);
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  transition: color var(--dur-fast);
}

.search-clear:hover { color: var(--text-primary); }

/* ------------------------------------------------------------
   DASHBOARD STATS
------------------------------------------------------------ */
.dashboard {
  padding: 32px 0 24px;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  backdrop-filter: blur(8px);
  transition: border-color var(--dur-base) var(--ease-out);
}

.stat-card:hover { border-color: var(--border-strong); }

.stat-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-value .accent { color: var(--emerald); }

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ------------------------------------------------------------
   FILTERS / CATEGORY TABS
------------------------------------------------------------ */
.filters-section {
  padding: 0 0 20px;
  position: sticky;
  top: var(--header-h);
  z-index: 50;
  background: rgba(10,15,13,0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 16px;
  flex-wrap: wrap;
}

.category-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.cat-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.cat-tab:hover {
  background: var(--bg-card);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.cat-tab.active {
  background: var(--emerald-glow);
  border-color: var(--emerald-dim);
  color: var(--emerald);
}

.cat-tab .cat-count {
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,0.1);
  border-radius: 100px;
  padding: 0 6px;
  line-height: 18px;
}

.cat-tab.active .cat-count {
  background: rgba(16,185,129,0.2);
}

/* Sort */
.sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sort-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.sort-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 5px 10px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--dur-fast);
}

.sort-select:focus { border-color: var(--emerald-dim); }
.sort-select option { background: #111916; }

/* ------------------------------------------------------------
   MAIN CONTENT AREA
------------------------------------------------------------ */
.main-content {
  padding: 24px 0 60px;
}

/* Results bar */
.results-bar {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  min-height: 20px;
}

.results-bar strong { color: var(--text-secondary); }

/* ------------------------------------------------------------
   DEMO CARD GRID
------------------------------------------------------------ */
.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* Individual card */
.demo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(8px);
  transition:
    border-color var(--dur-base) var(--ease-out),
    background var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  animation: card-in var(--dur-base) var(--ease-out) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.demo-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

/* Thumbnail */
.card-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-elevated);
  overflow: hidden;
  flex-shrink: 0;
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 400ms var(--ease-out);
}

.demo-card:hover .card-thumb img {
  transform: scale(1.03);
}

/* Default thumbnail (no image) */
.card-thumb-default {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, #0f1f18 0%, #0a150f 100%);
}

.card-thumb-default .thumb-icon {
  opacity: 0.2;
}

.card-thumb-default .thumb-folder {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  letter-spacing: 0.02em;
}

/* Category badge on thumbnail */
.card-cat-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 100px;
  backdrop-filter: blur(8px);
  border: 1px solid currentColor;
  opacity: 0.85;
}

/* Preview hover overlay */
.card-preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10,15,13,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.demo-card:hover .card-preview-overlay {
  opacity: 1;
}

.preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--emerald);
  color: #0a150f;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transform: scale(0.92);
  transition: transform var(--dur-fast) var(--ease-out);
}

.demo-card:hover .preview-btn {
  transform: scale(1);
}

/* Card body */
.card-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.card-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.card-folder {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
}

.card-date {
  font-size: 12px;
  color: var(--text-muted);
}

/* Card footer */
.card-footer {
  padding: 12px 18px 18px;
  display: flex;
  gap: 8px;
}

.btn-open {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  background: var(--emerald-glow-s);
  border: 1px solid rgba(16,185,129,0.25);
  border-radius: var(--radius-sm);
  color: var(--emerald);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.btn-open:hover {
  background: var(--emerald-glow);
  border-color: var(--emerald-dim);
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition:
    color var(--dur-fast),
    border-color var(--dur-fast),
    background var(--dur-fast);
  flex-shrink: 0;
}

.btn-copy:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--bg-card);
}

.btn-copy.copied {
  color: var(--emerald);
  border-color: var(--emerald-dim);
}

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

.empty-icon {
  margin: 0 auto 20px;
  width: 80px;
  height: 80px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-body {
  font-size: 14px;
  margin-bottom: 24px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 20px;
  cursor: pointer;
  transition:
    background var(--dur-fast),
    color var(--dur-fast);
}

.btn-ghost:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ------------------------------------------------------------
   FOOTER
------------------------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
}

.footer-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.footer-sub {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ------------------------------------------------------------
   LIGHTBOX / PREVIEW OVERLAY
------------------------------------------------------------ */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.lightbox.is-open {
  display: flex;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  height: 90vh;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: lightbox-in var(--dur-base) var(--ease-out);
}

@keyframes lightbox-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(10,15,13,0.9);
}

.lightbox-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lightbox-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-cat {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 100px;
  background: var(--emerald-glow);
  color: var(--emerald);
  border: 1px solid rgba(16,185,129,0.3);
  white-space: nowrap;
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--emerald);
  color: #0a150f;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--dur-fast);
}

.btn-primary:hover { background: #34d399; }

.lightbox-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--dur-fast), border-color var(--dur-fast);
}

.lightbox-close:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.lightbox-frame-wrap {
  flex: 1;
  position: relative;
  background: #fff;
}

.lightbox-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Prevent scroll when lightbox open */
body.lightbox-open { overflow: hidden; }

/* ------------------------------------------------------------
   CATEGORY COLOUR HELPERS
   Used by JS to set badge colours
------------------------------------------------------------ */
.cat--restaurant   { background: var(--cat-restaurant);   color: var(--cat-restaurant-t); border-color: var(--cat-restaurant-t); }
.cat--trade        { background: var(--cat-trade);        color: var(--cat-trade-t);       border-color: var(--cat-trade-t); }
.cat--medical      { background: var(--cat-medical);      color: var(--cat-medical-t);     border-color: var(--cat-medical-t); }
.cat--construction { background: var(--cat-construction); color: var(--cat-construction-t);border-color: var(--cat-construction-t); }
.cat--real-estate  { background: var(--cat-realestate);   color: var(--cat-realestate-t);  border-color: var(--cat-realestate-t); }
.cat--ecommerce    { background: var(--cat-ecommerce);    color: var(--cat-ecommerce-t);   border-color: var(--cat-ecommerce-t); }
.cat--corporate    { background: var(--cat-corporate);    color: var(--cat-corporate-t);   border-color: var(--cat-corporate-t); }

/* ------------------------------------------------------------
   TOAST NOTIFICATION
------------------------------------------------------------ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  padding: 12px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: toast-in 200ms var(--ease-out);
  pointer-events: none;
}

.toast .toast-check {
  color: var(--emerald);
  flex-shrink: 0;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------
   LOADING SKELETON
------------------------------------------------------------ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-card) 0%,
    rgba(255,255,255,0.07) 50%,
    var(--bg-card) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ------------------------------------------------------------
   RESPONSIVE
------------------------------------------------------------ */
@media (max-width: 768px) {
  .demo-grid {
    grid-template-columns: 1fr;
  }

  .header-inner {
    gap: 12px;
  }

  .logo-sub { display: none; }

  .dashboard-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .lightbox { padding: 8px; }

  .lightbox-title { font-size: 13px; }

  .lightbox-panel { height: 95vh; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { flex-direction: column; align-items: flex-start; }
  .sort-wrap { align-self: flex-end; }
}
