/* Shared app header (dashboard-style) */

header {
  background-color: var(--surface);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 100;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

header .container {
  max-width: 1400px;
}

header nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  height: 70px;
}

header .logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  transition: var(--transition);
}

header .logo:hover {
  color: var(--primary-dark);
  transform: translateY(-1px);
}

header .logo i {
  font-size: 1.2em;
}

.nav-user {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.notification-btn,
.message-btn,
.friends-btn {
  position: relative;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  width: 40px;
  height: 40px;
}

.notification-btn:hover,
.message-btn:hover,
.friends-btn:hover {
  background-color: var(--background);
  color: var(--primary);
  transform: scale(1.05);
}

.notification-btn:active,
.message-btn:active,
.friends-btn:active {
  transform: scale(0.95);
  background-color: var(--primary-light);
}

.notification-btn:disabled,
.message-btn:disabled,
.friends-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.notification-badge,
.message-badge,
.friends-badge {
  position: absolute;
  top: 5px;
  right: 5px;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
  animation: pulse-badge 2s infinite;
  z-index: 10;
}

.notification-badge {
  background-color: var(--error);
}

.message-badge {
  background-color: var(--info);
}

.friends-badge {
  background-color: var(--primary);
}

.message-badge.has-unread {
  animation: pulse-notification 2s infinite;
}

@keyframes pulse-badge {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes pulse-notification {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(66, 153, 225, 0.7);
  }
  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 10px rgba(66, 153, 225, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(66, 153, 225, 0);
  }
}

.message-btn:hover .message-badge {
  transform: scale(1.1);
  animation: none;
  background-color: #2b6cb0;
}

.message-btn::before,
.notification-btn::before,
.friends-btn::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -45px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.message-btn:hover::before,
.notification-btn:hover::before,
.friends-btn:hover::before {
  opacity: 1;
}

.message-btn::after,
.notification-btn::after,
.friends-btn::after {
  content: '';
  position: absolute;
  bottom: -35px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1001;
}

.message-btn:hover::after,
.notification-btn:hover::after,
.friends-btn:hover::after {
  opacity: 1;
}

.notification-menu,
.message-menu,
.user-menu,
.friends-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.75rem);
  right: 0;
  background-color: var(--surface);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: 0.5rem 0;
  min-width: 280px;
  max-width: 320px;
  z-index: 1000;
  border: 1px solid rgba(0,0,0,0.05);
  overflow: hidden;
  max-height: 70vh;
  overflow-y: auto;
}

.notification-menu::before,
.message-menu::before,
.user-menu::before,
.friends-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  right: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--surface);
}

.notification-menu.show,
.message-menu.show,
.user-menu.show,
.friends-menu.show {
  display: block;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.notification-mark-all {
  border: none;
  background: none;
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
}

.notification-footer {
  display: block;
  padding: 0.75rem 1rem;
  text-align: center;
  text-decoration: none;
  color: var(--primary);
  border-top: 1px solid rgba(0,0,0,0.06);
}

.notification-item,
.message-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  transition: var(--transition);
  cursor: pointer;
  line-height: 1.4;
}

.notification-item:hover,
.message-item:hover {
  background-color: var(--background);
}

.notification-item:last-child,
.message-item:last-child {
  border-bottom: none;
}

.notification-item.unread {
  background-color: rgba(255, 107, 53, 0.08);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: 999px;
  transition: var(--transition);
}

.user-profile:hover {
  background-color: var(--background);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-light);
}

.user-info h4 {
  font-size: 0.95rem;
  margin: 0;
}

.user-info p {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin: 0;
}

.user-menu a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition);
}

.user-menu a:hover {
  background-color: var(--background);
  color: var(--primary);
}

.user-menu a.logout-link {
  color: var(--error);
}

.user-menu a.logout-link:hover {
  background-color: rgba(245, 101, 101, 0.1);
}

.page-back-bar {
  background-color: var(--surface);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.page-back-bar .container {
  padding: 0.5rem 1.5rem;
  max-width: 1400px;
}

.page-back-bar .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.page-back-bar .back-link:hover {
  color: var(--primary);
  background-color: var(--background);
}

@media (max-width: 768px) {
  .nav-user .user-info {
    display: none;
  }

  .nav-user {
    gap: 0.5rem;
  }

  .notification-menu,
  .message-menu,
  .user-menu,
  .friends-menu {
    min-width: 250px;
    right: -1rem;
  }

  .message-btn::before,
  .message-btn::after,
  .notification-btn::before,
  .notification-btn::after,
  .friends-btn::before,
  .friends-btn::after {
    display: none;
  }

  .message-badge,
  .notification-badge,
  .friends-badge {
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
    top: 3px;
    right: 3px;
  }

  .page-back-bar .container {
    padding: 0.35rem 1rem;
  }
}

@media (max-width: 480px) {
  header nav {
    height: 60px;
    padding: 0.75rem 0;
  }

  header .logo {
    font-size: 1.2rem;
    gap: 0.35rem;
    min-width: 0;
  }

  header .logo i {
    font-size: 1em;
  }

  .nav-user {
    gap: 0.25rem;
  }

  .notification-btn,
  .message-btn,
  .friends-btn {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .user-avatar {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 375px) {
  header .logo {
    font-size: 1.05rem;
  }

  .notification-btn,
  .message-btn,
  .friends-btn {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
    padding: 0.35rem;
  }

  .user-avatar {
    width: 30px;
    height: 30px;
  }
}

/* ========== FRIENDS DROPDOWN ========== */

.friends-dropdown-wrapper {
  display: flex;
  align-items: center;
}

.friend-request-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
}

.friend-request-item:last-child {
  border-bottom: none;
}

.friend-request-item:hover {
  background-color: var(--background);
}

.friend-request-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(0,0,0,0.06);
}

.friend-request-info {
  flex: 1;
  min-width: 0;
}

.friend-request-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-request-time {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.friend-request-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
  align-items: center;
}

.friend-req-accept,
.friend-req-decline {
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.friend-req-accept {
  background-color: var(--success);
  color: white;
}

.friend-req-accept:hover {
  background-color: #38a169;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(72, 187, 120, 0.4);
}

.friend-req-decline {
  background-color: var(--background);
  color: var(--text-secondary);
}

.friend-req-decline:hover {
  background-color: var(--error);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(245, 101, 101, 0.4);
}

.friend-req-accept:disabled,
.friend-req-decline:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.friend-request-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  color: var(--text-tertiary);
  gap: 0.5rem;
}

.friend-request-empty i {
  font-size: 2rem;
  color: var(--success);
  opacity: 0.6;
}

.friend-request-empty p {
  font-size: 0.85rem;
  margin: 0;
}

.friend-request-count {
  background-color: var(--primary);
  color: white;
  border-radius: 10px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}
