/* ═══════════════════════════════════════════════════
   MOH — Navbar
   شريط التنقل العلوي
   ═══════════════════════════════════════════════════ */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--navbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--navbar-border);
  z-index: var(--z-fixed);
  transition: all var(--transition-base);
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--space-4);
  gap: var(--space-4);
}

/* ─── Logo ─── */
.navbar__logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  flex-shrink: 0;
}

.navbar__logo-icon {
  width: 36px;
  height: 36px;
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: var(--font-extrabold);
  font-size: var(--text-lg);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.navbar__logo-text {
  font-size: var(--text-xl);
  font-weight: var(--font-extrabold);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

/* ─── Search Bar ─── */
.navbar__search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.navbar__search-input {
  width: 100%;
  padding: var(--space-2) var(--space-4);
  padding-right: 2.5rem;
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1.5px solid transparent;
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
  height: 40px;
  direction: rtl;
}

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

.navbar__search-input::placeholder {
  color: var(--text-tertiary);
}

.navbar__search-icon {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  display: flex;
}

.navbar__search-icon svg {
  width: 18px;
  height: 18px;
}

/* ─── Actions ─── */
.navbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;
}

.navbar__action-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: all var(--transition-base);
  cursor: pointer;
  background: none;
  border: none;
}

.navbar__action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.navbar__action-btn svg {
  width: 22px;
  height: 22px;
}

/* Notification badge on icon */
.navbar__action-btn .badge-count {
  position: absolute;
  top: 2px;
  left: 2px;
  min-width: 18px;
  height: 18px;
  font-size: 10px;
  padding: 0 4px;
  border: 2px solid var(--bg-primary);
}

/* ─── Theme Toggle ─── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  background: none;
  border: none;
  position: relative;
  overflow: hidden;
}

.theme-toggle:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  transition: all var(--transition-base);
}

.theme-toggle__sun,
.theme-toggle__moon {
  position: absolute;
  display: flex;
}

.theme-toggle__moon {
  opacity: 0;
  transform: rotate(90deg) scale(0);
}

[data-theme="dark"] .theme-toggle__sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0);
}

[data-theme="dark"] .theme-toggle__moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* ─── User Menu ─── */
.navbar__user {
  position: relative;
}

.navbar__user-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1);
  padding-left: var(--space-3);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
  background: none;
  border: 1.5px solid transparent;
}

.navbar__user-btn:hover {
  background: var(--bg-tertiary);
}

.navbar__user-btn .avatar {
  width: 32px;
  height: 32px;
  font-size: var(--text-xs);
}

.navbar__user-name {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.navbar__user-chevron {
  color: var(--text-tertiary);
  display: flex;
  transition: transform var(--transition-fast);
}

.navbar__user-chevron svg {
  width: 16px;
  height: 16px;
}

/* ─── User Dropdown ─── */
.navbar__user-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
  padding: var(--space-2);
  overflow: hidden;
}

.navbar__user-menu--active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.navbar__user-menu-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: var(--space-4);
}

.navbar__user-menu-info {
  overflow: hidden;
}

.navbar__user-menu-name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar__user-menu-email {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar__user-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  background: none;
  text-align: right;
}

.navbar__user-menu-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.navbar__user-menu-item--danger {
  color: var(--danger-600);
}

.navbar__user-menu-item--danger:hover {
  background: var(--danger-50);
  color: var(--danger-700);
}

.navbar__user-menu-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ─── Create Post Button (Desktop) ─── */
.navbar__create-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: #fff;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
  white-space: nowrap;
}

.navbar__create-btn:hover {
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
  transform: translateY(-1px);
}

.navbar__create-btn svg {
  width: 18px;
  height: 18px;
}

/* ─── Mobile Bottom Navigation ─── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--navbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--navbar-border);
  z-index: var(--z-fixed);
}

.bottom-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 0 var(--space-2);
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--space-1) var(--space-3);
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: var(--font-medium);
  text-decoration: none;
  transition: all var(--transition-fast);
  position: relative;
  border-radius: var(--radius-lg);
  cursor: pointer;
  background: none;
  border: none;
}

.bottom-nav__item:hover,
.bottom-nav__item--active {
  color: var(--primary-600);
}

[data-theme="dark"] .bottom-nav__item--active {
  color: var(--primary-400);
}

.bottom-nav__item svg {
  width: 24px;
  height: 24px;
}

/* Center create button in bottom nav */
.bottom-nav__create {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
  transform: translateY(-8px);
  transition: all var(--transition-base);
}

.bottom-nav__create:hover {
  transform: translateY(-10px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

.bottom-nav__create svg {
  width: 24px;
  height: 24px;
}

/* Badge count on bottom nav */
.bottom-nav__item .badge-count {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  min-width: 16px;
  height: 16px;
  font-size: 9px;
  padding: 0 4px;
}

@media (max-width: 768px) {
  .bottom-nav {
    display: block;
  }

  .navbar__search {
    display: none;
  }

  .navbar__create-btn {
    display: none;
  }

  .navbar__user-name {
    display: none;
  }

  .navbar__logo-text {
    font-size: var(--text-lg);
  }
}

@media (max-width: 480px) {
  .navbar__actions {
    gap: 0;
  }

  .navbar__action-btn {
    width: 36px;
    height: 36px;
  }

  .navbar__action-btn svg {
    width: 20px;
    height: 20px;
  }
}
