/* ===========================
   App Shell Layout
   =========================== */

.app {
  display: flex;
  flex-direction: row;
  height: 100vh;
}

/* --- Sidebar --- */

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  padding: 16px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  position: relative;
  flex-shrink: 0;
  gap: 8px;
}

.sidebar-header h1 {
  color: var(--accent2);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  margin: 0;
  line-height: 1;
}

.sidebar-collapse-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text2);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  background: var(--bg3);
  color: var(--text);
}

.sidebar-search {
  padding: 8px 16px;
  flex-shrink: 0;
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}

.sidebar-search input:focus {
  border-color: var(--accent);
}

.sidebar-search input::placeholder {
  color: var(--text3);
}

/* --- Sidebar Nav --- */

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

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

.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text2);
  letter-spacing: 1.2px;
  padding: 0 12px;
  margin-bottom: 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text2);
  font-size: 14px;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg3);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent2);
}

.nav-item .badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.nav-item .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-item .status-dot.running {
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}

.nav-item .status-dot.idle {
  background: var(--text2);
}

.nav-item .status-dot.queued {
  background: var(--orange);
}

/* --- Collapsed sidebar --- */

.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .nav-item .badge {
  display: none;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px;
}

.sidebar.collapsed .nav-item svg {
  margin: 0;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 16px 8px;
}

.sidebar.collapsed .sidebar-header h1 .icon {
  margin: 0;
}

/* --- Main Area --- */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* --- Topbar --- */

.topbar {
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  background: var(--bg2);
  flex-shrink: 0;
}

.topbar-search {
  flex: 1;
  max-width: 400px;
  margin: 0 auto;
  position: relative;
}

.topbar-search input {
  width: 100%;
  padding: 8px 14px 8px 36px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235a5f72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

.topbar-search input:focus {
  border-color: var(--accent);
}

.topbar-search input::placeholder {
  color: var(--text3);
}

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

.notification-bell {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text2);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.notification-bell:hover {
  background: var(--bg3);
  color: var(--text);
}

.notification-bell .bell-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* --- Content --- */

.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* --- Pulse Animation --- */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
