/* =========================
   LAYOUT
========================= */
.app-layout {
  display: flex;
  height: 100vh;
}

/* =========================
   SIDEBAR
========================= */
.sidebar {
  width: 15rem; /* 240px */
  background: var(--color-white);
  border-right: 1px solid var(--color-gray-200);
  color: #fff;
  flex-shrink: 0;
  transition: width 0.28s ease;
}

/* =========================
   MAIN
========================= */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-layout.sidebar-collapsed .sidebar {
  width: 5.25rem;
}

.app-layout.sidebar-collapsed .sidebar:hover {
  width: 15rem;
}

/* =========================
   HEADER (TOPBAR)
========================= */
.header {
  height: 3.75rem; /* 60px */
  background: #fff;
  border-bottom: 0.0625rem solid #e5e7eb;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
}

/* =========================
   CONTENT
========================= */
.content {
  flex: 1;
  padding: 1.25rem;
  overflow-y: auto;
  background: #f6f8fa;
  box-shadow: rgba(0, 0, 0, 0.06) 0px 2px 4px 0px inset;
}

/* =========================
   SCROLL GLOBAL
========================= */

/* Chrome, Edge, Safari */
*::-webkit-scrollbar {
  width: 0.5rem; /* 8px */
  height: 0.5rem;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 0.5rem;
  transition: 0.2s;
}

*::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* =========================
   CONTENT SCROLL (main)
========================= */
.content {
  overflow-y: auto;
}

.content::-webkit-scrollbar-thumb {
  background: #cbd5f5; /* xanh nhẹ */
}

.content::-webkit-scrollbar-thumb:hover {
  background: #818cf8;
}

/* =========================
   SIDEBAR SCROLL
========================= */
.sidebar {
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
  width: 0.375rem; /* 6px */
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* =========================
   FIREFOX SUPPORT
========================= */
* {
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

.content {
  scrollbar-color: #818cf8 transparent;
}

.sidebar {
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Desktop: chỉ sidebar trái; mobile: ẩn, dùng thanh dưới */
.sidebar__mobile {
  display: none;
  width: 100%;
}

@media (max-width: 768px) {
  .content {
    padding: 0.75rem;
    /* Thanh dưới + FAB nhô lên + thêm khoảng đệm để nội dung cuối không bị che */
    padding-bottom: calc(7rem + env(safe-area-inset-bottom, 0px));
  }

  .header {
    display: none;
  }

  .sidebar__desktop {
    display: none !important;
  }

  .sidebar__mobile {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    border-right: none;
    border-top: none;
    background: transparent;
    overflow: visible;
    z-index: 1000;
  }

  .app-layout.sidebar-collapsed .sidebar {
    width: 100%;
  }
}
