/* =====================================================
   APP FRAME
===================================================== */

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* phần thân dưới header */
.app-body {
  display: flex;
  flex: 1;
  margin-top: 56px;                 /* đúng bằng header */
  height: calc(100vh - 56px);
  background: #f3f4f6;               /* nền app nhẹ lại như ban đầu */
}

/* =====================================================
   HEADER (TOP BAR)
===================================================== */

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 0 12px;
  background: #1976d2;               /* màu thương hiệu */
  color: #fff;

  z-index: 1100;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}



/* =====================================================
   AUTH HEADER (LOGIN / COMPANY / CHANGE PASSWORD)
===================================================== */

.auth-header {
  position: fixed;        /* 🔥 QUAN TRỌNG */
  top: 0;
  left: 0;
  right: 0;

  height: 56px;           /* đồng bộ với app-header */
  background: #1976d2;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
  z-index: 1100;
}


.auth-body {
  margin-top: 56px;     /* 🔥 CHỪA CHỖ CHO HEADER FIXED */
  padding: 20px 12px;
}



/* nút 3 gạch */
.menu-toggle {
  width: 48px;
  height: 48px;
  min-width: 48px;

  display: flex;
  align-items: center;
  justify-content: center;

  margin-top: -2px; /* 🔼 nâng lên nhẹ cho cân header */

  border: none;
  background: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  border-radius: 10px;
}

.menu-toggle:hover {
  background: rgba(255,255,255,0.15);
}

/* SEARCH BAR NẰM TRONG HEADER */
.header-search {
  flex: 1;
  display: flex;
  justify-content: center;
}

.header-search input {
  width: 100%;
  max-width: 460px;
  padding: 8px 14px;
  border-radius: 20px;
  border: none;
  font-size: 14px;
  outline: none;
}

/* icon user bên phải */
.header-user {
  font-size: 18px;
  padding: 6px 10px;
  border-radius: 8px;
}

.header-user:hover {
  background: rgba(255,255,255,0.15);
}

/* =====================================================
   SIDEBAR
===================================================== */

.app-sidebar {
  width: 240px;
  background: #1976d2;
  color: #fff;

  display: flex;
  flex-direction: column;

  position: fixed;
  top: 56px;
  left: -240px; /* ❗ MẶC ĐỊNH ẨN */
  height: calc(100vh - 56px);

  overflow-y: auto;
  z-index: 1200; /* cao hơn content */
  transition: left .3s ease;
}

/* Khi mở */
.app-sidebar.open {
  left: 0;
}


/* Overlay khi sidebar mở */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1150;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}

.sidebar-overlay.show {
  opacity: 1;
  pointer-events: auto;
}


/* logo + tên app */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
}

.sidebar-brand:hover {
  background: rgba(255,255,255,0.08);
}

.sidebar-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.sidebar-appname {
  font-weight: 600;
  font-size: 15px;
}

/* menu giữa */
.sidebar-menu {
  flex: 1;
  padding: 8px 0;
}

/* nhóm tài khoản cuối sidebar */
.sidebar-account {
  border-top: 1px solid rgba(255,255,255,0.15);
  padding: 8px 0;
}

/* item menu */
.menu-item {
  width: 100%;
  padding: 12px 18px;
  background: none;
  border: none;
  color: #fff;
  text-align: left;
  font-size: 15px;
  cursor: pointer;
}

.menu-item:hover {
  background: rgba(255,255,255,0.12);
}

.menu-item.active {
  background: rgba(0,0,0,0.18);
  font-weight: 600;
}

/* =====================================================
   CONTENT AREA
===================================================== */

.app-content {
  flex: 1;
  margin-left: 0; /* ❗ không còn sidebar cố định */
  padding: 20px 18px 40px;
  overflow-y: auto;
  height: calc(100vh - 56px);
}

/* =====================================================
   MOBILE
===================================================== */

@media (max-width: 1023px) {

  .app-sidebar {
    left: -240px;
    transition: left .3s ease;
  }

  .app-sidebar.open {
    left: 0;
  }

  .app-content {
    margin-left: 0;
    padding: 16px 12px 32px;
  }

}


/* @media (min-width: 1024px) {
  .app-shell.sidebar-collapsed .app-sidebar {
    width: 60px;
  }

  .app-shell.sidebar-collapsed .sidebar-appname,
  .app-shell.sidebar-collapsed .menu-item {
    display: none;
  }

  .app-shell.sidebar-collapsed .sidebar-brand {
    justify-content: center;
  }

  .app-shell.sidebar-collapsed .sidebar-logo {
    margin: 0;
  }
}

/* @media (min-width: 1024px) {
  .app-shell.sidebar-collapsed .app-content {
    margin-left: 60px; /* khớp với sidebar thu gọn */
  }
} */


/* =====================================================
   DESKTOP SAFETY WIDTH (TRÁNH BÓP MÉO GRID)
===================================================== */




/* =====================================================
   DESKTOP MIN WIDTH SAFETY (TRÁNH BÓP MÉO GRID)
===================================================== */

@media (min-width: 1024px) {
  .app-body {
    min-width: 1100px; /* đủ cho sidebar overlay + grid 3 cột */
  }
}
