/* ============================================
   PhatNguoi PDF Search — Fresh Light Theme
   Sáng, sạch, hiện đại
   ============================================ */

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

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

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: #f8f9fc;
  color: #1e1e2e;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

/* --- Background: soft gradient mesh --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 60% 50% at 0% 0%, rgba(99,102,241,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(6,182,212,0.05) 0%, transparent 50%),
    radial-gradient(ellipse 40% 30% at 50% 50%, rgba(139,92,246,0.03) 0%, transparent 45%);
  pointer-events: none;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.15); }

/* --- Selection --- */
::selection { background: rgba(99,102,241,0.2); color: #1e1e2e; }

/* ============================================
   Utilities
   ============================================ */
.hidden { display: none !important; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ============================================
   Cards — White glass
   ============================================ */
.card {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: all 0.3s cubic-bezier(0.23,1,0.32,1);
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.1);
}

.card-highlight {
  border-color: rgba(99,102,241,0.15);
}

.card-highlight:hover {
  border-color: rgba(99,102,241,0.3);
  box-shadow: 0 4px 20px rgba(99,102,241,0.08);
}

.card-header {
  padding: 1.125rem 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.card-body { padding: 1.5rem; }

/* ============================================
   Buttons
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.23,1,0.32,1);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,0.25);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(99,102,241,0.35);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(0,0,0,0.03);
  color: #1e1e2e;
  border: 1px solid rgba(0,0,0,0.08);
}

.btn-ghost:hover {
  background: rgba(0,0,0,0.06);
  border-color: rgba(0,0,0,0.12);
}

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }

/* ============================================
   Inputs
   ============================================ */
.input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1.5px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  color: #1e1e2e;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9375rem;
  transition: all 0.25s cubic-bezier(0.23,1,0.32,1);
  outline: none;
}

.input::placeholder { color: rgba(0,0,0,0.25); }

.input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.input-search {
  padding-left: 2.75rem;
}

/* ============================================
   Badge / Tags
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-purple { background: rgba(99,102,241,0.1); color: #5b5bd6; }
.badge-green { background: rgba(16,185,129,0.1); color: #059669; }
.badge-red { background: rgba(239,68,68,0.1); color: #dc2626; }
.badge-yellow { background: rgba(245,158,11,0.1); color: #d97706; }

/* ============================================
   Drop Zone
   ============================================ */
.drop-zone {
  border: 2px dashed rgba(0,0,0,0.1);
  border-radius: 16px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.23,1,0.32,1);
  background: rgba(255,255,255,0.6);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: #6366f1;
  background: rgba(99,102,241,0.04);
  box-shadow: 0 0 24px rgba(99,102,241,0.06);
}

.drop-zone-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.drop-zone-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; }
.drop-zone-desc { font-size: 0.8125rem; color: rgba(0,0,0,0.35); }

/* ============================================
   Stat Grid
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.stat-box {
  padding: 1.25rem 1rem;
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(0,0,0,0.35);
  font-weight: 600;
}

.text-accent { color: #6366f1; }
.text-warning { color: #d97706; }
.text-success { color: #059669; }
.text-info { color: #0891b2; }
.text-gradient {
  background: linear-gradient(135deg, #6366f1, #7c3aed, #0891b2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   Table
   ============================================ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  padding: 0.75rem 1rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(0,0,0,0.35);
  background: rgba(0,0,0,0.02);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  color: #1e1e2e;
  vertical-align: middle;
  /* Overflow protection: không cho cell phình to */
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(99,102,241,0.03); }

/* ============================================
   Plate Badge — giống biển số xe thật
   ============================================ */
.plate-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: rgba(99,102,241,0.08);
  color: #6366f1;
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  border: 1px solid rgba(99,102,241,0.15);
  white-space: nowrap;
  font-family: 'Courier New', 'SF Mono', monospace;
}

/* ============================================
   Filter Pills
   ============================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4rem 0.875rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.23,1,0.32,1);
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.8);
  color: rgba(0,0,0,0.55);
  white-space: nowrap;
}

.pill:hover { border-color: rgba(0,0,0,0.15); color: #1e1e2e; }
.pill.active { background: #6366f1; border-color: #6366f1; color: #fff; }
.pill .pill-count {
  background: rgba(0,0,0,0.06);
  padding: 0.0625rem 0.375rem;
  border-radius: 4px;
  font-size: 0.6875rem;
}
.pill.active .pill-count { background: rgba(255,255,255,0.2); }

/* ============================================
   Pagination
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 1.25rem 0;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  background: #fff;
  color: rgba(0,0,0,0.45);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.23,1,0.32,1);
}

.page-btn:hover { border-color: rgba(0,0,0,0.15); color: #1e1e2e; }
.page-btn.active { background: #6366f1; border-color: #6366f1; color: #fff; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ============================================
   Highlight
   ============================================ */
mark.highlight {
  background: rgba(99,102,241,0.15);
  color: inherit;
  padding: 0.1rem 0.2rem;
  border-radius: 3px;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  padding: 4rem 2rem;
  text-align: center;
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem; color: rgba(0,0,0,0.6); }
.empty-state-desc { font-size: 0.875rem; color: rgba(0,0,0,0.35); max-width: 24rem; margin: 0 auto; }

/* ============================================
   Toast
   ============================================ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  padding: 0.875rem 1.25rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  font-size: 0.875rem;
  font-weight: 500;
  transform: translateY(1rem);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.23,1,0.32,1);
  pointer-events: none;
}

.toast.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.toast.error { border-color: rgba(239,68,68,0.3); }
.toast.success { border-color: rgba(16,185,129,0.3); }

/* ============================================
   Loading Overlay
   ============================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 998;
  background: rgba(248,249,252,0.85);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.spinner {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2.5px solid rgba(99,102,241,0.12);
  border-top-color: #6366f1;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { font-size: 0.9375rem; color: rgba(0,0,0,0.45); font-weight: 500; }

/* ============================================
   Layout helpers
   ============================================ */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: rgba(0,0,0,0.4); }
.font-medium { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ============================================
   Section header / eyebrow
   ============================================ */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(99,102,241,0.06);
  color: #6366f1;
  border: 1px solid rgba(99,102,241,0.12);
  margin-bottom: 0.75rem;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .container { padding: 0 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 1.375rem; }
  .card-header { padding: 1rem 1.125rem; }
  .card-body { padding: 1.125rem; }
  .toast { left: 1rem; right: 1rem; bottom: 1rem; }
  thead th, tbody td { padding: 0.5rem 0.625rem; font-size: 0.8125rem; }
}

.badge-success {
  background: rgba(85, 239, 196, 0.12);
  color: var(--success);
}

.badge-danger {
  background: rgba(255, 107, 107, 0.12);
  color: var(--danger);
}

.badge-warning {
  background: rgba(253, 203, 110, 0.12);
  color: var(--warning);
}

/* --- Eyebrow Tag (Section Label) --- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  border: 1px solid var(--border-glass);
  margin-bottom: 0.75rem;
}

/* --- Loading Spinner --- */
.spinner {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.spinner-lg {
  width: 2.5rem;
  height: 2.5rem;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Toast / Notification --- */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-inner);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  font-size: 0.875rem;
  transform: translateY(1.5rem);
  opacity: 0;
  transition: all 0.5s var(--transition-spring);
  pointer-events: none;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toast.toast-error {
  border-color: rgba(255, 107, 107, 0.3);
}

.toast.toast-success {
  border-color: rgba(85, 239, 196, 0.3);
}

/* --- Animations --- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(1.5rem);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

.animate-fade-up {
  animation: fadeUp 0.8s var(--transition-spring) both;
}

.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }

/* --- Empty State --- */
.empty-state {
  padding: 4rem 2rem;
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-state-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  max-width: 24rem;
  margin: 0 auto;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .double-bezel {
    border-radius: 1.25rem;
    padding: 1px;
  }
  .double-bezel-inner {
    border-radius: calc(1.25rem - 0.25rem);
    padding: 1rem;
  }
  .drop-zone {
    padding: 2rem 1rem;
    border-radius: 1.25rem;
  }
  .stat-card .stat-value {
    font-size: 1.5rem;
  }
  .table-premium th,
  .table-premium td {
    padding: 0.625rem 0.75rem;
    font-size: 0.8125rem;
  }
  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    text-align: center;
  }
  .filter-pills-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .filter-pills-scroll::-webkit-scrollbar {
    display: none;
  }
}

/* --- Print --- */
@media print {
  body::before { display: none; }
  .double-bezel { border: 1px solid #ddd; backdrop-filter: none; }
  .btn-premium, .drop-zone, .pagination { display: none; }
}

/* --- Utility --- */
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-gradient {
  background: linear-gradient(135deg, #6366f1, #7c3aed, #0891b2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
