/* Next Talk Stack Component - Left Side */

.next-talk-stack {
  --size-stack-offset: var(--size-3); /* Offset for stacked cards */
  position: fixed;
  bottom: var(--size-4);
  left: var(--size-4);
  z-index: var(--layer-navigation);
  width: min(40%, var(--size-content-2));
  pointer-events: none; /* Allow clicks through the container */
}

/* Collapsed state (default) */
.next-talk-stack:not(.expanded) .next-talk-card {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  overflow: hidden; /* Hide content that exceeds the fixed height */
}

.next-talk-stack:not(.expanded) .next-talk-card[data-stack-position="0"] {
  transform: translateY(0) scale(1);
  height: 110px; /* Fixed height for consistent stacking */
}

.next-talk-stack:not(.expanded) .next-talk-card[data-stack-position="1"] {
  transform: translateY(calc(var(--size-stack-offset) * -1)) scale(0.98);
  height: 110px; /* Fixed height for consistent stacking */
}

.next-talk-stack:not(.expanded) .next-talk-card[data-stack-position="2"] {
  transform: translateY(calc(var(--size-stack-offset) * -2)) scale(0.96);
  height: 110px; /* Fixed height for consistent stacking */
}

/* Expanded state - cards expand upward */
.next-talk-stack.expanded {
  display: flex;
  flex-direction: column-reverse; /* Stack from bottom up */
  align-items: flex-start;
}

.next-talk-stack.expanded .next-talk-card {
  position: relative;
  margin-top: var(--size-2); /* Space between cards when expanded */
  transform: translateY(0) scale(1) !important;
  height: auto !important; /* Reset to natural height when expanded */
  overflow: visible !important; /* Show all content when expanded */
}

.next-talk-card {
  background: var(--layer-surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-large);
  box-shadow: var(--elevation-3);
  padding: var(--size-3);
  cursor: pointer;
  transition: all 0.3s var(--ease-standard);
  pointer-events: auto; /* Enable clicks on cards */
  min-height: 80px;
  width: max(var(--size-content-2), 400px);
  transform-origin: bottom center;
  border-left: 4px solid var(--primary); /* Visual indicator for upcoming talks */
}

/* Hover only affects expanded cards */
.next-talk-stack.expanded .next-talk-card:hover {
  box-shadow: var(--elevation-4);
  transform: translateY(-2px) scale(1.02) !important;
  z-index: 1010 !important;
}

.next-talk-stack.expanded .next-talk-card:active {
  transform: translateY(0) scale(0.98) !important;
  box-shadow: var(--elevation-2);
}

/* Card Content Layout - Icon on left, 3 lines on right */
.next-talk-card-content {
  display: flex;
  gap: var(--size-3);
  align-items: flex-start;
}

.next-talk-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-container);
  color: var(--on-primary-container);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* Three-line content area */
.next-talk-details {
  flex: 1;
  min-width: 0; /* Allow text truncation */
  display: flex;
  flex-direction: column;
  gap: var(--size-1);
}

/* Line 1: Talk Title */
.next-talk-title {
  font-size: 1rem; /* Normal font size */
  font-weight: var(--font-weight-6);
  color: var(--on-surface);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Line 2: Role and Time */
.next-talk-role-time {
  font-size: var(--font-size-body-small);
  color: var(--on-surface-variant);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.next-talk-role {
  font-weight: var(--font-weight-5);
  color: var(--primary);
}

/* Line 3: Status and Conference */
.next-talk-meta {
  display: flex;
  align-items: center;
  gap: var(--size-1);
  font-size: var(--font-size-body-small);
  color: var(--on-surface-variant);
  line-height: 1.2;
}

.next-talk-status {
  padding: 2px 6px;
  border-radius: var(--radius-small);
  font-size: var(--font-size-label-small);
  font-weight: var(--font-weight-5);
}

.next-talk-status.starting-soon {
  background: var(--warning-container);
  color: var(--on-warning-container);
}

.next-talk-status.in-progress {
  background: var(--error-container);
  color: var(--on-error-container);
}

.next-talk-separator {
  color: var(--outline);
}

.next-talk-conference {
  color: var(--primary);
  font-weight: var(--font-weight-5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Stacking positions for multiple cards */
.next-talk-card[data-stack-position="0"] {
  z-index: 1005;
}

.next-talk-card[data-stack-position="1"] {
  z-index: 1004;
}

.next-talk-card[data-stack-position="2"] {
  z-index: 1003;
}

/* Only apply opacity in collapsed state for distant cards */
.next-talk-stack:not(.expanded) .next-talk-card[data-stack-position="2"] {
  opacity: 0.9;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
  .next-talk-stack {
    bottom: 70px; /* Same position as desktop */
    left: 10px;
    width: 45%; /* Mobile width */
    z-index: var(--layer-navigation); /* Same as desktop */
  }
  
  /* Adjust collapsed state for mobile */
  .next-talk-stack:not(.expanded) .next-talk-card[data-stack-position="1"] {
    transform: translateY(calc(var(--size-3) * -1)) scale(0.98);
  }

  .next-talk-stack:not(.expanded) .next-talk-card[data-stack-position="2"] {
    transform: translateY(calc(var(--size-3) * -2)) scale(0.96);
  }

  .next-talk-card {
    padding: var(--size-2);
    min-height: 70px;
  }

  /* Fixed height for mobile collapsed state too */
  .next-talk-stack:not(.expanded) .next-talk-card {
    height: 70px; /* Smaller fixed height for mobile */
  }

  .next-talk-card-content {
    gap: var(--size-2);
  }

  .next-talk-icon {
    width: 32px;
    height: 32px;
  }

  .next-talk-details {
    gap: 4px;
  }

  .next-talk-title {
    font-size: var(--font-size-body-small);
  }

  .next-talk-role-time {
    font-size: var(--font-size-label-medium);
  }

  .next-talk-meta {
    font-size: var(--font-size-label-small);
    gap: 4px;
  }

  /* Reduce number of visible cards on mobile */
  .next-talk-card[data-stack-position="2"] {
    display: none;
  }
}

/* Hover effect for stack expansion */
.next-talk-stack:hover .next-talk-card {
  transition: transform 0.3s var(--ease-standard);
}

/* Focus states for accessibility */
.next-talk-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .next-talk-card {
    border-width: 2px;
    border-color: var(--outline);
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .next-talk-card,
  .next-talk-stack:hover .next-talk-card {
    transition: none;
  }
}

/* Dark mode considerations */
@media (prefers-color-scheme: dark) {
  .next-talk-card {
    border-color: var(--outline);
  }
}