/* RSS Carousel Widget Styling - Grid layout with hover navigation */

#rss-carousel-widget {
  margin: 1rem 0 1rem 0;
  background: var(--md-default-fg-color--lightest);
  border-radius: 16px;
  padding: 0.25rem 0.5rem 0.5rem 0.5rem !important;
}

.rss-carousel {
  position: relative;
  background: transparent;
}

.rss-carousel-title {
  margin: 0.25rem 0 1rem 0 !important;
  padding: 0.25rem 0.5rem !important;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--md-default-fg-color);
}

.rss-carousel-track {
  position: relative;
  min-height: 300px;
}

.rss-carousel-items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding: 0.5rem 0;
}

.rss-item {
  display: none;
  flex-direction: column;
  background: var(--md-default-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 12px;
  overflow: hidden;
  transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  height: 480px;
  opacity: 0;
  transform: scale(0.95);
}

.rss-item.active {
  display: flex;
  opacity: 1;
  transform: scale(1);
  animation: fadeInScale 0.5s ease-in-out;
}

.rss-item.active:hover {
  transform: translateY(-4px) scale(1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--md-primary-fg-color);
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.rss-item-image {
  width: 100%;
  height: 60%;
  overflow: hidden;
  background: var(--md-default-fg-color--lightest);
}

.rss-item-image a {
  display: block;
  width: 100%;
  height: 100%;
}

.rss-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.rss-item:hover .rss-item-image img {
  transform: scale(1.05);
}

.rss-item-content {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.rss-item-category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-top: auto;
  align-self: flex-start;
}

.rss-item-category.official {
  background: #e3f2fd;
  color: #1976d2;
}

.rss-item-category.blog {
  background: #f3e5f5;
  color: #7b1fa2;
}

.rss-item-category.video {
  background: #ffebee;
  color: #c62828;
}

.rss-item-category.community {
  background: #e8f5e9;
  color: #2e7d32;
}

[data-md-color-scheme="slate"] .rss-item-category.official {
  background: rgba(25, 118, 210, 0.2);
  color: #90caf9;
}

[data-md-color-scheme="slate"] .rss-item-category.blog {
  background: rgba(123, 31, 162, 0.2);
  color: #ce93d8;
}

[data-md-color-scheme="slate"] .rss-item-category.video {
  background: rgba(198, 40, 40, 0.2);
  color: #ef9a9a;
}

[data-md-color-scheme="slate"] .rss-item-category.community {
  background: rgba(46, 125, 50, 0.2);
  color: #a5d6a7;
}

.rss-item-title {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.3;
  font-weight: 600;
}

.rss-item-title a {
  color: var(--md-default-fg-color);
  text-decoration: none;
  transition: color 0.2s ease;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rss-item-title a:hover {
  color: var(--md-primary-fg-color);
}

.rss-item-snippet {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--md-default-fg-color--lighter);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rss-item-meta {
  display: flex;
  gap: 0.5rem;
  font-size: 0.65rem;
  color: var(--md-default-fg-color--light);
  margin-bottom: 0.4rem;
}

.rss-item-source {
  font-weight: 600;
}

.rss-item-date::before {
  content: "•";
  margin-right: 0.5rem;
}

/* Navigation buttons - center positioned, show on hover */
.rss-nav-prev,
.rss-nav-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--md-primary-fg-color);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  z-index: 10;
  opacity: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.rss-carousel:hover .rss-nav-prev,
.rss-carousel:hover .rss-nav-next {
  opacity: 1;
}

.rss-nav-prev:hover,
.rss-nav-next:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.rss-nav-prev:disabled,
.rss-nav-next:disabled {
  cursor: not-allowed;
  opacity: 0.3 !important;
}

.rss-nav-prev {
  left: -24px;
}

.rss-nav-next {
  right: -24px;
}

.rss-control-icon {
  font-size: 1.25rem;
  line-height: 1;
}

/* Loading state */
.rss-carousel-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--md-default-fg-color--light);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--md-default-fg-color--lightest);
  border-top-color: var(--md-primary-fg-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.rss-carousel-loading p {
  margin: 0;
  font-size: 0.875rem;
}

/* Empty state */
.rss-carousel-empty {
  padding: 3rem;
  text-align: center;
  color: var(--md-default-fg-color--light);
}

.rss-carousel-empty p {
  margin: 0;
  font-size: 0.95rem;
}

/* Responsive design */
@media screen and (max-width: 991px) {
  .rss-carousel-items {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .rss-nav-prev {
    left: -16px;
  }
  
  .rss-nav-next {
    right: -16px;
  }
}

@media screen and (max-width: 767px) {
  .rss-carousel-items {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .rss-item {
    height: 420px;
  }

  .rss-item-content {
    padding: 1rem;
  }

  .rss-item-title {
    font-size: 0.75rem;
  }

  .rss-item-snippet {
    font-size: 0.65rem;
  }

  .rss-item-meta {
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.6rem;
  }

  .rss-item-date::before {
    content: "";
    margin-right: 0;
  }
  
  .rss-nav-prev,
  .rss-nav-next {
    width: 40px;
    height: 40px;
    opacity: 0.9;
  }
  
  .rss-nav-prev {
    left: 8px;
  }
  
  .rss-nav-next {
    right: 8px;
  }
  
  .rss-control-icon {
    font-size: 1rem;
  }
}

/* Very small phones (320px - iPhone 5) */
@media screen and (max-width: 479px) {
  #rss-carousel-widget {
    padding: 0.25rem 0.25rem 0.5rem 0.25rem !important;
  }

  .rss-carousel-title {
    font-size: 1.25rem;
    margin: 0.25rem 0 0.75rem 0 !important;
  }

  .rss-item {
    height: 400px;
  }

  .rss-item-content {
    padding: 0.75rem;
  }

  .rss-nav-prev,
  .rss-nav-next {
    width: 36px;
    height: 36px;
  }

  .rss-control-icon {
    font-size: 0.9rem;
  }
}
