/* Navbar styling for SG Technolog application */

/* === Main Navbar === */
.navbar {
  background-color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
}

.navbar.scrolled {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  padding: 0.5rem 1rem;
}

.navbar-brand {
  padding: 0;
  font-weight: 600;
  color: #212529;
  transition: transform 0.2s ease;
}

.navbar-brand:hover {
  transform: scale(1.02);
}

.navbar-brand img {
  max-height: 40px;
  transition: filter 0.3s ease;
}

.navbar-toggler {
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.navbar-toggler:focus {
  box-shadow: none;
  outline: none;
}

.navbar-toggler:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* === Navbar Links and Dropdown Styling === */
.navbar .nav-link {
  color: #495057;
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  position: relative;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.navbar .nav-link:hover {
  color: #0d6efd;
  background-color: rgba(13, 110, 253, 0.04);
}

.navbar .nav-link.active {
  color: #0d6efd;
  font-weight: 500;
  position: relative;
}

/* Hiệu ứng đồng nhất cho dropdown menu */
.navbar .nav-link.dropdown-toggle.active {
  color: #0d6efd !important;
  font-weight: 600;
  position: relative;
}

/* Thêm gạch chân cho dropdown-toggle active */
.navbar .nav-link.dropdown-toggle.active::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 1rem;
  right: 1rem;
  height: 2px;
  background-color: #0d6efd;
  border-radius: 2px;
}

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

.navbar .dropdown-menu {
  margin-top: 0.25rem;
  border: none;
  border-radius: 8px;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
  animation: fadeInDown 0.3s ease-out;
  padding: 0.5rem 0;
  min-width: 220px;
  overflow: hidden;
}

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

/* Thêm đường viền bên trái khi hover để tăng hiệu ứng */
.navbar .dropdown-item {
  color: #495057;
  padding: 0.7rem 1.25rem;
  font-size: 0.9375rem;
  border-left: 3px solid transparent;
  transition: all 0.25s ease;
  position: relative;
}

.navbar .dropdown-item:hover {
  color: #0d6efd;
  background-color: rgba(13, 110, 253, 0.08);
  border-left: 3px solid #0d6efd;
}

/* Hiệu ứng ripple cho dropdown item */
.navbar .dropdown-item::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background-color: rgba(13, 110, 253, 0.15);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
}

.navbar .dropdown-item:active::after {
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
  }
  100% {
    width: 100px;
    height: 100px;
    opacity: 0;
  }
}

/* Style cho item active trong dropdown */
.navbar .dropdown-item.active {
  background-color: #0d6efd;
  color: white;
  font-weight: 500;
  border-left: 3px solid #0055cc;
  position: relative;
}

/* Thêm hiệu ứng dấu kiểm cho item active */
.navbar .dropdown-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 3px;
  background-color: #0055cc;
}

.navbar .dropdown-item i {
  margin-right: 8px;
  width: 16px;
  text-align: center;
  color: #6c757d;
  transition: color 0.2s ease;
}

/* Hiệu ứng đặc biệt cho item được chọn trong dropdown */
.navbar .dropdown-item.active i {
  color: white;
}

.navbar .dropdown-item:hover i {
  color: #0d6efd;
}

/* Cải thiện hiển thị cho dropdown khi active */
.navbar .dropdown.show .dropdown-toggle,
.navbar .dropdown .dropdown-toggle.active {
  color: #0d6efd;
}

/* Hiệu ứng cho dropdown toggle khi được mở */
.navbar .dropdown-toggle.temp-active {
  color: #0d6efd;
}

/* === Mobile Notification Bell === */
.notification-mobile {
  margin-right: 0.125rem;
  display: flex;
  align-items: center;
  order: 2;
  position: relative;
}

.notification-mobile .nav-link {
  padding: 0.5rem;
  border-radius: 4px;
  position: relative;
}

.notification-mobile .bi-bell-fill {
  font-size: 1.25rem;
  color: #495057;
  transition: color 0.3s ease;
}

.notification-mobile .nav-link:hover .bi-bell-fill,
.notification-mobile .nav-link:focus .bi-bell-fill {
  color: #0d6efd;
}

.notification-mobile .badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
  padding: 0;
  min-width: 20px;
  text-align: center;
  animation: pulse 1.5s infinite;
}

/* Điều chỉnh cho số có nhiều chữ số */
.notification-mobile .badge:not(:empty) {
  min-width: 20px;
}

/* Cho số từ 10 trở lên */
.notification-mobile .badge.multi-digit {
  min-width: 22px;
  width: 22px;
  height: 22px;
  font-size: 0.6rem;
}

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

/* === Desktop Notification Bell === */
.notification-bell-container {
  position: relative;
  margin-right: 1rem;
}

.nav-bell {
  font-size: 1.25rem;
  color: #495057;
  cursor: pointer;
  padding: 0.375rem 0.75rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  position: relative;
}

.nav-bell:hover {
  color: #0d6efd;
  background-color: rgba(13, 110, 253, 0.05);
}

.notification-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
  padding: 0;
  min-width: 20px;
  text-align: center;
  animation: pulse 1.5s infinite;
}

/* Điều chỉnh cho số có nhiều chữ số */
.notification-badge:not(:empty) {
  min-width: 20px;
}

/* Cho số từ 10 trở lên */
.notification-badge.multi-digit {
  min-width: 22px;
  width: 22px;
  height: 22px;
  font-size: 0.6rem;
}

/* === Notification Dropdown === */
.dropdown-menu.notification-dropdown {
  width: 450px;
  max-height: 500px;
  overflow-y: auto;
  padding: 0;
}

.notification-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid #e9ecef;
  background-color: #f8f9fa;
  position: sticky;
  top: 0;
  z-index: 1;
}

.notification-dropdown-footer {
  padding: 0.75rem 1rem;
  text-align: center;
  border-top: 1px solid #e9ecef;
  background-color: #f8f9fa;
  position: sticky;
  bottom: 0;
  z-index: 1;
}

.notification-dropdown-footer a {
  color: #0d6efd;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.notification-dropdown-footer a:hover {
  color: #0a58ca;
  text-decoration: underline !important;
}

/* Layout cho mỗi thông báo */
.notification-dropdown .notification-item {
  padding: 1rem;
  border-bottom: 1px solid #e9ecef;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.notification-dropdown .notification-item:hover {
  background-color: rgba(13, 110, 253, 0.05);
}

.notification-dropdown .notification-unread {
  background-color: rgba(13, 110, 253, 0.04);
  position: relative;
}

.notification-dropdown .notification-read {
  background-color: transparent;
}

/* Style cho tiêu đề thông báo */
.notification-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #212529;
}

/* Style cho nội dung thông báo với giới hạn dòng */
.notification-message-truncate {
  font-size: 0.875rem;
  color: #6c757d;
  margin: 0.5rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Style cho icon thông báo */
.notification-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #e9ecef;
  font-size: 1.25rem;
}

/* Style cho các icon theo loại thông báo */
.notification-icon .bi-info-circle {
  color: #0d6efd;
}

.notification-icon .bi-check-circle {
  color: #198754;
}

.notification-icon .bi-exclamation-triangle {
  color: #ffc107;
}

.notification-icon .bi-times-circle {
  color: #dc3545;
}

/* Style cho nội dung thông báo */
.notification-dropdown .notification-message {
  font-size: 0.875rem;
  color: #6c757d;
  margin: 0.5rem 0;
}

/* Style cho các nút trong thông báo */
.notification-item .btn-sm {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  margin-top: 0.5rem;
}

.notification-item .btn-outline-primary {
  border-color: #dee2e6;
  color: #0d6efd;
}

.notification-item .btn-outline-primary:hover {
  background-color: #0d6efd;
  border-color: #0d6efd;
  color: white;
}

.notification-item button.text-muted {
  background: none;
  border: none;
  font-size: 0.75rem;
  padding: 0;
  cursor: pointer;
  margin-top: 0.5rem;
}

.notification-item button.text-muted:hover {
  color: #0d6efd !important;
  text-decoration: underline;
}

/* Thêm khoảng trống cho các phần trong notification */
.notification-item .d-flex.flex-column > div {
  margin-bottom: 0.25rem;
}

.notification-item .d-flex.flex-column > div:last-child {
  margin-bottom: 0;
}

/* === User Menu === */
.navbar .navbar-nav .dropdown-menu.dropdown-menu-end {
  right: 0;
  left: auto;
}

/* === Responsive Adjustments === */
@media (max-width: 991.98px) {
  .navbar .nav-link {
    padding: 0.5rem 1rem;
  }
  
  .navbar .dropdown-menu {
    box-shadow: none;
    border-left: 2px solid #e9ecef;
    border-radius: 0;
    margin-left: 1rem;
    animation: none;
  }
  
  .navbar .dropdown-item {
    padding: 0.6rem 1rem;
  }
  
  /* Điều chỉnh hiệu ứng active cho mobile */
  .navbar .nav-link.dropdown-toggle.active::after {
    display: none;
  }
  
  .navbar .nav-link.dropdown-toggle.active {
    background-color: rgba(13, 110, 253, 0.08);
    border-radius: 4px;
  }
  
  .navbar .nav-link.active:not(.dropdown-toggle)::after {
    display: none;
  }
  
  .navbar .nav-link.active:not(.dropdown-toggle) {
    background-color: rgba(13, 110, 253, 0.08);
    border-radius: 4px;
  }
  
  /* === Điều chỉnh layout cho mobile === */
  .navbar-brand {
    order: 1;
  }
  
  .notification-mobile {
    order: 2;
    margin-right: 0.125rem;
  }
  
  .navbar-toggler {
    order: 3;
    margin-left: 0;
  }
  
  /* Đảm bảo các phần tử sắp xếp đúng */
  .navbar .container {
    display: flex;
    align-items: center;
  }
  
  .navbar .container > .navbar-brand {
    flex: 0 0 auto;
  }
  
  .navbar .container > .notification-mobile {
    flex: 0 0 auto;
    margin-left: auto;
    margin-right: 0.125rem;
  }
  
  .navbar .container > .navbar-toggler {
    flex: 0 0 auto;
    margin-left: 0;
  }
}

/* Đảm bảo dropdown thông báo hiển thị đúng trên thiết bị di động */
@media (max-width: 767.98px) {
  .dropdown-menu.notification-dropdown {
    width: 300px;
    left: auto !important;
    right: 0 !important;
    transform: none !important;
  }
  
  .notification-mobile {
    margin-right: 0.125rem;
  }
}

/* Tiny screens adjustments */
@media (max-width: 360px) {
  .navbar-brand img {
    max-height: 32px;
  }
  
  .dropdown-menu.notification-dropdown {
    width: 280px;
  }
  
  .notification-mobile {
    margin-right: 0.1rem;
  }
}

/* Hiệu ứng khi hover chuông thông báo */
#notification-bell:hover,
#notification-bell-mobile:hover {
  transform: scale(1.1);
}

/* Hiệu ứng cho nút đánh dấu đã đọc tất cả */
#mark-all-read {
  transition: all 0.2s ease;
}

#mark-all-read:hover {
  background-color: #0d6efd;
  color: white;
}

/* Tăng độ tương phản giữa các mục thông báo */
.notification-item + .notification-item {
  border-top: 1px solid #f1f3f4;
}

/* Style cho trạng thái loading */
.spinner-border-sm {
  width: 1rem;
  height: 1rem;
}

/* Thêm animation cho các thay đổi trạng thái */
.notification-unread, .notification-read {
  transition: background-color 0.3s ease;
}

/* Cải thiện hiển thị thời gian */
.notification-item .text-muted {
  font-size: 0.75rem;
}

/* Xử lý cuộn trong dropdown */
.dropdown-menu.notification-dropdown::-webkit-scrollbar {
  width: 6px;
}

.dropdown-menu.notification-dropdown::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.dropdown-menu.notification-dropdown::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.dropdown-menu.notification-dropdown::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Tạo UX tốt hơn cho trạng thái rỗng */
.dropdown-menu .text-center.py-3 {
  color: #6c757d;
  font-style: italic;
}

/* Cải thiện focus styles cho trải nghiệm keyboard */
.navbar .nav-link:focus-visible,
.navbar .dropdown-item:focus-visible {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* === Hiệu ứng cho active dropdown === */
.navbar .dropdown-toggle.active::after {
  border-top-color: #0d6efd;
}

/* === Smooth transition cho tất cả các thành phần === */
.navbar *,
.dropdown-menu * {
  transition: all 0.2s ease;
}

/* === Hiệu ứng đặc biệt cho navbar brand khi hover === */
.navbar-brand:hover img {
  filter: brightness(1.1);
}

/* Đảm bảo vị trí badge nhất quán - Hoàn toàn tròn và căn giữa hoàn hảo */
/* Đảm bảo vị trí badge nhất quán CHỈ cho chuông thông báo */
.notification-bell-container .badge.bg-danger, 
.notification-mobile .badge.bg-danger {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
  padding: 0;
  min-width: 20px;
  text-align: center;
}

/* Điều chỉnh cho số có nhiều chữ số */
.badge.bg-danger:not(:empty) {
  min-width: 20px;
}

/* Cho số từ 10 trở lên */
.badge.bg-danger.multi-digit {
  min-width: 22px;
  width: 22px;
  height: 22px;
  font-size: 0.6rem;
}

/* Cấu trúc không gian trong bố cục navbar */
.navbar .container {
  max-width: 1200px;
}

/* === Hiệu ứng active đồng nhất === */
.navbar .nav-link.active {
  background-color: rgba(13, 110, 253, 0.1);
  border-radius: 6px;
}

/* Thêm hiệu ứng active rõ ràng cho các thành phần */
.navbar .nav-link.active:not(.dropdown-toggle) {
  position: relative;
}

.navbar .nav-link.active:not(.dropdown-toggle)::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 2px;
  background-color: #0d6efd;
  border-radius: 2px;
}

/* Custom styles cho bảng điều hướng dropdown */
.navbar .dropdown .nav-link {
  display: flex;
  align-items: center;
}

.navbar .dropdown .nav-link i {
  font-size: 0.875rem;
  margin-right: 0.5rem;
}

.navbar .dropdown-toggle::after {
  margin-left: 0.5rem;
}

/* === Hiệu ứng cho hình ảnh trong navbar brand === */
.navbar-brand img {
  object-fit: contain;
}

.navbar-brand:hover img {
  transform: scale(1.05);
}

/* == Hiệu ứng tương tác tốt hơn cho các nút == */
.notification-item button, 
.notification-item .btn {
  transition: all 0.2s ease;
}

.navbar .dropdown-item:active {
  transform: translateX(2px);
}

/* Hiệu ứng chỉ báo thông báo mới */
.notification-unread::after {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  width: 8px;
  height: 8px;
  background-color: #dc3545;
  border-radius: 50%;
}

/* Cải thiện đọc thông báo */
.notification-item button.text-muted {
  font-size: 0.75rem;
  color: #6c757d;
}

.notification-item button.text-muted:hover {
  color: #0d6efd !important;
}