/* styles.css — Ghi đè Bootstrap 5, bám theo mockup 05_Mockup_GiaoDien.html */

/* ── Biến màu (CSS variables) ─────────────────────────────────────────────── */
:root {
  --ind:   #4F46E5;   /* indigo chính */
  --indl:  #EEF2FF;   /* indigo nhạt (nền active) */
  --indd:  #3730A3;   /* indigo đậm (chữ active) */
  --grn:   #10B981;
  --grnl:  #ECFDF5;
  --grnd:  #065F46;
  --amb:   #F59E0B;
  --ambl:  #FFFBEB;
  --ambd:  #92400E;
  --red:   #EF4444;
  --redl:  #FEF2F2;
  --redd:  #991B1B;
  --sky:   #0EA5E9;
  --skyl:  #E0F2FE;
  --skyd:  #075985;
  --slate: #1E293B;
  --mut:   #64748B;
  --bord:  #E2E8F0;
  --bg:    #F8FAFC;
  --bg2:   #F1F5F9;

  --sidebar-w: 220px;
  --topbar-h:  54px;
}

/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--slate);
  margin: 0;
  line-height: 1.5;
}

/* ── Màn hình đăng nhập ───────────────────────────────────────────────────── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  background: #fff;
  border: 1px solid var(--bord);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--slate);
  margin-bottom: 28px;
}

.login-logo .logo-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ind);
}

.login-card label {
  font-size: 13px;
  font-weight: 600;
  color: var(--mut);
  margin-bottom: 4px;
}

.login-card .form-control {
  border-color: var(--bord);
  border-radius: 8px;
  font-size: 14px;
  padding: 9px 12px;
}

.login-card .form-control:focus {
  border-color: var(--ind);
  box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}

.btn-login {
  background: var(--ind);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  padding: 10px;
  width: 100%;
  cursor: pointer;
  transition: background .15s;
}

.btn-login:hover { background: var(--indd); }

/* ── Layout chính (sau đăng nhập) ────────────────────────────────────────── */
#app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Thanh trên ───────────────────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--bord);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--slate);
  text-decoration: none;
  white-space: nowrap;
}

.brand .logo-box {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--ind);
  flex-shrink: 0;
}

/* Nút hamburger (chỉ hiện trên mobile) */
#btn-sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: var(--mut);
  display: none;
}

#btn-sidebar-toggle:hover { background: var(--bg2); }

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--bord);
  border-radius: 9px;
  padding: 7px 12px;
  color: var(--mut);
  font-size: 14px;
  background: var(--bg2);
  width: 260px;
  cursor: text;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.btn-notif {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--mut);
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
}

.btn-notif:hover { background: var(--bg2); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--indl);
  color: var(--indd);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

/* ── Vùng nội dung (sidebar + main) ──────────────────────────────────────── */
#content-area {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--bord);
  padding: 12px 10px;
  overflow-y: auto;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
}

.nav-group-label {
  font-size: 11px;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: #94A3B8;
  padding: 14px 8px 6px;
  font-weight: 600;
}

.nav-group-label:first-child { padding-top: 4px; }

.nav-link[data-page] {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--mut);
  text-decoration: none;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background .1s, color .1s;
  user-select: none;
}

.nav-link[data-page]:hover {
  background: var(--bg2);
  color: var(--slate);
}

.nav-link[data-page].active {
  background: var(--indl);
  color: var(--indd);
  font-weight: 600;
}

.nav-icon {
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  opacity: .8;
  font-style: normal;
}

/* ── Vùng nội dung chính ──────────────────────────────────────────────────── */
#main-content {
  flex: 1;
  min-width: 0;
  padding: 24px;
  overflow-y: auto;
}

.page-section { display: block; }
.page-section.d-none { display: none !important; }

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--slate);
  margin: 0 0 6px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--mut);
  margin: 0 0 24px;
}

.placeholder-content {
  background: #fff;
  border: 1px dashed var(--bord);
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--mut);
  font-size: 14px;
}

/* ── Topbar: tên + vai trò người dùng ────────────────────────────────────────── */
.topbar-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate);
}

.topbar-role-label {
  font-size: 11px;
  color: var(--mut);
}

/* ── Badge vai trò (trong bảng điều khiển) ───────────────────────────────────── */
.badge-role {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 8px;
  background: var(--indl);
  color: var(--indd);
  vertical-align: middle;
}

/* ── Phạm vi xem dữ liệu ─────────────────────────────────────────────────────── */
.scope-label {
  font-size: 14px;
  color: var(--slate);
}

.scope-desc {
  font-size: 13px;
}

/* ── Dropdown tài khoản ──────────────────────────────────────────────────────── */
.dropdown-menu {
  border-color: var(--bord);
  border-radius: 10px;
  padding: 6px;
  min-width: 180px;
}

.dropdown-item {
  border-radius: 7px;
  font-size: 13px;
  padding: 7px 12px;
}

/* ── Nút đăng nhập Bootstrap override ───────────────────────────────────────── */
.btn-primary {
  background: var(--ind);
  border-color: var(--ind);
}

.btn-primary:hover {
  background: var(--indd);
  border-color: var(--indd);
}

/* ── Responsive: mobile ────────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
  #btn-sidebar-toggle { display: flex; }

  .search-bar { width: 160px; }

  #sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    height: calc(100vh - var(--topbar-h));
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,.1);
  }

  #sidebar.show {
    transform: translateX(0);
  }

  /* Lớp phủ mờ khi sidebar mở trên mobile */
  #sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--topbar-h);
    background: rgba(0,0,0,.3);
    z-index: 199;
  }

  #sidebar-overlay.show { display: block; }

  #main-content { padding: 16px; }
}

@media (min-width: 768px) {
  #sidebar-overlay { display: none !important; }
}
