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

.eventCard {
  overflow: hidden;
  padding: 0 !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  container-type: inline-size;
  min-width: 280px;

  &:hover {
    border-color: var(--mantine-color-gray-4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);

    .title {
      color: var(--mantine-color-primary-filled);
    }
  }

  &.isDraft {
    opacity: 0.75;
    border-style: dashed;

    &:hover {
      opacity: 1;
    }
  }

  &.isEnded {
    opacity: 0.6;

    &:hover {
      opacity: 0.8;
    }

    .image {
      filter: grayscale(50%);
    }
  }
}

.cardLink {
  display: flex;
  text-decoration: none;
  color: inherit;
  min-height: 140px;

  @include mixins.respond-below(md, true) {
    flex-direction: column;
    min-height: auto;
    position: relative;
  }
}

.imageContainer {
  position: relative;
  width: 200px;
  min-width: 200px;
  overflow: hidden;

  @include mixins.respond-below(md, true) {
    width: 100%;
    min-width: 100%;
    height: 140px;
  }
}

.image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.placeholderImage {
  &::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.08'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 1;
  }
}

.imageOverlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.15) 100%);
}

.placeholderOverlay {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(0, 0, 0, 0.15) 100%),
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.15) 0%, transparent 50%);
}

.statusBadge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: var(--hi-radius-sm);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 5px;
  backdrop-filter: blur(4px);

  &.status-live {
    background: var(--mantine-color-green-6);
    color: var(--mantine-color-white);
  }

  &.status-onsale {
    background: var(--mantine-color-primary-filled);
    color: var(--mantine-color-white);
  }

  &.status-draft {
    background: rgba(255, 255, 255, 0.9);
    color: var(--mantine-color-gray-7);
    border: 1px dashed var(--mantine-color-gray-5);
  }

  &.status-ended,
  &.status-archived {
    background: rgba(0, 0, 0, 0.6);
    color: var(--mantine-color-white);
  }
}

.pulseDot {
  width: 6px;
  height: 6px;
  background: var(--mantine-color-white);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.dateBadge {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: var(--mantine-color-white);
  border-radius: var(--hi-radius-sm);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.dateDay {
  font-size: 18px;
  font-weight: 700;
  color: var(--mantine-color-dark-9);
  line-height: 1;
}

.dateMonth {
  font-size: 10px;
  font-weight: 600;
  color: var(--mantine-color-primary-filled);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

.content {
  flex: 1;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;

  @include mixins.respond-below(md, true) {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
    gap: 12px;
  }
}

.contentMain {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--mantine-color-text);
  line-height: 1.3;
  transition: color 0.15s ease;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  margin-top: 2px;
}

.eventDate {
  color: var(--mantine-color-text);
  font-weight: 500;
}

.relativeDate {
  color: var(--mantine-color-dimmed);
  font-weight: 400;
}

.separator {
  color: var(--mantine-color-gray-4);
}

.location {
  color: var(--mantine-color-dimmed);
  @include mixins.ellipsis;
  max-width: 160px;
}

.footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.organizer {
  font-size: 12px;
  color: var(--mantine-color-dimmed);
  text-decoration: none;

  &:hover {
    color: var(--mantine-color-primary-filled);
    text-decoration: underline;
  }
}

.ticketStatus {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 500;

  &.ticket-available {
    background: var(--mantine-color-green-0);
    color: var(--mantine-color-green-8);
  }

  &.ticket-partial {
    background: var(--mantine-color-yellow-0);
    color: var(--mantine-color-yellow-8);
  }

  &.ticket-sold-out {
    background: var(--mantine-color-red-0);
    color: var(--mantine-color-red-7);
  }
}

.statsPanel {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 18px;
  background: var(--mantine-color-gray-0);
  border-radius: var(--hi-radius-md);
  flex-shrink: 0;

  @include mixins.respond-below(lg, true) {
    gap: 18px;
    padding: 10px 14px;
  }

  @include mixins.respond-below(md, true) {
    justify-content: space-around;
    padding: 12px;
  }
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: default;
  min-width: 75px;

  @include mixins.respond-below(lg, true) {
    min-width: 65px;
  }
}

.statValue {
  font-size: 18px;
  font-weight: 700;
  color: var(--mantine-color-text);
  line-height: 1;

  @include mixins.respond-below(lg, true) {
    font-size: 16px;
  }
}

.statValueRevenue {
  font-size: 18px;
  font-weight: 700;
  color: var(--mantine-color-green-7);
  line-height: 1;

  @include mixins.respond-below(lg, true) {
    font-size: 16px;
  }
}

.statLabel {
  font-size: 10px;
  color: var(--mantine-color-dimmed);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 500;
}

.menuButton {
  flex-shrink: 0;

  @include mixins.respond-below(md, true) {
    position: absolute;
    top: 10px;
    right: 10px;
  }
}

.actionButton {
  color: var(--mantine-color-dimmed);

  @include mixins.respond-below(md, true) {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);

    &:hover {
      background: var(--mantine-color-white);
    }
  }

  &:hover {
    background: var(--mantine-color-gray-1);
    color: var(--mantine-color-text);
  }
}
