/* Mặc định ẩn */
.notification-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  width: 300px;
  z-index: 1000;
}

/* Khi thêm class "show" → hiện ra */
.notification-dropdown.show {
  display: block;
}

div#notification-container {
  width: 780px;
}
/* 📌 Wrapper chứa chuông & danh sách thông báo */
#notificationWrapper {
  position: relative;
  display: inline-block;
}

/* 📌 Chuông thông báo */
#notificationBell {
  cursor: pointer;
  font-size: 18px;
  color: #333;
  position: relative;
  padding: 5px;
  transition: all 0.2s ease-in-out;
}

#notificationBell:hover {
  color: #4a7d91;
  transform: scale(1.1);
}

/* 📌 Mặc định ẩn số lượng thông báo */
.notification-count {
  position: absolute;
  top: -10px;
  right: -10px;
  background-color: #4a7d91;
  color: white;
  padding: 0px 8px;
  border-radius: 5px;
  font-size: 14px;
  z-index: 2;
  display: none; /* ✅ Ẩn nếu không có thông báo */
}

/* 📌 Luôn hiển thị số thông báo khi có */
.notification-count.show {
  display: inline-block !important; /* ✅ Fix để chắc chắn nó hiển thị */
}

/* 📌 Dropdown thông báo (ẩn mặc định) */
#notificationDropdown {
}

@media (max-width: 699px) {
  #notificationDropdown {
    width: 100%;
    position: fixed;
    display: none;
    top: 70px;
    left: 0; /* Căn theo vị trí của chuông */
    background: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 8px;
    z-index: 1;
    list-style: none;
    overflow: hidden;
    overflow-y: auto;
    max-height: 500px;
  }
}

@media (min-width: 700px) {
  #notificationDropdown {
    width: 500px;
    display: none;
    position: absolute;
    top: 100%; /* Hiển thị ngay bên dưới chuông */
    left: 0; /* Căn theo vị trí của chuông */
    transform: translateX(-50%); /* Dịch nhẹ về bên phải nếu cần */
    background: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 8px;
    z-index: 1;
    list-style: none;
    overflow: hidden;
    max-height: 500px;
    overflow-y: auto;
  }
}

/* 📌 Khi dropdown hiển thị */
#notificationDropdown.show {
  display: block !important; /* Đảm bảo dropdown hiển thị khi nhấn */
}

/* 📌 Hiệu ứng mở dropdown */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 📌 Mỗi thông báo */
.notification-item {
  border-bottom: 1px solid #ddd;
  display: flex;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: space-between;
}

/* 📌 Nội dung thông báo (phần bên trái) */
.notification-message {
  flex-grow: 1; /* Bắt buộc phần nội dung bên trái lấp đầy */
  margin-right: 10px; /* Tạo khoảng cách giữa nội dung và nút */
  white-space: nowrap; /* Không cho nội dung bị xuống dòng */
  overflow: hidden;
  text-overflow: ellipsis; /* Thêm dấu "..." nếu quá dài */
}

/* 📌 Nút "Mark as Read" */
.mark-as-read {
  min-width: 120px; /* Đảm bảo tất cả nút có chiều rộng tối thiểu 120px */
  max-width: 120px; /* Không cho nút dài hơn 120px */
  text-align: center;
  background: #007bff;
  color: white;
  border: none;
  padding: 5px 0;
  cursor: pointer;
  border-radius: 4px;
  font-size: 12px;
  transition: background 0.2s;
  flex-shrink: 0; /* Ngăn nút bị thu nhỏ */
}

/* Hiệu ứng hover */
.mark-as-read:hover {
  background: #0056b3;
}

.mark-as-read:hover {
  background: #0056b3;
}

/* 📌 Thông báo rỗng */
.no-notifications {
  padding: 15px;
  text-align: center;
  color: #000000;
  font-size: 18px;
}

/* 📌 Nếu không có thông báo, danh sách có padding */
#notificationDropdown:empty::before {
  content: "🔔 You have no notifications.";
  display: block;
  text-align: center;
  color: #999;
  font-size: 14px;
  padding: 15px;
}

/* 📌 Header của dropdown (chứa 2 nút) */
.notification-header {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 1px solid #ddd;
  background-color: #f9f9f9;
}

/* 📌 Nút "Xem tất cả" */
.view-all-notifications {
  text-decoration: none;
  color: #007bff;
  font-size: 16px;
}

.view-all-notifications:hover {
  text-decoration: underline;
}

/* 📌 Nút đóng dropdown */
.close-dropdown {
  padding: 3px;
  text-align: right;
  font-weight: bold;
  cursor: pointer;
  color: red;
}

.close-dropdown:hover {
  background-color: #e5e5e5;
}

/* 📌 Nút lọc thông báo */
#notificationFilter {
  margin-bottom: 10px;
}
.filter-btn {
  padding: 5px 10px;
  margin-right: 5px;
  cursor: pointer;
  border: 1px solid #ccc;
  background: #f1f1f1;
  color: black;
}
.filter-btn:hover {
  background: #ddd;
}

/* 📌 Danh sách thông báo */
.user-notifications {
  list-style: none;
  padding: 0;
}
.user-notifications li {
  padding: 10px;
}
.user-notifications li.unread {
  background-color: #f8d7da;
  font-weight: bold;
}
.user-notifications li.read {
  background-color: #fff;
  color: #666;
}

/* 📌 Hiệu ứng shimmer loading */
.notification-shimmer-loading {
  width: 100%;
  height: 86px;
  background: linear-gradient(90deg, #e0e0e0 25%, #f5f5f5 50%, #e0e0e0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 5px;
  margin-bottom: 8px;
  display: block;
}

/* 📌 Hiệu ứng shimmer chạy ngang */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* 📌 Bộ lọc thông báo */
#notificationFilter {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

#categoryFilter {
  padding: 6px;
  border-radius: 5px;
  font-size: 14px;
  border: 1px solid #ccc;
  background: #f1f1f1;
}

a.view-link {
  color: #4a7d91 !important;
  font-weight: normal;
}

.notification-attachment-label {
  color: #c7c8c9 !important;
  font-weight: normal;
}

.user-notifications li.unread {
  background-color: #ffffff !important; /* Giữ màu nền trắng khi Unread */
  opacity: 1; /* Đảm bảo không bị mờ */
  transition: background-color 0.3s ease-in-out;
}

.user-notifications li.read {
  background-color: #fff !important; /* Màu xám nhạt khi Read */
  opacity: 1;
}

button#markAllReadBtn {
  padding: 6px;
  border-radius: 5px;
  font-size: 14px;
  border: 1px solid #ccc;
  background: #f1f1f1;
  color: black;
}

span.badge.unread {
  font-weight: normal;
  color: #7d7d7d;
}

.notification-time {
  font-size: 11px;
  color: #7d7d7d;
}

span.badge.read {
  font-size: 14px;
  color: #7d7d7d;
}
ul#userNotifications {
  list-style: none;
  padding-left: 0;
  margin-left: 0;
}
.notification-message {
  font-size: 14px;
  color: #7d7d7d;
  word-wrap: break-word; /* Đảm bảo xuống dòng khi cần */
  overflow-wrap: break-word; /* Hỗ trợ xuống dòng tốt hơn */
  white-space: normal; /* Cho phép xuống dòng khi cần */
  max-width: 100%; /* Giới hạn kích thước để không bị tràn */
}

span.order-id {
  font-size: 11px;
  color: #7d7d7d;
}

.notification-item {
  padding: 10px;
  border-bottom: 1px solid #ddd;
}

.notification-wrapper {
  display: flex;
  align-items: center;
}

.notification-thumb {
  flex-shrink: 0;
  margin-right: 10px;
}

.notification-thumb img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 5px;
}

.notification-content-with-thumb {
  flex: 1;
}

.notification-content-no-thumb {
  flex: 1;
  margin-left: 0; /* Không có ảnh thì nội dung căn lề trái */
}

/* CSS cho nút gạt */
.switch-notification-settings {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}
.switch-notification-settings input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider-notification-settings {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}
.slider-notification-settings:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}
input:checked + .slider-notification-settings {
  background-color: #4caf50;
}
input:checked + .slider-notification-settings:before {
  transform: translateX(26px);
}
