/**
 * TASKMATE - Coding Tab Styles
 * ============================
 * Styling für die Coding-Verzeichnis-Verwaltung
 */

/* View Container */
.view-coding {
  padding: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
}

/* Header */
.coding-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.coding-header-centered {
  justify-content: center;
}

.coding-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Grid Layout */
.coding-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

/* Kachel */
.coding-tile {
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.coding-tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Farbbalken oben */
.coding-tile-color {
  height: 4px;
  flex-shrink: 0;
}

/* Tile Header */
.coding-tile-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 1rem 0.5rem;
}

.coding-tile-icon {
  font-size: 2rem;
  line-height: 1;
}

.coding-tile-menu {
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.coding-tile-menu:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Tile Content */
.coding-tile-content {
  padding: 0 1rem;
  flex-grow: 1;
}

.coding-tile-name {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.coding-tile-path {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono, monospace);
  word-break: break-all;
  line-height: 1.4;
}

.coding-tile-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* CLAUDE.md Badge */
.coding-tile-badge {
  display: inline-block;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: white;
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-top: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Git Status */
.coding-tile-status {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.git-branch-badge {
  background: var(--bg-tertiary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: var(--font-mono, monospace);
  color: var(--text-secondary);
}

.git-status-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.git-status-badge.loading {
  background: var(--bg-tertiary);
  color: var(--text-muted);
}

.git-status-badge.clean {
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
}

.git-status-badge.dirty {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
}

.git-status-badge.error {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
}

.git-status-badge.ahead {
  background: rgba(124, 141, 181, 0.15);
  color: var(--info);
}

.git-status-badge.behind {
  background: rgba(139, 92, 246, 0.15);
  color: #8B5CF6;
}

/* Action Buttons */
.coding-tile-actions {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
}

.btn-claude {
  flex: 1;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}

.btn-claude:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-claude:active {
  transform: translateY(0);
}

.btn-codex {
  flex: 1;
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}

.btn-codex:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-codex:active {
  transform: translateY(0);
}

/* Git Actions */
.coding-tile-git {
  display: flex;
  gap: 0.5rem;
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

.coding-tile-git .btn {
  flex: 1;
  font-size: 0.75rem;
  padding: 0.5rem;
}

/* Empty State */
.coding-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.coding-empty .empty-icon {
  margin-bottom: 1rem;
  color: var(--text-muted);
  opacity: 0.5;
}

.coding-empty .empty-icon svg {
  width: 64px;
  height: 64px;
}

.coding-empty h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.coding-empty p {
  font-size: 0.875rem;
  max-width: 400px;
  margin: 0 auto;
}

/* Command Modal */
.command-box {
  background: var(--bg-tertiary);
  padding: 1rem;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
}

.command-box code {
  font-family: var(--font-mono, monospace);
  font-size: 0.875rem;
  word-break: break-all;
  flex: 1;
  color: var(--text-primary);
}

/* Color Presets */
.color-presets {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.color-preset {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.color-preset:hover {
  transform: scale(1.1);
}

.color-preset.selected {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--bg-secondary);
}

.color-picker-custom {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}

.color-picker-custom::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-custom::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

/* Gitea Section in Modal */
.coding-gitea-section {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
}

.coding-gitea-section summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text-secondary);
  user-select: none;
}

.coding-gitea-section summary:hover {
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
  .view-coding {
    padding: 1rem;
  }

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

  .coding-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .coding-header h2 {
    font-size: 1.25rem;
  }

  .coding-header .btn {
    width: 100%;
    justify-content: center;
  }

  .coding-tile-actions {
    flex-direction: column;
  }

  .coding-tile-git {
    flex-wrap: wrap;
  }

  .coding-tile-git .btn {
    flex: 1 1 calc(50% - 0.25rem);
  }

  .command-box {
    flex-direction: column;
    align-items: stretch;
  }

  .command-box code {
    text-align: center;
  }
}

@media (max-width: 480px) {
  .coding-empty {
    padding: 2rem 1rem;
  }

  .coding-tile-git .btn {
    flex: 1 1 100%;
  }
}

/* CLAUDE.md Textarea im Modal */
#coding-claude-instructions {
  font-family: var(--font-mono, 'Consolas', 'Monaco', monospace);
  font-size: 0.85rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 200px;
}

/* Hint unter Labels */
.label-hint {
  font-weight: normal;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.form-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* CLAUDE.md Tabs */
.claude-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.claude-tab {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.claude-tab:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.claude-tab.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-bottom-color: var(--bg-secondary);
}

.claude-content {
  display: block;
}

.claude-content.active {
  display: block;
}

/* CLAUDE.md Link */
.claude-link-container {
  margin-top: 0.5rem;
}

.claude-link {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.claude-link:hover:not(:disabled) {
  background: var(--bg-secondary);
  border-color: var(--primary-color);
}

.claude-link:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.claude-icon {
  font-size: 1.1rem;
}

.claude-text {
  color: var(--text-primary);
}

.claude-link:disabled .claude-text {
  color: var(--text-muted);
  font-style: italic;
}

/* CLAUDE.md Modal */
.claude-md-viewer {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.claude-md-display {
  width: 100%;
  height: 100%;
  background: var(--bg-tertiary);
  padding: 1.5rem;
  font-family: var(--font-mono, 'Consolas', 'Monaco', monospace);
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-y: auto;
  color: var(--text-primary);
  margin: 0;
  border: none;
  outline: none;
  resize: none;
}
