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

:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: #1a2235;
  --bg-glass: rgba(26, 34, 53, 0.6);
  --border: rgba(99, 115, 171, 0.15);
  --border-glow: rgba(59, 130, 246, 0.3);
  --text-primary: #f0f4ff;
  --text-secondary: #8b98b8;
  --text-muted: #5a6785;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --success: #22c55e;
  --success-glow: rgba(34, 197, 94, 0.2);
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --purple: #8b5cf6;
  --cyan: #06b6d4;
  --pink: #ec4899;
  --gradient-primary: linear-gradient(135deg, #3b82f6, #8b5cf6);
  --gradient-accent: linear-gradient(135deg, #06b6d4, #3b82f6);
  --gradient-card: linear-gradient(145deg, rgba(26, 34, 53, 0.8), rgba(17, 24, 39, 0.9));
  --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);
  --shadow-glow: 0 0 20px var(--accent-glow);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

* { margin:0; padding:0; box-sizing:border-box; }
html { overflow-x: hidden; max-width: 100vw; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: 
    radial-gradient(ellipse at 20% 0%, rgba(59,130,246,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(139,92,246,0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--accent); text-decoration: none; transition: all 0.3s; }
a:hover { color: var(--accent-hover); }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ============ NAVBAR ============ */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar .logo {
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
}

.navbar .logo span { font-size: 1.6rem; }

.nav-links {
  display: flex; gap: 4px; list-style: none;
}

.nav-links a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.3s;
  display: flex; align-items: center; gap: 6px;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-right {
  display: flex; align-items: center; gap: 12px;
}

.nav-balance {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 14px;
  font-weight: 600;
  color: var(--success);
  font-size: 0.9rem;
  display: flex; align-items: center; gap: 6px;
}

.product-price { font-weight: 800; color: var(--accent); font-size: 1.1rem; }
.price-old { text-decoration: line-through; color: var(--text-muted); font-size: 0.85rem; margin-right: 8px; font-weight: 500; }

.nav-user {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.3s;
}

.nav-user:hover { background: var(--bg-card); }

.nav-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
}

.user-dropdown {
  position: absolute; top: 60px; right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  display: none;
  overflow: hidden;
  z-index: 1001;
}

.user-dropdown.show { display: block; }

.user-dropdown a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.user-dropdown a:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

/* ============ MAIN CONTENT ============ */
.main-content {
  margin-top: 64px;
  min-height: calc(100vh - 64px);
  position: relative;
  z-index: 1;
}

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

.page-section { padding: 2rem 0; }

/* SVG constraints for icons */
.cat-icon svg, .product-img svg {
  max-width: 100%;
  max-height: 100%;
  display: block;
  margin: auto;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover { border-color: var(--accent); }

.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: #000; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-full { width: 100%; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ============ CARDS ============ */
.card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
  overflow: hidden;
  transition: all 0.3s;
}

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

.card-body { padding: 1.25rem; }
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}

/* ============ FORMS ============ */
.form-group { margin-bottom: 1rem; }

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

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

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

/* ============ HERO BANNER ============ */
.hero {
  padding: 3rem 0;
  text-align: center;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: -100px; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff, #a5b4fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 2rem;
  position: relative;
}

/* ============ CATEGORY GRID ============ */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 2rem 0;
}

.cat-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.cat-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-3px);
}

.cat-icon { font-size: 2rem; margin-bottom: 8px; display: block; }
.cat-name { font-weight: 600; font-size: 0.85rem; }
.cat-count { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* ============ PRODUCT GRID ============ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.product-card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s;
}

.product-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 0 30px var(--accent-glow);
  transform: translateY(-4px);
}

.product-img {
  height: 160px;
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  position: relative;
}

.product-badge {
  position: absolute;
  top: 10px; right: 10px;
  background: var(--success);
  color: white;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.product-info { padding: 1rem; }

.product-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-meta {
  display: flex; justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.product-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.product-stock {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.product-actions { display: flex; gap: 8px; }

/* ============ STATS BAR ============ */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 2rem 0;
}

.stat-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  text-align: center;
  transition: all 0.3s;
}

.stat-item:hover { border-color: var(--accent); }

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============ TABLE ============ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}

.table-wrap::-webkit-scrollbar {
  height: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg-card);
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

td { color: var(--text-primary); }

tr:hover td { background: rgba(59,130,246,0.03); }

/* ============ BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: var(--success-glow); color: var(--success); }
.badge-danger { background: var(--danger-glow); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-info { background: rgba(6,182,212,0.15); color: var(--cyan); }
.badge-purple { background: rgba(139,92,246,0.15); color: var(--purple); }
.badge-secondary { background: rgba(100,116,139,0.15); color: var(--text-secondary); }

/* Pulsate animation for "Buying" status */
.pulsate {
  animation: pulsate-animation 2s infinite ease-in-out;
}

@keyframes pulsate-animation {
  0% { opacity: 0.6; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1.02); }
  100% { opacity: 0.6; transform: scale(0.98); }
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center; justify-content: center;
}

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

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.modal-close {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.3s;
}

.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 1.25rem; }
.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ============ TABS ============ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.tab {
  padding: 10px 18px;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
  white-space: nowrap;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: inherit; font-size: 0.9rem;
}

.tab:hover { color: var(--text-secondary); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ============ TOPUP QR ============ */
.topup-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  max-width: 500px;
  margin: 2rem auto;
}

.topup-code {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--warning);
  background: var(--bg-secondary);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  margin: 1rem 0;
  cursor: pointer;
  user-select: all;
  border: 2px dashed var(--border);
}

/* ============ FOOTER ============ */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: 3rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-title {
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.footer-links { list-style: none; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: var(--text-muted); font-size: 0.9rem; }
.footer-links a:hover { color: var(--accent); }

.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ============ ADMIN SIDEBAR ============ */
.admin-layout {
  display: flex;
  min-height: calc(100vh - 64px);
}

.admin-sidebar {
  width: 250px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  flex-shrink: 0;
  overflow-y: auto;
}

.admin-sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.admin-sidebar a:hover, .admin-sidebar a.active {
  background: var(--bg-card);
  color: var(--text-primary);
  border-left-color: var(--accent);
}

.admin-content {
  flex: 1;
  padding: 1.5rem;
  overflow-x: auto;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.admin-header h2 { font-size: 1.4rem; font-weight: 700; }

/* ============ DASHBOARD GRID ============ */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 2rem;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  transition: all 0.3s;
}

.dash-card:hover { border-color: var(--accent); }

.dash-card .icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.dash-card .value { font-size: 1.6rem; font-weight: 700; }
.dash-card .label { color: var(--text-muted); font-size: 0.8rem; margin-top: 2px; }

/* ============ TOAST ============ */
.toast-container {
  position: fixed; top: 80px; right: 20px;
  z-index: 3000; display: flex; flex-direction: column; gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 500;
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
  max-width: 350px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--accent); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============ LOADING ============ */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem; color: var(--text-muted);
}

.spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 10px;
}

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

/* ============ EMPTY STATE ============ */
.empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

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

/* ============ SECTION HEADERS ============ */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
}

/* ============ AUTH PAGES ============ */
.auth-container {
  max-width: 420px;
  margin: 3rem auto;
  padding: 0 1rem;
}

.auth-card {
  background: var(--gradient-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  backdrop-filter: blur(10px);
}

.auth-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.auth-switch {
  text-align: center;
  margin-top: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .navbar { padding: 0 0.5rem; justify-content: flex-start; gap: 6px; width: 100vw; }
  .mobile-menu-btn { order: -1; display: block !important; margin-right: 2px; flex-shrink: 0; }
  .logo { font-size: 1.15rem !important; flex-shrink: 0; }
  .nav-right { margin-left: auto; flex-shrink: 1; min-width: 0; gap: 6px !important; }
  .nav-balance { font-size: 0.75rem; padding: 4px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
  .nav-user span { display: none; }
  .nav-avatar { width: 28px; height: 28px; font-size: 0.7rem; }
  
  .nav-links {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: calc(100vh - 64px) !important;
    min-height: calc(100vh - 64px);
    background: #070b14;
    flex-direction: column;
    padding: 1.5rem 1rem;
    gap: 0;
    display: none;
    z-index: 1050;
    border-top: 2px solid var(--accent);
    overflow-y: auto;
    list-style: none;
  }
  .nav-links.show { display: flex !important; }
  .nav-links li {
    width: 100%;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .nav-links li:last-child { border-bottom: none; }
  .nav-links a {
    font-size: 1.15rem;
    padding: 18px 16px;
    width: 100%;
    justify-content: flex-start;
    color: #ffffff !important;
    font-weight: 600;
    border-radius: 8px;
    transition: background 0.2s;
  }
  .nav-links a:hover,
  .nav-links a.active {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #60a5fa !important;
  }

  .hero h1 { font-size: 1.6rem; }
  .hero p { font-size: 0.9rem; }
  .container { padding: 0 12px; max-width: 100vw; overflow-x: hidden; }
  
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .product-card { padding: 10px; }
  .product-info h3 { font-size: 0.9rem; }
  
  /* Sidebar will be handled by the fixed position rules below */
  
  .stats-bar { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-item { padding: 1rem 0.5rem; }
  .stat-value { font-size: 1.25rem; }
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text-primary);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.mobile-menu-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============ SKELETON LOADING ============ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-secondary) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
  display: block;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============ SCROLL TO TOP ============ */
.scroll-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: var(--gradient-primary);
  color: white;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s;
}

.scroll-top:hover { transform: translateY(-5px); }
.scroll-top.show { display: flex; animation: slideUp 0.3s ease; }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ============ GUIDE STEPS ============ */
.guide-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 2rem 0;
}

.guide-step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  position: relative;
}

.guide-step .step-num {
  width: 36px; height: 36px;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  margin: 0 auto 12px;
}

.guide-step h4 { margin-bottom: 8px; font-size: 0.95rem; }
.guide-step p { font-size: 0.8rem; color: var(--text-muted); }

/* ============ FILTERS ============ */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  align-items: center;
}

.filter-bar .form-input,
.filter-bar .form-select {
  width: auto;
  min-width: 160px;
}

/* ============ PRODUCT DETAIL ============ */
.product-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin: 2rem 0;
}

.product-detail-img {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
}

@media (max-width: 768px) {
  .product-detail-grid { grid-template-columns: 1fr; }
}

/* ============ ANIMATIONS ============ */
.fade-in {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Paginator */
.pagination {
  display: flex; gap: 4px; justify-content: center; margin-top: 1.5rem;
}

.pagination button {
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.pagination button.active,
.pagination button:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Copy button */
.copy-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Search bar */
.search-bar {
  position: relative;
  max-width: 400px;
}

.search-bar input {
  padding-left: 40px;
}

.search-bar::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
}


/* ============ LIGHT MODE ============ */
body.light-mode {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.8);
  --border: rgba(0, 0, 0, 0.1);
  --border-glow: rgba(59, 130, 246, 0.1);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --gradient-card: linear-gradient(145deg, #ffffff, #f1f5f9);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.12);
}

body.light-mode .hero h1 {
  background: linear-gradient(135deg, #0f172a, #3b82f6);
  -webkit-background-clip: text;
  background-clip: text;
}

body.light-mode .hero::before {
  background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
}

body.light-mode .navbar {
  background: rgba(255, 255, 255, 0.85);
}

body.light-mode .admin-sidebar {
  background: #ffffff;
}

body.light-mode .user-dropdown {
  background: #ffffff;
}

body.light-mode .modal {
  background: #ffffff;
}

body.light-mode .form-input, body.light-mode .form-select, body.light-mode .form-textarea {
  background: #f8fafc;
  border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .btn-secondary {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
  color: #0f172a;
}

.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1.1rem;
}

.theme-toggle:hover { transform: rotate(15deg) scale(1.1); border-color: var(--accent); }

/* ============ ARTICLES ============ */
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.article-content a {
  color: var(--accent);
  text-decoration: none;
}
.article-content a:hover {
  text-decoration: underline;
}
.article-content p {
  margin-bottom: 1.2rem;
  color: var(--text-secondary);
}
.article-content h2, .article-content h3, .article-content h4 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.btn-article {
  display: inline-block;
  padding: 10px 24px;
  background: var(--gradient-primary);
  color: white !important;
  border-radius: var(--radius-md);
  text-decoration: none !important;
  font-weight: 600;
  transition: all 0.3s;
  border: none;
  cursor: pointer;
  margin: 10px 0;
  box-shadow: var(--shadow-md);
}

.btn-article:hover {
  transform: translateY(-2px);
  box-shadow: var(--accent-glow);
  color: white !important;
}

/* Quill Editor Styles */
.editor-container {
  height: 350px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: var(--text-primary);
}
.ql-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.ql-container {
  border: 1px solid var(--border) !important;
  border-top: none !important;
  font-family: inherit !important;
  font-size: 1rem !important;
}
.ql-editor {
  min-height: 200px;
}
.ql-editor.ql-blank::before {
  color: var(--text-muted) !important;
  font-style: normal !important;
}
.ql-snow .ql-stroke {
  stroke: var(--text-secondary) !important;
}
.ql-snow .ql-fill {
  fill: var(--text-secondary) !important;
}
.ql-snow .ql-picker {
  color: var(--text-secondary) !important;
}
.ql-snow .ql-picker-options {
  background-color: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
}
.ql-article-button::before {
  content: '🔘';
  font-size: 14px;
}
.ql-article-button {
  width: 28px !important;
}
.ql-article-button:hover::after {
  content: 'Tạo nút';
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  border: 1px solid var(--border);
  z-index: 10;
}

.admin-menu-toggle {
  display: none;
}

/* ============ MOBILE ADMIN FIXES ============ */
@media (max-width: 992px) {
  .admin-menu-toggle { display: block; }
  .admin-sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 2001;
    background: var(--bg-secondary);
    box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
    padding-top: 1.5rem;
  }
  .admin-sidebar.show { left: 0; }
  .admin-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    z-index: 2000;
    display: none;
    animation: fadeIn 0.3s ease;
  }
  .admin-backdrop.show { display: block; }
  .admin-layout { flex-direction: column; }
  .admin-content { padding: 1rem; width: 100%; }
}

@media (max-width: 768px) {
  .admin-header { 
    flex-direction: column; 
    align-items: stretch !important; 
    gap: 12px; 
    padding: 1rem !important;
  }
  .admin-header div { 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    width: 100%;
  }
  .admin-header button, .admin-header a { 
    width: 100% !important; 
    text-align: center;
    margin: 0 !important;
  }
  .dash-grid { 
    padding: 0 5px;
    gap: 12px;
  }
  .dash-card { 
    padding: 1rem;
  }
  .table-wrap {
    margin: 0 -1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .modal {
    width: 95%;
    margin: 10px;
  }
}

/* ============ 2FA TOOL ============ */
#tfaCode {
  font-family: 'Inter', monospace;
  transition: all 0.3s;
  text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}
#tfaCode:hover {
  color: var(--accent-hover);
  transform: scale(1.05);
}
.progress-bar {
  position: relative;
  background: var(--bg-secondary);
}
#tfaProgress {
  transition: width 1s linear;
}

/* ============ QUILL EDITOR ============ */
.editor-container { 
  min-height: 400px; 
  background: #fff; 
  color: #333; 
  border: 1px solid var(--border);
  border-bottom-left-radius: var(--radius-md); 
  border-bottom-right-radius: var(--radius-md); 
}
.ql-toolbar {
  background: #f8fafc;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
}
.ql-editor { 
  font-size: 1rem; 
  line-height: 1.6; 
  min-height: 400px; 
}
.ql-editor img { 
  max-width: 100%; 
  height: auto; 
  cursor: pointer;
}
/* Ensure images in article content are also responsive */
.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: 1rem 0;
}

/* ============ LANGUAGE SELECTOR ============ */
.lang-selector { position: relative; }
.lang-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.lang-btn:hover { border-color: var(--accent); background: var(--bg-glass); }

.lang-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 150px;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 1002;
  overflow: hidden;
}
.lang-dropdown.show { display: block; }
.lang-dropdown a {
  display: block;
  padding: 10px 16px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all 0.2s;
}
.lang-dropdown a:hover { background: var(--bg-glass); color: var(--text-primary); }

/* Hide Google Translate UI */
.goog-te-banner-frame.skiptranslate, .goog-te-gadget-icon { display: none !important; }
body { top: 0px !important; }
.goog-te-menu-value { display: none !important; }
.goog-tooltip { display: none !important; }
.goog-tooltip:hover { display: none !important; }
.goog-text-highlight { background-color: transparent !important; border: none !important; box-shadow: none !important; }
#google_translate_element { display: none !important; }
.skiptranslate { display: none !important; }
iframe.goog-te-banner-frame { display: none !important; }
.goog-te-menu-frame { max-height: 400px !important; overflow-y: auto !important; }
