/* Modal Styles */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--color-bg-secondary, #1a1a1a);
  border-radius: 12px;
  width: 100%;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 640px) {
  .modal-content {
    max-width: 600px;
  }
}

@media (min-width: 1024px) {
  .modal-content {
    max-width: 900px;
  }
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  color: var(--text-primary);
}

.modal-close-btn,
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: white;
  cursor: pointer;
  padding: 4px;
  transition: all 0.2s ease;
  line-height: 1;
}

.modal-close-btn:hover,
.modal-close:hover {
  color: white;
  transform: scale(1.1);
  opacity: 0.8;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Folder Browser Specific */

.folder-browser .modal-content {
  max-width: 1000px;
}

/* Breadcrumb Navigation */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: var(--bg-primary);
  border-radius: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.breadcrumb-item {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 14px;
  transition: all 0.2s;
}

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

.breadcrumb-item.current {
  color: var(--primary-color);
  cursor: default;
}

.breadcrumb-item.add-current-folder {
  color: var(--primary-color);
  font-weight: 500;
}

.breadcrumb-separator {
  color: var(--text-tertiary);
  font-size: 12px;
}

/* Folder List */

.folder-list {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
  max-height: 300px;
  overflow-y: auto;
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.2s;
}

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

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

.folder-item-icon {
  font-size: 24px;
  flex-shrink: 0;
}

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

.folder-item-name {
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-item-path {
  font-size: 12px;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.selected-indicator {
  color: var(--primary-color);
  font-weight: 500;
  cursor: default !important;
}

/* Selected Folders Section */

.selected-folders-section {
  margin-top: 20px;
}

.selected-folders-section h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.selected-folders-list {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.selected-folder-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

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

.selected-folder-path {
  color: var(--text-secondary);
  font-size: 14px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.remove-folder-btn {
  color: var(--error-color);
}

.remove-folder-btn:hover {
  text-decoration: underline;
}

/* Loading States */

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.error-state {
  text-align: center;
  padding: 40px;
  color: var(--error-color);
}

/* Loading secondary text */

.loading-secondary {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Duplicate Confirmation Modal */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 20px;
}

.modal-dialog {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0 0 var(--spacing-md) 0;
}

.modal-message {
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin: 0 0 var(--spacing-xl) 0;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: var(--spacing-md);
  justify-content: flex-end;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
  flex: 1;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  min-width: 120px;
}
