:root {
  --primary: #2563eb;
  --primary-glow: rgba(37, 99, 235, 0.4);
  --primary-hover: #1d4ed8;
  --bg-dark: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.6);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f8fafc;
  --text-light: #94a3b8;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  --radius-sm: 8px;
  --radius: 16px;
  --radius-lg: 24px;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  background: radial-gradient(circle at top right, #1e293b, #0f172a);
  color: var(--text);
  font-family: 'Inter', -apple-system, blinkmacsystemfont, 'Segoe UI', roboto, sans-serif;
  margin: 0;
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* Glassmorphism */
.bg-glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* Sidebar Styling */
.sidebar {
  width: 280px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  border-right: 1px solid var(--border);
  transition: transform 0.3s ease;
  overflow-y: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
}

.mobile-toggle {
  display: none;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  width: 45px;
  height: 45px;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px var(--primary-glow);
  cursor: pointer;
}

.sidebar-logo {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 3rem;
}

.sidebar-logo span {
  color: var(--primary);
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-link {
  color: var(--text-light);
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.nav-link.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.nav-link i {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

/* Main Layout */
.main-content {
  margin-left: 280px;
  padding: 3rem;
  max-width: 1600px;
  width: 100%;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.page-subtitle {
  color: var(--text-light);
  font-size: 1.1rem;
  margin: 4px 0 0 0;
}

.title-section {
  margin-bottom: 2.5rem;
}

/* Card System */
.card {
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.stat-card {
  padding: 2rem;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px var(--primary-glow);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* Tables */
.table-responsive {
  width: 100%;
  border-radius: var(--radius);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

/* Compact tables (opt-in) */
table.table-compact th,
table.table-compact td {
  padding: 0.65rem 1rem;
  line-height: 1.2;
}

th {
  padding: 1.25rem 1.5rem;
  text-align: left;
  background: rgba(255, 255, 255, 0.02);
  font-weight: 700;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  transition: all 0.2s ease;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Badges */
.badge {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.badge-info {
  background: rgba(6, 182, 212, 0.1);
  color: var(--info);
}

/* Forms */
.form-control {
  width: 100%;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.875rem 1.25rem;
  color: white;
  font-size: 1rem;
  transition: all 0.2s ease;
  display: block;
  min-height: 3.25rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(15, 23, 42, 0.6);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Progress */
.progress {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 10px;
}

.progress-bar.purple {
  background: #a855f7;
}

.progress-bar.blue {
  background: var(--primary);
}

.progress-bar.green {
  background: var(--success);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade {
  animation: fadeIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Layout Utilities */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

@media (max-width: 1024px) {
  :root {
    --radius: 12px;
    --radius-lg: 16px;
  }

  body {
    font-size: 14px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    padding: 1.5rem 1rem;
    gap: 1.5rem;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .sidebar.show+.sidebar-overlay {
    display: block;
  }

  .mobile-toggle {
    display: flex;
  }

  .sidebar-logo {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .sidebar-footer {
    padding-top: 1.5rem;
  }

  .nav-link {
    padding: 0.75rem 1rem;
    gap: 10px;
  }

  .main-content {
    margin-left: 0;
    padding: 4.5rem 0.75rem 1.5rem;
  }

  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .card-title {
    font-size: 1.25rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
  }

  .stat-card {
    padding: 1.25rem;
  }

  .stat-value {
    font-size: 1.75rem;
  }

  .btn {
    width: 100%;
    justify-content: center;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
  }

  th,
  td {
    padding: 0.75rem 1rem;
  }

  th {
    font-size: 0.75rem;
  }

  .form-row {
    flex-direction: column;
    gap: 1rem;
  }

  .form-group {
    flex: 1 1 auto;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .form-actions {
    flex-direction: column;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
  }

  .badge {
    padding: 4px 8px;
    font-size: 0.7rem;
  }

  .page-title {
    font-size: 1.75rem;
  }

  .page-subtitle {
    font-size: 0.95rem;
  }

  .title-section {
    margin-bottom: 1.5rem;
  }

  .filter-bar {
    flex-direction: column;
    gap: 0.75rem !important;
  }

  .filter-bar .btn {
    width: 100%;
  }
}

/* Extra responsiveness for compact member tables on small screens */
@media (max-width: 768px) {
  /* Hide less important columns to avoid horizontal squeeze:
     1: Mã HV, 2: Tài khoản, 6: Liên hệ, 8: Ngày tham gia, 9: Thao tác */
  table.table-compact th:nth-child(1),
  table.table-compact td:nth-child(1),
  table.table-compact th:nth-child(2),
  table.table-compact td:nth-child(2),
  table.table-compact th:nth-child(6),
  table.table-compact td:nth-child(6),
  table.table-compact th:nth-child(8),
  table.table-compact td:nth-child(8),
  table.table-compact th:nth-child(9),
  table.table-compact td:nth-child(9) {
    display: none;
  }

  table.table-compact th,
  table.table-compact td {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 13px;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .page-subtitle {
    font-size: 0.875rem;
  }

  .main-content {
    padding: 4rem 0.5rem 1rem;
  }

  .card {
    padding: 0.875rem;
  }

  .card-title {
    font-size: 1.125rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  td {
    font-size: 0.875rem;
  }
}

.form-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.form-group {
  flex: 1 1 300px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  font-size: 0.875rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.25rem;
  padding-right: 2.5rem;
}

center a[href*="somee.com"] {
    display: none !important;
}
div[onmouseover="S_ssac();"] {
    display: none !important;
}
div[style*="z-index: 2147483647"] {
    display: none !important;
}
body > div[style*="position: fixed"][style*="bottom: 0px"] {
    display: none !important;
}