/* Todo list component styles for the Flow State app */

/* Make the todoCard a flex container to better control space distribution */
#todoCard {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#todoCard h2 {
  margin-bottom: 12px;
}

#todoCard .focus-tips {
  margin-bottom: 15px;
}

#todoCard .todo-input {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}

#addTodoBtn {
  min-width: 3rem;
  font-size: 0.9rem;
}

/* Make the todoList take up remaining space */
#todoList {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  min-height: 100px; /* Ensure a minimum height even when empty */
  max-height: 500px; /* Ensure a minimum height even when empty */
  margin: 0;
  padding: 0;
}

#todoList li {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--shadow);
  cursor: grab; /* Indicate item can be dragged */
  transition: background-color var(--transition);
}

#todoList li:last-child {
  border-bottom: none;
}

/* Styling for when an item is being dragged */
#todoList li.dragging {
  opacity: 0.6;
  background-color: var(--bg);
  cursor: grabbing;
  box-shadow: 0 0 8px var(--shadow);
}

/* Drop indicator styles */
#todoList li.drop-target-above {
  border-top: 2px solid var(--accent);
}

#todoList li.drop-target-below {
  border-bottom: 2px solid var(--accent);
}

#todoList li input[type="checkbox"] {
  margin-right: 12px;
}

.todo-text {
  flex: 1;
  margin-right: 10px;
}

/* Todo status styles */
#todoList li.completed .todo-text {
  text-decoration: line-through;
  color: var(--muted);
  font-style: italic;
}

#todoList li.status-not-started .todo-text {
  /* Default style */
  color: var(--fg);
}

#todoList li.status-in-progress .todo-text {
  color: #3498db; /* Blue */
  font-weight: 500;
}

#todoList li.status-blocked .todo-text {
  color: #e74c3c; /* Red */
  font-style: italic;
}

#todoList li.status-testing .todo-text {
  color: #9b59b6; /* Purple */
  font-weight: 500;
}

/* Todo status indicator */
.todo-status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  display: inline-block;
}

.status-not-started .todo-status-indicator {
  background-color: var(--muted);
}

.status-in-progress .todo-status-indicator {
  background-color: #3498db;
}

.status-blocked .todo-status-indicator {
  background-color: #e74c3c;
}

.status-completed .todo-status-indicator {
  background-color: #2ecc71;
}

.status-testing .todo-status-indicator {
  background-color: #9b59b6;
}

/* Todo status dropdown */
.todo-status {
  margin-right: 8px;
  position: relative;
}

.todo-status-select {
  padding: 2px 4px;
  font-size: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--muted);
  background-color: var(--bg);
  color: var(--fg);
  cursor: pointer;
}

/* Styling for the new todo buttons with FA icons */
.todo-buttons {
  display: flex;
  gap: 4px;
}

.todo-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
  font-size: 0.8rem;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.todo-btn:hover {
  color: var(--fg);
  background-color: rgba(var(--accent-rgb), 0.1);
}

.todo-btn.remove-btn:hover {
  color: #ff5252;
  background-color: rgba(255, 82, 82, 0.1);
}

/* Drag handle styling */
.todo-btn.drag-handle {
  cursor: grab;
  color: var(--muted);
  opacity: 0.5;
  transition: opacity var(--transition);
}

.todo-btn.drag-handle:hover {
  opacity: 1;
}

/* Adjust cursor when dragging */
#todoList li:active {
  cursor: grabbing;
}

/* Edit mode styling */
.todo-edit-input {
  flex: 1;
  padding: 4px 8px;
  margin-right: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background-color: var(--bg);
  color: var(--fg);
  font-size: 0.9rem;
  font-family: inherit;
}

.todo-edit-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.3);
}

/* Hide certain elements when in edit mode */
#todoList li.editing {
  cursor: default;
}

#todoList li.editing .todo-text {
  display: none;
}

/* Edit button styling */
.todo-btn.edit-btn:hover {
  color: #3498db;
  background-color: rgba(52, 152, 219, 0.1);
}

/* Save edit button styling */
.todo-btn.save-edit-btn {
  color: #2ecc71;
}

.todo-btn.save-edit-btn:hover {
  color: #27ae60;
  background-color: rgba(46, 204, 113, 0.1);
}

/* Cancel edit button styling */
.todo-btn.cancel-edit-btn {
  color: #e74c3c;
}

.todo-btn.cancel-edit-btn:hover {
  color: #c0392b;
  background-color: rgba(231, 76, 60, 0.1);
}

/* Todo actions styling */
.todo-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  justify-content: flex-end;
}

.todo-action-btn {
  padding: 6px 12px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.todo-action-btn:hover {
  border-color: var(--accent);
  background: var(--bg-alt);
}

.todo-action-btn i {
  font-size: 0.8rem;
}

/* Modal positioning - center horizontally and vertically */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.modal-content {
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  position: relative;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

/* Todo Import Modal Styles */
.todo-import-modal {
  max-width: 700px;
}

/* Format help section styles */
.format-help {
  margin-bottom: 20px;
}

.format-header h3 {
  margin: 0 0 10px 0;
  color: var(--fg);
}

.format-header p {
  margin: 0 0 15px 0;
  color: var(--muted);
}

.format-example {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 15px;
  margin-bottom: 15px;
}

.csv-example {
  margin-bottom: 15px;
}

.csv-example strong {
  color: var(--fg);
  margin-bottom: 8px;
  display: block;
}

.csv-example pre {
  background: var(--bg);
  border: 1px solid var(--muted);
  border-radius: calc(var(--radius) * 0.7);
  padding: 10px;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  color: var(--fg);
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
}

.column-info h4 {
  margin: 0 0 10px 0;
  color: var(--fg);
  font-size: 0.95rem;
}

.column-info ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.column-info li {
  margin-bottom: 5px;
  font-size: 0.9rem;
}

.column-info strong {
  color: var(--fg);
}

.file-actions {
  display: flex;
  gap: 12px;
  margin-top: 15px;
}

.browse-btn, .sample-btn {
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.browse-btn:hover, .sample-btn:hover {
  background: var(--accent);
  opacity: 0.9;
  transform: translateY(-1px);
}

.sample-btn {
  background: transparent;
  color: var(--accent);
}

.sample-btn:hover {
  background: var(--accent);
  color: white;
}

/* Remove important priority styles since we're removing that feature */
.preview-tag.priority-high,
.preview-tag.priority-urgent {
  display: none;
}

/* Multi-select support styles */
.preview-item.range-selected {
  background: rgba(var(--accent-rgb), 0.15);
  border-left: 2px solid var(--accent);
}

.preview-item.last-selected {
  background: rgba(var(--accent-rgb), 0.2);
  border-left: 3px solid var(--accent);
}

/* Selection helper text */
.selection-help {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 8px;
  text-align: center;
  font-style: italic;
}

/* Responsive adjustments for import modal */
@media (max-width: 768px) {
  .modal {
    padding: 10px;
  }
  
  .todo-import-modal {
    max-width: 100%;
  }
  
  .file-actions {
    flex-direction: column;
  }
  
  .browse-btn, .sample-btn {
    justify-content: center;
  }
  
  .preview-actions {
    flex-wrap: wrap;
  }
  
  .preview-action-btn {
    font-size: 0.75rem;
    padding: 3px 6px;
  }
  
  .import-actions {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }
  
  .action-buttons {
    justify-content: center;
  }
}

/* Mobile-specific todo list improvements */
@media (max-width: 600px) {
  /* Improve todo item layout on mobile */
  #todoList li {
    flex-wrap: wrap;
    padding: 12px 8px;
    gap: 8px;
    align-items: flex-start;
  }
  
  /* Mobile-specific: Stack main content and controls vertically */
  .todo-main-content {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
    margin-bottom: 8px;
  }
  
  .todo-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 4px;
  }
  
  /* Make todo text take full width on mobile */
  .todo-text {
    flex: 1;
    margin-right: 0;
    word-wrap: break-word;
    line-height: 1.3;
  }
  
  /* Compact status dropdown on mobile */
  .todo-status-select {
    font-size: 0.7rem;
    padding: 2px 4px;
    max-width: 120px;
  }
  
  /* Adjust button sizing for mobile */
  .todo-buttons {
    gap: 2px;
  }
  
  .todo-btn {
    padding: 6px 8px;
    font-size: 0.75rem;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Hide button text on very small screens, keep only icons */
  .todo-btn i {
    margin: 0;
  }
  
  /* Edit input takes full width on mobile */
  .todo-edit-input {
    margin-right: 0;
    margin-bottom: 8px;
    font-size: 0.85rem;
  }
  
  /* Adjust input field on mobile */
  #todoCard .todo-input {
    flex-direction: column;
    gap: 8px;
  }
  
  #todoInput {
    width: 100%;
    padding: 10px;
    font-size: 0.9rem;
  }
  
  #addTodoBtn {
    width: 100%;
    padding: 10px;
    font-size: 0.9rem;
    min-width: auto;
  }
  
  /* Compact todo list on mobile */
  #todoList {
    max-height: 400px;
  }
  
  /* Status indicator slightly larger on mobile for touch targets */
  .todo-status-indicator {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
  }
}

/* Very small screens (phones in portrait) */
@media (max-width: 480px) {
  #todoList li {
    padding: 10px 6px;
  }
  
  .todo-text {
    font-size: 0.9rem;
  }
  
  .todo-buttons {
    flex-wrap: wrap;
    gap: 1px;
  }
  
  .todo-btn {
    padding: 5px 6px;
    font-size: 0.7rem;
    min-width: 28px;
    height: 28px;
  }
  
  .todo-status-select {
    font-size: 0.65rem;
    max-width: 100px;
  }
}

/* Desktop layout: Keep original horizontal layout */
@media (min-width: 601px) {
  /* Desktop: Use horizontal layout with wrapper divs as flex containers */
  .todo-main-content {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 8px;
  }
  
  .todo-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  
  /* Ensure todo text still gets proper spacing */
  .todo-text {
    flex: 1;
    margin-right: 10px;
  }
  
  /* Keep original desktop styling for status dropdown */
  .todo-status {
    margin-right: 8px;
  }
}

/* Import info section */
.import-info {
  margin-bottom: 20px;
  padding: 15px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--muted);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.file-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  border-radius: var(--radius);
  font-size: 1.5rem;
}

.file-details {
  flex: 1;
}

.file-name {
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.file-stats {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Import Preview Styles */
.import-preview {
  margin-bottom: 20px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--muted);
}

.preview-header h3 {
  margin: 0;
  color: var(--fg);
}

.preview-actions {
  display: flex;
  gap: 8px;
}

.preview-action-btn {
  padding: 4px 8px;
  border: 1px solid var(--muted);
  border-radius: calc(var(--radius) * 0.7);
  background: var(--bg);
  color: var(--fg);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}

.preview-action-btn:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.preview-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: var(--bg);
}

.no-preview {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
  margin: 0;
}

.preview-item {
  display: flex;
  align-items: flex-start;
  padding: 12px;
  border-bottom: 1px solid var(--shadow);
  transition: background-color var(--transition);
  cursor: pointer;
  user-select: none;
}

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

.preview-item:hover {
  background: var(--bg-alt);
}

.preview-item.selected {
  background: rgba(var(--accent-rgb), 0.1);
  border-left: 3px solid var(--accent);
}

.preview-checkbox {
  margin-right: 12px;
  margin-top: 2px;
}

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

.preview-text {
  font-weight: 500;
  color: var(--fg);
  margin-bottom: 4px;
  word-wrap: break-word;
}

.preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.preview-tag {
  padding: 2px 6px;
  background: var(--bg-alt);
  border-radius: calc(var(--radius) * 0.5);
  border: 1px solid var(--muted);
}

.preview-tag.category {
  background: rgba(var(--accent-rgb), 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

/* Import Options Styles */
.import-options {
  margin-bottom: 20px;
  padding: 15px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--muted);
}

.option-group h4 {
  margin: 0 0 15px 0;
  color: var(--fg);
}

.import-option {
  margin-bottom: 12px;
}

.import-option:last-child {
  margin-bottom: 0;
}

.import-option label {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  padding: 10px;
  border-radius: var(--radius);
  transition: background-color var(--transition);
}

.import-option label:hover {
  background: var(--bg);
}

.import-option input[type="radio"] {
  margin-bottom: 5px;
}

.option-description {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Import Actions Styles */
.import-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 1px solid var(--muted);
}

.selected-count {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.action-buttons {
  display: flex;
  gap: 10px;
}

.modal-cancel-btn {
  padding: 8px 16px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
  transition: all var(--transition);
}

.modal-cancel-btn:hover {
  border-color: var(--accent);
  background: var(--bg-alt);
}

.modal-save-btn {
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: all var(--transition);
  font-weight: 500;
}

.modal-save-btn:hover {
  background: var(--accent);
  opacity: 0.9;
  transform: translateY(-1px);
}

.modal-save-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.modal-save-btn:disabled:hover {
  background: var(--accent);
  opacity: 0.5;
  transform: none;
}

/* Close modal button */
.close-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition);
}

.close-modal:hover {
  color: var(--fg);
}

/* Modal form padding */
.modal-form {
  padding: 20px;
}