[data-bs-theme="dark"] {
  --bs-card-bg: #484848;
}

[data-bs-theme="dark"] .btn-outline-primary {
  color: #ffffff;
}

main {
  padding-top: 5em;
  /* padding-bottom:2em; */
}

body.reduced-motion .speaker-icon.playing {
  animation: none;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .speaker-icon.playing {
    animation: none;
  }
}

.speaker-icon {
  cursor: pointer;
  display: inline-block;
  padding: 8px 12px;
  border-radius: 50%;
  transition: all 0.3s;
  margin-left: 10px;
}

[data-bs-theme="dark"] .speaker-icon.enabled {
  /* background: #5a67d8; */
  color: white;
}

[data-bs-theme="light"] .speaker-icon.enabled {
  /* background: #5a67d8; */
  color: black;
}

.speaker-icon.enabled:hover {
  /* background: #4c51bf; */
  transform: scale(1.1);
}

.speaker-icon.disabled {
  background: #e2e8f0;
  color: #a0aec0;
  cursor: not-allowed;
}


.speaker-icon.playing {
  animation: speakerPulse 1.5s infinite;
}

@keyframes speakerPulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }

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

span[data-bs-toggle="tooltip"] {
  transition: all 0.2s ease;
  /* padding: 2px 4px; */
  border-radius: 3px;
}

span[data-bs-toggle="tooltip"]:hover {
  background-color: var(--bs-secondary-bg);
  color: var(--bs-emphasis-color);
}

/* Make highlight more visible in dark mode */
[data-bs-theme="dark"] span[data-bs-toggle="tooltip"]:hover {
  background-color: rgba(255, 255, 255, 0.4);
}

/* Fix navbar and content width on mobile */
body {
  overflow-x: hidden;
}

.navbar .container {
  padding-left: 15px;
  padding-right: 15px;
}

@media (max-width: 991px) {
  .navbar .container {
    max-width: 100%;
    width: 100%;
  }
}

/* Ensure images scale properly */
.bs-docs-section img {
  max-width: 500px;
  width: 100%;
}

/*make the first TD bold, in every row*/
tbody td:first-child {
  font-weight: bold;
}

/* Ensure table text respects theme */
/* .table {
    --bs-table-color: var(--bs-body-color);
    --bs-table-bg: var(--bs-body-bg);
    }

    .table td,
    .table th {
    color: var(--bs-body-color); */
/* Fix striped table for theme switching */
.table-striped>tbody>tr:nth-of-type(odd)>* {
  --bs-table-bg-type: transparent;
  background-color: transparent;
}

.table-striped>tbody>tr:nth-of-type(even)>* {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Dark theme adjustments */
[data-bs-theme="dark"] .table-striped>tbody>tr:nth-of-type(even)>* {
  background-color: rgba(255, 255, 255, 0.05);

}

.dropdown-submenu>.dropdown-menu {
  top: 0;
  left: 100%;
  margin-top: -1px;
}

.hero-section {
  position: relative;
  height: 50vh;
  min-height: 360px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  margin-top: -2.5em;
  /* Counteract main padding */
  /* padding-top: 5em; */
  /* Add back padding for content */
}

[data-bs-theme="light"] .hero-section {
  background: linear-gradient(#2c3e50 0%, #83a9cf 100%);
}

[data-bs-theme="dark"] .hero-section {
  background: linear-gradient(#375a7f 0%, #1a242f 100%);
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* background: rgba(0, 0, 0, 0.4); Dark overlay for text readability */
  z-index: 0;
}

/* Animations */
.animate-fade-in-up {
  animation: fadeInUp 0.8s ease-out forwards;
  opacity: 0;
  transform: translateY(20px);
}

.delay-100 {
  animation-delay: 0.1s;
}

.delay-200 {
  animation-delay: 0.2s;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Cards */
.hover-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
}

.section-title {
  font-weight: 700;
  color: var(--bs-heading-color);
}

.title-underline {
  width: 60px;
  height: 4px;
  background-color: var(--bs-primary);
  border-radius: 2px;
}

#resultArea .card {
  background: rgba(0, 0, 0, 0.2);
}

/* Extracted from list_view.html */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-card-list {
  width: 100%;
}

.post-card-list .card {
  flex-direction: row !important;
  width: 100%;
}

.post-card-list .card-img-container {
  flex-shrink: 0;
  width: 250px;
  height: 200px;
}

.post-card-list .card-body {
  flex: 1;
}

.post-card-grid .card-img-container {
  width: 100%;
}

.post-card-grid .card {
  flex-direction: column !important;
}

.card-img-container {
  height: 200px;
  overflow: hidden;
}

.card-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.version-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.version-btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  border-radius: 1rem;
}

.post-item {
  animation: slideInUp 0.5s ease-out;
  animation-fill-mode: both;
}

.post-item:nth-child(1) {
  animation-delay: 0.05s;
}

.post-item:nth-child(2) {
  animation-delay: 0.1s;
}

.post-item:nth-child(3) {
  animation-delay: 0.15s;
}

.post-item:nth-child(4) {
  animation-delay: 0.2s;
}

.post-item:nth-child(5) {
  animation-delay: 0.25s;
}

.post-item:nth-child(6) {
  animation-delay: 0.3s;
}

.post-item:nth-child(7) {
  animation-delay: 0.35s;
}

.post-item:nth-child(8) {
  animation-delay: 0.4s;
}

.post-item:nth-child(9) {
  animation-delay: 0.45s;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

[data-bs-theme="light"] .card-img-placeholder {
  background: linear-gradient(135deg, #f7f7f7 0%, #e2e2e2 100%);
}

[data-bs-theme="dark"] .card-img-placeholder {
  background: linear-gradient(135deg, #626262 0%, #4a4a4a 100%);
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

[data-bs-theme="dark"] .loading-overlay {
  background: rgba(0, 0, 0, 0.8);
}

.loading-overlay.active {
  display: flex;
}

@media (max-width: 991px) {
  .post-grid {
    grid-template-columns: 1fr;
  }
}