/**
 * Impact Stats Component Styles - Kunco Milestone Block Style
 * 
 * Exact recreation of Kunco's milestone-block component
 * Layout: Left side with text + 2x2 stats grid, Right side with image/video
 */

/* Section Container */
.impact-stats {
  padding: 0;
  background: #ffffff;
}

.impact-stats .container {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.impact-stats__content-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  align-items: stretch;
}

/* Desktop 2-column layout */
@media (min-width: 992px) {
  .impact-stats__content-wrapper {
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
  }
  
  /* Media on right (default) */
  .impact-stats--media-right .impact-stats__content {
    order: 1;
  }
  
  .impact-stats--media-right .impact-stats__media {
    order: 2;
  }
  
  /* Media on left */
  .impact-stats--media-left .impact-stats__content {
    order: 2;
  }
  
  .impact-stats--media-left .impact-stats__media {
    order: 1;
  }
}

/* Content Side */
.impact-stats__content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Headline - Unser Blau */
.impact-stats__headline {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  color: var(--color-primary);
  margin: 0;
  line-height: 1.5;
  letter-spacing: 0.5px;
}

/* Subline - Large bold title */
.impact-stats__subline {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  color: #212529;
  margin: 0;
  line-height: 1.3;
}

.impact-stats__subline strong {
  font-weight: 700;
  color: #212529;
}

/* Description text */
.impact-stats__description {
  font-family: var(--font-family-base);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  line-height: var(--line-height-base);
  margin: var(--space-xs) 0 var(--space-md) 0;
}

.impact-stats__description p {
  margin: 0;
}

/* Stats Items Grid - 2x2 */
.impact-stats__items {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.75rem;
  margin-top: 0.25rem;
}

@media (min-width: 576px) {
  .impact-stats__items {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem 1.25rem;
  }
}

/* Handle Drupal wrappers */
.impact-stats__items > * {
  display: contents;
}

/* Individual Stats Item */
.impact-stats-item {
  display: flex;
}

/* Milestone Block - Kunco Style */
.milestone-block {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
}

.milestone-block.position-icon-left {
  flex-direction: row;
}

/* Milestone Icon - Small colored icon */
.milestone-icon {
  flex-shrink: 0;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  line-height: 1;
  color: var(--color-primary); /* Unser Blau */
}

.milestone-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
}

.milestone-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: brightness(0) saturate(100%) invert(23%) sepia(98%) saturate(1234%) hue-rotate(188deg) brightness(94%) contrast(101%);
}

/* Alle Icons in unserem Blau */
.impact-stats-item:nth-child(1) .milestone-icon,
.impact-stats-item:nth-child(2) .milestone-icon,
.impact-stats-item:nth-child(3) .milestone-icon,
.impact-stats-item:nth-child(4) .milestone-icon {
  color: var(--color-primary);
}

/* Milestone Right - Content container with hairline */
.milestone-right {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-grow: 1;
  justify-content: center;
  padding-left: 1rem;
  border-left: 1px solid #e0e0e0; /* Hairline! */
}

/* Milestone Number Inner - Number wrapper with optional symbol */
.milestone-number-inner {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  line-height: 1;
  color: var(--color-primary);
}

/* Alle Nummern in unserem Blau */
.impact-stats-item:nth-child(1) .milestone-number-inner,
.impact-stats-item:nth-child(2) .milestone-number-inner,
.impact-stats-item:nth-child(3) .milestone-number-inner,
.impact-stats-item:nth-child(4) .milestone-number-inner {
  color: var(--color-primary);
}

/* Milestone Number - The actual number */
.milestone-number {
  font-family: var(--font-family-base);
  font-size: var(--font-size-3xl); /* 32px */
  font-weight: var(--font-weight-normal);
  line-height: 1;
  color: var(--color-primary);
}

/* Symbol - Additional text after number (like "M $") */
.milestone-number-inner .symbol {
  font-family: 'Poppins', sans-serif;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 700;
  color: inherit;
  margin-left: 0.125rem;
}

/* Milestone Text - Label below number */
.milestone-text {
  font-family: 'Roboto', sans-serif;
  font-size: 0.9375rem;
  font-weight: 400;
  color: #212529;
  line-height: 1.4;
  margin-top: 0.25rem;
}

/* Media Side - Image with video overlay */
.impact-stats__media {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 400px;
  border-radius: 2px;
  overflow: hidden;
  background: #f5f5f5;
}

/* Handle Drupal image wrappers */
.impact-stats__media > div,
.impact-stats__media > figure {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

.impact-stats__media img,
.impact-stats__media video {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1.1);
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Video Overlay - Play button */
.impact-stats__media .video-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90px;
  height: 90px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.impact-stats__media .video-overlay:hover {
  background: #ffffff;
  transform: translate(-50%, -50%) scale(1.05);
}

/* Play Icon SVG */
.impact-stats__media .video-overlay .play-icon {
  width: 32px;
  height: 32px;
  color: #0056A0;
  margin-left: 4px;
}

/* Animation for counters */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.milestone-number {
  animation: countUp 0.8s ease-out;
}

/* Stagger animation for items */
.impact-stats-item:nth-child(1) .milestone-number {
  animation-delay: 0.1s;
}

.impact-stats-item:nth-child(2) .milestone-number {
  animation-delay: 0.2s;
}

.impact-stats-item:nth-child(3) .milestone-number {
  animation-delay: 0.3s;
}

.impact-stats-item:nth-child(4) .milestone-number {
  animation-delay: 0.4s;
}

/* Fade in animation for entire items */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.milestone-block {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out forwards;
}

.impact-stats-item:nth-child(1) .milestone-block {
  animation-delay: 0s;
}

.impact-stats-item:nth-child(2) .milestone-block {
  animation-delay: 0.15s;
}

.impact-stats-item:nth-child(3) .milestone-block {
  animation-delay: 0.3s;
}

.impact-stats-item:nth-child(4) .milestone-block {
  animation-delay: 0.45s;
}

/* Responsive adjustments */
@media (min-width: 768px) {
  .impact-stats__content {
    gap: 1rem;
  }
  
  .impact-stats__items {
    margin-top: 1rem;
    gap: 2rem 1.5rem;
  }
}

@media (min-width: 1200px) {
  .impact-stats__content-wrapper {
    gap: 4rem;
  }
  
  .impact-stats__items {
    gap: 2.25rem 2rem;
  }
  
  .milestone-icon {
    width: 50px;
    height: 50px;
    font-size: 2.75rem;
  }
  
  .milestone-block {
    gap: 1.25rem;
  }
}

/* Mobile optimizations */
@media (max-width: 575px) {
  .impact-stats__content {
    gap: 1.25rem;
  }
  
  .impact-stats__headline {
    font-size: 0.9375rem;
  }
  
  .impact-stats__description {
    font-size: 0.875rem;
  }
  
  .impact-stats__items {
    gap: 2rem;
    margin-top: 1.5rem;
  }
  
  .milestone-block {
    gap: 0.875rem;
  }
  
  .milestone-icon {
    width: 40px;
    height: 40px;
    font-size: 2.25rem;
  }
  
  .milestone-right {
    padding-left: 0.875rem;
  }
  
  .milestone-number {
    font-size: 2rem;
  }
  
  .milestone-number-inner .symbol {
    font-size: 1.125rem;
  }
  
  .milestone-text {
    font-size: 0.875rem;
  }
  
  .impact-stats__media .video-overlay {
    width: 70px;
    height: 70px;
  }
  
  .impact-stats__media .video-overlay .play-icon {
    width: 24px;
    height: 24px;
  }
}

/* Accessibility */
.milestone-block:focus-within {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.impact-stats__media .video-overlay:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .milestone-block,
  .milestone-number,
  .impact-stats__media .video-overlay {
    animation: none;
    opacity: 1;
    transition: none;
  }
  
  .impact-stats__media .video-overlay:hover {
    transform: translate(-50%, -50%);
  }
}

/* Print styles */
@media print {
  .impact-stats {
    page-break-inside: avoid;
  }
  
  .impact-stats__content-wrapper {
    grid-template-columns: 1fr;
  }
  
  .impact-stats__items {
    grid-template-columns: 1fr;
  }
  
  .impact-stats__media {
    max-height: 300px;
  }
  
  .impact-stats__media .video-overlay {
    display: none;
  }
  
  .milestone-icon,
  .milestone-number-inner,
  .milestone-number {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* Video Modal Overlay */
.video-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.video-modal-overlay.active {
  opacity: 1;
}

.video-modal-container {
  position: relative;
  width: 90%;
  max-width: 1200px;
  aspect-ratio: 16 / 9;
}

.video-modal-close {
  position: absolute;
  top: -50px;
  right: 0;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.video-modal-close:hover {
  transform: scale(1.1);
}

.video-modal-close svg {
  width: 30px;
  height: 30px;
}

.video-modal-content {
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.video-modal-content iframe,
.video-modal-content video {
  width: 100%;
  height: 100%;
  display: block;
}

.video-modal-content video {
  object-fit: contain;
}

@media (max-width: 767px) {
  .video-modal-container {
    width: 95%;
  }
  
  .video-modal-close {
    top: -40px;
    width: 35px;
    height: 35px;
  }
  
  .video-modal-close svg {
    width: 25px;
    height: 25px;
  }
}