/**
 * TASKMATE - Gitea Styles
 * =======================
 * Styles für die Git/Gitea-Integration
 */

/* =============================================================================
   GITEA VIEW
   ============================================================================= */

.view-gitea {
  padding: var(--spacing-6);
  max-width: 900px;
  margin: 0 auto;
}

/* =============================================================================
   MODE SWITCH
   ============================================================================= */

.gitea-mode-switch {
  display: flex;
  gap: var(--spacing-2);
  margin-bottom: var(--spacing-4);
  padding: var(--spacing-2);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
}

.gitea-mode-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  flex: 1;
  padding: var(--spacing-3) var(--spacing-4);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  justify-content: center;
}

.gitea-mode-btn svg {
  flex-shrink: 0;
}

.gitea-mode-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.gitea-mode-btn.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* =============================================================================
   GITEA SECTIONS
   ============================================================================= */

.gitea-section {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-6);
  margin-bottom: var(--spacing-4);
}

.gitea-config-header {
  margin-bottom: var(--spacing-6);
}

.gitea-config-header h2 {
  margin: 0 0 var(--spacing-2) 0;
  font-size: var(--text-xl);
  color: var(--text-primary);
}

.gitea-config-header p {
  margin: 0;
  color: var(--text-secondary);
}

/* =============================================================================
   CONNECTION STATUS
   ============================================================================= */

.gitea-connection-status {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-3) var(--spacing-4);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-6);
}

.gitea-connection-status .status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
}

.gitea-connection-status.connected .status-indicator {
  background: var(--success);
}

.gitea-connection-status.disconnected .status-indicator {
  background: var(--error);
}

.gitea-connection-status .status-text {
  color: var(--text-primary);
  font-size: var(--text-sm);
}

/* =============================================================================
   CONFIG FORM
   ============================================================================= */

.gitea-config-form .form-group {
  margin-bottom: var(--spacing-4);
}

.gitea-repo-select-group {
  display: flex;
  gap: var(--spacing-2);
}

.gitea-repo-select-group select {
  flex: 1;
}

.gitea-divider {
  display: flex;
  align-items: center;
  margin: var(--spacing-6) 0;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.gitea-divider::before,
.gitea-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-default);
}

.gitea-divider span {
  padding: 0 var(--spacing-4);
}

.gitea-divider:empty::before {
  flex: 1;
}

.gitea-divider:empty::after {
  display: none;
}

/* =============================================================================
   REPOSITORY HEADER
   ============================================================================= */

.gitea-repo-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-4);
  padding-bottom: var(--spacing-4);
  border-bottom: 1px solid var(--border-default);
}

.gitea-repo-header .repo-info h2 {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  margin: 0 0 var(--spacing-2) 0;
  font-size: var(--text-xl);
  color: var(--text-primary);
}

.gitea-repo-header .repo-info h2 svg {
  color: var(--text-secondary);
}

.gitea-repo-header .repo-url {
  display: block;
  color: var(--primary);
  font-size: var(--text-sm);
  text-decoration: none;
  word-break: break-all;
}

.gitea-repo-header .repo-url:hover {
  text-decoration: underline;
}

.gitea-repo-header .repo-actions {
  display: flex;
  gap: var(--spacing-2);
}

.btn-danger-hover:hover {
  color: var(--error);
  border-color: var(--error);
}

/* =============================================================================
   LOCAL PATH DISPLAY
   ============================================================================= */

.gitea-local-path {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-3) var(--spacing-4);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-4);
}

.gitea-local-path .path-label {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.gitea-local-path code {
  font-family: monospace;
  font-size: var(--text-sm);
  color: var(--text-primary);
  word-break: break-all;
}

/* =============================================================================
   STATUS PANEL
   ============================================================================= */

.gitea-status-panel {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--spacing-4);
  margin-bottom: var(--spacing-4);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--spacing-4);
}

.status-item {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-1);
}

.status-label {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.branch-select-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
}

.branch-select {
  padding: var(--spacing-2) var(--spacing-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--text-sm);
  cursor: pointer;
  flex: 1;
}

.branch-select:focus {
  outline: none;
  border-color: var(--primary);
}

.btn-small {
  padding: var(--spacing-1) var(--spacing-2);
  font-size: var(--text-xs);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-1);
  min-width: 28px;
  min-height: 28px;
}

.btn-icon svg {
  flex-shrink: 0;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--spacing-1) var(--spacing-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
}

.status-badge.clean {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.status-badge.dirty {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.status-badge.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.changes-count {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

/* =============================================================================
   OPERATIONS PANEL
   ============================================================================= */

.gitea-operations-panel {
  margin-bottom: var(--spacing-4);
}

.gitea-operations-panel h3 {
  margin: 0 0 var(--spacing-4) 0;
  font-size: var(--text-base);
  color: var(--text-primary);
}

.operations-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-3);
}

.operation-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  min-width: 100px;
}

.operation-btn svg {
  flex-shrink: 0;
}

.operation-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =============================================================================
   CHANGES PANEL
   ============================================================================= */

.gitea-changes-panel {
  margin-bottom: var(--spacing-4);
}

.gitea-changes-panel h3 {
  margin: 0 0 var(--spacing-3) 0;
  font-size: var(--text-base);
  color: var(--text-primary);
}

.changes-list {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
}

.change-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-2) var(--spacing-3);
  border-bottom: 1px solid var(--border-default);
  font-size: var(--text-sm);
}

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

.change-status {
  width: 20px;
  font-weight: 600;
  font-family: monospace;
  text-align: center;
  flex-shrink: 0;
}

.change-status.modified { color: var(--warning); }
.change-status.added { color: var(--success); }
.change-status.deleted { color: var(--error); }
.change-status.untracked { color: var(--text-tertiary); }
.change-status.renamed { color: var(--info); }

.change-file {
  flex: 1;
  color: var(--text-primary);
  word-break: break-all;
  font-family: monospace;
}

/* =============================================================================
   COMMITS PANEL
   ============================================================================= */

.commits-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-3);
}

.commits-header h3 {
  margin: 0;
  font-size: var(--text-base);
  color: var(--text-primary);
}

.gitea-commits-panel h3 {
  margin: 0 0 var(--spacing-3) 0;
  font-size: var(--text-base);
  color: var(--text-primary);
}

.commits-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
}

.commit-item {
  display: flex;
  gap: var(--spacing-3);
  padding: var(--spacing-3) var(--spacing-4);
  border-bottom: 1px solid var(--border-default);
}

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

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

.commit-hash {
  font-family: monospace;
  font-size: var(--text-sm);
  color: var(--primary);
  background: var(--bg-primary);
  padding: var(--spacing-1) var(--spacing-2);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

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

.commit-message {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--spacing-1);
  word-break: break-word;
}

.commit-meta {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.commit-meta .author {
  font-weight: 500;
  color: var(--text-secondary);
}

.commit-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  flex-shrink: 0;
  align-self: center;
}

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

.commit-delete:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* =============================================================================
   EMPTY STATE
   ============================================================================= */

.gitea-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--spacing-12);
  color: var(--text-secondary);
}

.gitea-empty-state svg {
  margin-bottom: var(--spacing-4);
  color: var(--text-tertiary);
}

.gitea-empty-state h3 {
  margin: 0 0 var(--spacing-2) 0;
  font-size: var(--text-lg);
  color: var(--text-primary);
}

.gitea-empty-state p {
  margin: 0;
  color: var(--text-secondary);
}

/* =============================================================================
   LOADING STATES
   ============================================================================= */

.gitea-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-8);
}

.gitea-loading .spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-default);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =============================================================================
   FORM ENHANCEMENTS
   ============================================================================= */

.form-hint {
  display: block;
  margin-top: var(--spacing-1);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.form-hint.success {
  color: var(--success);
}

.form-hint.error {
  color: var(--error);
}

.form-hint.warning {
  color: var(--warning);
}

.form-static-value {
  padding: var(--spacing-2) var(--spacing-3);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 768px) {
  .view-gitea {
    padding: var(--spacing-4);
  }

  .gitea-section {
    padding: var(--spacing-4);
  }

  .gitea-repo-header {
    flex-direction: column;
    gap: var(--spacing-3);
  }

  .gitea-repo-header .repo-actions {
    align-self: flex-end;
  }

  .status-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .operations-grid {
    justify-content: stretch;
  }

  .operation-btn {
    flex: 1;
    justify-content: center;
    min-width: 80px;
  }
}

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

  .operations-grid {
    flex-direction: column;
  }

  .operation-btn {
    width: 100%;
  }

  .gitea-mode-switch {
    flex-direction: column;
  }

  .gitea-mode-btn {
    justify-content: center;
  }
}

/* =============================================================================
   BROWSER UPLOAD
   ============================================================================= */

.browser-compat-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-3);
  padding: var(--spacing-3) var(--spacing-4);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-4);
  color: var(--warning);
  font-size: var(--text-sm);
}

.browser-compat-notice svg {
  flex-shrink: 0;
  margin-top: 2px;
}

/* Upload Steps */
.upload-step {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--spacing-4);
  margin-bottom: var(--spacing-4);
}

.step-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  margin-bottom: var(--spacing-4);
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  font-weight: 600;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.step-title {
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
}

.file-count {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: var(--bg-primary);
  padding: var(--spacing-1) var(--spacing-2);
  border-radius: var(--radius-sm);
}

/* Directory Picker */
.directory-picker {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-3);
  align-items: center;
}

.btn-lg {
  padding: var(--spacing-3) var(--spacing-6);
  font-size: var(--text-base);
}

.drop-zone {
  width: 100%;
  padding: var(--spacing-8);
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--text-tertiary);
  transition: all 0.2s;
}

.drop-zone svg {
  margin-bottom: var(--spacing-2);
  color: var(--text-tertiary);
}

.drop-zone p {
  margin: 0;
  font-size: var(--text-sm);
}

.drop-zone.drag-over {
  border-color: var(--primary);
  background: rgba(200, 168, 81, 0.08);
  color: var(--primary);
}

.drop-zone.drag-over svg {
  color: var(--primary);
}

/* Files List */
.upload-files-list {
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
}

.upload-file-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-2) var(--spacing-3);
  border-bottom: 1px solid var(--border-default);
  font-size: var(--text-sm);
  font-family: monospace;
}

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

.upload-file-item .file-icon {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.upload-file-item .file-path {
  flex: 1;
  color: var(--text-primary);
  word-break: break-all;
}

.upload-file-item .file-size {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  flex-shrink: 0;
}

.excluded-info {
  margin-top: var(--spacing-2);
  color: var(--text-tertiary);
}

/* Upload Actions */
.upload-actions {
  display: flex;
  gap: var(--spacing-3);
  justify-content: flex-end;
  margin-top: var(--spacing-4);
}

/* Progress Bar */
.upload-progress {
  margin-top: var(--spacing-4);
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
  width: 0%;
}

#upload-progress-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  min-width: 40px;
  text-align: right;
}

/* Responsive */
@media (max-width: 480px) {
  .upload-actions {
    flex-direction: column;
  }

  .upload-actions .btn {
    width: 100%;
  }
}
