/* =====================================================
   DATA INLOCO - ESTILOS ADICIONAIS v2.0
   Novas funcionalidades: Subtarefas, Tags, Comentários,
   Anexos, Templates, WIP Limits, Busca, Histórico
   ===================================================== */

/* ========== TOAST NOTIFICATIONS ========== */
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-size: 14px;
  min-width: 250px;
  animation: slideIn 0.3s ease;
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

.toast-info {
  border-left: 4px solid var(--primary);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========== BUSCA GLOBAL ========== */
.kanban-search {
  position: relative;
  flex: 1;
  max-width: 300px;
}

.kanban-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--white);
  transition: all 0.2s ease;
}

.kanban-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ice);
}

.kanban-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.kanban-search .clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
}

.kanban-search .clear-btn:hover {
  color: var(--text);
}

/* ========== WIP LIMITS ========== */
.kanban-col.wip-exceeded .kanban-col-header {
  background: #fef2f2;
}

.kanban-col.wip-exceeded .kanban-col-count {
  background: var(--danger);
  color: var(--white);
}

.wip-indicator {
  font-size: 11px;
  font-weight: 500;
  margin-left: 2px;
}

/* ========== CARD ENHANCEMENTS ========== */
.kanban-card.overdue {
  border-left: 3px solid var(--danger);
}

.kanban-card-progress {
  height: 4px;
  background: var(--gray-100);
  border-radius: 2px;
  margin: 8px 0;
  overflow: hidden;
}

.kanban-card-progress-bar {
  height: 100%;
  background: var(--success);
  transition: width 0.3s ease;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kanban-card-subtasks,
.kanban-card-indicator,
.kanban-card-hours {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
}

.kanban-card-hours.overtime {
  color: var(--danger);
}

.kanban-card-tag {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 3px;
}

.kanban-card-tag-more {
  font-size: 10px;
  color: var(--muted);
}

/* ========== SUBTAREFAS ========== */
.subtask-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.subtask-row input {
  flex: 1;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--gray-100);
  color: var(--danger);
}

/* Subtarefas no modal de detalhes */
.subtask-progress {
  height: 6px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.subtask-progress-bar {
  height: 100%;
  background: var(--success);
  transition: width 0.3s ease;
}

.subtask-list {
  margin-bottom: 12px;
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.subtask-item:hover {
  background: var(--gray-50);
}

.subtask-item.completed .subtask-title {
  text-decoration: line-through;
  color: var(--muted);
}

.subtask-checkbox {
  position: relative;
  cursor: pointer;
}

.subtask-checkbox input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.subtask-checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.subtask-checkbox input:checked + .subtask-checkmark {
  background: var(--success);
  border-color: var(--success);
}

.subtask-checkbox input:checked + .subtask-checkmark::after {
  content: '✓';
  color: white;
  font-size: 12px;
}

.subtask-title {
  flex: 1;
  font-size: 14px;
}

.subtask-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.subtask-item:hover .subtask-delete {
  opacity: 1;
}

.subtask-delete:hover {
  color: var(--danger);
}

.subtask-add {
  display: flex;
  gap: 8px;
}

.subtask-add input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
}

/* ========== TAGS ========== */
.tag-checkbox-label {
  display: inline-flex;
  cursor: pointer;
}

.tag-checkbox {
  position: absolute;
  opacity: 0;
}

.tag-checkbox-visual {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.tag-checkbox:checked + .tag-checkbox-visual {
  border-width: 2px;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

#tags-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ========== COMENTÁRIOS ========== */
.comments-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 12px;
}

.comment-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}

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

.comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

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

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

.comment-header strong {
  font-size: 13px;
}

.comment-time {
  font-size: 11px;
  color: var(--muted);
}

.comment-text {
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-delete {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  margin-top: 4px;
}

.comment-delete:hover {
  color: var(--danger);
}

.comment-add {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-add textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  resize: vertical;
  min-height: 60px;
}

.comment-add .btn {
  align-self: flex-end;
}

/* ========== ANEXOS ========== */
.attachments-list {
  margin-bottom: 12px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: all 0.15s ease;
}

.attachment-item:hover {
  border-color: var(--primary-light);
  background: var(--gray-50);
}

.attachment-icon {
  width: 40px;
  height: 40px;
  background: var(--ice);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

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

.attachment-name {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-name:hover {
  color: var(--primary);
}

.attachment-size {
  font-size: 11px;
  color: var(--muted);
}

.attachment-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.attachment-item:hover .attachment-delete {
  opacity: 1;
}

.attachment-delete:hover {
  color: var(--danger);
}

.attachment-upload {
  margin-top: 8px;
}

/* ========== HISTÓRICO DE ATIVIDADES ========== */
.activity-list {
  max-height: 300px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}

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

.activity-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
}

.activity-user {
  font-weight: 600;
  margin-right: 4px;
}

.activity-action {
  color: var(--text-light);
}

.activity-details {
  display: block;
  color: var(--muted);
  font-style: italic;
  margin-top: 2px;
}

.activity-time {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

/* ========== TASK DETAIL MODAL ========== */
.task-detail-modal .modal-container {
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.task-detail-content {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  flex: 1;
  overflow: hidden;
}

.task-detail-main {
  overflow-y: auto;
  padding-right: 8px;
}

.task-detail-sidebar {
  border-left: 1px solid var(--border);
  padding-left: 24px;
  overflow-y: auto;
}

.detail-section {
  margin-bottom: 24px;
}

.detail-section h4 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 12px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
}

.detail-label {
  font-size: 13px;
  color: var(--text-light);
}

.detail-value {
  font-size: 13px;
  font-weight: 500;
}

.priority-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.priority-badge.low { background: #f3f4f6; color: #6b7280; }
.priority-badge.medium { background: #dbeafe; color: #2563eb; }
.priority-badge.high { background: #fef3c7; color: #d97706; }
.priority-badge.urgent { background: #fecaca; color: #dc2626; }

.task-detail-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.task-detail-tab {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s ease;
}

.task-detail-tab:hover {
  color: var(--text);
}

.task-detail-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.task-detail-tab-content {
  display: none;
}

.task-detail-tab-content.active {
  display: block;
}

/* ========== CONFIGURAÇÕES ========== */
.settings-section {
  background: var(--white);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.settings-section h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== TEMPLATES ========== */
.btn.full {
  width: 100%;
}

/* ========== RESPONSIVO ========== */
@media (max-width: 768px) {
  .task-detail-content {
    grid-template-columns: 1fr;
  }
  
  .task-detail-sidebar {
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 24px;
  }
  
  .kanban-search {
    max-width: none;
  }
}


/* ========== TASK MODAL SCROLLABLE ========== */
.task-modal .modal-container {
  max-height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: visible !important;
}

.task-modal .modal-header {
  flex-shrink: 0;
}

.task-modal .task-form,
.task-modal form.task-form {
  overflow-y: auto !important;
  max-height: calc(90vh - 80px) !important;
  flex: 1 !important;
  padding: 24px !important;
  padding-right: 16px !important;
}

/* Estilizar scrollbar */
.task-modal .task-form::-webkit-scrollbar {
  width: 6px;
}

.task-modal .task-form::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 3px;
}

.task-modal .task-form::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.task-modal .task-form::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* ========== SUBTASKS INPUT ========== */
.subtasks-input-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subtask-input-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.subtask-input-item input {
  flex: 1;
}

.subtask-input-item .btn-remove-subtask {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.subtask-input-item .btn-remove-subtask:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ========== TAGS CHECKBOXES ========== */
.tags-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 32px;
}

.tags-checkboxes .tag-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border);
  background: var(--white);
}

.tags-checkboxes .tag-checkbox:hover {
  border-color: var(--primary);
}

.tags-checkboxes .tag-checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
}

.tags-checkboxes .tag-checkbox.selected {
  background: var(--ice);
  border-color: var(--primary);
}

.tags-checkboxes .tag-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tags-checkboxes .empty-tags {
  color: var(--muted);
  font-size: 13px;
}

/* ========== GLOBAL SEARCH ========== */
.global-search-container {
  position: relative;
  display: flex;
  align-items: center;
}

.global-search-icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
}

.global-search-input {
  width: 200px;
  padding: 8px 32px 8px 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  transition: all 0.2s ease;
  background: var(--gray-50);
}

.global-search-input:focus {
  width: 280px;
  background: var(--white);
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(11, 46, 99, 0.1);
}

.global-search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.global-search-clear:hover {
  background: var(--gray-200);
  color: var(--text);
}

@media (max-width: 768px) {
  .global-search-container {
    display: none;
  }
}

/* ========== TEMPLATES GRID ========== */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.template-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.template-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.template-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.template-card-title {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}

.template-card-actions {
  display: flex;
  gap: 4px;
}

.template-card-actions button {
  background: none;
  border: none;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s ease;
}

.template-card-actions button:hover {
  background: var(--gray-100);
  color: var(--text);
}

.template-card-desc {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}

.template-card-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}

.template-card-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ========== SETTINGS SECTIONS ========== */
.settings-section {
  margin-bottom: 32px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: 999px;
  font-size: 13px;
}

.tag-item .tag-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.tag-item .tag-delete {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tag-item .tag-delete:hover {
  background: #fee2e2;
  color: #dc2626;
}
