/**
 * Task Bar Widget Styles
 * Persistent task bar component for displaying upcoming/overdue tasks
 */

/* Container */
#task-bar-widget {
  position: sticky;
  top: 60px; /* Below main navigation */
  z-index: 100;
  margin-bottom: 20px;
}

/* Main task bar */
.task-bar {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: all 0.3s ease;
}

.task-bar.collapsed .task-bar-content {
  max-height: 0;
  overflow: hidden;
}

/* Header */
.task-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
}

.task-bar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: #1a1a1a;
}

.task-bar-icon {
  color: #4a90e2;
}

.task-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.task-bar-view-all {
  font-size: 13px;
  color: #4a90e2;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.task-bar-view-all:hover {
  color: #357abd;
  text-decoration: underline;
}

.task-bar-toggle {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #666;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-bar-toggle:hover {
  color: #1a1a1a;
}

/* Content */
.task-bar-content {
  max-height: 400px;
  overflow-y: auto;
  transition: max-height 0.3s ease;
}

.task-bar-content.hidden {
  display: none;
}

.task-bar-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

/* Task Items */
.task-bar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
  position: relative;
}

.task-bar-item:last-child {
  border-bottom: none;
}

.task-bar-item:hover {
  background-color: #f8f9fa;
}

/* Priority indicator stripe */
.task-bar-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background-color: #ccc;
}

.task-bar-item.priority-urgent::before {
  background-color: #e74c3c; /* Red */
}

.task-bar-item.priority-high::before {
  background-color: #f39c12; /* Orange */
}

.task-bar-item.priority-medium::before {
  background-color: #3498db; /* Blue */
}

.task-bar-item.priority-low::before {
  background-color: #95a5a6; /* Gray */
}

/* Checkbox */
.task-bar-checkbox {
  position: relative;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}

.task-bar-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.task-bar-checkbox .checkmark {
  display: block;
  height: 18px;
  width: 18px;
  border: 2px solid #ccc;
  border-radius: 4px;
  background-color: #fff;
  transition: all 0.2s;
}

.task-bar-checkbox:hover .checkmark {
  border-color: #4a90e2;
}

.task-bar-checkbox input:checked ~ .checkmark {
  background-color: #4a90e2;
  border-color: #4a90e2;
}

.task-bar-checkbox input:checked ~ .checkmark::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Item Content */
.task-bar-item-content {
  flex: 1;
  cursor: pointer;
  min-width: 0; /* Allow text truncation */
}

.task-bar-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.task-bar-priority-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.task-bar-priority-badge.priority-urgent {
  background-color: #fee;
  color: #e74c3c;
}

.task-bar-priority-badge.priority-high {
  background-color: #ffeaa7;
  color: #d35400;
}

.task-bar-priority-badge.priority-medium {
  background-color: #e3f2fd;
  color: #2980b9;
}

.task-bar-priority-badge.priority-low {
  background-color: #ecf0f1;
  color: #7f8c8d;
}

.task-bar-item-title {
  font-size: 14px;
  font-weight: 500;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-bar-item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: #666;
}

.task-bar-client {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.task-bar-client::before {
  content: '👤';
  font-size: 11px;
}

.task-bar-due-date {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.task-bar-due-date::before {
  content: '📅';
  font-size: 11px;
}

.task-bar-due-date.overdue {
  color: #e74c3c;
  font-weight: 600;
}

/* Scrollbar styling */
.task-bar-content::-webkit-scrollbar {
  width: 6px;
}

.task-bar-content::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.task-bar-content::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.task-bar-content::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #task-bar-widget {
    top: 50px; /* Adjust for smaller nav on mobile */
  }

  .task-bar-header {
    padding: 10px 12px;
  }

  .task-bar-item {
    padding: 10px 12px;
  }

  .task-bar-item-title {
    font-size: 13px;
  }

  .task-bar-item-meta {
    font-size: 11px;
  }

  .task-bar-view-all {
    display: none; /* Hide on mobile to save space */
  }
}

/* Animation for new tasks */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.task-bar-item {
  animation: slideIn 0.3s ease;
}
