/* CSS cho tính năng lưu bài viết */

/* Nút lưu bài viết */
.save-for-later {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0058dd, #0046b1);
  border: none;
  border-radius: 30px;
  padding: 12px 22px;
  margin: 25px 10px 5px 0;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-size: 1rem;
  font-weight: 500;
  color: white;
  clear: both;
  box-shadow: 0 4px 12px rgba(0, 88, 221, 0.3);
  position: relative;
  overflow: hidden;
  min-width: 180px;
  text-align: center;
  z-index: 1;
}

.save-for-later::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0046b1, #0058dd);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

.save-for-later::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.6s ease-out;
  z-index: -1;
}

.save-for-later:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 88, 221, 0.4);
}

.save-for-later:hover::before {
  opacity: 1;
}

.save-for-later:active {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 88, 221, 0.3);
}

.save-for-later:active::after {
  transform: scale(3);
  opacity: 0;
  transition: 0s;
}

.save-for-later i {
  margin-right: 10px;
  font-size: 1.2rem;
  transition: all 0.4s ease;
}

.save-for-later:hover i {
  transform: scale(1.2) rotate(5deg);
}

/* Trạng thái đã lưu */
.save-for-later.saved {
  background: linear-gradient(135deg, #2e7d32, #43a047);
  color: white;
  box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.save-for-later.saved::before {
  background: linear-gradient(135deg, #43a047, #2e7d32);
}

.save-for-later.saved i {
  color: white;
  animation: savedPulse 1.5s ease infinite;
}

/* Hiệu ứng nhấp nháy cho biểu tượng khi đã lưu */
@keyframes savedPulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
  }
}

/* Hiệu ứng chú ý khi trang được tải */
.save-button-container {
  position: relative;
}

/* Danh sách bài viết đã lưu */
.saved-posts-container {
  position: fixed !important;
  top: 0 !important;
  right: -400px !important;
  left: auto !important;
  width: 400px !important;
  height: 100% !important;
  background-color: #ffffff !important;
  box-shadow: -2px 0 20px rgba(0, 0, 0, 0.15) !important;
  z-index: 10001 !important;
  transition: right 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
  overflow-y: auto !important;
  display: flex !important;
  flex-direction: column !important;
  will-change: right !important;
  /* Tối ưu hóa hiệu suất animation */
  backface-visibility: hidden !important;
  /* Tối ưu hóa hiệu suất animation */
}

.saved-posts-container.open {
  right: 0 !important;
  left: auto !important;
}

.saved-posts-header {
  padding: 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #f97316, #e84c10);
  color: white;
}

.saved-posts-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
}

.saved-posts-header h3 i {
  font-size: 1.4rem;
}

.saved-posts-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: white;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.saved-posts-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.saved-posts-list {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.saved-post-item {
  display: flex;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
  position: relative;
  transition: all 0.3s ease;
}

.saved-post-item:hover {
  transform: translateY(-3px);
}

.saved-post-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.saved-post-thumbnail {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  margin-right: 15px;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.saved-post-thumbnail i {
  font-size: 2rem;
  color: #f97316;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fff8f3;
}

.saved-post-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.3s ease;
}

.saved-post-item:hover .saved-post-thumbnail img {
  transform: scale(1.1);
}

.saved-post-content {
  flex: 1;
}

.saved-post-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 5px 0;
  color: #1c2332;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.saved-post-title a {
  color: #1c2332;
  text-decoration: none;
  transition: color 0.3s ease;
}

.saved-post-title a:hover {
  color: #f97316;
}

.saved-post-meta {
  font-size: 0.85rem;
  color: #777;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.saved-post-date {
  display: flex;
  align-items: center;
  gap: 5px;
}

.saved-post-date i {
  color: #f97316;
  font-size: 0.8rem;
}

.saved-post-remove {
  background: none;
  border: none;
  color: #777;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.3s ease;
}

.saved-post-remove:hover {
  color: #f44336;
}

.saved-post-remove::before {
  content: '\f2ed';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 0.8rem;
}

/* Trạng thái trống */
.saved-posts-empty {
  text-align: center;
  padding: 40px 20px;
  color: #777;
}

.saved-posts-empty i {
  font-size: 3rem;
  color: #ddd;
  margin-bottom: 15px;
  display: block;
  animation: floatIcon 3s ease-in-out infinite;
}

.saved-posts-empty p {
  font-size: 1.1rem;
  margin-bottom: 20px;
}

.saved-posts-empty a {
  display: inline-block;
  padding: 10px 20px;
  background: linear-gradient(135deg, #f97316, #e84c10);
  color: white;
  text-decoration: none;
  border-radius: 30px;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(249, 115, 22, 0.2);
}

.saved-posts-empty a:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(249, 115, 22, 0.3);
}

@keyframes floatIcon {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-15px);
  }
}

/* Footer của danh sách */
.saved-posts-footer {
  padding: 15px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  background-color: #f9f9f9;
}

.saved-posts-clear {
  background: none;
  border: none;
  color: #f44336;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 8px 15px;
  display: flex;
  align-items: center;
  gap: 5px;
  border-radius: 20px;
  transition: all 0.3s ease;
}

.saved-posts-clear:hover {
  background-color: rgba(244, 67, 54, 0.1);
}

.saved-posts-view-all {
  background: linear-gradient(135deg, #f97316, #e84c10);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 8px 15px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 3px 8px rgba(249, 115, 22, 0.2);
}

.saved-posts-view-all:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(249, 115, 22, 0.3);
}

.saved-posts-toggle {
  position: fixed;
  top: 35%;
  right: 20px;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #f97316, #e84c10);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10000;
  box-shadow: 0 4px 15px rgba(249, 115, 22, 0.3);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: none;
}

.saved-posts-toggle:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}

.saved-posts-toggle i {
  font-size: 1.4rem;
  transition: all 0.3s ease;
}

.saved-posts-toggle:hover i {
  transform: scale(1.2);
}

.saved-posts-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: #1c2332;
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.saved-posts-empty {
  text-align: center;
  padding: 30px 0;
  color: #777;
}

.saved-posts-empty i {
  font-size: 3rem;
  margin-bottom: 10px;
  color: #ddd;
}

/* Overlay nền */
.saved-posts-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  will-change: opacity, visibility;
  /* Tối ưu hóa hiệu suất animation */
  backface-visibility: hidden;
  /* Tối ưu hóa hiệu suất animation */
}

.saved-posts-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Thông báo */
.save-notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 10px 20px;
  border-radius: 4px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Styles cho hộp thoại xác nhận */
.confirm-dialog-overlay {
  z-index: 10010 !important;
  /* Đảm bảo hiển thị trên tất cả các phần tử khác */
}

/* Media queries cho thiết bị di động */
@media (max-width: 576px) {
  .saved-posts-container {
    width: 100% !important;
    right: -100% !important;
  }

  /* Đảm bảo hộp thoại xác nhận hiển thị đúng trên mobile */
  .confirm-dialog-container {
    width: 95% !important;
    max-width: 350px !important;
    padding: 15px !important;
  }
}

/* Responsive styles */
@media (max-width: 768px) {
  .saved-posts-toggle {
    top: 250px !important;
    right: 15px !important;
    left: auto !important;
    width: 50px !important;
    height: 50px !important;
  }

  .saved-posts-toggle:hover {
    transform: scale(1.05) translateY(-5px) !important;
  }

  .saved-posts-toggle i {
    font-size: 26px !important;
  }

  .saved-posts-container {
    width: 320px !important;
    right: -320px !important;
    left: auto !important;
  }

  .saved-posts-header {
    padding: 20px 25px;
  }

  .saved-posts-list {
    padding: 20px 25px;
  }

  .saved-post-thumbnail {
    width: 60px;
    height: 60px;
  }

  .save-for-later {
    font-size: 0.9rem;
    padding: 10px 18px;
    min-width: 160px;
  }

  /* Đảm bảo nút không bị che khuất bởi các phần tử khác trên mobile */
  .saved-posts-toggle {
    z-index: 1002;
  }
}

/* CSS đặc biệt để đảm bảo nút ở bên phải */
.saved-posts-toggle {
  left: auto !important;
  right: 20px !important;
}

@media (max-width: 768px) {
  .saved-posts-toggle {
    left: auto !important;
    right: 15px !important;
  }
}

/* Small mobile devices */
@media (max-width: 576px) {
  .saved-posts-toggle {
    top: 200px !important;
    right: 10px !important;
    width: 45px !important;
    height: 45px !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25) !important;
  }

  .saved-posts-toggle i {
    font-size: 23px !important;
  }

  .saved-posts-container {
    width: 100% !important;
    right: -100% !important;
  }

  .saved-posts-header {
    padding: 15px 20px;
  }

  .saved-posts-header h3 {
    font-size: 1.2rem;
  }

  .saved-posts-list {
    padding: 15px 20px;
  }

  .saved-post-thumbnail {
    width: 50px;
    height: 50px;
  }

  .saved-post-title {
    font-size: 0.95rem;
  }

  .saved-post-meta {
    font-size: 0.8rem;
  }

  .saved-post-remove {
    padding: 4px 10px;
    font-size: 0.8rem;
  }

  .save-for-later {
    font-size: 0.85rem;
    padding: 8px 15px;
    min-width: 140px;
    margin: 20px 5px 5px 0;
  }

  .save-for-later i {
    font-size: 1.1rem;
    margin-right: 8px;
  }
}