/* Overlay */
.lib-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: lib-fadeIn 0.15s ease;
}

@keyframes lib-fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Modal */
.lib-modal {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  width: 680px;
  max-width: 95vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  animation: lib-slideIn 0.2s ease;
  overflow: hidden;
}

@keyframes lib-slideIn {
  from {
    transform: translateY(-16px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Header */
.lib-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #111;
  border-bottom: 1px solid #2a2a2a;
}

.lib-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #ccc;
  text-transform: uppercase;
}

.lib-icon {
  width: 18px;
  height: 18px;
  color: #00b8d4;
  flex-shrink: 0;
}

.lib-close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
  line-height: 1;
}

.lib-close-btn:hover {
  background: #2a2a2a;
  color: #fff;
}

/* Tabs */
.lib-tabs {
  display: flex;
  background: #111;
  border-bottom: 1px solid #2a2a2a;
  padding: 0 18px;
  gap: 4px;
}

.lib-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #888;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 10px 14px;
  transition: all 0.15s;
  letter-spacing: 0.03em;
}

.lib-tab:hover {
  color: #ccc;
}

.lib-tab.active {
  color: #00b8d4;
  border-bottom-color: #00b8d4;
}

/* Status bar */
.lib-status {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 1px solid transparent;
}

.lib-status.success {
  background: #0d2b1e;
  color: #4ade80;
  border-bottom-color: #1a4731;
}

.lib-status.error {
  background: #2b0d0d;
  color: #f87171;
  border-bottom-color: #4a1a1a;
}

/* Content */
.lib-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Search bar */
.lib-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid #2a2a2a;
  background: #111;
}

.lib-search-icon {
  width: 16px;
  height: 16px;
  color: #555;
  flex-shrink: 0;
}

.lib-search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #ddd;
  font-size: 14px;
  caret-color: #00b8d4;
}

.lib-search-bar input::placeholder {
  color: #555;
}

.lib-spinner {
  width: 16px;
  height: 16px;
  color: #00b8d4;
  flex-shrink: 0;
  animation: spin 0.8s linear infinite;
}

.lib-spinner-center {
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Library list */
.lib-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.lib-list::-webkit-scrollbar {
  width: 6px;
}

.lib-list::-webkit-scrollbar-track {
  background: #111;
}

.lib-list::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

/* Empty state */
.lib-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #555;
  font-size: 14px;
  gap: 8px;
  text-align: center;
}

.lib-empty-sub {
  font-size: 12px;
  color: #444;
}

/* Library item */
.lib-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid #1f1f1f;
  transition: background 0.1s;
}

.lib-item:hover {
  background: #1f1f1f;
}

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

.lib-item-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.lib-item-name {
  font-weight: 700;
  color: #e0e0e0;
  font-size: 14px;
}

.lib-item-author {
  color: #777;
  font-size: 12px;
}

.lib-item-desc {
  color: #888;
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

.lib-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.lib-item-version {
  font-size: 11px;
  color: #666;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 3px;
  padding: 2px 6px;
  white-space: nowrap;
}

.lib-installed-badge {
  color: #4ade80;
  border-color: #1a4731;
  background: #0d2b1e;
}

/* Install button */
.lib-install-btn {
  background: #00b8d4;
  color: #000;
  border: none;
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.lib-install-btn:hover:not(:disabled) {
  background: #00d4f0;
  box-shadow: 0 0 12px rgba(0, 184, 212, 0.4);
  transform: translateY(-1px);
}

.lib-install-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.lib-installing {
  display: flex;
  align-items: center;
  gap: 4px;
}