/* Records View Component - Notion/VS Code inspired layout */
.records-container {
  flex: 1;
  min-height: 0;
  padding: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary, #191919);
}

.records-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.records-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary, #202020);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  padding: 16px;
  gap: 16px;
  min-height: 0;
}

.records-sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.records-sidebar-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary, #ffffff);
}

.records-sidebar-subtitle {
  font-size: 12px;
  color: var(--text-muted, #9a9a9a);
}

.records-tree {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.records-tree-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.records-tree-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted, #7f7f7f);
}

.records-tree-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary, #d6d6d6);
  font-size: 14px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.records-tree-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border, rgba(255, 255, 255, 0.1));
  color: var(--text-primary, #ffffff);
}

.records-tree-item.active {
  background: rgba(255, 107, 53, 0.12);
  border-color: rgba(255, 107, 53, 0.35);
  color: var(--text-primary, #ffffff);
}

.records-tree-name {
  font-weight: 500;
}

.records-tree-count {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted, #b2b2b2);
}

.records-tree-item.active .records-tree-count {
  background: rgba(255, 107, 53, 0.25);
  color: var(--text-primary, #ffffff);
}

.records-sidebar-footer {
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  padding-top: 12px;
}

.records-sidebar-hint {
  font-size: 12px;
  color: var(--text-muted, #8f8f8f);
  line-height: 1.4;
}

.records-main {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary, #202020);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  padding: 20px;
  min-height: 0;
  overflow: hidden;
}

.records-tabs {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0 12px;
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  margin-bottom: 12px;
}

.records-tab-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.records-tab {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary, #d6d6d6);
  font-size: 13px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  cursor: pointer;
  transition: all 0.15s ease;
}

.records-tab:hover {
  border-color: var(--border, rgba(255, 255, 255, 0.15));
  color: var(--text-primary, #ffffff);
}

.records-tab.active {
  background: rgba(255, 107, 53, 0.2);
  border-color: rgba(255, 107, 53, 0.4);
  color: var(--text-primary, #ffffff);
}

.records-tab-panels {
  flex: 1;
  min-height: 0;
}

.records-panel {
  flex: 1;
  min-height: 0;
}

.records-panel-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  background: var(--bg-primary, #191919);
  color: var(--text-secondary, #d6d6d6);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.records-panel-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary, #ffffff);
}

.records-panel-description {
  font-size: 13px;
  color: var(--text-muted, #9a9a9a);
  line-height: 1.5;
}

.records-panel-list {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary, #d6d6d6);
}

.records-panel-list span {
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.records-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  gap: 8px;
  color: var(--text-muted, #9a9a9a);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.records-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary, #ffffff);
}

.records-empty-subtitle {
  font-size: 13px;
  max-width: 360px;
  line-height: 1.4;
}

/* Table View - Notion-inspired */
.records-table-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: transparent;
  padding: 0;
  gap: 0;
}

.records-table-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  padding-bottom: 0;
  border-bottom: none;
  min-height: 40px;
}

.records-back-btn {
  padding: 4px 8px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted, #9b9a97);
  cursor: pointer;
  font-size: 14px;
  font-weight: 400;
  transition: all 0.12s ease;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 28px;
  height: 28px;
  justify-content: center;
}

.records-back-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary, #ffffff);
}

.records-table-title {
  color: var(--text-primary, #ffffff);
  font-size: 32px;
  font-weight: 700;
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  letter-spacing: -0.035em;
  line-height: 1.1;
  flex: 1;
}

.records-table-controls {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  align-items: center;
  padding: 0;
  flex-wrap: wrap;
}

.records-search-input {
  flex: 1;
  max-width: 280px;
  padding: 6px 8px;
  border: none;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary, #ffffff);
  font-size: 13px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  transition: all 0.12s ease;
  height: 28px;
}

.records-search-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.07);
}

.records-search-input::placeholder {
  color: var(--text-muted, #9b9a97);
  font-weight: 400;
}

.records-filter-select {
  padding: 6px 8px;
  border: none;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary, #ffffff);
  font-size: 13px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  cursor: pointer;
  transition: all 0.12s ease;
  min-width: 110px;
  height: 28px;
}

.records-filter-select:hover {
  background: rgba(255, 255, 255, 0.07);
}

.records-filter-select:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.07);
}

.records-table-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  border: none;
  border-radius: 0;
  background: transparent;
  margin: 0;
  padding: 0;
}

.records-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: transparent;
}

.records-table thead {
  position: sticky;
  top: 0;
  background: var(--bg-primary, #191919);
  z-index: 10;
  backdrop-filter: blur(8px);
}

.records-table th {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  border-right: 1px solid rgba(255, 255, 255, 0.025);
  color: var(--text-muted, #9b9a97);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-primary, #191919);
  position: sticky;
  top: 0;
  white-space: nowrap;
  height: 36px;
  user-select: none;
}

.records-table th:first-child {
  border-left: 1px solid rgba(255, 255, 255, 0.025);
}

.records-table th:last-child {
  border-right: none;
}

.records-table th:first-child {
  padding-left: 0;
}

.records-table th:last-child {
  padding-right: 0;
}

.records-table td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.025);
  border-right: 1px solid rgba(255, 255, 255, 0.02);
  color: var(--text-secondary, #e0e0e0);
  font-size: 14px;
  line-height: 1.5;
  vertical-align: middle;
  height: 46px;
  transition: color 0.12s ease, background-color 0.12s ease;
  background: rgba(255, 255, 255, 0.01);
}

.records-table td:first-child {
  padding-left: 0;
  font-weight: 500;
  color: var(--text-primary, #ffffff);
  min-width: 200px;
  border-left: 1px solid rgba(255, 255, 255, 0.02);
}

.records-table td:not(:first-child) {
  color: var(--text-secondary, #d0d0d0);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.records-table td:last-child {
  padding-right: 0;
  border-right: none;
}

.records-table tbody tr {
  cursor: pointer;
  transition: background 0.12s ease, border-left-color 0.12s ease;
  background: transparent;
  border-left: 2px solid transparent;
  border-top: 1px solid rgba(255, 255, 255, 0.015);
}

.records-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
  border-left-color: rgba(255, 107, 53, 0.4);
}

.records-table tbody tr:hover td {
  color: var(--text-primary, #ffffff);
  background: rgba(255, 255, 255, 0.02);
}

.records-table tbody tr:last-child td {
  border-bottom: none;
}

.records-table tbody tr.selected {
  background: rgba(255, 107, 53, 0.06);
  border-left-color: rgba(255, 107, 53, 0.5);
}

.records-table tbody tr.selected td {
  color: var(--text-primary, #ffffff);
}

/* Empty state */
.records-table tbody tr td[colspan] {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted, #9b9a97);
  font-size: 14px;
  font-weight: 400;
  border-bottom: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .records-shell {
    grid-template-columns: 1fr;
  }

  .records-sidebar {
    order: 0;
  }
  
  .records-table-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .records-search-input {
    max-width: 100%;
  }
  
  .records-table-wrapper {
    overflow-x: auto;
  }
  
  .records-table {
    min-width: 600px;
  }
}

/* Smooth scrolling */
.records-table-wrapper {
  scrollbar-width: thin;
  scrollbar-color: var(--border, rgba(255, 255, 255, 0.09)) transparent;
}

.records-table-wrapper::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.records-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.records-table-wrapper::-webkit-scrollbar-thumb {
  background: var(--border, rgba(255, 255, 255, 0.09));
  border-radius: 4px;
}

.records-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--border, rgba(255, 255, 255, 0.15));
}

.records-tree {
  scrollbar-width: thin;
  scrollbar-color: var(--border, rgba(255, 255, 255, 0.2)) transparent;
}

.records-tree::-webkit-scrollbar {
  width: 6px;
}

.records-tree::-webkit-scrollbar-track {
  background: transparent;
}

.records-tree::-webkit-scrollbar-thumb {
  background: var(--border, rgba(255, 255, 255, 0.15));
  border-radius: 6px;
}

.records-tree::-webkit-scrollbar-thumb:hover {
  background: var(--border, rgba(255, 255, 255, 0.25));
}

/* Site Record View */
.site-record-container {
  flex: 1;
  min-height: 0;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  padding: 20px;
  overflow-y: hidden;
}

.site-record-field {
  margin-bottom: 15px;
}

.site-record-field-label {
  color: var(--text-muted, #999999);
  font-size: 12px;
  margin-bottom: 5px;
  font-weight: 500;
}

.site-record-field-value {
  color: var(--text-primary, #ffffff);
  font-size: 14px;
}

.site-record-field-value.status-unknown {
  color: var(--accent, #ff6b35);
}

.site-record-field-value.status-invalid {
  color: var(--text-muted, #999999);
}

/* Record Details View */
.records-details-view {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 0;
  width: 100%;
  max-width: 100%;
}

.records-details-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.records-details-title {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary, #ffffff);
  margin: 0;
}

.records-details-content {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 32px;
  align-items: start;
}

.records-details-image {
  position: sticky;
  top: 100px;
}

.records-image-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-muted, #9b9a97);
  font-size: 14px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.records-image-placeholder:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.12);
}

.records-image-placeholder svg {
  opacity: 0.4;
}

.records-image-placeholder span {
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.records-details-info {
  min-width: 0;
}

.records-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.records-detail-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.records-detail-item-full {
  grid-column: 1 / -1;
}

.records-detail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted, #9b9a97);
  margin-bottom: 4px;
}

.records-detail-value {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-primary, #ffffff);
  line-height: 1.5;
  word-wrap: break-word;
}

.records-detail-value a {
  color: var(--accent, #ff6b35);
  text-decoration: none;
  transition: color 0.2s ease;
}

.records-detail-value a:hover {
  color: var(--accent-hover, #ff8c5a);
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 1024px) {
  .records-details-content {
    grid-template-columns: 300px 1fr;
    gap: 24px;
  }
  
  .records-details-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .records-details-content {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .records-details-image {
    position: static;
  }
  
  .records-image-placeholder {
    max-width: 400px;
    margin: 0 auto;
  }
  
  .records-details-title {
    font-size: 24px;
  }
  
  .records-details-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}
