/**
 * Spectroscopy File Converter - CSS
 *
 * Composable panel utilities + file tree + drop zone + results
 * Naming: kebab-case throughout. IDs for unique, classes for repeated.
 */

/* === Composable Panel Utilities === */

.panel {
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.5rem 1.5rem 1rem;
}

.panel-content {
  padding: 0 1.5rem 1.5rem;
}

.panel-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid hsl(var(--border));
}

/* === Sidebar File Panel === */

#file-panel {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 1rem;
  align-self: flex-start;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
}

#file-panel > .panel-header {
  padding: 0.75rem 1rem;
}

#file-panel > .panel-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 0.75rem 0.75rem;
}

/* === Drop Zone (compact, flex row) === */

#drop-zone {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  border: 2px dashed hsl(var(--muted));
  border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: border-color 200ms, background-color 200ms;
}

#drop-zone:hover,
#drop-zone.drag-over {
  border-color: hsl(var(--primary));
  background-color: hsl(var(--primary) / 0.05);
}

#drop-zone-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: hsl(var(--muted-foreground));
}

#drop-zone-text {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}

/* === File Tree === */

#file-tree {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.tree-folder-header {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  user-select: none;
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  transition: background-color 150ms;
}

.tree-folder-header:hover {
  background-color: hsl(var(--accent));
}

.tree-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 200ms ease;
  color: hsl(var(--muted-foreground));
}

.tree-folder[data-expanded="true"] > .tree-folder-header .tree-chevron {
  transform: rotate(90deg);
}

.tree-folder-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: hsl(var(--muted-foreground));
}

.tree-folder-count {
  margin-left: auto;
  font-size: 0.6875rem;
  font-weight: 400;
  color: hsl(var(--muted-foreground));
}

.tree-folder-content {
  display: none;
  flex-direction: column;
  padding-left: 0.75rem;
}

.tree-folder[data-expanded="true"] > .tree-folder-content {
  display: flex;
}

.tree-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  transition: background-color 150ms, color 150ms;
}

.tree-item:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--foreground));
}

.tree-item.active {
  background-color: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.tree-item-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.tree-item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-empty {
  padding: 0.25rem 0.5rem 0.25rem 1.25rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-style: italic;
}

/* === VFS Status Footer === */

#vfs-status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

#vfs-status svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* === Results Cards === */

.results-card {
  transition: all 0.2s ease;
}

.results-card.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.drag-handle {
  cursor: move;
  user-select: none;
}

.card-ghost {
  position: relative;
  height: 4px;
  background-color: hsl(var(--primary));
  margin: 1rem 0;
  border-radius: 2px;
}

/* === File Preview Table === */

.file-preview {
  position: relative;
  max-height: 400px;
  overflow-y: auto;
}

.file-preview table {
  font-size: 0.875rem;
}

.file-preview thead th {
  position: sticky;
  top: 0;
  background-color: hsl(var(--muted));
  z-index: 10;
  color: hsl(var(--foreground));
}

/* === Metadata === */

.metadata-value {
  position: relative;
  transition: color 0.2s ease;
}

.metadata-value::after {
  content: "Click to copy";
  position: absolute;
  top: 0;
  right: 0;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.metadata-value:hover::after {
  opacity: 1;
}

/* === Export === */

.export-button {
  transition: all 0.2s ease;
}

.export-button:hover {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

/* === Format Badge === */

.format-badge {
  display: inline-flex;
  align-items: center;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  transition: background-color 150ms;
}

.format-badge:hover {
  background-color: hsl(var(--secondary) / 0.8);
}

/* === Responsive === */

@media (max-width: 768px) {
  #file-panel {
    width: 100%;
    position: static;
    max-height: none;
  }
}
