/* ============================================================
   TrackyTag â€” Design System & Global Styles
   ============================================================ */

/* â”€â”€ Fonts â”€â”€ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* â”€â”€ Design Tokens â”€â”€ */
:root {
  /* Colors */
  --bg: #0d0d14;
  --bg2: #13131f;
  --surface: #1a1a2e;
  --surface2: #212138;
  --surface3: #2a2a4a;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-dark: #4f46e5;
  --purple: #a855f7;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;

  /* Text */
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;

  /* Borders */
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.6);

  /* Gradients */
  --grad-accent: linear-gradient(135deg, #6366f1, #a855f7);
  --grad-card: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.05));

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --glow: 0 0 24px rgba(99, 102, 241, 0.3);

  /* Sizes */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Nav */
  --nav-h: 72px;
  --header-h: 80px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* â”€â”€ Reset â”€â”€ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input,
textarea,
select {
  font-family: inherit;
}

/* â”€â”€ Utility â”€â”€ */
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* â”€â”€ Loading Screen â”€â”€ */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 48px;
}

.loading-brand {
  text-align: center;
}

.loading-icon {
  width: 88px;
  height: 88px;
  margin: 0 auto 20px;
  background: var(--surface);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow);
  animation: float 3s ease-in-out infinite;
}

.loading-brand h1 {
  font-size: 2rem;
  font-weight: 800;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.loading-brand p {
  color: var(--text2);
  margin-top: 6px;
  font-size: 0.9rem;
}

.loading-dots {
  display: flex;
  gap: 8px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.3;
  animation: dot-bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dot-bounce {

  0%,
  80%,
  100% {
    transform: scale(0.8);
    opacity: 0.3;
  }

  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

/* â”€â”€ App Shell â”€â”€ */
#app {
  min-height: 100vh;
  min-height: 100dvh;
}

/* â”€â”€ Header â”€â”€ */
#app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(13, 13, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo span {
  font-size: 1.6rem;
  font-weight: 700;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

#page-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: var(--surface);
  transition: background 0.2s var(--ease);
}

.icon-btn:hover {
  background: var(--surface2);
}

/* â”€â”€ Main Content â”€â”€ */
#view-container {
  padding-top: var(--header-h);
  padding-bottom: calc(var(--nav-h) + 16px);
  min-height: 100vh;
  min-height: 100dvh;
}

/* â”€â”€ Bottom Navigation â”€â”€ */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(26, 26, 46, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 20px;
  color: var(--text3);
  font-size: 0.7rem;
  font-weight: 500;
  transition: color 0.2s var(--ease);
  border-radius: var(--radius-md);
}

.nav-item.active {
  color: var(--accent-light);
}

.nav-item svg {
  transition: transform 0.2s var(--ease);
}

.nav-item:hover svg,
.nav-item:active svg {
  transform: scale(1.1);
}

/* FAB Scan/Add Buttons */
.nav-fab {
  position: relative;
  margin-top: -20px;
  color: transparent;
  padding: 4px 12px;
}

.fab-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--grad-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
  color: white;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.nav-fab:hover .fab-circle,
.nav-fab:active .fab-circle {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.7);
}

.nav-fab.active .fab-circle {
  background: var(--grad-accent);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25), 0 4px 20px rgba(99, 102, 241, 0.5);
}

/* â”€â”€ Cards â”€â”€ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

.card:hover,
.card:active {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(99, 102, 241, 0.2);
}

.card-glass {
  background: rgba(26, 26, 46, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* â”€â”€ Item Cards (Dashboard) â”€â”€ */
.item-card {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

.item-card:hover,
.item-card:active {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(99, 102, 241, 0.25);
}

.item-card-thumb {
  width: 90px;
  min-width: 90px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-top-left-radius: calc(var(--radius-md) - 1px);
  border-bottom-left-radius: calc(var(--radius-md) - 1px);
  overflow: hidden;
}

.item-card-thumb img {
  width: 90px;
  height: 90px;
  object-fit: cover;
}

.item-card-thumb .no-photo {
  color: var(--text3);
  font-size: 1.8rem;
}

/* List View Mode overrides */
.item-list.list-view-mode {
  gap: 8px; /* Tighter vertical spacing */
}
.item-list.list-view-mode .item-card {
  padding: 8px 12px;
  min-height: auto;
}
.item-list.list-view-mode .item-card-thumb {
  display: none;
}
.item-list.list-view-mode .item-card-body {
  padding: 0;
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 4px;
  column-gap: 12px;
}
/* Force a line break between row 1 and row 2 */
.item-list.list-view-mode .item-card-body::before {
  content: "";
  flex-basis: 100%;
  order: 3;
}
.item-list.list-view-mode .item-card-name {
  order: 1;
  flex: 1 1 0px;
  margin-bottom: 0;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-list.list-view-mode .item-card-date {
  order: 2;
  flex: 0 0 auto;
  margin-left: 0 !important;
  text-align: right;
  line-height: 1;
}
.item-list.list-view-mode .item-card-location {
  order: 4;
  flex: 1 1 0px;
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-list.list-view-mode .footer-row {
  display: contents !important;
}
.item-list.list-view-mode .badges-row {
  order: 5;
  flex: 0 0 auto;
  margin-top: 0 !important;
  margin-left: auto !important;
  justify-content: flex-end;
  flex-wrap: nowrap !important;
}

.item-card-body {
  padding: 14px 16px;
  flex: 1;
  min-width: 0;
}

.item-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.item-card-location {
  font-size: 0.8rem;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.item-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  padding: 2px 8px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-light);
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.item-card-date {
  font-size: 0.72rem;
  color: var(--text3);
  margin-top: 4px;
}

/* â”€â”€ Buttons â”€â”€ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s var(--ease);
  cursor: pointer;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--grad-accent);
  color: white;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface3);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-info {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-light);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.btn-info:hover {
  background: rgba(99, 102, 241, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
}

.btn-ghost:hover {
  background: var(--surface);
  color: var(--text);
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: 10px;
  border-radius: var(--radius-sm);
}

.btn-ai {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.btn-ai:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
}

.btn-ai:disabled {
  opacity: 0.8;
  cursor: wait;
  transform: none;
}

.ai-sparkles {
  animation: sparkles-float 2s ease-in-out infinite;
  display: inline-block;
}

@keyframes sparkles-float {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-3px) rotate(15deg);
  }
}

.loading-dots-ai {
  display: flex;
  gap: 3px;
}

.loading-dots-ai span {
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  animation: ai-pulse 1s infinite alternate;
}

.loading-dots-ai span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots-ai span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes ai-pulse {
  from {
    opacity: 0.3;
    transform: scale(0.8);
  }

  to {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* â”€â”€ Forms â”€â”€ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input,
.form-textarea,
.form-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  color: var(--text);
  font-size: 0.95rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  outline: none;
  width: 100%;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text3);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text3);
}

/* â”€â”€ Photo Upload â”€â”€ */
.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  background: var(--surface2);
}

.photo-upload-area:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}

.photo-upload-area .upload-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.photo-upload-area p {
  color: var(--text2);
  font-size: 0.88rem;
}

.photo-preview {
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  background: var(--surface3);
}

.photo-preview img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
}

.photo-preview-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
}

.photo-btn-action {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.photo-btn-action:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* â”€â”€ NFC Scan Animation â”€â”€ */
.scan-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 32px;
  padding: 24px;
}

.scan-ring {
  position: relative;
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scan-ring::before,
.scan-ring::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--accent);
  animation: ring-pulse 2s ease-out infinite;
}

.scan-ring::before {
  width: 100%;
  height: 100%;
  animation-delay: 0s;
}

.scan-ring::after {
  width: 100%;
  height: 100%;
  animation-delay: 0.8s;
}

.scan-ring-inner {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--grad-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow);
  z-index: 1;
}

.scan-ring-inner svg {
  color: white;
}

@keyframes ring-pulse {
  0% {
    transform: scale(0.6);
    opacity: 1;
  }

  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.scan-status {
  text-align: center;
}

.scan-status h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.scan-status p {
  color: var(--text2);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* â”€â”€ Tags / Badges â”€â”€ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.tag-accent {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-light);
}

.tag-success {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.tag-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.tag-linked {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

/* â”€â”€ Empty State â”€â”€ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 32px;
  text-align: center;
}

.empty-icon {
  width: 80px;
  height: 80px;
  background: var(--surface2);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text3);
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text2);
}

.empty-state p {
  font-size: 0.88rem;
  color: var(--text3);
  line-height: 1.5;
  max-width: 260px;
}

/* â”€â”€ Skeleton loader â”€â”€ */
.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.skeleton-card {
  display: flex;
  gap: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  height: 90px;
}

.skeleton-thumb {
  width: 90px;
  min-width: 90px;
}

.skeleton-body {
  flex: 1;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-line {
  height: 14px;
  border-radius: 6px;
}

.skeleton-line.short {
  width: 60%;
}

.skeleton-line.shorter {
  width: 40%;
}

/* â”€â”€ Toast â”€â”€ */
#toast-container {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: min(360px, 90vw);
  pointer-events: none;
}

.toast {
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in 0.3s var(--ease) forwards;
}

.toast-success {
  background: rgba(22, 163, 74, 0.95);
  color: white;
}

.toast-error {
  background: rgba(220, 38, 38, 0.95);
  color: white;
}

.toast-info {
  background: rgba(99, 102, 241, 0.95);
  color: white;
}

.toast-warning {
  background: rgba(217, 119, 6, 0.95);
  color: white;
}

.toast.removing {
  animation: toast-out 0.3s var(--ease) forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* â”€â”€ Auth Screen â”€â”€ */
#auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--bg);
}

/* â”€â”€ Page transitions â”€â”€ */
.page-enter {
  animation: page-in 0.3s var(--ease) forwards;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* â”€â”€ Section Headers â”€â”€ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  margin-bottom: 12px;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* â”€â”€ Search bar â”€â”€ */
.search-bar {
  position: relative;
  margin: 0 16px 16px;
}

.search-bar svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px 12px 44px;
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.search-input::placeholder {
  color: var(--text3);
}

/* â”€â”€ Item detail â”€â”€ */
.detail-photo {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  background: #000;
  cursor: zoom-in;
  transition: opacity 0.2s var(--ease);
}

.detail-photo:hover {
  opacity: 0.9;
}

.detail-body {
  padding: 24px 20px;
}

.detail-name {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 8px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.detail-section-value {
  color: var(--text2);
  font-size: 0.95rem;
  line-height: 1.6;
}

.detail-actions {
  display: flex;
  gap: 12px;
  padding-top: 8px;
}

.detail-actions .btn {
  flex: 1;
}

.detail-no-photo {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  color: var(--text3);
}

/* â”€â”€ Dialog / overlay â”€â”€ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: overlay-in 0.25s var(--ease);
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.dialog {
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 20px 40px;
  width: 100%;
  max-width: 480px;
  animation: slide-up 0.3s var(--ease);
}

@keyframes slide-up {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

.dialog h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.dialog p {
  color: var(--text2);
  font-size: 0.9rem;
  margin-bottom: 24px;
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  gap: 12px;
}

/* â”€â”€ Lightbox â”€â”€ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: overlay-in 0.3s var(--ease);
}

.lightbox-content {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 100%;
  max-height: 100%;
}

.lightbox-close {
  align-self: flex-end;
  margin-bottom: 12px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  z-index: 1010;
  transition: all 0.2s;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: scale-up 0.3s var(--ease);
}

@keyframes scale-up {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* â”€â”€ Profile page â”€â”€ */
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  margin: 0 auto 12px;
  display: block;
}

.profile-name {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
}

.profile-email {
  color: var(--text2);
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 32px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-number {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--grad-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text3);
  margin-top: 2px;
}

/* â”€â”€ NFC indicator â”€â”€ */
.nfc-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
}

.nfc-linked {
  background: rgba(34, 197, 94, 0.1);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.nfc-linked .nfc-dot {
  animation: none;
}

.nfc-unlinked {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.nfc-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

/* â”€â”€ Divider â”€â”€ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* â”€â”€ Scroll list â”€â”€ */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 16px;
}

/* â”€â”€ Page padding â”€â”€ */
.page-content {
  padding: 16px;
}

.page-content+.page-content {
  padding-top: 0;
}

/* â”€â”€ Responsive (tablet) â”€â”€ */
@media (min-width: 600px) {
  .item-card-thumb {
    width: 110px;
    min-width: 110px;
  }

  .item-card-thumb img {
    width: 110px;
    height: 110px;
  }

  #bottom-nav {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  #app-header {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }

  #view-container {
    max-width: 480px;
    margin: 0 auto;
  }

  #toast-container {
    bottom: calc(var(--nav-h) + 24px);
  }
}

/* â”€â”€ Custom Scrollbar (Global) â”€â”€ */
::-webkit-scrollbar,
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track,
.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb,
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover,
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* â”€â”€ Toggle Switch â”€â”€ */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--surface3);
  transition: .3s;
  border-radius: 24px;
  border: 1px solid var(--border);
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text2);
  transition: .3s;
  border-radius: 50%;
}
input:checked + .toggle-slider {
  background: var(--grad-accent);
  border-color: transparent;
}
input:checked + .toggle-slider:before {
  transform: translateX(20px);
  background-color: white;
}

/* ── Generic Tooltip ── */
.hover-tooltip {
  position: relative;
}
.hover-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--surface3);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text);
  white-space: pre-wrap;
  min-width: 150px;
  max-width: 220px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: var(--shadow-sm);
  z-index: 100;
  font-weight: 500;
  line-height: 1.3;
}
.hover-tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: var(--surface3) transparent transparent transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
}
/* Trigger on hover, focus-within, focus, or an explicit active state */
.hover-tooltip:hover::after,
.hover-tooltip:focus-within::after,
.hover-tooltip:focus::after,
.hover-tooltip.active::after,
.hover-tooltip:hover::before,
.hover-tooltip:focus-within::before,
.hover-tooltip:focus::before,
.hover-tooltip.active::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.hover-tooltip:hover::before,
.hover-tooltip:focus-within::before,
.hover-tooltip:focus::before,
.hover-tooltip.active::before {
  transform: translateX(-50%);
}
