/* ========== Parts Tab Layout ========== */

.parts-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 0;
    height: calc(100vh - 200px);
    background: var(--light-bg);
}

/* ========== Parts List Panel ========== */

.parts-list-panel {
    background: var(--light-card);
    border-right: 1px solid var(--light-border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.part-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--light-border);
    cursor: pointer;
    transition: all 0.15s ease;
}

.part-item:hover {
    background: var(--light-bg);
}

.part-item.selected {
    background: rgba(119, 95, 255, 0.08);
    border-left: 3px solid var(--primary);
    padding-left: 13px;
}

.part-item-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.part-item-icon {
    font-size: 16px;
    margin-top: 2px;
}

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

.part-item-number {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, monospace;
}

.part-item-description {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.part-item-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    margin-left: 26px;
}

.part-item-category {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--light-bg);
    padding: 2px 8px;
    border-radius: 4px;
}

/* ========== Enrichment Badge ========== */

.enrichment-badge {
    font-size: 10px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.enrichment-badge.enriched {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.enrichment-badge.not-found {
    background: rgba(239, 68, 68, 0.1);
    color: #DC2626;
}

.enrichment-badge.pending {
    background: rgba(107, 114, 128, 0.1);
    color: #6B7280;
}

/* ========== Pagination ========== */

.parts-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--light-border);
    background: var(--light-card);
    position: sticky;
    bottom: 0;
}

.parts-pagination-info {
    font-size: 12px;
    color: var(--text-muted);
}

/* ========== Parts Detail Panel ========== */

.parts-detail-panel {
    background: var(--light-card);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.part-detail-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.part-detail-section {
    background: var(--light-bg);
    border-radius: 8px;
    padding: 16px;
}

.part-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--light-border);
}

.part-detail-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'SF Mono', Monaco, monospace;
    margin: 0;
}

.part-detail-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.part-detail-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.part-detail-row:last-child {
    margin-bottom: 0;
}

.part-detail-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
}

.part-detail-value {
    font-size: 13px;
    color: var(--text-primary);
}

.part-detail-models {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.part-detail-models .model-tag {
    font-size: 11px;
    padding: 3px 8px;
    background: rgba(119, 95, 255, 0.1);
    color: var(--primary);
    border-radius: 4px;
}

.part-detail-models .model-tag.enrichment {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.part-detail-models .model-tag small {
    opacity: 0.7;
}

/* ========== Relations ========== */

.part-relations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.relation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--light-card);
    border-radius: 6px;
    border: 1px solid var(--light-border);
}

.relation-type {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.relation-type.replacedby {
    background: rgba(245, 158, 11, 0.1);
    color: #D97706;
}

.relation-type.alsoorder {
    background: rgba(59, 130, 246, 0.1);
    color: #2563EB;
}

.relation-type.alternative {
    background: rgba(139, 92, 246, 0.1);
    color: #7C3AED;
}

.relation-part {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
}

.relation-part:hover {
    text-decoration: underline;
}

.relation-context {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

/* ========== Source Location ========== */

.part-location {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--light-card);
    border-radius: 6px;
    border: 1px solid var(--light-border);
}

.part-location .location-icon {
    font-size: 16px;
}

.part-location a {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
}

.part-location a:hover {
    text-decoration: underline;
}

/* ========== Empty/Preview State ========== */

.parts-detail-panel .preview-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    padding: 40px;
}

.parts-detail-panel .preview-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.parts-detail-panel .preview-empty-text {
    font-size: 14px;
}

/* ========== Actions Bar Additions ========== */

#partsTab .actions-bar {
    flex-wrap: wrap;
}

#partsTab .actions-bar input[type="text"] {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid var(--light-border);
    border-radius: 6px;
    width: 200px;
    outline: none;
    transition: border-color 0.15s ease;
    background: var(--light-card);
    color: var(--text-primary);
}

#partsTab .actions-bar input[type="text"]:focus {
    border-color: var(--primary);
}

#partsTab .actions-bar select {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid var(--light-border);
    border-radius: 6px;
    background: var(--light-card);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
}

#partsTab .actions-bar select:focus {
    border-color: var(--primary);
}

#partsTab .spacer {
    flex: 1;
}

#partsCount {
    font-size: 12px;
    color: var(--text-muted);
    padding: 6px 12px;
    background: var(--light-bg);
    border-radius: 6px;
}

/* ========== Source Locations (Multiple) ========== */

.part-locations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.part-location-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--light-card);
    border-radius: 6px;
    border: 1px solid var(--light-border);
    transition: border-color 0.15s ease;
}

.part-location-item:hover {
    border-color: var(--primary);
}

.part-location-item .location-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.part-location-item .location-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.part-location-item .location-section-link {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.part-location-item .location-section-link:hover {
    text-decoration: underline;
}

.part-location-item .location-page {
    font-size: 11px;
    color: var(--text-muted);
}

