/* ==========================================================================
   Filament-inspired Dashboard
   A clean, modern admin panel to showcase the login-page collection
   ========================================================================== */

:root {
  /* Palette */
  --bg: #f1f5f9;
  --bg-soft: #f8fafc;
  --sidebar: #0f172a;
  --sidebar-soft: #1e293b;
  --sidebar-hover: #334155;
  --card: #ffffff;
  --border: #e2e8f0;
  --border-soft: #eef2f7;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --text-invert: #e2e8f0;

  /* Accent (Filament indigo) */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-soft: #eef2ff;
  --primary-tint: #c7d2fe;

  /* Status colors */
  --green: #10b981;
  --green-soft: #d1fae5;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --blue: #3b82f6;
  --blue-soft: #dbeafe;
  --rose: #f43f5e;
  --rose-soft: #ffe4e6;

  /* Effects */
  --shadow-sm: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  --shadow: 0 1px 3px 0 rgb(15 23 42 / 0.08), 0 1px 2px -1px rgb(15 23 42 / 0.08);
  --shadow-md: 0 4px 6px -1px rgb(15 23 42 / 0.08), 0 2px 4px -2px rgb(15 23 42 / 0.06);
  --shadow-lg: 0 10px 25px -5px rgb(15 23 42 / 0.12), 0 8px 10px -6px rgb(15 23 42 / 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
  min-height: 100vh;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.app {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--text-invert);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
  transition: transform var(--transition);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 20px;
  border-bottom: 1px solid rgb(255 255 255 / 0.06);
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
  display: grid;
  place-items: center;
  font-size: 20px;
  box-shadow: 0 6px 16px -4px rgb(99 102 241 / 0.6);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #fff;
  line-height: 1.2;
}

.brand-text span {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 500;
}

.nav {
  flex: 1;
  padding: 18px 14px;
  overflow-y: auto;
}

.nav-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 14px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-faint);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  position: relative;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--primary-dark);
  color: #fff;
  box-shadow: 0 4px 12px -2px rgb(79 70 229 / 0.5);
}

.nav-item .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 16px;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--sidebar-hover);
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
}

.nav-item.active .badge {
  background: rgb(255 255 255 / 0.2);
  color: #fff;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgb(255 255 255 / 0.06);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 11px;
  background: var(--sidebar-soft);
  transition: background var(--transition);
  cursor: pointer;
}

.user-card:hover {
  background: var(--sidebar-hover);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #f43f5e);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info {
  overflow: hidden;
}

.user-info strong {
  display: block;
  font-size: 13px;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info small {
  font-size: 11px;
  color: var(--text-faint);
}

/* ---- Main area ---- */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Top bar */
.topbar {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(8px);
}

.menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-muted);
}

.page-titles h2 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.page-titles .crumbs {
  font-size: 12.5px;
  color: var(--text-faint);
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 1px;
}

.page-titles .crumbs b {
  color: var(--text-muted);
  font-weight: 500;
}

.search {
  margin-left: auto;
  position: relative;
  width: 320px;
  max-width: 40vw;
}

.search input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  transition: all var(--transition);
}

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

.search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.search .search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  font-size: 15px;
}

.topbar-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 17px;
  position: relative;
  transition: all var(--transition);
}

.topbar-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.topbar-btn .dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rose);
  border: 2px solid var(--card);
}

/* Content */
.content {
  padding: 28px 32px 48px;
  flex: 1;
}

/* ==========================================================================
   Stat cards
   ========================================================================== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 30px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.stat::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgb(99 102 241 / 0.03));
  pointer-events: none;
}

.stat:hover {
  border-color: var(--primary-tint);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 23px;
  flex-shrink: 0;
}

.stat-icon.indigo { background: var(--primary-soft); color: var(--primary-dark); }
.stat-icon.green  { background: var(--green-soft);  color: var(--green); }
.stat-icon.blue   { background: var(--blue-soft);   color: var(--blue); }
.stat-icon.amber  { background: var(--amber-soft);  color: var(--amber); }

.stat-meta .num {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.1;
}

.stat-meta .label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.stat-meta .trend {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ==========================================================================
   Section heading + toolbar
   ========================================================================== */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: wrap;
}

.section-head h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}

.section-head p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

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

.filter-pill.active {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

/* ==========================================================================
   Page cards grid
   ========================================================================== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 22px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition);
}

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

.card-thumb {
  position: relative;
  aspect-ratio: 16 / 11;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.card-thumb iframe {
  position: absolute;
  inset: 0;
  width: 1600px;
  height: 1100px;
  border: 0;
  transform: scale(0.286);
  transform-origin: top left;
  pointer-events: none;
}

.card-thumb .thumb-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(255 255 255 / 0.4) 0%, transparent 35%);
  pointer-events: none;
}

.card-thumb .tag {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  backdrop-filter: blur(6px);
  z-index: 2;
}

.tag.ig { background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af, #515bd4); color: #fff; }
.tag.fb { background: var(--blue); color: #fff; }
.tag.err { background: var(--rose-soft); color: var(--rose); }
.tag.warn { background: var(--amber-soft); color: var(--amber); }

.card-thumb .open-fab {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--text);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 17px;
  opacity: 0;
  transform: translateY(8px);
  transition: all var(--transition);
  text-decoration: none;
  z-index: 3;
}

.card:hover .open-fab {
  opacity: 1;
  transform: translateY(0);
}

.card-body {
  padding: 18px 20px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-body h4 {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body .desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 5px;
  line-height: 1.5;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-soft);
  font-size: 11.5px;
  color: var(--text-faint);
  font-weight: 500;
}

.card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.card-meta .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.card-actions {
  display: flex;
  gap: 10px;
  padding: 0 20px 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--primary-dark);
  color: #fff;
  flex: 1;
}

.btn-primary:hover {
  background: var(--primary);
  box-shadow: 0 4px 12px -2px rgb(99 102 241 / 0.5);
}

.btn-ghost {
  background: var(--card);
  border-color: var(--border);
  color: var(--text-muted);
}

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

/* ==========================================================================
   Empty state (search no results)
   ========================================================================== */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty .emoji {
  font-size: 44px;
  margin-bottom: 12px;
}

.empty h4 {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 4px;
}

.empty p {
  font-size: 13px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.foot {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-faint);
  flex-wrap: wrap;
  gap: 10px;
}

.foot a {
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 600;
}

/* ==========================================================================
   Modal (page viewer)
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgb(15 23 42 / 0.7);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity var(--transition);
}

.modal.open {
  display: flex;
  opacity: 1;
}

.modal-box {
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 1100px;
  height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px -10px rgb(0 0 0 / 0.4);
  transform: scale(0.96);
  transition: transform var(--transition);
}

.modal.open .modal-box {
  transform: scale(1);
}

.modal-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-bar h4 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
}

.modal-bar .url {
  font-size: 12px;
  color: var(--text-faint);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: 'SF Mono', Menlo, monospace;
}

.modal-bar .spacer {
  flex: 1;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--rose-soft);
  color: var(--rose);
  border-color: var(--rose-soft);
}

.modal-body {
  flex: 1;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.modal-body iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .search { display: none; }
  .content { padding: 22px 18px 40px; }
  .topbar { padding: 14px 18px; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .card-actions { flex-direction: column; }
}

/* Scrollbar polish */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.nav::-webkit-scrollbar-thumb { background: #334155; border-color: var(--sidebar); }

/* Reveal animation */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card, .stat {
  animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

/* ==========================================================================
   Activity panel (live submissions)
   ========================================================================== */
.activity {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 32px;
  overflow: hidden;
}

.activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
  gap: 14px;
  flex-wrap: wrap;
}

.activity-head h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}

.activity-head p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.activity-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: all var(--transition);
}

.live-pill .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgb(16 185 129 / 0.5);
  animation: livePulse 1.8s infinite;
}

@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgb(16 185 129 / 0.5); }
  70%  { box-shadow: 0 0 0 7px rgb(16 185 129 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(16 185 129 / 0); }
}

.live-pill.pulse {
  background: var(--primary-soft);
  color: var(--primary-dark);
  transform: scale(1.05);
}
.live-pill.pulse .live-dot { background: var(--primary); }

.activity-body { position: relative; }

.act-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.act-table thead th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 12px 22px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

.act-table tbody td {
  padding: 13px 22px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  vertical-align: middle;
}

.act-table tbody tr:last-child td { border-bottom: 0; }

.act-table tbody tr {
  animation: rowIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes rowIn {
  from { opacity: 0; background: var(--primary-soft); }
  to   { opacity: 1; background: transparent; }
}

.act-table .when {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.act-table .mono {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--text-muted);
}

.act-table .details { color: var(--text-faint); }

/* small inline tag override inside the table */
.act-table .tag {
  font-size: 10.5px;
  padding: 3px 9px;
  font-weight: 700;
  border-radius: 999px;
}

.act-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.act-empty .emoji { font-size: 40px; margin-bottom: 12px; }
.act-empty h4 { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.act-empty p { font-size: 12.5px; max-width: 360px; }

@media (max-width: 720px) {
  .act-table thead { display: none; }
  .act-table, .act-table tbody, .act-table tr, .act-table td { display: block; width: 100%; }
  .act-table tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .act-table tbody td { border: 0; padding: 3px 0; }
  .act-table .when::before { content: '⏱ '; }
}
