/* Content cards – shared for kafala_events, posts, stories (list & detail) */

/* Page body */
.page-body-gradient {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
}

/* Hero sections (list & detail) */
.hero-posts,
.hero-stories,
.hero-post {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  padding: 4rem 1rem;
  color: white;
  text-align: center;
  margin-top: 5rem;
}

.hero-post {
  padding: 3rem 1rem;
}

.content-hero-title {
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero-post .content-hero-title {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  margin-bottom: 0;
}

.content-hero-desc {
  font-size: clamp(0.95rem, 2vw, 1.2rem);
  opacity: 0.95;
}

/* Container */
.content-cards-container {
  max-width: 1200px;
}

.content-cards-container-detail {
  max-width: 900px;
}

.content-cards-section-title {
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 0;
}

/* Empty / loading state */
.content-cards-empty {
  text-align: center;
  padding: 2rem 0;
}

.content-cards-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.content-cards-empty-text {
  color: #666;
  font-size: 1.1rem;
  font-weight: 500;
}

/* --- List cards: .post-card (events & posts) --- */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-card {
  background: white;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: slideInUp 0.5s ease-out forwards;
  opacity: 0;
}

.post-card:nth-child(1) { animation-delay: 0.1s; }
.post-card:nth-child(2) { animation-delay: 0.15s; }
.post-card:nth-child(3) { animation-delay: 0.2s; }
.post-card:nth-child(4) { animation-delay: 0.25s; }
.post-card:nth-child(5) { animation-delay: 0.3s; }
.post-card:nth-child(6) { animation-delay: 0.35s; }

.post-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(52, 152, 219, 0.2);
}

/* Whole card as link (e.g. kafala-events list) */
a.post-card-link {
  color: inherit;
}

.post-image {
  position: relative;
  width: 100%;
  padding-bottom: 66.67%;
  overflow: hidden;
  background: #f0f0f0;
}

.post-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.3) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.post-card:hover .post-overlay {
  opacity: 1;
}

.post-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s ease;
  font-size: 1.5rem;
  color: var(--primary-color);
}

.post-card:hover .post-play-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.post-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--primary-color);
  color: white;
  padding: 0.5rem 0.8rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
}

[dir="rtl"] .post-badge {
  right: auto;
  left: 0.75rem;
}

.post-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.75rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-description {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1rem;
  flex: 1;
  line-height: 1.5;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  margin-bottom: 1rem;
}

.post-date {
  font-size: 0.85rem;
  color: #999;
}

.post-read-more {
  display: inline-block;
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 0.5rem 0;
}

.post-read-more:hover {
  color: var(--secondary-color);
  transform: translateX(-5px);
}

[dir="rtl"] .post-read-more:hover {
  transform: translateX(5px);
}

/* --- Story card (stories list) --- */
.story-card {
  background: white;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: slideInUp 0.5s ease-out forwards;
  opacity: 0;
}

.story-card:nth-child(1) { animation-delay: 0.1s; }
.story-card:nth-child(2) { animation-delay: 0.15s; }
.story-card:nth-child(3) { animation-delay: 0.2s; }
.story-card:nth-child(4) { animation-delay: 0.25s; }
.story-card:nth-child(5) { animation-delay: 0.3s; }
.story-card:nth-child(6) { animation-delay: 0.35s; }

.story-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(52, 152, 219, 0.2);
}

.story-media {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  overflow: hidden;
  background: #f0f0f0;
}

.story-media img,
.story-media video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.3) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.story-card:hover .story-overlay {
  opacity: 1;
}

.story-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.3s ease;
  font-size: 1.5rem;
  color: var(--primary-color);
}

.story-card:hover .story-play-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

.story-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--primary-color);
  color: white;
  padding: 0.5rem 0.8rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
}

[dir="rtl"] .story-badge {
  right: auto;
  left: 0.75rem;
}

.story-info {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.story-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-description {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.story-orphan {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #eee;
  margin-bottom: 0.75rem;
}

.story-orphan-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.story-orphan-name {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 0.95rem;
}

.story-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.story-card .like-btn {
  background: #f0f0f0;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #666;
}

.story-card .like-btn:hover {
  background: #e0e0e0;
}

.story-card .like-btn.liked {
  background: #ffe0e0;
  color: #e74c3c;
}

.story-card .like-btn.liked i {
  animation: heartBeat 0.3s ease;
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.3); }
  50% { transform: scale(1.1); }
}

.story-card .share-btn {
  background: #f0f0f0;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #666;
  font-size: 0.9rem;
}

.story-card .share-btn:hover {
  background: var(--primary-color);
  color: white;
}

.story-date {
  font-size: 0.8rem;
  color: #999;
}

/* --- Detail page: article, media, body, share, related --- */
.post-article {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  animation: slideInUp 0.5s ease-out;
}

.post-media-container {
  margin-bottom: 2rem;
  border-radius: 0.5rem;
  overflow: hidden;
}

.post-media-container img,
.post-media-container video {
  width: 100%;
  border-radius: 0.5rem;
  max-height: 60vh;
  object-fit: cover;
}

.post-media-container video {
  display: block;
}

/* Event detail: gallery (main + thumbnails) and link card */
.event-gallery-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  align-items: stretch;
}

.event-gallery-main {
  position: relative;
  width: 100%;
  height: 400px;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #f0f0f0;
}

.event-gallery-main-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(20px);
  transform: scale(1.05);
}

.event-gallery-main-img-current {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  border-radius: 0.5rem;
  object-fit: contain;
  pointer-events: none;
}

.event-gallery-main a,
.event-gallery-main img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  border-radius: 0.5rem;
  object-fit: contain;
  cursor: pointer;
}

.event-gallery-main a {
  line-height: 0;
}

.event-gallery-thumbs {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  padding-bottom: 0.25rem;
}

.event-gallery-thumb {
  display: block;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.2s ease, opacity 0.2s ease;
  padding: 0;
  background: none;
  cursor: pointer;
}

.event-gallery-thumb:hover,
.event-gallery-thumb:focus {
  border-color: var(--primary-color);
  opacity: 0.95;
}

.event-gallery-thumb-active {
  border-color: var(--primary-color);
}

.event-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.event-link-card {
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.06) 0%, rgba(46, 204, 113, 0.06) 100%);
  border-radius: 1rem;
  border-inline-start: 4px solid var(--primary-color);
}

[dir="rtl"] .event-link-card {
  border-inline-start: 4px solid var(--primary-color);
  border-inline-end: none;
}

[dir="ltr"] .event-link-card {
  border-inline-end: 4px solid var(--primary-color);
  border-inline-start: none;
}

.event-link-card-inner {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.event-link-icon {
  color: var(--primary-color);
  font-size: 1.25rem;
}

.event-link-title {
  color: var(--primary-color);
  font-weight: 700;
  margin: 0 0 0.25rem 0;
}

.event-link-domain {
  font-size: 0.9rem;
  color: #666;
  margin: 0;
}

.event-link-cta {
  align-self: flex-start;
  margin-top: 0.5rem;
}

.post-meta-info {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #f0f0f0;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.post-date-badge {
  font-size: 0.9rem;
  color: var(--primary-color);
  font-weight: 500;
}

.post-type-badge {
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
}

.post-body {
  font-size: 1.05rem;
  line-height: 1.8;
  color: #333;
  text-align: justify;
}

.post-body h5 {
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.post-body.mb-section {
  margin-bottom: 1.5rem;
}

.post-body .row img {
  width: 100%;
  border-radius: 0.5rem;
  height: 180px;
  object-fit: cover;
}

.post-share-section {
  padding: 2rem;
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.05) 0%, rgba(46, 204, 113, 0.05) 100%);
  border-radius: 1rem;
  margin-top: 2rem;
}

.post-share-section h5 {
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 1rem;
}

.share-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.share-btn {
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: white;
}

.facebook-btn { background: #1877F2; }
.twitter-btn { background: #1DA1F2; }
.whatsapp-btn { background: #25D366; }
.copy-btn { background: var(--primary-color); }

.facebook-btn:hover { background: #165ED0; transform: translateY(-2px); }
.twitter-btn:hover { background: #1a8cd8; transform: translateY(-2px); }
.whatsapp-btn:hover { background: #1fad50; transform: translateY(-2px); }
.copy-btn:hover { background: var(--secondary-color); transform: translateY(-2px); }

/* Related section */
.related-posts-section {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 2px solid #f0f0f0;
}

.related-posts-section.mt-5.pt-4 {
  margin-top: 3rem;
  padding-top: 2rem;
}

.related-posts-section h3 {
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 2rem;
  text-align: center;
}

.related-post-card {
  display: block;
  background: white;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  text-decoration: none;
  height: 100%;
}

.related-post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(52, 152, 219, 0.15);
}

.related-post-image {
  position: relative;
  width: 100%;
  padding-bottom: 60%;
  overflow: hidden;
  background: #f0f0f0;
}

.related-post-image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.related-post-card:hover .related-post-image img {
  transform: scale(1.05);
}

.related-post-info {
  padding: 1rem;
}

.related-post-info h5 {
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.related-post-info p {
  font-size: 0.9rem;
  color: #666;
  margin: 0;
}

/* Back / primary button on detail */
.btn-content-primary {
  background: var(--primary-color);
  border: none;
}

.btn-content-primary:hover {
  background: var(--secondary-color);
  border: none;
}

.btn-content-outline {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-content-outline:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* Pagination */
.content-cards-container .pagination {
  margin-top: 3rem;
}

.content-cards-container .pagination .page-link {
  color: var(--primary-color);
  border-color: #ddd;
  transition: all 0.2s ease;
}

.content-cards-container .pagination .page-link:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.content-cards-container .pagination .page-item.active .page-link {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* Story skeleton (infinite scroll) */
.story-skeleton {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  height: 100%;
}

.skeleton-media {
  width: 100%;
  padding-bottom: 100%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 2s infinite;
}

.skeleton-info {
  padding: 1rem;
}

.skeleton-line {
  height: 12px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 2s infinite;
  margin-bottom: 0.75rem;
  border-radius: 4px;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Loading / empty state for stories */
.content-cards-loading-spinner {
  color: var(--primary-color);
  width: 3rem;
  height: 3rem;
}

.content-cards-loading-text {
  color: var(--primary-color);
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .post-card,
  .story-card {
    animation: none;
    opacity: 1;
  }

  .post-content,
  .story-info {
    padding: 1rem;
  }

  .post-title,
  .story-title {
    font-size: 1rem;
  }

  .post-description,
  .story-description {
    font-size: 0.85rem;
  }

  .post-article {
    padding: 1.5rem;
  }

  .post-body {
    font-size: 0.95rem;
  }

  [dir="rtl"] .post-body {
    text-align: right;
  }

  .share-buttons {
    justify-content: center;
  }

  .share-btn {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
  }

  .related-post-image {
    height: 150px;
    padding-bottom: 0;
  }

  .event-gallery-thumb {
    width: 72px;
    height: 72px;
  }

  .related-post-image img {
    position: relative;
    width: 100%;
    height: 100%;
  }
}
