/* ─── Topbar ─── */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 76px;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 18px 40px rgba(76, 29, 149, 0.08);
  z-index: var(--z-topbar);
  gap: 16px;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(108, 92, 231, 0), rgba(108, 92, 231, 0.35), rgba(142, 68, 173, 0));
  pointer-events: none;
}

/* ─── Brand (replaces search) ─── */
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
}

.topbar-brand-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.03em;
}

/* ─── Nav Tabs ─── */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-nav-tab {
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-decoration: none;
  border-radius: 999px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.topbar-nav-tab:hover {
  color: var(--color-text);
  background: rgba(108, 92, 231, 0.06);
}

.topbar-nav-tab.active {
  color: var(--color-primary);
  background: rgba(108, 92, 231, 0.1);
  font-weight: 700;
}

/* ─── Topbar Left/Right ─── */

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

.search-input {
  width: 300px;
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--color-bg-secondary);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-lg);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--color-text);
  transition: all var(--transition-base);
}

.search-wrapper {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
}

.search-input-with-icon {
  padding-left: 40px;
}

.search-input:focus {
  outline: none;
  background: var(--color-bg);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-input::placeholder {
  color: var(--color-text-light);
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex: 1;
}

.notification-center {
  position: relative;
}

.notification-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(108, 92, 231, 0.12);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(245, 247, 255, 0.92));
  box-shadow: 0 12px 30px rgba(108, 92, 231, 0.08);
  color: var(--color-text);
  cursor: pointer;
  font-weight: 700;
  transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.notification-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.notification-icon {
  width: 16px;
  height: 16px;
  filter: grayscale(1);
}

.notification-badge {
  background: #ef4444;
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.75rem;
}

.notification-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  width: 320px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 18px;
  box-shadow: 0 22px 44px rgba(17, 24, 39, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 100;
  max-height: 400px;
  overflow-y: auto;
}

.notification-dropdown.active {
  display: block;
}

.notification-dropdown-header {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(229, 231, 235, 0.75);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  color: #111827;
}

.notification-list {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notification-empty {
  padding: 20px 16px;
  border-radius: 14px;
  text-align: center;
  color: var(--color-text-secondary);
  background: rgba(248, 250, 252, 0.88);
  border: 1px dashed rgba(148, 163, 184, 0.25);
}

.notification-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 255, 0.9));
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.notification-item--success {
  border-color: rgba(16, 185, 129, 0.16);
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.96), rgba(255, 255, 255, 0.92));
}

.notification-item--warning {
  border-color: rgba(245, 158, 11, 0.18);
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.96), rgba(255, 255, 255, 0.92));
}

.notification-item--info {
  border-color: rgba(108, 92, 231, 0.16);
}

.notification-time {
  margin-bottom: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-light);
}

.notification-title {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #111827;
}

.notification-body {
  font-size: 0.88rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.user-avatar-container {
  position: relative;
}

.topbar-avatar-trigger {
  cursor: pointer;
}

.topbar-avatar-image {
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.topbar-user-name {
  font-weight: 500;
}

.topbar-chevron {
  font-size: 10px;
  opacity: 0.5;
}

.dropdown-icon {
  width: 16px;
  opacity: 0.6;
}

.dropdown-icon-danger {
  filter: hue-rotate(300deg);
}

.mobile-sidebar-toggle {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text);
  margin-right: 15px;
}

.user-avatar {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  cursor: pointer;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-lg);
  transition: background-color var(--transition-base);
}

.user-avatar:hover {
  background-color: var(--color-bg-secondary);
}

.user-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

#userName {
  font-weight: 500;
  font-size: 0.95rem;
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1024px) {
  .search-input {
    width: 200px;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: var(--spacing-md);
    gap: var(--spacing-md);
    min-height: 68px;
  }

  .topbar-left {
    display: none;
  }

  .topbar-right {
    gap: 10px;
  }

  .search-input {
    width: 100%;
  }

  .notification-dropdown {
    width: min(320px, calc(100vw - 32px));
    right: 0;
  }
}
