@use "../../../../styles/mixins.scss";

// Design tokens - matching OrganizerHomepage
$font-display: var(--theme-font-family, 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
$font-body:  var(--theme-font-family, 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);

$radius-lg: 20px;
$radius-md: 14px;
$radius-sm: 10px;
$radius-xs: 6px;

$transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
$transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

.eventCardLink {
  text-decoration: none;
  color: inherit;
  display: block;

  &:hover {
    .eventCard {
      background: var(--accent-soft);

      .imageWrapper {
        img {
          transform: scale(1.03);
        }

        .placeholderContent {
          transform: scale(1.03);
        }
      }

      .shareButton {
        opacity: 1;
        transform: scale(1);
      }

      .dateBadge {
        border-color: var(--primary-color);
      }
    }
  }
}

.eventCard {
  // Inherit CSS variables from parent
  --primary-color: inherit;
  --primary-text-color: inherit;
  --secondary-color: inherit;
  --secondary-text-color: inherit;
  --bg-color: inherit;
  --content-bg-color: inherit;
  --border-color: inherit;
  --accent-soft: inherit;
  --accent-muted: inherit;
  --accent-contrast: inherit;

  font-family: $font-body;
  background: transparent;
  border-radius: $radius-md;
  overflow: visible;
  transition: all $transition-fast;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px;
  gap: 12px;

  @include mixins.respond-above('sm') {
    flex-direction: row;
    height: auto;
    min-height: 140px;
    padding: 12px;
    gap: 16px;
  }
}

// Image Section
.eventImage {
  position: relative;
  flex: 0 0 auto;

  @include mixins.respond-below('sm') {
    height: 160px;
  }

  @include mixins.respond-above('sm') {
    width: 200px;
    height: 120px;
  }
}

// Image wrapper with its own border radius
.imageWrapper {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: $radius-sm;
  overflow: hidden;
  background: var(--bg-color);

  @include mixins.respond-below('sm') {
    max-height: 160px;
  }

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform $transition-slow;
  }
}

// Placeholder when no image
.placeholderImage {
  width: 100%;
  height: 100%;
  background: var(--bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.placeholderContent {
  position: relative;
  transition: transform $transition-slow;
}

.placeholderIcon {
  font-size: 2.5rem;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
  color: var(--badge-text, white);
  animation: float 4s ease-in-out infinite;

  @media (max-width: 640px) {
    font-size: 2rem;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-6px) rotate(-2deg);
  }
  75% {
    transform: translateY(3px) rotate(2deg);
  }
}

// Sparkles
.sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sparkle {
  position: absolute;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  animation: sparkle 3s ease-in-out infinite;

  &:nth-child(1) {
    top: 15%;
    left: 20%;
    animation-delay: 0s;
  }

  &:nth-child(2) {
    top: 70%;
    right: 25%;
    animation-delay: 1s;
  }

  &:nth-child(3) {
    bottom: 25%;
    left: 30%;
    animation-delay: 2s;
  }
}

@keyframes sparkle {
  0%, 100% {
    opacity: 0;
    transform: scale(0) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1) rotate(180deg);
  }
}

// Image Overlay - contains floating elements
.imageOverlay {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
}

// Share button
.shareButton {
  opacity: 0;
  transform: scale(0.8);
  transition: all $transition-fast;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: $radius-xs;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 4px;

  @media (max-width: 640px) {
    opacity: 1;
    transform: scale(1);
  }
}

.shareIcon {
  color: var(--secondary-color);
  transition: all $transition-fast;

  &:hover {
    transform: scale(1.1);
    color: var(--primary-text-color);
  }
}

// Live indicator
.liveIndicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #ef4444;
  backdrop-filter: blur(10px);
  border-radius: $radius-xs;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.liveText {
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.liveDot {
  width: 5px;
  height: 5px;
  background: white;
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.5;
  }
}

// Date badge
.dateBadge {
  position: absolute;
  background: var(--content-bg-color);
  color: var(--primary-text-color);
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  border-radius: $radius-xs;
  box-shadow: 0 2px 8px var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: $font-display;
  font-weight: 600;
  font-size: 0.75rem;
  z-index: 10;
  bottom: 8px;
  left: 8px;
  backdrop-filter: blur(10px);
  transition: border-color $transition-fast;

  @include mixins.respond-below('sm') {
    left: 8px;
  }

  svg {
    color: var(--primary-color);
  }
}

// Content Section
.eventContent {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  justify-content: center;

  @include mixins.respond-below('sm') {
    padding: 0 4px;
  }

  @include mixins.respond-above('sm') {
    padding-right: 4px;
  }
}

.eventHeader {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.eventTitle {
  font-family: $font-display;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: var(--primary-text-color);
  line-height: 1.3;
  letter-spacing: -0.01em;

  @include mixins.respond-below('sm') {
    font-size: 0.95rem;
  }
}

.eventDateTime {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--secondary-color);
  font-size: 0.8125rem;
  font-weight: 500;

  svg {
    color: var(--accent-muted);
    flex-shrink: 0;
  }
}

.timezone {
  font-weight: 500;
  opacity: 0.8;
}

.eventDescription {
  font-size: 0.8125rem;
  color: var(--secondary-color);
  line-height: 1.5;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

// Footer section
.eventFooter {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;

  @include mixins.respond-below('sm') {
    gap: 8px;
  }
}

.eventMeta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.location {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--secondary-color);
  font-size: 0.8125rem;
  font-weight: 500;

  svg {
    color: var(--accent-muted);
    flex-shrink: 0;
  }
}

// Price section
.priceSection {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: $font-display;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--primary-text-color);
  padding: 6px 12px;
  background: var(--accent-soft);
  border-radius: $radius-xs;
  white-space: nowrap;

  svg {
    color: var(--primary-color);
    flex-shrink: 0;
  }

  .price {
    color: var(--primary-text-color);
  }

  .free {
    font-weight: 700;
    color: var(--primary-color);
  }
}
