/* Modal Container */
.import-hub-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(43, 24, 18, 0.6); /* Using dark overlay based on text color */
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.import-hub-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.import-hub-container {
  font-family: var(--font, "Inter", "Be Vietnam Pro", sans-serif);
  background-color: var(--bg-elevated, #ffffff);
  color: var(--text, #231510);
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  padding: 2rem;
  border-radius: var(--radius, 16px);
  box-shadow: var(--shadow, 0 16px 48px -12px rgba(43, 24, 18, 0.08));
  border: 1px solid var(--border, rgba(139, 21, 56, 0.12));
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  overflow: hidden;
}

.import-hub-modal.is-open .import-hub-container {
  transform: scale(1) translateY(0);
}

/* Header & Close Button */
.import-hub-header {
  text-align: center;
  position: relative;
  margin-bottom: 2rem;
}

.import-hub-close {
  position: absolute;
  top: 0;
  right: 0;
  background: transparent;
  border: none;
  color: var(--text-muted, #6b5c57);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s ease;
  text-decoration: underline;
}

.import-hub-close:hover {
  color: var(--accent, #9A183C);
}

.import-hub-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent, #9A183C);
  margin-bottom: 0.5rem;
}

.import-hub-subtitle {
  color: var(--text-muted, #6b5c57);
  font-size: 0.95rem;
}

/* Tabs */
.ih-tabs-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border, rgba(139, 21, 56, 0.12));
  padding-bottom: 0.5rem;
}

.ih-tab-button {
  background: transparent;
  color: var(--text-muted, #6b5c57);
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  border-radius: var(--radius, 16px) var(--radius, 16px) 0 0;
}

.ih-tab-button:hover {
  color: var(--accent, #9A183C);
  background-color: var(--surface, #f4efea);
}

.ih-tab-button.active {
  color: var(--accent, #9A183C);
  background-color: var(--surface, #f4efea);
}

.ih-tab-button.active::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--accent, #9A183C);
  border-radius: 3px 3px 0 0;
}

.ih-tab-content {
  display: none;
  animation: ihFadeIn 0.3s ease-out;
  flex-grow: 1;
  overflow-y: auto;
}

.ih-tab-content.is-active {
  display: block;
}

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

/* Import Portal Grid */
.ih-import-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .ih-import-grid {
    grid-template-columns: 1fr;
  }
}

.ih-card {
  background: var(--bg, #fcfbfa);
  border: 1px solid var(--border, rgba(139, 21, 56, 0.12));
  border-radius: var(--radius, 16px);
  padding: 2rem;
  box-shadow: 0 4px 12px -4px rgba(43, 24, 18, 0.05);
}

.ih-card-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: var(--text, #231510);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Drag and Drop */
.ih-drag-drop {
  border: 2px dashed var(--border, rgba(139, 21, 56, 0.12));
  border-radius: var(--radius, 16px);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-elevated, #ffffff);
}

.ih-drag-drop:hover, .ih-drag-drop.drag-active {
  border-color: var(--accent, #9A183C);
  background: var(--accent-dim, rgba(154, 24, 60, 0.08));
}

.ih-file-info {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface, #f4efea);
  border-radius: 8px;
  display: none;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border, rgba(139, 21, 56, 0.12));
}

/* Inputs */
.ih-input-group {
  margin-bottom: 1.25rem;
}

.ih-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--text-muted, #6b5c57);
}

.ih-input {
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--bg-elevated, #ffffff);
  border: 1px solid var(--border, rgba(139, 21, 56, 0.12));
  border-radius: 8px;
  color: var(--text, #231510);
  font-size: 0.95rem;
  font-family: inherit;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.ih-input:focus {
  outline: none;
  border-color: var(--accent, #9A183C);
  box-shadow: 0 0 0 3px var(--accent-dim, rgba(154, 24, 60, 0.08));
}

/* Buttons */
.ih-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  font-size: 0.95rem;
  width: 100%;
  font-family: inherit;
}

.ih-btn-primary {
  background: var(--accent, #9A183C);
  color: white;
}

.ih-btn-primary:hover:not(:disabled) {
  background: var(--accent-bright, #B81D48);
  transform: translateY(-1px);
}

.ih-btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Preview Area */
.ih-preview-container {
  display: flex;
  gap: 1.5rem;
  height: 500px;
}

.ih-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--bg, #fcfbfa);
  border: 1px solid var(--border, rgba(139, 21, 56, 0.12));
  border-radius: var(--radius, 16px);
  padding: 1.25rem;
  overflow-y: auto;
}

.ih-dataset-item {
  padding: 0.85rem;
  border-radius: 8px;
  background: var(--bg-elevated, #ffffff);
  border: 1px solid var(--border, rgba(139, 21, 56, 0.12));
  margin-bottom: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ih-dataset-item:hover {
  background: var(--surface, #f4efea);
}

.ih-dataset-item.active {
  border-color: var(--accent, #9A183C);
  background: var(--accent-dim, rgba(154, 24, 60, 0.08));
  box-shadow: 0 2px 4px rgba(139, 21, 56, 0.05);
}

.ih-dataset-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
  color: var(--text, #231510);
}

.ih-dataset-meta {
  font-size: 0.75rem;
  color: var(--text-muted, #6b5c57);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ih-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(43, 24, 18, 0.08);
  color: var(--text-muted, #6b5c57);
  width: fit-content;
}

.ih-badge.success {
  background: rgba(47, 111, 78, 0.15); /* var(--success) */
  color: var(--success, #2f6f4e);
}

/* Table */
.ih-table-wrapper {
  flex-grow: 1;
  background: var(--bg-elevated, #ffffff);
  border: 1px solid var(--border, rgba(139, 21, 56, 0.12));
  border-radius: var(--radius, 16px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ih-table-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border, rgba(139, 21, 56, 0.12));
  background: var(--bg, #fcfbfa);
  color: var(--text, #231510);
}

.ih-table-scroll {
  overflow: auto;
  flex-grow: 1;
}

.ih-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 0.9rem;
}

.ih-table th, .ih-table td {
  padding: 0.85rem 1.25rem;
  text-align: left;
  border-bottom: 1px solid var(--border, rgba(139, 21, 56, 0.12));
}

.ih-table th {
  background: var(--surface, #f4efea);
  font-weight: 600;
  color: var(--text, #231510);
  position: sticky;
  top: 0;
  z-index: 10;
}

.ih-table tbody tr:hover {
  background-color: var(--bg, #fcfbfa);
}

/* Spinner & Messages */
.ih-spinner {
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top: 2px solid white;
  width: 18px;
  height: 18px;
  animation: ihSpin 1s linear infinite;
  display: inline-block;
}

@keyframes ihSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ih-error {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(139, 21, 56, 0.05); /* light red */
  border-left: 4px solid var(--accent, #9A183C);
  border-radius: 4px;
  color: var(--accent, #9A183C);
  font-size: 0.85rem;
  display: none;
}

/* Trigger Button (placed in Dashboard) */
.btn-open-import {
  background: var(--bg-elevated, #ffffff);
  color: var(--text, #231510);
  border: 1px solid var(--border, rgba(139, 21, 56, 0.12));
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 0.85rem;
  box-shadow: 0 1px 2px rgba(43, 24, 18, 0.05);
}

.btn-open-import:hover {
  background: var(--accent, #9A183C);
  color: #fff;
  border-color: var(--accent, #9A183C);
  transform: translateY(-1px);
}
