/* Recommendations Plugin Styles */

/* Like Button */
.rec_like_button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 15px;
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 50px;
  color: #6c757d;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  font-size: 14px;
}

.rec_like_button:hover {
  background: #fff;
  border-color: #2eacce;
  color: #2eacce;
}

.rec_like_button.is_recommended {
  background: #fff3cd;
  border-color: #ffc107;
  color: #856404;
}

.rec_like_button.is_recommended:hover {
  background: #ffeaa7;
}

.rec_like_button .fa-heart {
  font-size: 18px;
}

.rec_like_button .rec-count {
  font-weight: bold;
}

/* Badges */
.rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
}

.rec-item-badge {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffc107;
}

.rec-seller-badge {
  background: #2eacce;
  color: #fff;
  border: 1px solid #1d8ba8;
}

/* Recommendations Block */
.rec-recommendations-block {
  margin: 20px 0;
}

.rec-recommendations-block h3 {
  font-size: 18px;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #2eacce;
}

.rec-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 15px;
}

.rec-item {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  background: #fff;
}

.rec-item:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.rec-item a {
  text-decoration: none;
  display: block;
}

.rec-item-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.rec-item-title {
  padding: 10px 10px 5px;
  font-weight: bold;
  color: #333;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-item-price {
  padding: 0 10px 5px;
  color: #28a745;
  font-weight: bold;
  font-size: 14px;
}

.rec-item-count {
  padding: 0 10px 10px;
  color: #e74c3c;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Active Users Widget (Stories) - Единый стиль */
.rec-active-users {
  margin: 20px 0;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.rec-active-users-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
}

.rec-active-users-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.rec-active-users-header h3 i {
  color: #2eacce;
  margin-right: 8px;
}

.rec-active-users-count {
  font-size: 13px;
  color: #6c757d;
  background: #f8f9fa;
  padding: 3px 12px;
  border-radius: 20px;
}

.rec-users-stories {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 5px 0 10px;
  scrollbar-width: thin;
  scrollbar-color: #2eacce #f1f1f1;
}

.rec-users-stories::-webkit-scrollbar {
  height: 6px;
}

.rec-users-stories::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.rec-users-stories::-webkit-scrollbar-thumb {
  background: #2eacce;
  border-radius: 10px;
}

.rec-user-story {
  flex: 0 0 auto;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
}

.rec-user-story:hover {
  transform: translateY(-3px);
}

.rec-user-avatar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rec-user-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 8px;
  border: 3px solid #2eacce;
  padding: 2px;
  transition: all 0.3s ease;
  position: relative;
}

.rec-user-avatar:hover {
  border-color: #1d8ba8;
  transform: scale(1.05);
}

.rec-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.rec-user-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: #ffc107;
  color: #856404;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  border: 2px solid #fff;
}

.rec-user-name {
  font-size: 12px;
  color: #333;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
  font-weight: 500;
}

/* Исправленный тултип для сторис - работает! */
.rec-user-tooltip {
  position: absolute;
  bottom: calc(100% + 15px);
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  padding: 16px 18px;
  min-width: 260px;
  max-width: 320px;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  pointer-events: none;
  box-sizing: border-box;
}

/* Показываем тултип при наведении на .rec-user-story */
.rec-user-story:hover .rec-user-tooltip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Стрелка тултипа */
.rec-user-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: #ffffff;
  z-index: 2;
}

.rec-user-tooltip::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 9px solid transparent;
  border-top-color: #e9ecef;
  z-index: 1;
}

/* Содержимое тултипа */
.rec-tooltip-content {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.rec-tooltip-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid #2eacce;
  background: #f8f9fa;
}

.rec-tooltip-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rec-tooltip-info {
  flex: 1;
  text-align: left;
  min-width: 0;
}

.rec-tooltip-name {
  font-weight: 700;
  font-size: 15px;
  color: #1a1a1a;
  margin-bottom: 4px;
  word-break: break-word;
}

.rec-tooltip-stats {
  font-size: 13px;
  color: #5a6268;
  line-height: 1.5;
}

.rec-tooltip-stats span {
  display: block;
  margin-bottom: 2px;
}

.rec-tooltip-stats i {
  width: 18px;
  text-align: center;
  margin-right: 4px;
  color: #2eacce;
}

.rec-tooltip-badge {
  display: inline-block;
  background: #fff3cd;
  color: #856404;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}

.rec-tooltip-link {
  display: inline-block;
  margin-top: 8px;
  color: #2eacce;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.rec-tooltip-link:hover {
  text-decoration: underline;
  color: #1d8ba8;
}

/* Адаптив для тултипа */
@media (max-width: 768px) {
  .rec-user-tooltip {
    min-width: 200px;
    max-width: 260px;
    left: 0;
    transform: translateX(0);
    padding: 12px 14px;
  }
  
  .rec-user-tooltip::after,
  .rec-user-tooltip::before {
    left: 30px;
    transform: translateX(0);
  }
  
  .rec-tooltip-avatar {
    width: 44px;
    height: 44px;
  }
  
  .rec-tooltip-name {
    font-size: 14px;
  }
  
  .rec-tooltip-stats {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .rec-user-tooltip {
    min-width: 160px;
    max-width: 220px;
    padding: 10px 12px;
  }
  
  .rec-tooltip-avatar {
    width: 36px;
    height: 36px;
  }
  
  .rec-tooltip-name {
    font-size: 13px;
  }
  
  .rec-tooltip-stats {
    font-size: 11px;
  }
}

/* Адаптив для виджета */
@media (max-width: 768px) {
  .rec-active-users {
    padding: 15px;
  }
  
  .rec-users-stories {
    gap: 15px;
  }
  
  .rec-user-avatar {
    width: 60px;
    height: 60px;
  }
  
  .rec-user-name {
    font-size: 11px;
    max-width: 65px;
  }
}

@media (max-width: 480px) {
  .rec-items-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
  }
  
  .rec-item-img {
    height: 120px;
  }
  
  .rec-user-avatar {
    width: 50px;
    height: 50px;
  }
  
  .rec-user-name {
    font-size: 10px;
    max-width: 55px;
  }
  
  .rec-active-users-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .rec-users-stories {
    gap: 10px;
  }
}

/* Публичная страница */
.rec-public-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px;
}

.rec-page-header {
  text-align: center;
  margin-bottom: 40px;
}

.rec-page-header h1 {
  font-size: 32px;
  color: #2eacce;
  margin-bottom: 10px;
}

.rec-page-header p {
  color: #6c757d;
  font-size: 16px;
}

.rec-empty-state {
  text-align: center;
  padding: 60px 20px;
}

.rec-empty-state .fa-heart-o {
  font-size: 64px;
  color: #dee2e6;
  margin-bottom: 20px;
}

.rec-empty-state h3 {
  color: #495057;
  margin-bottom: 10px;
}

.rec-empty-state p {
  color: #6c757d;
}

.rec-items-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.rec-list-item {
  border: 1px solid #e9ecef;
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.3s ease;
  background: #fff;
}

.rec-list-item:hover {
  box-shadow: 0 5px 20px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.rec-list-link {
  display: flex;
  text-decoration: none;
  color: inherit;
}

.rec-list-img {
  width: 200px;
  min-height: 150px;
  flex-shrink: 0;
  position: relative;
  background: #f8f9fa;
}

.rec-list-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rec-hot-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #dc3545;
  color: #fff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
}

.rec-list-info {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.rec-list-title {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
}

.rec-list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  font-size: 13px;
  color: #6c757d;
  margin-bottom: 10px;
}

.rec-list-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.rec-list-seller-badge {
  color: #856404;
  background: #fff3cd;
  padding: 2px 8px;
  border-radius: 12px;
}

.rec-list-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
}

.rec-list-price {
  font-size: 20px;
  font-weight: bold;
  color: #28a745;
}

.rec-list-count {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #e74c3c;
  font-weight: bold;
}

.rec-list-count .fa-heart {
  font-size: 18px;
}

.rec-pagination {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 30px;
}

.rec-page-link {
  padding: 8px 14px;
  border: 1px solid #dee2e6;
  border-radius: 5px;
  text-decoration: none;
  color: #333;
  transition: all 0.3s ease;
}

.rec-page-link:hover {
  background: #f8f9fa;
  border-color: #2eacce;
}

.rec-page-link.rec-active {
  background: #2eacce;
  color: #fff;
  border-color: #2eacce;
}

@media (max-width: 768px) {
  .rec-list-link {
    flex-direction: column;
  }
  
  .rec-list-img {
    width: 100%;
    height: 200px;
  }
  
  .rec-list-title {
    font-size: 16px;
  }
  
  .rec-list-meta {
    flex-direction: column;
    gap: 5px;
  }
  
  .rec-list-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* Личный кабинет пользователя */
.rec-user-page {
  padding: 20px;
}

.rec-user-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.rec-stat-item {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
}

.rec-stat-number {
  font-size: 32px;
  font-weight: bold;
  color: #2eacce;
}

.rec-stat-label {
  font-size: 14px;
  color: #6c757d;
  margin-top: 5px;
}

.rec-stat-item.rec-seller {
  background: #fff3cd;
  border-color: #ffc107;
}

.rec-stat-badge {
  margin-top: 10px;
  color: #856404;
  font-weight: bold;
}

.rec-stat-hint {
  margin-top: 10px;
  font-size: 12px;
  color: #6c757d;
}

.rec-user-section {
  margin-bottom: 40px;
}

.rec-user-section h3 {
  border-bottom: 2px solid #2eacce;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

.rec-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
}

.rec-user-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.rec-user-item:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.rec-user-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 15px;
  flex-shrink: 0;
}

.rec-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rec-user-info {
  flex: 1;
}

.rec-user-name {
  font-weight: bold;
  margin-bottom: 2px;
}

.rec-user-count {
  font-size: 12px;
  color: #6c757d;
}

.rec-user-link {
  font-size: 12px;
  color: #2eacce;
  text-decoration: none;
}

.rec-user-link:hover {
  text-decoration: underline;
}

.rec-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.rec-item {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  position: relative;
}

.rec-item:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.rec-item a {
  text-decoration: none;
  display: block;
}

.rec-item-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.rec-item-title {
  padding: 10px 10px 5px;
  font-weight: bold;
  color: #333;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-item-price {
  padding: 0 10px 5px;
  color: #28a745;
  font-weight: bold;
}

.rec-item-count {
  padding: 0 10px 10px;
  color: #e74c3c;
  font-size: 12px;
}

.rec-item-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #ffc107;
  color: #856404;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
}

.rec-empty {
  color: #6c757d;
  padding: 20px;
  text-align: center;
  border: 1px dashed #dee2e6;
  border-radius: 8px;
}

@media (max-width: 768px) {
  .rec-user-stats {
    grid-template-columns: 1fr;
  }
  
  .rec-user-grid,
  .rec-items-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}

/* Active Users Widget (Stories) - только базовые стили */
.rec-active-users {
  margin: 20px 0;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.rec-active-users-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
}

.rec-active-users-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.rec-active-users-header h3 i {
  color: #2eacce;
  margin-right: 8px;
}

.rec-active-users-count {
  font-size: 13px;
  color: #6c757d;
  background: #f8f9fa;
  padding: 3px 12px;
  border-radius: 20px;
}

.rec-users-stories {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding: 5px 0 10px;
  scrollbar-width: thin;
  scrollbar-color: #2eacce #f1f1f1;
}

.rec-users-stories::-webkit-scrollbar {
  height: 6px;
}

.rec-users-stories::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.rec-users-stories::-webkit-scrollbar-thumb {
  background: #2eacce;
  border-radius: 10px;
}

.rec-user-story {
  flex: 0 0 auto;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
}

.rec-user-story:hover {
  transform: translateY(-3px);
}

.rec-user-avatar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.rec-user-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 8px;
  border: 3px solid #2eacce;
  padding: 2px;
  transition: all 0.3s ease;
  position: relative;
}

.rec-user-avatar:hover {
  border-color: #1d8ba8;
  transform: scale(1.05);
}

.rec-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.rec-user-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: #ffc107;
  color: #856404;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  border: 2px solid #fff;
}

.rec-user-name {
  font-size: 12px;
  color: #333;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
  font-weight: 500;
}

/* Скрываем старый тултип в DOM */
.rec-user-tooltip {
  display: none !important;
}