@import url('https://api.fontshare.com/v2/css?f[]=cabinet-grotesk@800,500,700,400,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --background: #FDFDFD;
  --foreground: #0A0A0A;
  --primary: #047857;
  --primary-foreground: #FFFFFF;
  --secondary: #0A0A0A;
  --muted: #F3F4F6;
  --muted-foreground: #6B7280;
  --accent: #ECFDF5;
  --accent-foreground: #047857;
  --border: #E5E7EB;
  --destructive: #EF4444;
  --radius: 0.75rem;
  --sidebar-width: 260px;
  --topbar-height: 60px;
}

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

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--background);
  color: var(--foreground);
}

h1,h2,h3,h4,h5,h6 { font-family: 'Cabinet Grotesk', sans-serif; letter-spacing: -0.02em; }

.page-bg { background: linear-gradient(180deg,#FDFDFD 0%,#F8FAFC 100%); min-height:100vh; }

.glass-header {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.card-premium {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px 0 rgb(0 0 0/0.05);
  transition: all 0.3s ease;
}
.card-premium:hover { box-shadow: 0 10px 40px -10px rgb(0 0 0/0.1); transform: translateY(-2px); }

.card-marketing {
  background: #fff;
  border: 1px solid rgba(229,231,235,0.5);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0/0.03);
  transition: all 0.3s ease;
}
.card-marketing:hover { transform: translateY(-4px); box-shadow: 0 20px 40px -10px rgb(0 0 0/0.1); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn-primary:hover { background: #065f46; transform: translateY(-1px); box-shadow: 0 4px 12px rgb(4 120 87/0.3); }

.btn-outline {
  background: transparent;
  color: var(--foreground);
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.9375rem;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--accent); }

.btn-danger { background:#EF4444; color:#fff; padding:0.5rem 1rem; border-radius:0.5rem; border:none; cursor:pointer; font-weight:600; font-size:0.875rem; transition:all 0.2s; touch-action:manipulation; }
.btn-danger:hover { background:#dc2626; }

.btn-whatsapp {
  background: #25D366;
  color: #fff;
  padding: 0.625rem 1.25rem;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
  touch-action: manipulation;
}
.btn-whatsapp:hover { background: #128C7E; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,211,102,0.35); }

.badge {
  background: var(--accent);
  color: var(--accent-foreground);
  padding: 0.375rem 0.75rem;
  border-radius: 2rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  text-decoration: none;
}

.overline {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
}

.gradient-text {
  background: linear-gradient(135deg, #047857, #10b981, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.spinner {
  width: 2rem; height: 2rem;
  border: 3px solid var(--muted);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.animate-fade-in { animation: fadeIn 0.6s ease; }
@keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }

/* Form Inputs */
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--foreground);
  background: #fff;
  transition: border-color 0.2s;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(4 120 87/0.1); }

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.375rem;
}

.form-group { margin-bottom: 1.25rem; }

/* ── TRIAL BANNER ── */
.trial-banner {
  background: linear-gradient(90deg, #047857, #10b981);
  color: #fff;
  padding: 0.625rem 1.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.trial-banner a { color: #fff; font-weight: 700; text-decoration: underline; }
.trial-expired-banner {
  background: linear-gradient(90deg, #dc2626, #ef4444);
  color: #fff;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.trial-expired-banner a { color: #fff; font-weight: 700; text-decoration: underline; }

/* ── DASHBOARD LAYOUT ── */
.dashboard-layout { display: flex; min-height: 100vh; }

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 39;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-overlay.active { display: block; }

.sidebar {
  width: var(--sidebar-width);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 40;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.sidebar-logo {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}
.sidebar-logo-icon {
  width: 2.25rem; height: 2.25rem;
  background: var(--primary);
  border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-nav { padding: 1rem 0.75rem; flex: 1; }
.sidebar-section { margin-bottom: 1.5rem; }
.sidebar-section-label {
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted-foreground);
  padding: 0 0.75rem; margin-bottom: 0.5rem;
}

.sidebar-link {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.7rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.9rem; font-weight: 500;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: all 0.15s;
  margin-bottom: 0.125rem;
  -webkit-tap-highlight-color: transparent;
}
.sidebar-link:hover { background: var(--muted); color: var(--foreground); }
.sidebar-link.active { background: var(--accent); color: var(--primary); font-weight: 600; }
.sidebar-link svg { flex-shrink: 0; }

.main-content { margin-left: var(--sidebar-width); flex: 1; min-width: 0; }

.top-bar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 30;
  min-height: var(--topbar-height);
}

.mobile-menu-btn {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: 0.375rem; border-radius: 0.375rem;
  color: var(--foreground);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.mobile-menu-btn:hover { background: var(--muted); }

.page-content { padding: 1.5rem; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem;
}
.stat-value { font-size: 1.875rem; font-weight: 800; font-family: 'Cabinet Grotesk', sans-serif; color: var(--foreground); }
.stat-label { font-size: 0.8125rem; color: var(--muted-foreground); font-weight: 500; margin-top: 0.25rem; }
.stat-icon {
  width: 2.5rem; height: 2.5rem; border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.875rem;
}

/* Tables – scrollable on mobile */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; min-width: 500px; }
.data-table th {
  text-align: left; padding: 0.75rem 1rem;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
  background: var(--muted);
  white-space: nowrap;
}
.data-table td {
  padding: 0.875rem 1rem; border-bottom: 1px solid var(--border);
  font-size: 0.875rem; color: var(--foreground);
}
.data-table tr:hover td { background: #fafafa; }
.data-table tr:last-child td { border-bottom: none; }

/* Vcard card in dashboard */
.vcard-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  transition: all 0.2s;
  position: relative; overflow: hidden;
}
.vcard-card:hover { box-shadow: 0 8px 30px rgb(0 0 0/0.08); transform: translateY(-2px); }

/* Pills / Status badges */
.pill { display: inline-flex; align-items: center; padding: 0.25rem 0.625rem; border-radius: 2rem; font-size: 0.75rem; font-weight: 600; white-space: nowrap; }
.pill-green  { background: #d1fae5; color: #065f46; }
.pill-yellow { background: #fef3c7; color: #92400e; }
.pill-red    { background: #fee2e2; color: #991b1b; }
.pill-blue   { background: #dbeafe; color: #1e40af; }
.pill-gray   { background: #f3f4f6; color: #374151; }

/* Tabs */
.tabs { display: flex; gap: 0.25rem; background: var(--muted); border-radius: 0.5rem; padding: 0.25rem; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  padding: 0.5rem 1rem; border-radius: 0.375rem;
  font-size: 0.875rem; font-weight: 600; white-space: nowrap;
  border: none; cursor: pointer; background: transparent;
  color: var(--muted-foreground); transition: all 0.15s;
  flex-shrink: 0;
  touch-action: manipulation;
}
.tab-btn.active { background: #fff; color: var(--foreground); box-shadow: 0 1px 3px rgb(0 0 0/0.08); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal {
  background: #fff; border-radius: 1.25rem 1.25rem 0 0; padding: 1.75rem 1.5rem;
  width: 100%; max-width: 520px; max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 -8px 40px rgb(0 0 0/0.18);
  animation: modalUp 0.28s cubic-bezier(0.34,1.2,0.64,1);
}
@keyframes modalUp { from { transform: translateY(60px); opacity:0; } to { transform: none; opacity:1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-title { font-size: 1.2rem; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--muted-foreground); padding: 0.375rem; border-radius: 0.375rem; touch-action: manipulation; }
.modal-close:hover { background: var(--muted); }

/* Alert */
.alert { padding: 0.875rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 500; margin-bottom: 1rem; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }

/* vCard public page */
.vcard-container { max-width: 420px; margin: 0 auto; min-height: 100vh; background: #fff; }
.vcard-cover { height: 160px; background: linear-gradient(135deg,#047857,#10b981); position: relative; }
.vcard-avatar {
  width: 5rem; height: 5rem; border-radius: 50%;
  border: 3px solid #fff; object-fit: cover;
  position: absolute; bottom: -2.5rem; left: 1.5rem;
  background: #e5e7eb;
}
.vcard-info { padding: 3.5rem 1.5rem 1.5rem; }

/* ── MOBILE BOTTOM NAV ── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  z-index: 50;
  padding: 0.5rem 0 max(0.5rem, env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}
.mobile-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 0.375rem 0.25rem;
  font-size: 0.6rem; font-weight: 600;
  color: var(--muted-foreground);
  text-decoration: none;
  border: none; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: color 0.15s;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.mobile-nav-item.active { color: var(--primary); }
.mobile-nav-item svg { flex-shrink: 0; }

/* ── RESPONSIVE BREAKPOINTS ── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* Show hamburger */
  .mobile-menu-btn { display: flex !important; align-items: center; justify-content: center; }

  /* Sidebar slides in from left */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgb(0 0 0/0.15);
  }
  .sidebar.open { transform: translateX(0); }

  /* Main content full width */
  .main-content { margin-left: 0; }

  /* Top bar compact */
  .top-bar { padding: 0.75rem 1rem; }

  /* Page content with bottom nav clearance */
  .page-content { padding: 1rem 0.875rem 5rem; }

  /* Stats 2-col */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .stat-card { padding: 1rem; }
  .stat-value { font-size: 1.5rem; }

  /* vCards grid */
  #vcardsGrid { grid-template-columns: 1fr !important; }

  /* Show bottom nav */
  .mobile-bottom-nav { display: grid; }

  /* Modal full-width bottom sheet */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: 100%; border-radius: 1.25rem 1.25rem 0 0; }

  /* Tables scroll */
  .table-wrap { border-radius: 0.75rem; }

  /* Top bar title smaller */
  .top-bar h1 { font-size: 1.1rem; }

  /* Pricing cards stack */
  .plan-card { padding: 1.5rem; }

  /* Trial banner */
  .trial-banner { padding: 0.5rem 1rem; font-size: 0.75rem; }
  .trial-expired-banner { padding: 0.5rem 1rem; font-size: 0.75rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.625rem; }
  .stat-value { font-size: 1.375rem; }
  .page-content { padding: 0.875rem 0.75rem 5rem; }
  .top-bar h1 { font-size: 1rem; }

  /* Full width buttons on mobile */
  .btn-primary, .btn-outline { font-size: 0.875rem; padding: 0.7rem 1.25rem; }

  /* Make vcard-editor sections single col */
  .vcard-form-grid { grid-template-columns: 1fr !important; }
}

/* Toast */
#toast-container {
  position: fixed; bottom: 5rem; right: 1rem; z-index: 9999;
  display: flex; flex-direction: column; gap: 0.5rem;
  max-width: calc(100vw - 2rem);
}
.toast {
  background: #1f2937; color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem; font-weight: 500;
  box-shadow: 0 4px 12px rgb(0 0 0/0.15);
  animation: slideIn 0.3s ease;
  display: flex; align-items: center; gap: 0.5rem;
}
.toast.success { background: #065f46; }
.toast.error   { background: #991b1b; }
@keyframes slideIn { from { opacity:0; transform:translateX(1rem); } to { opacity:1; transform:none; } }
