/* public/css/layout.css — Admin Dashboard Layout */

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-deepest);
}

/* === 側邊欄 (Sidebar) === */
.sidebar {
  width: 260px;
  background: var(--bg-base);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-base);
  z-index: 100;
}

.sidebar-header {
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--glass-border);
}

.sidebar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all var(--transition-fast);
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.nav-item.active {
  color: #fff;
  background: var(--primary);
  box-shadow: var(--shadow-sm);
}

.nav-icon {
  font-size: 1.2rem;
}

/* === 主內容區 === */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* === 頂部導覽 (Topbar) === */
.topbar {
  height: 72px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  z-index: 90;
}

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

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #fff;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* === 內容區 === */
.main-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.05), transparent 400px);
}

/* === RWD === */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-toggle {
    display: block;
  }
  .topbar {
    padding: 0 20px;
  }
  .main-content {
    padding: 20px;
  }
  /* Overlay for mobile sidebar */
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    display: none;
  }
  .sidebar-overlay.open {
    display: block;
  }
}
