/* ======================================================= */
/* VLEMP DASHBOARD THEME (CloudFly Style)                  */
/* ======================================================= */
:root {
  --dash-bg: #f4f6f8;
  --dash-surface: #ffffff;
  --dash-text: #1f2937;
  --dash-muted: #6b7280;
  --dash-border: #e5e7eb;
  --dash-hover: #f9fafb;
  --dash-th-bg: #f9fafb;
  --dash-primary: #0052FF; /* Màu xanh của Logo VLEMP */
  --dash-primary-light: #eff6ff; /* Nền xanh nhạt khi active */
  --dash-shadow: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"], body.dark-theme {
  --dash-bg: #0b1120;
  --dash-surface: #111827;
  --dash-text: #f3f4f6;
  --dash-muted: #9ca3af;
  --dash-border: #1f2937;
  --dash-hover: #1f2937;
  --dash-th-bg: #0b1120;
  --dash-primary: #3b82f6;
  --dash-primary-light: rgba(59, 130, 246, 0.15);
  --dash-shadow: rgba(0, 0, 0, 0.3);
}

body.dashboard-page {
  margin: 0; padding: 0; overflow: hidden; height: 100vh;
  background: var(--dash-bg); color: var(--dash-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.dash-layout { display: flex; height: 100vh; width: 100vw; }

/* ========================================== */
/* SIDEBAR (CỘT TRÁI)                         */
/* ========================================== */
.dash-sidebar {
  width: 260px; background: var(--dash-surface);
  border-right: 1px solid var(--dash-border);
  display: flex; flex-direction: column; z-index: 20;
  transition: 0.3s ease; flex-shrink: 0;
}

.dash-logo-area {
  height: 65px; display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--dash-border); background: var(--dash-surface);
}
.dash-logo-area img { max-height: 40px; max-width: 80%; object-fit: contain; }

.sidebar-menu {
  padding: 15px 10px; flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 5px; list-style: none; margin: 0;
}
.sidebar-menu li a {
  display: flex; align-items: center; gap: 12px; padding: 12px 15px;
  color: var(--dash-text); text-decoration: none; border-radius: 8px;
  font-weight: 500; font-size: 14px; transition: 0.2s;
}
.sidebar-menu li a i { font-size: 20px; color: var(--dash-muted); transition: 0.2s; }
.sidebar-menu li a:hover { background: var(--dash-hover); }
.sidebar-menu li a.active { background: var(--dash-primary-light); color: var(--dash-primary); font-weight: 600; }
.sidebar-menu li a.active i { color: var(--dash-primary); }
.sidebar-menu li a.logout { color: #ef4444; margin-top: auto; }
.sidebar-menu li a.logout i { color: #ef4444; }
.sidebar-menu li a.logout:hover { background: #fef2f2; }
[data-theme="dark"] .sidebar-menu li a.logout:hover { background: rgba(239,68,68,0.1); }

/* ========================================== */
/* HEADER & MAIN CONTENT (CỘT PHẢI)           */
/* ========================================== */
.dash-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.dash-header {
  height: 65px; background: var(--dash-surface);
  border-bottom: 1px solid var(--dash-border);
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 25px; flex-shrink: 0;
}
.mobile-toggle { display: none; background: transparent; border: none; font-size: 24px; color: var(--dash-text); cursor: pointer; }
.header-right { display: flex; align-items: center; gap: 15px; }

.btn-icon { background: var(--dash-bg); border: 1px solid var(--dash-border); border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--dash-text); transition: 0.2s; font-size: 18px; }
.btn-icon:hover { color: var(--dash-primary); border-color: var(--dash-primary); }

.user-profile { display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px; border-radius: 30px; border: 1px solid var(--dash-border); cursor: pointer; background: var(--dash-bg); transition: 0.2s; }
.user-profile:hover { border-color: var(--dash-primary); }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--dash-primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 14px; }
.user-info { display: flex; flex-direction: column; padding-right: 5px; }
.user-name { font-size: 13px; font-weight: 700; color: var(--dash-text); }
.user-role { font-size: 11px; color: var(--dash-muted); }

/* KHU VỰC CUỘN NỘI DUNG */
.dash-content-wrapper { flex: 1; overflow-y: auto; display: flex; flex-direction: column; scroll-behavior: smooth; }
.dash-content { padding: 30px; flex: 1; max-width: 1400px; margin: 0 auto; width: 100%; box-sizing: border-box; }

/* ========================================== */
/* UI COMPONENTS (TABS, TABLES, CARDS)        */
/* ========================================== */
.tab-content { display: none; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.tab-header { margin-bottom: 25px; background: var(--dash-surface); padding: 20px; border-radius: 12px; border: 1px solid var(--dash-border); box-shadow: var(--dash-shadow); display: flex; align-items: center; gap: 12px; }
.tab-title { font-size: 1.2rem; font-weight: 700; color: var(--dash-text); margin: 0; display: flex; align-items: center; gap: 10px; }
.tab-title i { color: var(--dash-primary); font-size: 24px; }

.table-container { background: var(--dash-surface); border-radius: 12px; border: 1px solid var(--dash-border); overflow-x: auto; box-shadow: var(--dash-shadow); }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 15px 20px; border-bottom: 1px solid var(--dash-border); color: var(--dash-text); white-space: normal; }
th { background: var(--dash-th-bg); color: var(--dash-muted); font-size: 12px; text-transform: uppercase; font-weight: 700; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--dash-hover); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 25px; }
.card { background: var(--dash-surface); border-radius: 12px; padding: 20px; box-shadow: var(--dash-shadow); border: 1px solid var(--dash-border); }

.btn-primary { background: var(--dash-primary); color: white; border: none; padding: 8px 16px; border-radius: 6px; font-weight: 600; cursor: pointer; transition: 0.2s; font-size: 13px; }
.btn-primary:hover { opacity: 0.9; box-shadow: 0 4px 10px rgba(0, 82, 255, 0.2); }

.affiliate-tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--dash-border); margin-bottom: 25px; overflow-x: auto; }
.affiliate-tabs a { padding-bottom: 12px; color: var(--dash-muted); text-decoration: none; white-space: nowrap; font-weight: 600; transition: 0.2s; border-bottom: 2px solid transparent; font-size: 14px; }
.affiliate-tabs a.active { color: var(--dash-primary); border-bottom: 2px solid var(--dash-primary); }

.dash-footer { padding: 20px 30px; border-top: 1px solid var(--dash-border); display: flex; justify-content: space-between; align-items: center; color: var(--dash-muted); font-size: 13px; background: transparent; }
.dash-footer a { color: var(--dash-primary); text-decoration: none; font-weight: 500; margin-left: 20px; }

@media (max-width: 992px) {
  .dash-sidebar { position: fixed; left: -260px; height: 100vh; }
  .dash-sidebar.active { left: 0; box-shadow: 0 0 20px rgba(0,0,0,0.5); }
  .mobile-toggle { display: block; }
}