/* ==========================================================================
   layout.css — Lumina Studio
   App shell · Sidebar · Topbar · Page structure · Grids
   ========================================================================== */

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg-0);
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg-1);
  border-right: 1px solid var(--bdr-lo);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: width var(--ease-lg);
}
.sidebar.collapsed { width: var(--sidebar-col-w); }

/* Logo row */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 18px;
  border-bottom: 1px solid var(--bdr-lo);
  flex-shrink: 0;
  overflow: hidden;
}

.logo-icon {
  width: 34px; height: 34px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--clr-primary), var(--clr-danger));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px hsla(var(--accent-h),52%,56%,.35);
}
.logo-icon svg { width: 18px; height: 18px; color: #fff; }

.logo-text { overflow: hidden; white-space: nowrap; }
.logo-text .brand   { font-family: var(--f-display); font-weight: 800; font-size: 1rem; }
.logo-text .tagline { font-size: .68rem; color: var(--txt-3); margin-top: -2px; }

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
}

.nav-section { margin-bottom: 4px; }

.nav-section-label {
  padding: 8px 20px 4px;
  font-size: .60rem;
  font-weight: 700;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--txt-3);
  white-space: nowrap;
  transition: opacity var(--ease-md);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1px 8px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  color: var(--txt-2);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  transition: background var(--ease), color var(--ease);
}
.nav-item:hover  { background: var(--bg-2); color: var(--txt-1); }
.nav-item.active { background: hsla(var(--accent-h),52%,56%,.12); color: var(--clr-primary); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--clr-primary);
  border-radius: 0 2px 2px 0;
}

.nav-item .nav-icon {
  width: 32px; height: 32px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.nav-item svg     { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item .nav-label { font-size: .85rem; font-weight: 500; transition: opacity var(--ease-md); }

.nav-badge {
  margin-left: auto;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--clr-danger);
  color: #fff;
  font-size: .60rem;
  font-weight: 700;
  transition: opacity var(--ease-md);
}

/* Collapsed state — hide text */
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge { opacity: 0; pointer-events: none; }

/* Footer user row */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--bdr-lo);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: var(--r-md);
  overflow: hidden;
  transition: background var(--ease);
}
.sidebar-user:hover { background: var(--bg-2); }
.sidebar-user-info  { flex: 1; overflow: hidden; }
.sidebar-user-name  { font-size: .83rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role  { font-size: .70rem; color: var(--txt-3); }

.sidebar.collapsed .sidebar-user-info { opacity: 0; }

/* Collapse toggle button */
.sidebar-toggle {
  position: absolute;
  top: 50%; right: -12px;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  border-radius: var(--r-pill);
  background: var(--bg-2);
  border: 1px solid var(--bdr-md);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 101;
  transition: background var(--ease), border-color var(--ease);
}
.sidebar-toggle:hover { background: var(--bg-3); border-color: var(--clr-primary); }
.sidebar-toggle svg   { width: 12px; height: 12px; color: var(--txt-2); transition: transform var(--ease-lg); }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-1);
  border-bottom: 1px solid var(--bdr-lo);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  z-index: 99;
  transition: left var(--ease-lg);
}
.main-area.collapsed + * .topbar,
.sidebar.collapsed ~ .main-area .topbar { left: var(--sidebar-col-w); }

.topbar-title h2       { font-size: 1rem; font-weight: 700; }
.topbar-title .breadcrumb { font-size: .72rem; color: var(--txt-3); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* Global search */
.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-5);
  border: 1px solid var(--bdr-lo);
  border-radius: var(--r-pill);
  padding: 7px 14px;
  width: 220px;
  transition: width var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.topbar-search:focus-within {
  width: 280px;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px hsla(var(--accent-h),52%,56%,.12);
}
.topbar-search svg   { width: 14px; height: 14px; color: var(--txt-3); flex-shrink: 0; }
.topbar-search input { flex: 1; font-size: .83rem; }
.topbar-search input::placeholder { color: var(--txt-3); }

/* Icon button */
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--txt-2);
  position: relative;
  transition: background var(--ease), color var(--ease);
}
.icon-btn:hover { background: var(--bg-2); color: var(--txt-1); }
.icon-btn svg   { width: 17px; height: 17px; }

.notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--clr-danger);
  border: 1.5px solid var(--bg-1);
}

/* --------------------------------------------------------------------------
   Main content area
   -------------------------------------------------------------------------- */
.main-area {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  flex: 1;
  min-width: 0;
  transition: margin-left var(--ease-lg);
}
.main-area.collapsed { margin-left: var(--sidebar-col-w); }

.page-content {
  padding: 28px 28px 48px;
  min-height: calc(100vh - var(--topbar-h));
}

/* Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-header-left h1 { font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; }
.page-header-left p  { font-size: .82rem; color: var(--txt-2); margin-top: 2px; }
.page-header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   Grids
   -------------------------------------------------------------------------- */
.grid-4   { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; }
.grid-3   { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
.grid-2   { display: grid; grid-template-columns: repeat(2,1fr); gap: 18px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr;       gap: 18px; }
.grid-3-2 { display: grid; grid-template-columns: 3fr 2fr;       gap: 18px; }

/* --------------------------------------------------------------------------
   Mobile overlay (sidebar backdrop)
   -------------------------------------------------------------------------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(2px);
  z-index: 99;
}

/* --------------------------------------------------------------------------
   Dropdown panel
   -------------------------------------------------------------------------- */
.dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--bg-2);
  border: 1px solid var(--bdr-md);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  z-index: 200;
  overflow: hidden;
  animation: slideDown .2s ease both;
}
.dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--bdr-lo);
}
.dropdown-header h4   { font-size: .9rem; }
.dropdown-header span { font-size: .72rem; color: var(--clr-primary); cursor: pointer; }

.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 18px;
  cursor: pointer;
  transition: background var(--ease);
}
.notif-item:hover  { background: var(--bg-4); }
.notif-item.unread { background: hsla(var(--accent-h),52%,56%,.05); }

.notif-icon {
  width: 32px; height: 32px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
}
.notif-icon svg { width: 15px; height: 15px; }
.notif-text     { flex: 1; min-width: 0; }
.notif-text p   { font-size: .80rem; line-height: 1.4; }
.notif-text span{ font-size: .70rem; color: var(--txt-3); }
