/* ==========================================================================
   Teamup Event Embed – Card Styles v2.1
   Themes: Dark, Light, Auto (prefers-color-scheme)
   ========================================================================== */

/* ---------- Base ---------- */

.tue-card {
  --tue-accent: #4A90D9;
  --tue-radius: 16px;
  position: relative;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
  border-radius: var(--tue-radius);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  line-height: 1.4;
  box-sizing: border-box;
}

.tue-card *,
.tue-card *::before,
.tue-card *::after {
  box-sizing: border-box;
}

.tue-card:hover {
  transform: translateY(-2px);
}

/* Accent top bar */
.tue-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--tue-accent), color-mix(in srgb, var(--tue-accent) 50%, transparent));
  z-index: 2;
}

/* ==========================================
   DARK THEME
   ========================================== */

.tue-card--dark {
  --tue-bg: #1a1a2e;
  --tue-text: #ffffff;
  --tue-text-secondary: rgba(255, 255, 255, 0.7);
  --tue-text-muted: rgba(255, 255, 255, 0.55);
  --tue-border: rgba(255, 255, 255, 0.08);
  --tue-border-hover: rgba(255, 255, 255, 0.1);
  --tue-expand-bg: rgba(255, 255, 255, 0.04);
  --tue-expand-hover: rgba(255, 255, 255, 0.08);
  --tue-expand-text: rgba(255, 255, 255, 0.7);
  --tue-ghost-border: rgba(255, 255, 255, 0.12);
  --tue-ghost-text: rgba(255, 255, 255, 0.6);
  --tue-ghost-hover-border: rgba(255, 255, 255, 0.3);
  --tue-ghost-hover-text: rgba(255, 255, 255, 0.9);
  --tue-footer-text: rgba(255, 255, 255, 0.25);
  --tue-footer-border: rgba(255, 255, 255, 0.05);
  --tue-icon-opacity: 0.7;
  --tue-separator: rgba(255, 255, 255, 0.06);
  background: var(--tue-bg);
  border: 1px solid var(--tue-border);
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.tue-card--dark:hover {
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 1px var(--tue-border-hover),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* ==========================================
   LIGHT THEME
   ========================================== */

.tue-card--light {
  --tue-bg: #ffffff;
  --tue-text: #1a1a2e;
  --tue-text-secondary: #444;
  --tue-text-muted: #666;
  --tue-border: rgba(0, 0, 0, 0.1);
  --tue-border-hover: rgba(0, 0, 0, 0.15);
  --tue-expand-bg: rgba(0, 0, 0, 0.03);
  --tue-expand-hover: rgba(0, 0, 0, 0.06);
  --tue-expand-text: #444;
  --tue-ghost-border: rgba(0, 0, 0, 0.15);
  --tue-ghost-text: #555;
  --tue-ghost-hover-border: rgba(0, 0, 0, 0.3);
  --tue-ghost-hover-text: #111;
  --tue-footer-text: rgba(0, 0, 0, 0.3);
  --tue-footer-border: rgba(0, 0, 0, 0.06);
  --tue-icon-opacity: 0.5;
  --tue-separator: rgba(0, 0, 0, 0.06);
  background: var(--tue-bg);
  border: 1px solid var(--tue-border);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.04);
}

.tue-card--light:hover {
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.12),
    0 0 0 1px var(--tue-border-hover);
}

.tue-card--light .tue-card__image-fade {
  background: linear-gradient(90deg, transparent 50%, #ffffff) !important;
}

.tue-card--light .tue-card__btn--primary {
  color: #fff;
}

/* ==========================================
   AUTO THEME
   ========================================== */

.tue-card--auto {
  --tue-bg: #1a1a2e;
  --tue-text: #ffffff;
  --tue-text-secondary: rgba(255, 255, 255, 0.7);
  --tue-text-muted: rgba(255, 255, 255, 0.55);
  --tue-border: rgba(255, 255, 255, 0.08);
  --tue-border-hover: rgba(255, 255, 255, 0.1);
  --tue-expand-bg: rgba(255, 255, 255, 0.04);
  --tue-expand-hover: rgba(255, 255, 255, 0.08);
  --tue-expand-text: rgba(255, 255, 255, 0.7);
  --tue-ghost-border: rgba(255, 255, 255, 0.12);
  --tue-ghost-text: rgba(255, 255, 255, 0.6);
  --tue-ghost-hover-border: rgba(255, 255, 255, 0.3);
  --tue-ghost-hover-text: rgba(255, 255, 255, 0.9);
  --tue-footer-text: rgba(255, 255, 255, 0.25);
  --tue-footer-border: rgba(255, 255, 255, 0.05);
  --tue-icon-opacity: 0.7;
  --tue-separator: rgba(255, 255, 255, 0.06);
  background: var(--tue-bg);
  border: 1px solid var(--tue-border);
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.tue-card--auto:hover {
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 1px var(--tue-border-hover),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

@media (prefers-color-scheme: light) {
  .tue-card--auto {
    --tue-bg: #ffffff;
    --tue-text: #1a1a2e;
    --tue-text-secondary: #444;
    --tue-text-muted: #666;
    --tue-border: rgba(0, 0, 0, 0.1);
    --tue-border-hover: rgba(0, 0, 0, 0.15);
    --tue-expand-bg: rgba(0, 0, 0, 0.03);
    --tue-expand-hover: rgba(0, 0, 0, 0.06);
    --tue-expand-text: #444;
    --tue-ghost-border: rgba(0, 0, 0, 0.15);
    --tue-ghost-text: #555;
    --tue-ghost-hover-border: rgba(0, 0, 0, 0.3);
    --tue-ghost-hover-text: #111;
    --tue-footer-text: rgba(0, 0, 0, 0.3);
    --tue-footer-border: rgba(0, 0, 0, 0.06);
    --tue-icon-opacity: 0.5;
    --tue-separator: rgba(0, 0, 0, 0.06);
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.08),
      0 0 0 1px rgba(0, 0, 0, 0.04);
  }

  .tue-card--auto:hover {
    box-shadow:
      0 8px 24px rgba(0, 0, 0, 0.12),
      0 0 0 1px var(--tue-border-hover);
  }

  .tue-card--auto .tue-card__image-fade {
    background: linear-gradient(90deg, transparent 50%, #ffffff) !important;
  }

  .tue-card--auto .tue-card__btn--primary {
    color: #fff;
  }
}

/* ==========================================
   SHARED COMPONENTS
   ========================================== */

/* ---------- Image ---------- */

.tue-card__image {
  width: 130px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  align-self: stretch;
}

.tue-card__image img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
}

.tue-card__image-fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 50%, var(--tue-bg));
  pointer-events: none;
}

/* Accent bar (no-image) */
.tue-card__accent-bar {
  width: 6px;
  flex-shrink: 0;
  align-self: stretch;
  background: linear-gradient(180deg, var(--tue-accent), color-mix(in srgb, var(--tue-accent) 30%, transparent));
}

/* ---------- Content ---------- */

.tue-card__content {
  flex: 1;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.tue-card__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--tue-text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  padding: 0;
}

/* ---------- Meta ---------- */

.tue-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}

.tue-card__date,
.tue-card__time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--tue-text-muted);
  margin: 0;
  padding: 0;
}

.tue-card__date {
  font-weight: 500;
  color: var(--tue-text-secondary);
}

.tue-card__date svg,
.tue-card__time svg {
  flex-shrink: 0;
  opacity: var(--tue-icon-opacity);
}

/* ---------- Actions ---------- */

.tue-card__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  flex-wrap: wrap;
}

.tue-card__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  border: none;
  line-height: 1.4;
  font-family: inherit;
  white-space: nowrap;
}

.tue-card__btn--primary {
  background: var(--tue-accent);
  color: #fff;
  letter-spacing: 0.01em;
}

.tue-card__btn--primary:hover {
  filter: brightness(1.15);
}

.tue-card__btn-plus {
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
}

.tue-card__btn-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
}

.tue-card__btn--primary.tue-active .tue-card__btn-arrow {
  transform: rotate(180deg);
}

.tue-card__btn--ghost {
  padding: 6px 12px;
  border: 1px solid var(--tue-ghost-border);
  background: transparent;
  color: var(--tue-ghost-text);
  font-weight: 500;
}

.tue-card__btn--ghost:hover {
  border-color: var(--tue-ghost-hover-border);
  color: var(--tue-ghost-hover-text);
  text-decoration: none;
}

.tue-card__btn--ghost svg {
  flex-shrink: 0;
}

/* ==========================================
   INLINE CALENDAR EXPAND (FIXED)
   ========================================== */

/* Standardzustand: Ausgeblendet */
.tue-card__cal-expand {
  width: 100%;
  display: none; /* WICHTIG: Standardmäßig unsichtbar */
  padding: 0 20px;
  flex-direction: column;
  gap: 2px;
  overflow: hidden; /* Für saubere Animation */
}

/* Aktivzustand: Eingeblendet (via JS Klasse .tue-active) */
.tue-card__cal-expand.tue-active {
  display: flex;
  padding: 8px 20px 4px;
  animation: tue-fade-in 0.2s ease-in-out;
}

/* Animation Keyframes */
@keyframes tue-fade-in {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Separator line above cal links */
.tue-card__cal-expand::before {
  content: "";
  display: block;
  height: 1px;
  background: var(--tue-separator);
  margin-bottom: 6px;
}

.tue-card__cal-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--tue-expand-text);
  font-size: 13px;
  text-decoration: none;
  transition: background 0.15s ease;
  font-family: inherit;
}

.tue-card__cal-link:hover {
  background: var(--tue-expand-hover);
  text-decoration: none;
}

.tue-card__cal-link svg {
  flex-shrink: 0;
  opacity: var(--tue-icon-opacity);
}

/* ---------- Footer ---------- */

.tue-card__footer {
  width: 100%;
  padding: 6px 20px;
  border-top: 1px solid var(--tue-footer-border);
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.tue-card__footer span {
  font-size: 10px;
  color: var(--tue-footer-text);
  letter-spacing: 0.05em;
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
  .tue-card {
    max-width: 100%;
  }

  .tue-card__image {
    width: 100px;
  }

  .tue-card__content {
    padding: 12px 14px;
  }

  .tue-card__title {
    font-size: 16px;
  }

  .tue-card__meta {
    gap: 4px 10px;
  }

  .tue-card__date,
  .tue-card__time {
    font-size: 12px;
  }

  .tue-card__btn {
    font-size: 11px;
    padding: 5px 10px;
  }

  .tue-card__cal-expand {
    padding-left: 14px;
    padding-right: 14px;
  }

  .tue-card__cal-expand.tue-active {
    padding: 6px 14px 2px;
  }
}