/* ═══════════════════════════════════════════════════════════
   NFC HUB — Design System
   ═══════════════════════════════════════════════════════════ */

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

/* ─── CSS Variables ─────────────────────────────────────── */
:root {
  --bg-primary: #07070d;
  --bg-secondary: #0e0e18;
  --bg-surface: rgba(255,255,255,0.03);
  --bg-surface-hover: rgba(255,255,255,0.06);
  --bg-glass: rgba(14,14,24,0.75);
  --border-subtle: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --accent-cyan: #00d4ff;
  --accent-violet: #8b5cf6;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  --accent-blue: #3b82f6;
  --text-primary: #f0f0f5;
  --text-secondary: #70708a;
  --text-muted: #44445a;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-glow-cyan: 0 0 20px rgba(0,212,255,0.15);
  --shadow-glow-violet: 0 0 20px rgba(139,92,246,0.15);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);
  --font-sans: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 10% 20%, rgba(0,212,255,0.04), transparent),
    radial-gradient(ellipse 500px 500px at 90% 80%, rgba(139,92,246,0.04), transparent);
  pointer-events: none; z-index: 0;
}

a { color: var(--accent-cyan); text-decoration: none; transition: var(--transition); }
a:hover { opacity: 0.8; }

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ─── Layout ────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 64px 1fr;
  min-height: 100vh;
  position: relative; z-index: 1;
}

/* ─── Header ────────────────────────────────────────────── */
.header {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
  position: sticky; top: 0;
}

.header-logo {
  display: flex; align-items: center; gap: 12px;
  font-weight: 700; font-size: 1.2rem;
}

.header-logo .logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.header-actions { display: flex; align-items: center; gap: 12px; }

/* ─── Sidebar ───────────────────────────────────────────── */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  padding: 20px 12px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}

.sidebar-section-title {
  font-size: 0.65rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 16px 12px 8px;
}

.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
  color: var(--text-secondary);
  border: 1px solid transparent;
}

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

.sidebar-item.active {
  background: rgba(0,212,255,0.08);
  color: var(--accent-cyan);
  border-color: rgba(0,212,255,0.15);
}

.sidebar-item .item-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0.7;
}

.sidebar-item.active .item-icon,
.sidebar-item:hover .item-icon { opacity: 1; }

.sidebar-badge {
  margin-left: auto;
  background: var(--bg-surface);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ─── Main Content ──────────────────────────────────────── */
.main-content {
  padding: 32px;
  overflow-y: auto;
  position: relative;
}

.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 1.75rem; font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

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

/* ─── Cards Grid ────────────────────────────────────────── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  opacity: 0;
  transition: var(--transition);
}

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

.card:hover::before { opacity: 1; }

.card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  font-size: 22px;
}

.card-icon.cyan { background: rgba(0,212,255,0.1); color: var(--accent-cyan); }
.card-icon.violet { background: rgba(139,92,246,0.1); color: var(--accent-violet); }
.card-icon.emerald { background: rgba(16,185,129,0.1); color: var(--accent-emerald); }
.card-icon.rose { background: rgba(244,63,94,0.1); color: var(--accent-rose); }
.card-icon.amber { background: rgba(245,158,11,0.1); color: var(--accent-amber); }
.card-icon.blue { background: rgba(59,130,246,0.1); color: var(--accent-blue); }

.card-title {
  font-size: 1rem; font-weight: 600;
  margin-bottom: 6px;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.875rem; font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), #0099cc);
  color: #000; border: none;
}
.btn-primary:hover { box-shadow: var(--shadow-glow-cyan); transform: translateY(-1px); }

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

.btn-danger {
  background: rgba(244,63,94,0.1);
  color: var(--accent-rose);
  border-color: rgba(244,63,94,0.2);
}
.btn-danger:hover { background: rgba(244,63,94,0.2); }

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

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-icon { padding: 10px; width: 40px; height: 40px; }

/* ─── Form Elements ─────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 0.8rem; font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.1);
}

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

.form-textarea { resize: vertical; min-height: 100px; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2370708a' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-checkbox {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 0.875rem; color: var(--text-secondary);
}

.form-checkbox input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ─── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 90%; max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(20px) scale(0.97);
  transition: var(--transition);
}

.modal-overlay.active .modal { transform: translateY(0) scale(1); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px 0;
}

.modal-header h2 { font-size: 1.2rem; font-weight: 600; }

.modal-body { padding: 24px 28px; }

.modal-footer {
  padding: 16px 28px 24px;
  display: flex; justify-content: flex-end; gap: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* ─── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem; font-weight: 500;
}

.badge-cyan { background: rgba(0,212,255,0.1); color: var(--accent-cyan); }
.badge-violet { background: rgba(139,92,246,0.1); color: var(--accent-violet); }
.badge-emerald { background: rgba(16,185,129,0.1); color: var(--accent-emerald); }
.badge-rose { background: rgba(244,63,94,0.1); color: var(--accent-rose); }

/* ─── Toast Notifications ───────────────────────────────── */
.toast-container {
  position: fixed; top: 80px; right: 24px;
  z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}

.toast {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  min-width: 300px;
  display: flex; align-items: center; gap: 12px;
  font-size: 0.875rem;
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 3s forwards;
  box-shadow: var(--shadow-card);
}

.toast.success { border-left: 3px solid var(--accent-emerald); }
.toast.error { border-left: 3px solid var(--accent-rose); }
.toast.info { border-left: 3px solid var(--accent-cyan); }

/* ─── QR Display ────────────────────────────────────────── */
.qr-display {
  text-align: center; padding: 24px;
}

.qr-display img {
  max-width: 280px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.qr-display .qr-url {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-surface);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  word-break: break-all;
}

/* ─── Profile Card Preview ──────────────────────────────── */
.profile-preview {
  background: linear-gradient(135deg, rgba(0,212,255,0.05), rgba(139,92,246,0.05));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px;
  text-align: center;
}

.profile-preview .avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 32px; font-weight: 700; color: #000;
}

/* ─── Empty State ───────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px; margin-bottom: 16px; opacity: 0.3;
}

.empty-state h3 { color: var(--text-secondary); margin-bottom: 8px; }

/* ─── Profile List Item ─────────────────────────────────── */
.profile-item {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.profile-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-surface-hover);
}

.profile-item .profile-info { flex: 1; }
.profile-item .profile-info h4 { font-size: 0.95rem; font-weight: 600; }
.profile-item .profile-info p { font-size: 0.8rem; color: var(--text-secondary); }
.profile-item .profile-actions { display: flex; gap: 8px; }

/* ─── Form View ─────────────────────────────────────────── */
.form-view {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 32px;
  align-items: start;
}

.form-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.form-panel h3 {
  font-size: 1rem; font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

/* ─── Back Button ───────────────────────────────────────── */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 20px;
  transition: var(--transition);
  background: none; border: none;
  font-family: var(--font-sans);
}

.back-btn:hover { color: var(--accent-cyan); }

/* ─── Animations ────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; visibility: hidden; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.animate-fade { animation: fadeIn 0.4s ease; }
.animate-slide-up { animation: slideUp 0.4s ease; }

.cards-grid .card { animation: slideUp 0.4s ease backwards; }
.cards-grid .card:nth-child(1) { animation-delay: 0.05s; }
.cards-grid .card:nth-child(2) { animation-delay: 0.1s; }
.cards-grid .card:nth-child(3) { animation-delay: 0.15s; }
.cards-grid .card:nth-child(4) { animation-delay: 0.2s; }
.cards-grid .card:nth-child(5) { animation-delay: 0.25s; }
.cards-grid .card:nth-child(6) { animation-delay: 0.3s; }

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
  .form-view { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 64px auto 1fr;
  }
  .sidebar {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 8px;
    gap: 4px;
  }
  .sidebar-section-title { display: none; }
  .sidebar-item { white-space: nowrap; font-size: 0.8rem; padding: 8px 12px; }
  .main-content { padding: 20px 16px; }
  .cards-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.4rem; }
}
