/**
 * Component Picker Modal Styles
 */

.component-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.component-picker-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 1100px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

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

/* Header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #333;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.close-btn:hover {
  background: #f0f0f0;
  color: #333;
}

/* Search Section */
.search-section {
  padding: 16px 24px;
  border-bottom: 1px solid #e0e0e0;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 12px 40px 12px 12px;
  font-size: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: #007acc;
}

.clear-search-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.clear-search-btn:hover {
  background: #f0f0f0;
  color: #666;
}

/* Category Tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-bottom: 1px solid #e0e0e0;
  overflow-x: auto;
  scrollbar-width: thin;
  flex-wrap: nowrap;
  max-width: 100%;
  min-height: 60px;
  align-items: center;
}

.category-tab {
  padding: 8px 16px;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

.category-tab:hover {
  background: #e8e8e8;
  border-color: #ccc;
}

.category-tab.active {
  background: #007acc;
  border-color: #007acc;
  color: white;
}

/* Components Grid */
.components-grid {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  align-content: start;
}

.loading-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007acc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.no-results p {
  margin: 0 0 16px 0;
  font-size: 18px;
}

.clear-filters-btn {
  padding: 10px 20px;
  background: #007acc;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.clear-filters-btn:hover {
  background: #005a9e;
}

/* Component Card */
.component-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.component-card:hover {
  border-color: #007acc;
  box-shadow: 0 4px 12px rgba(0, 122, 204, 0.15);
  transform: translateY(-2px);
}

.card-thumbnail {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  background: #f9f9f9;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.component-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.card-thumbnail svg {
  max-width: 100%;
  max-height: 100%;
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-name {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.card-description {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-meta {
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: #999;
}

.card-category {
  text-transform: capitalize;
}

.card-pins {
  margin-left: auto;
}

/* Footer */
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.component-count {
  font-size: 14px;
  color: #666;
}

/* Scrollbar styles */
.components-grid::-webkit-scrollbar,
.category-tabs::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.components-grid::-webkit-scrollbar-track,
.category-tabs::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-radius: 4px;
}

.components-grid::-webkit-scrollbar-thumb,
.category-tabs::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.components-grid::-webkit-scrollbar-thumb:hover,
.category-tabs::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Dark mode support */
.component-picker-modal {
  background: #2d2d2d;
}

.modal-header h2,
.card-name {
  color: #fff;
}

.modal-header,
.search-section,
.category-tabs,
.modal-footer {
  border-color: #444;
}

.search-input {
  background: #3d3d3d;
  border-color: #555;
  color: #fff;
}

.search-input:focus {
  border-color: #007acc;
}

.search-input::placeholder {
  color: #888;
}

.category-tab {
  background: #3d3d3d;
  border-color: #555;
  color: #ccc;
}

.category-tab:hover {
  background: #4d4d4d;
}

.component-card {
  background: #3d3d3d;
  border-color: #555;
}

.component-card:hover {
  border-color: #007acc;
}

.card-thumbnail {
  background: #252525;
}

.card-description {
  color: #aaa;
}

.card-meta {
  color: #888;
}

.components-grid::-webkit-scrollbar-track {
  background: #3d3d3d;
}

.components-grid::-webkit-scrollbar-thumb {
  background: #555;
}

.loading-state,
.no-results {
  color: #aaa;
}

.component-count {
  color: #888;
}
