/**
 * Firebase Dynamic Integration 2 - Beautiful Light Theme Styles
 * Modern grid layout with horizontal arrangement - Version 1.5 - FIXED VIDEO & IMAGE
 */

/* Container and Layout */
.fdi-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Content Grid - 3 columns for normal cards */
.fdi-content-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  width: 100%;
}

/* Full width video card */
.fdi-card.video-card {
  grid-column: 1 / -1;
  width: 100%;
}

/* Card Styles */
.fdi-card {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(226, 232, 240, 0.8);
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
  transform: translateY(20px);
  display: flex;
  flex-direction: column;
  position: relative;
  height: fit-content;
}

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

.fdi-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
  border-color: rgba(99, 102, 241, 0.2);
}

/* Image Section - LIGHT BLUE BACKGROUND with COVER & INCREASED SIZE */
.fdi-image-container {
  position: relative;
  width: 100%;
  height: 280px; /* INCREASED: from 200px to 280px */
  overflow: hidden;
  background: #e0f2fe !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fdi-image {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Cover the container */
  object-position: center;
  transition: transform 0.5s ease;
  display: block;
}

.fdi-card:hover .fdi-image {
  transform: scale(1.05);
}

.fdi-image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(0, 0, 0, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.fdi-card:hover .fdi-image-overlay {
  opacity: 1;
}

/* Text Section - WHITE BACKGROUND & BLACK TEXT - MOVED UNDER VIDEO */
.fdi-text-section {
  padding: 24px;
  background: #ffffff !important;
  display: block;
  position: relative;
  flex-grow: 1;
  order: 3; /* Ensure text comes after video */
}

.fdi-text-content {
  position: relative;
  background: #ffffff;
}

.fdi-text-wrapper {
  position: relative;
  overflow: hidden;
  transition: max-height 0.4s ease;
  max-height: 240px; /* Doubled from 120px to 240px */
  background: #ffffff;
}

.fdi-text-wrapper.expanded {
  max-height: none;
}

.fdi-text {
  font-size: 1rem;
  line-height: 1.6;
  color: #000000 !important;
  margin: 0;
  font-weight: 400;
  text-align: left;
  position: relative;
  padding-left: 16px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  background: #ffffff;
}

.fdi-text::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 3px;
  height: calc(100% - 16px);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 2px;
}

/* Text overlay for gradient fade effect - WHITE FADE */
.fdi-text-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px; /* Increased for taller text area */
  background: linear-gradient(transparent, #ffffff);
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.fdi-text-wrapper.expanded .fdi-text-overlay {
  opacity: 0;
}

/* Read More Button */
.fdi-read-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 12px;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
  position: relative;
  z-index: 10;
  text-decoration: none;
}

.fdi-read-more-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  color: white;
  text-decoration: none;
}

.fdi-read-more-btn:active {
  transform: translateY(0);
}

.fdi-read-more-arrow {
  transition: transform 0.3s ease;
}

.fdi-read-more-btn.expanded .fdi-read-more-arrow {
  transform: rotate(180deg);
}

/* Hide read more button when not needed */
.fdi-read-more-btn.hidden {
  display: none !important;
}

/* Video Section - Dynamic sizing with text below */
.fdi-video-section {
  padding: 0;
  background: #ffffff !important;
  display: block;
  order: 2; /* Video comes after image but before text */
}

.fdi-video-wrapper {
  position: relative;
  width: 100%;
  height: 500px; /* Increased video height */
  background: #000000;
  overflow: hidden;
}

.fdi-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

/* Video Play Button - FIXED: Hide when video is playing */
.fdi-video-play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6366f1;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  opacity: 0.9;
  z-index: 2;
}

.fdi-video-play-button:hover {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

/* Hide play button when video is playing */
.fdi-video-wrapper.playing .fdi-video-play-button {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.fdi-video-fallback {
  color: #ffffff;
  text-align: center;
  padding: 20px;
}

.fdi-video-fallback a {
  color: #6366f1;
  text-decoration: none;
}

.fdi-video-fallback a:hover {
  text-decoration: underline;
}

/* Card Footer */
.fdi-card-footer {
  padding: 16px 24px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  order: 4; /* Footer comes last */
}

.fdi-card-meta {
  display: flex;
  justify-content: flex-end;
}

.fdi-card-index {
  display: none;
}

/* Footer - Hidden to remove text */
.fdi-footer {
  display: none;
}

/* Error and Info Messages */
.fdi-error,
.fdi-info {
  max-width: 600px;
  margin: 40px auto;
  padding: 32px;
  border-radius: 16px;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.fdi-error {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border: 2px solid #fca5a5;
  color: #dc2626;
}

.fdi-info {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 2px solid #93c5fd;
  color: #2563eb;
}

.fdi-error-icon,
.fdi-info-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  display: block;
}

.fdi-error h3,
.fdi-info h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 12px 0;
}

.fdi-error p,
.fdi-info p {
  font-size: 1rem;
  font-weight: 500;
  margin: 0;
  opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .fdi-content-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

@media (max-width: 768px) {
  .fdi-container {
    padding: 24px 16px;
    margin: 16px;
  }
  
  .fdi-content-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .fdi-text-section {
    padding: 20px;
  }
  
  .fdi-card-footer {
    padding: 12px 20px;
  }
  
  .fdi-image-container {
    height: 220px; /* Adjusted for mobile */
  }
  
  .fdi-video-wrapper {
    height: 350px; /* Adjusted for mobile */
  }
  
  .fdi-text-wrapper {
    max-height: 200px; /* Adjusted for mobile */
  }
  
  .fdi-text {
    font-size: 0.95rem;
    line-height: 1.5;
  }
  
  .fdi-read-more-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
  }
  
  .fdi-video-play-button {
    width: 64px;
    height: 64px;
  }
}

@media (max-width: 480px) {
  .fdi-container {
    margin: 8px;
    padding: 20px 12px;
    border-radius: 12px;
  }
  
  .fdi-image-container {
    height: 200px;
  }
  
  .fdi-video-wrapper {
    height: 280px;
  }
  
  .fdi-text-section {
    padding: 16px;
  }
  
  .fdi-text-wrapper {
    max-height: 180px; /* Adjusted for small mobile */
  }
  
  .fdi-video-play-button {
    width: 56px;
    height: 56px;
  }
  
  .fdi-read-more-btn {
    width: 100%;
    justify-content: center;
  }
}