/* assets/css/layout.css — Roomify Shell (Modern Dark Sidebar, Light Topbar) */
/* -----------------------------------------------------------------
   - Sidebar: modern dark slate (NOT black), no gradients
   - Topbar: glass light
   - Smaller fonts/icons, compact spacing
   - Profile dropdown visible + tooltip works in collapsed mode
------------------------------------------------------------------ */

:root {
  /* brand */
  --hrm-primary: #3b82f6; /* blue */
  --hrm-secondary: #22c55e; /* green */
  --hrm-accent: #a78bfa; /* violet */

  /* surfaces & text */
  --hrm-bg: #f5f7ff;
  --hrm-card: #ffffff;
  --hrm-text: #0f172a;
  --hrm-muted: #64748b;

  /* SIDEBAR — modern dark (no gradient) */
  --sidebar-bg: #0b1220; /* dark slate, not black */
  --sidebar-bd: rgba(255, 255, 255, 0.08);
  --sidebar-text: #e5e7eb;
  --sidebar-icon: #aeb7c6;
  --sidebar-soft: rgba(59, 130, 246, 0.14);
  --sidebar-soft-2: rgba(167, 139, 250, 0.1);

  /* TOPBAR / FOOTER */
  --topbar-glass: rgba(255, 255, 255, 0.92);
  --topbar-border: rgba(15, 23, 42, 0.08);
  --footer-glass: rgba(255, 255, 255, 0.92);
  --footer-border: rgba(15, 23, 42, 0.08);

  /* geometry */
  --sidebar-width: 240px;
  --sidebar-width-collapsed: 68px;
  --topbar-height: 58px;
  --footer-height: 46px;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;

  /* shadows & transitions */
  --shadow-soft: 0 8px 20px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 10px 26px rgba(59, 130, 246, 0.28);

  --tr: 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
  --tr-fast: 0.14s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --tr: 0s;
    --tr-fast: 0s;
  }
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(
      800px 400px at 15% -10%,
      rgba(59, 130, 246, 0.06),
      transparent 60%
    ),
    radial-gradient(
      700px 420px at 95% 110%,
      rgba(167, 139, 250, 0.05),
      transparent 60%
    ),
    var(--hrm-bg);
  color: var(--hrm-text);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.45;
  animation: page-pop 0.28s var(--tr) both;
}

@keyframes page-pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.app-shell {
  display: flex;
  min-height: 100vh;
  isolation: isolate;
}

/* =========================
   SIDEBAR (MODERN DARK)
========================= */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1050;
  transition: width var(--tr), transform var(--tr), box-shadow var(--tr);
  box-shadow: 6px 0 22px rgba(2, 6, 23, 0.35);
  border-right: 1px solid var(--sidebar-bd);
  overflow: hidden;
}

/* Brand strip */
.app-sidebar .brand-block {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--sidebar-bd);
  background: rgba(255, 255, 255, 0.02);
}

/* Logo */
.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
}
.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: none !important;
  opacity: 1 !important;
}

/* Roomify text (visible on dark) */
.brand-title {
  font-weight: 900;
  font-size: 14.6px;
  letter-spacing: 0.25px;
  color: #eaf0ff;
  white-space: nowrap;
}

/* Scroll */
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}
.sidebar-scroll::-webkit-scrollbar {
  width: 6px;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 50px;
}

/* group label */
.menu-label {
  padding: 12px 14px 6px;
  font-size: 10.2px;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  color: rgba(229, 231, 235, 0.65);
}

/* links */
.app-sidebar .menu-link {
  --r: 12px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin: 3px 6px;
  text-decoration: none;
  color: var(--sidebar-text);
  border-left: 3px solid transparent;
  border-radius: var(--r);
  transition: background var(--tr), border-left var(--tr), transform var(--tr),
    box-shadow var(--tr), color var(--tr-fast);
  overflow: hidden;
  font-size: 12.6px;
}

.app-sidebar .menu-link .menu-icon {
  width: 22px;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--sidebar-icon);
  transition: color var(--tr-fast), transform var(--tr-fast);
}
.app-sidebar .menu-link .menu-text {
  flex: 1;
}

.app-sidebar .menu-link:hover {
  background: rgba(255, 255, 255, 0.06);
  border-left-color: var(--hrm-primary);
  transform: translateX(2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.16);
}
.app-sidebar .menu-link:hover .menu-icon {
  color: #dbeafe;
  transform: translateY(-1px);
}

/* Active */
.app-sidebar .menu-link.active {
  background: rgba(59, 130, 246, 0.16);
  border-left-color: var(--hrm-primary);
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.app-sidebar .menu-link.active .menu-icon {
  color: #dbeafe;
}
.app-sidebar .menu-link.active::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  translate: 0 -50%;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22);
}

/* =========================
   APP BODY / CONTENT
========================= */
.app-body {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--tr);
  background: radial-gradient(
      900px 520px at 30% -10%,
      rgba(255, 255, 255, 0.85),
      transparent 70%
    ),
    radial-gradient(
      720px 520px at 90% 110%,
      rgba(255, 255, 255, 0.55),
      transparent 70%
    ),
    var(--hrm-bg);
}

/* TOPBAR (glass) */
.app-topbar {
  height: var(--topbar-height);
  background: var(--topbar-glass);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 2000;
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

/* top-left */
.top-left {
  display: flex;
  gap: 12px;
  align-items: center;
}

.topbar-toggle-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  transition: background var(--tr-fast), transform var(--tr-fast),
    box-shadow var(--tr-fast);
}
.topbar-toggle-btn:hover {
  background: rgba(59, 130, 246, 0.12);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.app-title {
  font-weight: 900;
  font-size: 15px;
  white-space: nowrap;
  letter-spacing: 0.2px;
  color: #0f172a;
}

/* top-right */
.top-right {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative; /* ✅ important: dropdown anchors correctly */
}

.notif-pill {
  position: relative;
  cursor: pointer;
  color: #475569;
  transition: transform var(--tr-fast), filter var(--tr-fast);
}
.notif-pill:hover {
  transform: translateY(-1px);
  filter: saturate(120%);
}

.notif-pill .badge-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f59e0b;
  color: #fff;
  font-size: 10px;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px #fff, 0 6px 14px rgba(245, 158, 11, 0.25);
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.profile-trigger .avatar-round {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12.4px;
  background: linear-gradient(135deg, #3b82f6, #22c55e);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25), var(--shadow-glow);
}
.profile-trigger .avatar-round img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-initial {
  color: #fff;
}

.profile-trigger .meta .name {
  font-size: 12px;
  font-weight: 900;
  color: var(--hrm-text);
}
.topbar-caret {
  font-size: 18px;
  color: #94a3b8;
}

/* ✅ Profile dropdown (works with hidden + show) */
.profile-dropdown {
  position: absolute;
  top: calc(var(--topbar-height) + 8px);
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  width: 240px;
  overflow: hidden;
  z-index: 3000;
  border: 1px solid rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(12px) saturate(140%);
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  animation: dropdown-fade 0.16s ease;
}
.profile-dropdown[hidden] {
  display: none !important;
}
.profile-dropdown.show {
  display: block !important;
}

@keyframes dropdown-fade {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.profile-dropdown .head {
  text-align: center;
  padding: 12px 8px 8px;
}
.profile-dropdown .head img,
.profile-dropdown .head .head-initial {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.18);
  display: inline-grid;
  place-items: center;
}
.profile-dropdown .head .head-initial {
  background: linear-gradient(135deg, #3b82f6, #22c55e);
  color: #fff;
  font-weight: 900;
  font-size: 18px;
}
.profile-dropdown .head .nm {
  font-weight: 900;
  margin-top: 4px;
  font-size: 13px;
}

.profile-dropdown .list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  text-decoration: none;
  color: #0f172a;
  font-size: 12.8px;
  transition: background var(--tr-fast), padding-left var(--tr-fast);
}
.profile-dropdown .list a:hover {
  background: rgba(59, 130, 246, 0.08);
  padding-left: 18px;
}

/* CONTENT + FOOTER */
.app-content {
  flex: 1;
  padding: 18px;
  min-height: calc(100vh - var(--topbar-height) - var(--footer-height));
  animation: content-rise 0.24s var(--tr) both;
}
@keyframes content-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-footer {
  height: var(--footer-height);
  background: var(--footer-glass);
  border-top: 1px solid var(--footer-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px;
  font-size: 12.6px;
  color: var(--hrm-text);
  backdrop-filter: saturate(150%) blur(8px);
  -webkit-backdrop-filter: saturate(150%) blur(8px);
  position: relative;
}

/* COLLAPSE */
.app-shell.sidebar-collapsed .app-sidebar {
  width: var(--sidebar-width-collapsed);
}
.app-shell.sidebar-collapsed .app-body {
  margin-left: var(--sidebar-width-collapsed);
}
.app-shell.sidebar-collapsed .app-sidebar .brand-title,
.app-shell.sidebar-collapsed .app-sidebar .menu-label,
.app-shell.sidebar-collapsed .app-sidebar .menu-link .menu-text {
  display: none !important;
}
.app-shell.sidebar-collapsed .app-sidebar .menu-link::after {
  display: none !important;
}
.app-shell.sidebar-collapsed .app-sidebar .brand-logo {
  margin: 0 auto;
}
.app-shell.sidebar-collapsed .app-sidebar .menu-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  margin: 6px 8px;
}

/* ✅ GLOBAL TOOLTIP for collapsed sidebar */
#hrmSidebarTip {
  position: fixed;
  z-index: 99999;
  display: none;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.2px;
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  white-space: nowrap;
  transform: translateY(-50%);
}

/* RESPONSIVE */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.sidebar-open {
    transform: translateX(0);
  }
  .app-body {
    margin-left: 0;
  }

  .sidebar-overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.38);
    z-index: 1040;
    animation: overlay-in 0.18s var(--tr) both;
  }
  .sidebar-overlay {
    display: none;
  }

  @keyframes overlay-in {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  .app-footer {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
    padding: 8px 16px 10px;
  }
}

@media (max-width: 575.98px) {
  .top-right .profile-trigger .meta {
    display: none;
  }
  .profile-dropdown {
    width: 210px;
  }
}

/* Interaction helpers */
.app-sidebar .menu-link,
.topbar-toggle-btn {
  --x: 50%;
  --y: 50%;
}

.app-sidebar .menu-link:focus-visible,
.topbar-toggle-btn:focus-visible,
.profile-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.28);
  border-radius: 12px;
}
