/* ── Import Panel ── */

/* Page load animation */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#import-panel {
  width: var(--import-panel-w, 420px);
  min-width: 320px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  animation: slideUp 0.6s ease-out;
}

/* Ensure the bottom toolbar inherits correct layout from base.css */
#bottom-toolbar {
  background: transparent;
  border-top: none;
}

/* Body spacing */
#import-body {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---- Panel Header ---- */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, var(--bg-surface), transparent);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.panel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---- Dropzone ---- */
.import-dropzone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(30, 41, 59, 0.5);
  gap: 16px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.import-dropzone:hover,
.import-dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
  transform: scale(1.02);
}

/* Shine effect on dropzone hover */
.shine-element::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(59, 130, 246, 0.1),
    transparent
  );
  transform: rotate(30deg);
  transition: transform 0.5s;
}

.import-dropzone:hover::before,
.import-dropzone.drag-over::before {
  animation: shine 1.5s infinite;
}

@keyframes shine {
  0% {
    transform: translateX(-100%) translateY(-100%) rotate(30deg);
  }
  100% {
    transform: translateX(100%) translateY(100%) rotate(30deg);
  }
}

/* Animated upload icon */
.import-dropzone i {
  transition: all 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.import-dropzone:hover i,
.import-dropzone.drag-over i {
  transform: scale(1.1) rotate(-5deg);
  filter: drop-shadow(0 4px 8px rgba(59, 130, 246, 0.5));
}

/* ---- Process button badge ---- */
#import-process-badge {
  background: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 500;
}

/* ---- Video Section ---- */
#import-video-section {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 16px;
}

#import-video-area {
  background: linear-gradient(135deg, #000, #111);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
}

#import-video-area video {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
}

/* Video placeholder */
#import-video-placeholder {
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
}

#import-video-placeholder i {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* ---- Frame Form ---- */
#frame-form {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: fadeUp 0.2s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

#frame-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, var(--bg-surface), transparent);
}

#frame-form-header .panel-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

/* Form fields */
#frame-form-body {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px 8px;
  max-height: 220px;
  overflow-y: auto;
}

.sf-field {
  margin-bottom: 12px;
}

.sf-field label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.sf-field input,
.sf-field select,
.sf-field textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-main);
  transition: all 0.2s ease;
}

.sf-field input:focus,
.sf-field select:focus,
.sf-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Form actions */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ---- Sidebar ---- */
#sidebar {
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  width: var(--sidebar-w);
  min-width: 240px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

#sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, var(--bg-surface), transparent);
}

#sidebar-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

#entries-count {
  background: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

/* Search wrap */
#sidebar-search-wrap {
  display: flex;
  align-items: center;
  padding: 12px;
  gap: 8px;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-color);
  border-radius: var(--radius);
}

#sidebar-search-wrap i {
  color: var(--text-muted);
  font-size: 1rem;
}

#sidebar-search {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 8px;
}

#sidebar-search:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

/* Entries list */
#entries-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}

/* Entry item (scoped for import page) */
.import-layout .entry-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  margin: 4px 0;
  background: var(--bg-input);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.import-layout .entry-item:hover {
  background: var(--bg-hover);
  transform: translateX(2px);
  border-left-color: var(--color-primary);
}

.import-layout .entry-item.active {
  background: var(--bg-hover);
  border-left-color: var(--color-success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.import-layout .entry-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.import-layout .entry-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.import-layout .entry-meta {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 2px;
}

/* Entry actions (scoped for import page) */
.import-layout .entry-actions {
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.import-layout .entry-item:hover .entry-actions {
  opacity: 1;
}

.import-layout .entry-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s ease;
  border: none;
  background: transparent;
  cursor: pointer;
}

.import-layout .entry-action-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.import-layout .entry-action-btn.delete {
  color: var(--color-danger);
}

.import-layout .entry-action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-danger);
}

/* ---- Bottom Toolbar (import overrides) ---- */
/* Let base.css handle the main toolbar layout; only import-specific tweaks here. */
#bottom-toolbar .toolbar-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
}

#bottom-toolbar .toolbar-btn.icon-only {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#bottom-toolbar .toolbar-btn .icon-xs {
  font-size: 1.1rem;
}

/* Label and figure selectors */
.bottom-select,
#figure-search {
  min-width: 120px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

.bottom-select:focus,
#figure-search:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* ---- Figure Combobox ---- */
.figure-combobox {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.figure-dropdown {
  position: absolute;
  bottom: 105%;
  left: 0;
  right: 0;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  z-index: 1000;
  display: none;
}

.figure-dropdown.open {
  display: block;
}

.figure-dropdown div {
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.figure-dropdown div:hover {
  background: var(--bg-hover);
}

.figure-dropdown div.active {
  background: var(--color-primary);
  color: white;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  #import-panel {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
  }

  #sidebar {
    width: 260px;
  }
}

@media (max-width: 768px) {
  #app-main {
    flex-direction: column;
    height: auto;
  }

  #import-panel,
  #sidebar,
  #workspace {
    width: 100%;
    max-width: none;
  }

  #sidebar {
    border-left: none;
    border-top: 1px solid var(--border);
    height: 200px;
  }

  #import-body {
    padding: 16px;
  }

  .import-dropzone {
    padding: 30px 16px;
  }
}
