/* =========================================
   Job Item Component - Minimal Single-Line Display
   
   Used in chatting page for real-time job notifications.
   Features:
   - Compact single-line layout
   - Expandable on hover (desktop) or click (mobile)
   - Auto-dismiss after 5s for completed jobs
   - Dynamic action buttons based on job status
   
   Note: This is different from jobList item rendering.
   ========================================= */

.job-item {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 64px;
  padding: 0px 0px 0px 10px;
  transition: all 0.2s ease;
  cursor: pointer;
  overflow: hidden;
  min-height: 32px;
  max-width: 100%;
}

.job-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(73, 114, 243, 0.3);
}

.job-item.expanded {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(73, 114, 243, 0.5);
}

.job-item.dismissing {
  opacity: 0.6;
  pointer-events: none;
}

/* Content Layout */
.job-content {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  position: relative;
  z-index: 1;
}

.job-type {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.4;
}

.job-description {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  opacity: 0;
  max-width: 0;
  transition: opacity 0.2s ease, max-width 0.2s ease;
  line-height: 1.4;
}

.job-item.expanded .job-description {
  opacity: 1;
  max-width: 100%;
}

/* Actions */
.job-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.job-more-btn,
.job-dynamic-btn {
  opacity: 0;
  max-width: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
  transition: opacity 0.2s ease, max-width 0.2s ease, padding 0.2s ease;
}

.job-item.expanded .job-more-btn,
.job-item.expanded .job-dynamic-btn {
  opacity: 1;
  max-width: 32px;
  padding: 4px 6px;
}

.job-btn-danger {
  background: rgba(239, 68, 68, 0.15) !important;
}

.job-btn-danger:hover {
  background: rgba(239, 68, 68, 0.25) !important;
}

/* State Icon */
.jobStateIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-right: 8px;
}

.jobStateIcon svg {
  width: 16px;
  height: 16px;
}

/* Progress Bar */
.job-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, #4972F3, #D925D2);
  transition: width 0.3s ease;
  border-radius: 0 0 8px 8px;
}

.job-item.dismissing .job-progress-bar {
  background: rgba(255, 255, 255, 0.1);
}

/* Animations */
@keyframes hourglass-flip {
  0%, 45% {
    transform: rotate(0deg);
  }
  50%, 95% {
    transform: rotate(180deg);
  }
  100% {
    transform: rotate(180deg);
  }
}

.icon-hourglass {
  animation: hourglass-flip 2s ease-in-out infinite;
  transform-origin: center;
}

.icon-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Mobile Specific */
@media (max-width: 767px) {
  
  .job-item.expanded {
    background: rgba(255, 255, 255, 0.08);
  }
}

/* Desktop: Prevent expanding beyond container */
@media (min-width: 768px) {
  .job-item {
    max-width: 100%;
  }
}

/* Dismissing Timer Animation */
.job-item.dismissing::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: var(--timer-progress, 0%);
  height: 100%;
  background: rgba(73, 114, 243, 0.05);
  transition: width 0.1s linear;
  z-index: 0;
}

/* Accessibility */
.job-item:focus-visible {
  outline: 2px solid rgba(73, 114, 243, 0.6);
  outline-offset: 2px;
}

button.job-more-btn:focus-visible,
button.job-dynamic-btn:focus-visible {
  outline: 2px solid rgba(73, 114, 243, 0.8);
  outline-offset: 1px;
}
