/* Bots Index Page Styles */

.bots-index {
  min-height: 100vh;
  background: #0f1117;
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
}

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

.bots-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f3f4f6;
  margin: 0;
}

.bots-header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bot-count {
  color: #9ca3af;
  font-size: 0.875rem;
}

.refresh-indicator {
  color: #6b7280;
  font-size: 0.75rem;
  transition: color 0.3s;
}

.refresh-indicator.active {
  color: #10b981;
}

/* Filter Bar */
.bots-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: #1a1d27;
  border: 1px solid #2d3140;
  border-radius: 10px;
  align-items: center;
}

.bots-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.bots-filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  margin-right: 2px;
  white-space: nowrap;
}

.bots-filter-chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #9ca3af;
  background: #0f1117;
  border: 1px solid #2d3140;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.bots-filter-chip:hover {
  border-color: #4f46e5;
  color: #c4b5fd;
}

.bots-filter-chip.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

.bots-filter-chip.llm-claude.active {
  background: rgba(212, 165, 116, 0.3);
  border-color: #d4a574;
  color: #d4a574;
}

.bots-filter-chip.llm-gpt.active {
  background: rgba(16, 163, 127, 0.3);
  border-color: #10a37f;
  color: #10a37f;
}

.bots-filter-chip.llm-gemini.active {
  background: rgba(66, 133, 244, 0.3);
  border-color: #4285f4;
  color: #4285f4;
}

.bots-filter-reset {
  font-size: 0.75rem;
  color: #ef4444;
  text-decoration: none;
  padding: 4px 12px;
  border-radius: 50px;
  border: 1px solid #ef4444;
  transition: all 0.15s;
}

.bots-filter-reset:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.bots-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
}

.bot-card {
  background: #1a1d27;
  border: 1px solid #2d3140;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.bot-card:hover {
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.3);
}

.bot-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.bot-card-avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.bot-card-avatar-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

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

.bot-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-card-name a {
  color: #f3f4f6;
  text-decoration: none;
}

.bot-card-name a:hover {
  color: #a78bfa;
}

.bot-card-badges {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.bot-card-llm {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 50px;
  text-transform: uppercase;
}

.bot-card-llm.claude {
  background: rgba(212, 165, 116, 0.2);
  color: #d4a574;
}

.bot-card-llm.gpt {
  background: rgba(16, 163, 127, 0.2);
  color: #10a37f;
}

.bot-card-llm.gemini {
  background: rgba(66, 133, 244, 0.2);
  color: #4285f4;
}

.bot-card-tone {
  font-size: 0.65rem;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 50px;
  background: rgba(167, 139, 250, 0.15);
  color: #a78bfa;
}

/* Description */

.bot-card-description {
  padding: 0 16px 10px;
  font-size: 0.75rem;
  color: #9ca3af;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Profile */

.bot-card-profile {
  padding: 0 16px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bot-card-profile-item {
  font-size: 0.7rem;
  color: #6b7280;
}

/* Terminal */

.bot-card-terminal {
  background: #0d1117;
  margin: 0;
  margin-top: auto;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #161b22;
  border-bottom: 1px solid #21262d;
}

.terminal-dots {
  display: flex;
  gap: 4px;
}

.terminal-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.terminal-dots .dot.red { background: #ff5f57; }
.terminal-dots .dot.yellow { background: #febc2e; }
.terminal-dots .dot.green { background: #28c840; }

.terminal-title {
  font-size: 0.65rem;
  color: #6b7280;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
}

.terminal-content {
  color: #c9d1d9;
  padding: 10px 12px;
  font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
  font-size: 0.7rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  min-height: 60px;
  max-height: 100px;
  overflow-y: auto;
}

/* Tasks Section */

.tasks-section {
  margin-top: 2rem;
  background: #1a1d27;
  border: 1px solid #2d3140;
  border-radius: 10px;
  padding: 20px;
}

.tasks-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.tasks-section-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f3f4f6;
  margin: 0;
}

.tasks-link-to-detail {
  font-size: 0.8rem;
  color: #818cf8;
  text-decoration: none;
}

.tasks-link-to-detail:hover {
  color: #a5b4fc;
  text-decoration: underline;
}

.tasks-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: #0f1117;
  border: 1px solid #2d3140;
  border-radius: 8px;
  align-items: center;
}

.tasks-empty {
  padding: 2rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-row {
  background: #0f1117;
  border: 1px solid #2d3140;
  border-radius: 8px;
  padding: 12px 16px;
  transition: border-color 0.15s;
}

.task-row:hover {
  border-color: #4f46e5;
}

.task-row-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.task-row-title {
  font-weight: 600;
  font-size: 0.875rem;
  flex: 1;
  min-width: 0;
}

.task-row-title a {
  color: #f3f4f6;
  text-decoration: none;
}

.task-row-title a:hover {
  color: #a78bfa;
}

.task-row-badges {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.task-badge {
  color: white;
  padding: 2px 10px;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
}

.task-priority-badge {
  color: #9ca3af;
  font-size: 0.7rem;
  padding: 2px 8px;
  border: 1px solid #2d3140;
  border-radius: 50px;
  white-space: nowrap;
}

.task-row-description {
  margin-top: 6px;
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.5;
}

.task-row-subtasks {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-subtask-count {
  font-size: 0.7rem;
  color: #6b7280;
  white-space: nowrap;
}

.task-subtask-bar {
  flex: 1;
  height: 4px;
  background: #2d3140;
  border-radius: 2px;
  overflow: hidden;
  max-width: 200px;
}

.task-subtask-bar-fill {
  height: 100%;
  background: #10b981;
  border-radius: 2px;
  transition: width 0.3s;
}

/* Tasks header actions */
.tasks-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tasks-active-filter-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: #818cf8;
  background: rgba(129, 140, 248, 0.15);
  padding: 4px 10px;
  border-radius: 50px;
  border: 1px solid rgba(129, 140, 248, 0.3);
}

/* Task keyword search */
.tasks-filter-search {
  width: 100%;
  margin-bottom: 4px;
}

.task-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-search-input {
  flex: 1;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #2d3140;
  background: #1a1d27;
  color: #f3f4f6;
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.15s;
}

.task-search-input:focus {
  border-color: #4f46e5;
}

.task-search-input::placeholder {
  color: #6b7280;
}

.task-search-btn {
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid #4f46e5;
  background: #4f46e5;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.task-search-btn:hover {
  background: #4338ca;
}

.task-search-clear {
  font-size: 0.75rem;
  color: #ef4444;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #ef4444;
  transition: all 0.15s;
  white-space: nowrap;
}

.task-search-clear:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* Task sort dropdown */
.task-sort-select {
  padding: 4px 28px 4px 10px;
  border-radius: 50px;
  border: 1px solid #2d3140;
  background: #0f1117;
  color: #f3f4f6;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s;
}

.task-sort-select:hover {
  border-color: #4f46e5;
}

.task-sort-select:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.3);
}

.task-sort-select option {
  background: #1a1d27;
  color: #f3f4f6;
}

/* Task status filter chip colors */
.bots-filter-chip.task-status-pending.active {
  background: rgba(148, 163, 184, 0.3);
  border-color: #94a3b8;
  color: #94a3b8;
}

.bots-filter-chip.task-status-in_progress.active {
  background: rgba(59, 130, 246, 0.3);
  border-color: #3b82f6;
  color: #3b82f6;
}

.bots-filter-chip.task-status-completed.active {
  background: rgba(16, 185, 129, 0.3);
  border-color: #10b981;
  color: #10b981;
}

.bots-filter-chip.task-status-human_review.active {
  background: rgba(245, 158, 11, 0.3);
  border-color: #f59e0b;
  color: #f59e0b;
}

/* Task urgency filter chip colors */
.bots-filter-chip.task-urgency-1.active {
  background: rgba(148, 163, 184, 0.3);
  border-color: #94a3b8;
  color: #94a3b8;
}

.bots-filter-chip.task-urgency-2.active {
  background: rgba(59, 130, 246, 0.3);
  border-color: #3b82f6;
  color: #3b82f6;
}

.bots-filter-chip.task-urgency-3.active {
  background: rgba(245, 158, 11, 0.3);
  border-color: #f59e0b;
  color: #f59e0b;
}

.bots-filter-chip.task-urgency-4.active {
  background: rgba(249, 115, 22, 0.3);
  border-color: #f97316;
  color: #f97316;
}

.bots-filter-chip.task-urgency-5.active {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
  color: #ef4444;
}

/* Task importance filter chip colors */
.bots-filter-chip.task-importance-1.active {
  background: rgba(148, 163, 184, 0.3);
  border-color: #94a3b8;
  color: #94a3b8;
}

.bots-filter-chip.task-importance-2.active {
  background: rgba(59, 130, 246, 0.3);
  border-color: #3b82f6;
  color: #3b82f6;
}

.bots-filter-chip.task-importance-3.active {
  background: rgba(245, 158, 11, 0.3);
  border-color: #f59e0b;
  color: #f59e0b;
}

.bots-filter-chip.task-importance-4.active {
  background: rgba(249, 115, 22, 0.3);
  border-color: #f97316;
  color: #f97316;
}

.bots-filter-chip.task-importance-5.active {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
  color: #ef4444;
}

/* Responsive */

@media (max-width: 1200px) {
  .bots-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .bots-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .bots-index {
    padding: 16px;
  }

  .bots-grid {
    grid-template-columns: 1fr;
  }

  .bots-filter-bar {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
  }

  .bots-filter-group {
    width: 100%;
  }
}

/* Bots Edit Page Styles */

.bot-edit {
  min-height: 100vh;
  background: #f9fafb;
  padding: 40px 24px;
}

.bot-edit .container {
  max-width: 600px;
  margin: 0 auto;
}

.edit-header {
  margin-bottom: 32px;
}

.back-link {
  display: inline-block;
  color: #6b7280;
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.back-link:hover {
  color: #7c3aed;
}

.edit-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

.notice {
  background: #d1fae5;
  color: #065f46;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.error-messages {
  background: #fee2e2;
  color: #991b1b;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.error-messages ul {
  margin: 0;
  padding-left: 20px;
}

.edit-content {
  background: white;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.bot-preview {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.avatar-preview {
  flex-shrink: 0;
}

.avatar-image {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 1.5rem;
}

.bot-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.role-badge {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
}

.llm-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  width: fit-content;
}

.llm-badge.claude {
  background: #d4a574;
  color: white;
}

.llm-badge.gpt {
  background: #10a37f;
  color: white;
}

.llm-badge.gemini {
  background: #4285f4;
  color: white;
}

.edit-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 600;
  color: #374151;
  font-size: 0.9rem;
}

.form-control {
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-control-file {
  padding: 12px;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  background: #f9fafb;
  cursor: pointer;
}

.form-control-file:hover {
  border-color: #7c3aed;
  background: #faf5ff;
}

.form-hint {
  font-size: 0.8rem;
  color: #6b7280;
  margin: 4px 0 0;
}

.form-actions {
  margin-top: 8px;
}

.btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, #ff6b9d 0%, #7c3aed 100%);
  color: white;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

@media (max-width: 640px) {
  .bot-edit {
    padding: 24px 16px;
  }

  .edit-content {
    padding: 24px 20px;
  }

  .bot-preview {
    flex-direction: column;
    text-align: center;
  }
}
