/* ========================================
   Exclude Editor Modal & Inline Source Tree
   ======================================== */

/* Shared: Tree Basis-Klassen können inline + modal verwendet werden */

.exclude-editor {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 72px;
}

.exclude-editor[data-open] {
  display: flex;
}

.exclude-editor__backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.exclude-editor__dialog {
  position: relative;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  background: #3F3F3F;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.exclude-editor__header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.exclude-editor__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.exclude-editor__subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted, #888);
  font-family: 'Courier New', monospace;
}

.exclude-editor__close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.exclude-editor__close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.exclude-editor__body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.exclude-editor__search {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  align-items: center;
}

.exclude-editor__search input[type="text"] {
  flex: 1;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
}

.exclude-editor__search input[type="text"]::placeholder {
  color: var(--text-muted, #888);
}

.exclude-editor__toggle-hidden {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #aaa;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.exclude-editor__toggle-hidden input[type="checkbox"] {
  cursor: pointer;
}

.exclude-editor__toggle-hidden:hover {
  color: #ddd;
}

.exclude-editor__tree {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.exclude-editor__loading {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted, #888);
}

.exclude-editor__empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted, #888);
}

.exclude-editor__footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
}

.exclude-editor__summary {
  font-size: 13px;
  color: var(--text-muted, #888);
}

.exclude-editor__summary strong {
  color: #fff;
}

.exclude-editor__actions {
  display: flex;
  gap: 8px;
}

/* ========================================
   Exclude Tree Items
   ======================================== */

.exclude-tree {
  list-style: none;
  padding: 0;
  margin: 0;
}

.exclude-tree__item {
  list-style: none;
}

.exclude-tree__row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 24px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.exclude-tree__row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.exclude-tree__row--excluded {
  background: rgba(251, 146, 60, 0.1);
  opacity: 0.6;
}

.exclude-tree__row--excluded .exclude-tree__name {
  text-decoration: line-through;
  color: rgba(255, 255, 255, 0.5);
}

/* Selected state (für Source-Picker Modal) */
.exclude-tree__row--selected {
  background: rgba(59, 130, 246, 0.15);
  border-left: 3px solid #3b82f6;
}

.exclude-tree__row--selected .exclude-tree__name {
  font-weight: 600;
  color: #60a5fa;
}

/* Global Exclude (durch aktives Pattern ausgeschlossen) */
.exclude-tree__row--global-excluded {
  background: rgba(220, 38, 38, 0.12);
  position: relative;
  opacity: 0.7;
}
.exclude-tree__row--global-excluded .exclude-tree__name {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: line-through;
}
.exclude-tree__row--global-excluded::after {
  content: 'EXCLUDED';
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.5);
  padding: 2px 4px;
  border-radius: 4px;
  margin-left: 8px;
}

/* Hidden files/folders */
.exclude-tree__item--hidden .exclude-tree__name {
  opacity: 0.5;
  font-style: italic;
}

.exclude-tree__item--hidden .exclude-tree__icon {
  opacity: 0.5;
}

.exclude-tree__toggle {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--text);
  cursor: pointer;
  font-size: 10px;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.exclude-tree__toggle:hover {
  color: var(--text);
}

.exclude-tree__toggle--expanded {
  transform: rotate(90deg);
}

.exclude-tree__toggle--placeholder {
  visibility: hidden;
}

.exclude-tree__checkbox {
  position: relative;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}

.exclude-tree__checkbox input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.exclude-tree__checkbox-custom {
  display: block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.2s;
  position: relative;
}

.exclude-tree__checkbox input:checked + .exclude-tree__checkbox-custom {
  background: var(--primary, #0ea5e9);
  border-color: var(--primary, #0ea5e9);
}

.exclude-tree__checkbox input:checked + .exclude-tree__checkbox-custom::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 12px;
  font-weight: bold;
}

.exclude-tree__checkbox input:indeterminate + .exclude-tree__checkbox-custom {
  background: rgba(14, 165, 233, 0.3);
  border-color: var(--primary, #0ea5e9);
}

.exclude-tree__checkbox input:indeterminate + .exclude-tree__checkbox-custom::after {
  content: '−';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--primary, #0ea5e9);
  font-size: 14px;
  font-weight: bold;
}

.exclude-tree__label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.exclude-tree__icon {
  font-size: 16px;
  flex-shrink: 0;
}

.exclude-tree__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-size: 14px;
}

.exclude-tree__children {
  list-style: none;
  padding: 0;
  margin: 0;
  display: none;
}

.exclude-tree__children--expanded {
  display: block;
}

.exclude-tree__item .exclude-tree__children .exclude-tree__row {
  padding-left: 50px;
}

.exclude-tree__item .exclude-tree__children .exclude-tree__children .exclude-tree__row {
  padding-left: 76px;
}

.exclude-tree__item .exclude-tree__children .exclude-tree__children .exclude-tree__children .exclude-tree__row {
  padding-left: 102px;
}

/* ========================================
   Exclude Badge in Source List
   ======================================== */

.exclude-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  margin-left: 8px;
  border: 1px solid rgba(251, 146, 60, 0.3);
}

.path-selection__edit {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  color: var(--text-muted, #888);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-left: 8px;
}

.path-selection__edit:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
  .exclude-editor__dialog {
    width: 95%;
    max-height: 90vh;
  }
  
  .exclude-editor__footer {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  
  .exclude-editor__actions {
    width: 100%;
  }
  
  .exclude-editor__actions button {
    flex: 1;
  }
}

/* ========================================
   Inline Source Tree (für Quellen-Auswahl)
   ======================================== */

.source-tree-container {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 16px;
  max-height: 500px;
  overflow-y: auto;
}

.source-tree-container .exclude-tree {
  margin: 0;
}

/* In Source-Modus: ausgewählte Items hervorheben */
.exclude-tree__row--selected {
  background: rgba(59, 130, 246, 0.15);
  border-left: 3px solid #3b82f6;
}

.exclude-tree__row--selected .exclude-tree__name {
  font-weight: 600;
  color: #60a5fa;
}

/* Inline Tree: Kompakteres Styling */
.source-tree-container .exclude-tree__item {
  margin: 2px 0;
}

.source-tree-container .exclude-tree__row {
  padding: 6px 8px;
  min-height: 36px;
}

.source-tree-container .exclude-tree__label {
  font-size: 14px;
}

/* Suchfeld für inline Tree */
.source-tree-search {
  width: 100%;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.source-tree-search:focus {
  outline: none;
  border-color: #3b82f6;
  background: rgba(0, 0, 0, 0.4);
}

.source-tree-search::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 768px) {
  .source-tree-container {
    max-height: 350px;
  }
}

/* ========================================
   Source Tree in path-selection (inline pro Quelle)
   ======================================== */

.path-selection__item--tree {
  margin-bottom: 8px;
}

.path-selection__item-main {
  display: flex;
  align-items: center;
  padding: 8px 4px;
  gap: 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.path-selection__item-main:hover {
  background: rgba(255, 255, 255, 0.03);
}

.path-selection__icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.path-selection__path {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
}

.path-selection__expand {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 50%;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.path-selection__expand:hover {
  color: var(--text);
}

.path-selection__expand--expanded {
  color: var(--text);
  transform: rotate(-45deg);
}

.path-selection__tree-wrapper {
  padding: 0 12px 12px 52px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.path-selection__tree-loading,
.path-selection__tree-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted, #888);
  font-size: 13px;
}

/* Inline Tree: Kompakteres Styling */
.exclude-tree--inline {
  margin: 0;
}

.exclude-tree--inline .exclude-tree__item {
  margin: 1px 0;
}

.exclude-tree__row--inline {
  padding: 4px 6px;
  min-height: 32px;
  font-size: 13px;
}

.exclude-tree--inline .exclude-tree__icon {
  font-size: 14px;
}

.exclude-tree--inline .exclude-tree__name {
  font-size: 13px;
}

.exclude-tree--inline .exclude-tree__toggle {
  width: 20px;
  height: 20px;
  font-size: 13px;
}

.exclude-tree--inline .exclude-tree__checkbox {
  width: 18px;
  height: 18px;
}

.exclude-tree--inline .exclude-tree__checkbox-custom {
  width: 18px;
  height: 18px;
}

.exclude-tree--inline .exclude-tree__checkbox-custom::after {
  width: 10px;
  height: 10px;
}
