:root {
  --primary: #03a84e;
  --primary-dark: #02873e;
  --primary-light: #45c467;
  --secondary: #64748b;
  --success: #03a84e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #f8fafc;
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --radius: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  min-height: 100vh;
  color: #1e293b;
}

.navbar-wifim {
  background: linear-gradient(135deg, #03a84e, #006838) !important;
  box-shadow: 0 4px 20px rgba(3, 168, 78, 0.2);
}

.wifim-brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.5px;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.navbar-brand i {
  font-size: 1.5rem;
}

.nav-link {
  font-weight: 500;
  border-radius: 10px;
  padding: 0.5rem 1rem;
  transition: all 0.2s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.18);
}

.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.feature-card {
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
}

.feature-card .card {
  height: 100%;
  padding: 2rem 1.5rem;
  text-align: center;
  border: 2px solid transparent;
  transition: all 0.3s;
}

.feature-card:hover .card {
  border-color: var(--primary);
}

.feature-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 2rem;
}

.feature-card h5 {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--secondary);
  font-size: 0.9rem;
  margin-bottom: 0;
}

.form-control, .form-select {
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.form-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #475569;
  margin-bottom: 0.4rem;
}

.btn {
  border-radius: 12px;
  font-weight: 600;
  padding: 0.7rem 1.5rem;
  transition: all 0.2s;
  font-size: 0.95rem;
}

.btn-primary {
  background: var(--primary);
  border: none;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(3, 168, 78, 0.35);
}

.btn-success { background: var(--success); border: none; }
.btn-success:hover { background: #16a34a; transform: translateY(-1px); }

.btn-outline-secondary {
  border: 2px solid #e2e8f0;
  color: #475569;
}

.btn-outline-secondary:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.alert {
  border: none;
  border-radius: 14px;
  padding: 1rem 1.25rem;
}

.alert-success { background: #f0fdf4; color: #15803d; }
.alert-danger { background: #fef2f2; color: #dc2626; }
.alert-info { background: #eff6ff; color: #1d4ed8; }

.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.loading-overlay.show {
  display: flex;
}

.loading-box {
  background: white;
  border-radius: 20px;
  padding: 2.5rem 3rem;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 90%;
}

.loading-box .spinner-border {
  width: 3rem;
  height: 3rem;
  color: var(--primary);
}

.loading-box p {
  margin-top: 1rem;
  font-weight: 600;
  color: #1e293b;
}

.loading-box .text-muted {
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

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

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--secondary);
  font-weight: 500;
}

.result-card {
  border-left: 4px solid var(--success);
}

.result-link {
  word-break: break-all;
  color: var(--primary);
  font-weight: 500;
}

.result-link:hover {
  color: var(--primary-dark);
}

.page-header {
  padding: 1.5rem 0;
}

.page-header h1 {
  font-weight: 800;
  font-size: 1.6rem;
  margin: 0;
}

.page-header p {
  color: var(--secondary);
  margin: 0.3rem 0 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--secondary);
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.back-link:hover {
  color: var(--primary);
}

.form-section {
  background: white;
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--card-shadow);
}

.badge-platform {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 600;
}

/* Scrollbar cho file list / data table */
#fileList::-webkit-scrollbar { width: 4px; }
#fileList::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.dv-table-wrap::-webkit-scrollbar { height: 6px; }
.dv-table-wrap::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Responsive data viewer */
@media (max-width: 768px) {
  .feature-card .card { padding: 1.5rem 1rem; }
  .loading-box { padding: 2rem 1.5rem; }
  .form-section { padding: 1.25rem; }
  .dv-header { flex-direction: column; align-items: stretch !important; }
  .dv-search { max-width: 100%; }
  .dv-pagination { flex-direction: column; align-items: stretch !important; text-align: center; }
  .dv-pagination .d-flex { justify-content: center; flex-wrap: wrap; }
  .dv-table td { max-width: 150px; }
}
