/* History Modal Styles - VibeSurf Extension */

/* History Modal - Modern Design */
.history-modal-content {
  width: 92vw;
  max-width: 900px;
  min-height: 70vh;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.history-content {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  padding: 32px;
  padding-top: 24px;
}

.history-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: visible;
  min-height: 0;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 24px 0;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 28px;
}

.section-header h4 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.5px;
}

.section-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 2px solid var(--primary-color);
  border-radius: 12px;
  background-color: transparent;
  color: var(--primary-color);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.back-btn:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 122, 204, 0.2);
}

/* Recent Tasks List */
.recent-tasks-list {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 28px;
  padding-right: 8px;
}

.recent-tasks-list::-webkit-scrollbar {
  width: 6px;
}

.recent-tasks-list::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.recent-tasks-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.recent-tasks-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

.recent-task-item {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 24px;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background-color: var(--bg-secondary);
  margin-bottom: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.recent-task-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.recent-task-item:hover {
  border-color: var(--primary-color);
  background-color: var(--bg-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 122, 204, 0.15);
}

.recent-task-item:hover::before {
  transform: scaleX(1);
}

.task-status-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  position: relative;
}

.task-status-icon::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 14px;
  padding: 2px;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.task-status-icon:hover::before {
  opacity: 1;
}

.task-status-icon.completed {
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), rgba(40, 167, 69, 0.2));
  color: var(--accent-color);
  border: 1px solid rgba(40, 167, 69, 0.3);
}

.task-status-icon.running {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 193, 7, 0.2));
  color: var(--warning-color);
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.task-status-icon.error {
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.2));
  color: var(--danger-color);
  border: 1px solid rgba(220, 53, 69, 0.3);
}

.task-status-icon.pending {
  background: linear-gradient(135deg, rgba(108, 117, 125, 0.1), rgba(108, 117, 125, 0.2));
  color: var(--text-muted);
  border: 1px solid rgba(108, 117, 125, 0.3);
}

.task-item-content {
  flex: 1;
  min-width: 0;
}

.task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.session-id-badge {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 11px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.task-timestamp {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.task-description {
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 16px;
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-weight: 400;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.task-status-text {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 12px;
}

.task-status-text.completed {
  background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), rgba(40, 167, 69, 0.15));
  color: var(--accent-color);
  border: 1px solid rgba(40, 167, 69, 0.2);
}

.task-status-text.running {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 193, 7, 0.15));
  color: var(--warning-color);
  border: 1px solid rgba(255, 193, 7, 0.2);
}

.task-status-text.error {
  background: linear-gradient(135deg, rgba(220, 53, 69, 0.1), rgba(220, 53, 69, 0.15));
  color: var(--danger-color);
  border: 1px solid rgba(220, 53, 69, 0.2);
}

.task-status-text.pending {
  background: linear-gradient(135deg, rgba(108, 117, 125, 0.1), rgba(108, 117, 125, 0.15));
  color: var(--text-muted);
  border: 1px solid rgba(108, 117, 125, 0.2);
}

.view-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 20px;
  border: 2px dashed var(--border-color);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.view-more-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 122, 204, 0.1), transparent);
  transition: left 0.5s;
}

.view-more-btn:hover {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, var(--bg-hover), var(--bg-secondary));
  color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 122, 204, 0.15);
}

.view-more-btn:hover::before {
  left: 100%;
}

/* Search and Filter Bar */
.search-filter-bar {
  display: flex;
  gap: 20px;
  margin-bottom: 28px;
}

.search-input {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background-color: var(--bg-primary);
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(0, 122, 204, 0.1);
  transform: translateY(-1px);
}

.filter-select {
  padding: 14px 18px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background-color: var(--bg-primary);
  font-size: 15px;
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  min-width: 140px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(0, 122, 204, 0.1);
  transform: translateY(-1px);
}

/* All Sessions List */
.sessions-list {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 28px;
  padding-right: 8px;
}

.sessions-list::-webkit-scrollbar {
  width: 6px;
}

.sessions-list::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.sessions-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.sessions-list::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

.session-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background-color: var(--bg-primary);
  margin-bottom: 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.session-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.session-item:hover {
  border-color: var(--primary-color);
  background-color: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 122, 204, 0.15);
}

.session-item:hover::before {
  transform: scaleX(1);
}

.session-info {
  flex: 1;
  min-width: 0;
}

.session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.session-id {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

.session-time {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.session-details {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.task-count {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.session-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

/* Pagination Controls */
.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 0;
  border-top: 2px solid var(--border-color);
  margin-top: auto;
}

.page-btn {
  padding: 12px 20px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-btn:hover:not(:disabled) {
  border-color: var(--primary-color);
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 122, 204, 0.2);
}

.page-btn:disabled {
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.4;
}

.page-btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

.page-info {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Empty State - Enhanced */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  text-align: center;
  color: var(--text-muted);
  min-height: 300px;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  border-radius: 16px;
  border: 2px dashed var(--border-color);
  margin: 20px 0;
}

.empty-state-icon {
  font-size: 72px;
  margin-bottom: 24px;
  opacity: 0.6;
  filter: grayscale(0.3);
}

.empty-state-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}

.empty-state-description {
  font-size: 15px;
  line-height: 1.6;
  opacity: 0.8;
  max-width: 320px;
}

/* Loading States */
.loading-skeleton {
  background: linear-gradient(90deg, 
    var(--bg-tertiary) 25%, 
    rgba(0, 122, 204, 0.1) 50%, 
    var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite ease-in-out;
  border-radius: 12px;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-task-item {
  height: 96px;
  border-radius: 16px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.skeleton-task-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  opacity: 0.3;
}

.skeleton-session-item {
  height: 76px;
  border-radius: 12px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.skeleton-session-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  opacity: 0.3;
}

/* Enhanced Status Dots */
.history-modal .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
  margin-right: 4px;
}

.history-modal .status-dot::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  border-radius: 50%;
  opacity: 0.3;
}

.history-modal .status-dot.completed, 
.history-modal .status-dot.done {
  background: var(--accent-color);
}

.history-modal .status-dot.completed::before, 
.history-modal .status-dot.done::before {
  background: var(--accent-color);
}

.history-modal .status-dot.running {
  background: var(--warning-color);
  animation: pulse-dot 2s infinite;
}

.history-modal .status-dot.running::before {
  background: var(--warning-color);
  animation: pulse-ring 2s infinite;
}

.history-modal .status-dot.failed, 
.history-modal .status-dot.error {
  background: var(--danger-color);
}

.history-modal .status-dot.failed::before, 
.history-modal .status-dot.error::before {
  background: var(--danger-color);
}

.history-modal .status-dot.paused {
  background: var(--text-muted);
}

.history-modal .status-dot.paused::before {
  background: var(--text-muted);
}

.history-modal .status-dot.active {
  background: var(--accent-color);
  animation: pulse-dot 2s infinite;
}

.history-modal .status-dot.active::before {
  background: var(--accent-color);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(0.9);
  }
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.8);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.3;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/* Enhanced Scrollbar Styles for History Modal */
.recent-tasks-list::-webkit-scrollbar,
.sessions-list::-webkit-scrollbar {
  width: 8px;
}

.recent-tasks-list::-webkit-scrollbar-track,
.sessions-list::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 4px;
  margin: 8px 0;
}

.recent-tasks-list::-webkit-scrollbar-thumb,
.sessions-list::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--border-color), var(--text-muted));
  border-radius: 4px;
  border: 1px solid var(--bg-tertiary);
}

.recent-tasks-list::-webkit-scrollbar-thumb:hover,
.sessions-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--text-secondary), var(--primary-color));
}

/* Focus Styles for Keyboard Navigation */
.recent-task-item:focus,
.session-item:focus,
.view-more-btn:focus,
.back-btn:focus {
  outline: 3px solid var(--primary-color) !important;
  outline-offset: 2px !important;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .recent-task-item,
  .session-item {
    border-width: 2px !important;
  }
  
  .task-status-icon,
  .task-status-text {
    border-width: 2px !important;
  }
  
  .history-modal .status-dot {
    border: 2px solid currentColor !important;
  }
}

/* Dark Mode Support (Future Enhancement) */
@media (prefers-color-scheme: dark) {
  .loading-skeleton {
    background: linear-gradient(90deg, 
      rgba(255, 255, 255, 0.1) 25%, 
      rgba(0, 122, 204, 0.2) 50%, 
      rgba(255, 255, 255, 0.1) 75%) !important;
  }
  
  .recent-tasks-list::-webkit-scrollbar-thumb,
  .sessions-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(0, 122, 204, 0.4)) !important;
  }
}