/* Clean App Styles - Minimal, focused design */

* {
  box-sizing: border-box;
}

.clean-app {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: #f8fafc;
  color: #334155;
}

/* Header */
.app-header {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.app-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #1e293b;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.status-indicator {
  font-size: 1rem;
}

.status-indicator.healthy {
  color: #10b981;
}

.status-indicator.warning {
  color: #f59e0b;
}

/* Navigation */
.app-nav {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 2rem;
  display: flex;
  gap: 0;
}

.app-nav button {
  background: transparent;
  border: none;
  padding: 1rem 1.5rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-weight: 500;
  color: #64748b;
  transition: all 0.2s;
}

.app-nav button:hover {
  color: #334155;
  background: #f1f5f9;
}

.app-nav button.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  background: #f8fafc;
}

/* Main Content */
.app-main {
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Search View */
.search-view {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.search-section h2 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.search-input-group {
  display: flex;
  gap: 0.75rem;
}

.search-input-group input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  font-size: 1rem;
  background: white;
  transition: border-color 0.2s;
}

.search-input-group input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.search-input-group button {
  padding: 0.75rem 1.5rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  min-width: 120px;
}

.search-input-group button:hover:not(:disabled) {
  background: #1d4ed8;
}

.search-input-group button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* Results Section */
.results-section {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.clear-btn {
  padding: 0.5rem 1rem;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.clear-btn:hover {
  background: #dc2626;
}

.empty-state {
  text-align: center;
  color: #6b7280;
  font-style: italic;
  padding: 2rem;
}

/* Search Results */
.search-results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.search-result {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  background: #f9fafb;
}

.result-query {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.result-query strong {
  color: #1f2937;
  flex: 1;
}

.timestamp {
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
}

.result-response {
  color: #374151;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.result-sources {
  font-size: 0.875rem;
  color: #6b7280;
}

/* Memory View */
.memory-view {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

/* Memory Tabs */
.memory-tabs {
  display: flex;
  gap: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.25rem;
  background: #f9fafb;
}

.memory-tabs button {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.2s;
}

.memory-tabs button:hover {
  color: #374151;
  background: #e5e7eb;
}

.memory-tabs button.active {
  background: white;
  color: #2563eb;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.memory-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.memory-item {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  background: #f9fafb;
  position: relative;
}

.memory-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.memory-content {
  color: #374151;
  line-height: 1.6;
  margin-bottom: 0.75rem;
  flex: 1;
}

.delete-memory-btn {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 0.375rem;
  width: 32px;
  height: 32px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-memory-btn:hover:not(:disabled) {
  background: #dc2626;
  transform: scale(1.05);
}

.delete-memory-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  opacity: 0.7;
}

.memory-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
}

.memory-type {
  background: #e5e7eb;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  text-transform: uppercase;
  font-weight: 500;
}

.memory-tags {
  background: #dbeafe;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  color: #1e40af;
}

.memory-access {
  background: #f3e8ff;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  color: #6b21a8;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
}

.pagination button {
  padding: 0.5rem 1rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.pagination button:hover:not(:disabled) {
  background: #1d4ed8;
}

.pagination button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.page-info {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

.loading-state {
  text-align: center;
  color: #6b7280;
  padding: 2rem;
  font-style: italic;
}

/* System View */
.system-view {
  background: white;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.system-view h2 {
  margin: 0 0 1.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.system-card {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  background: #f9fafb;
  text-align: center;
}

.system-card h3 {
  margin: 0 0 0.75rem 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
}

.status-badge {
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  text-transform: capitalize;
}

.status-badge.healthy,
.status-badge.operational {
  background: #dcfce7;
  color: #166534;
}

.status-badge.degraded,
.status-badge.warning {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.error,
.status-badge.critical {
  background: #fee2e2;
  color: #991b1b;
}

.refresh-btn {
  padding: 0.5rem 1rem;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.refresh-btn:hover {
  background: #1d4ed8;
}

/* Responsive Design */
@media (max-width: 768px) {
  .app-header {
    padding: 1rem;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .app-nav {
    padding: 0 1rem;
    overflow-x: auto;
  }

  .app-main {
    padding: 1rem;
  }

  .search-input-group {
    flex-direction: column;
  }

  .result-query {
    flex-direction: column;
    gap: 0.5rem;
  }

  .system-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
}

/* Code Intelligence Styles */
.code-view {
  padding: 2rem;
}

.code-tabs {
  display: flex;
  gap: 0.5rem;
  background: #f1f5f9;
  padding: 0.25rem;
  border-radius: 0.5rem;
}

.code-tabs button {
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.2s;
}

.code-tabs button:hover {
  color: #374151;
  background: #e5e7eb;
}

.code-tabs button.active {
  background: white;
  color: #2563eb;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.project-activation {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.project-activation h3 {
  margin: 0 0 1rem 0;
  color: #1e293b;
  font-weight: 600;
}

.input-group {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.project-path-input,
.pattern-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.875rem;
}

.project-path-input:focus,
.pattern-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.project-info {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.project-info h3 {
  margin: 0 0 1rem 0;
  color: #1e293b;
  font-weight: 600;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.info-item {
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: 0.375rem;
  border: 1px solid #e2e8f0;
}

.info-item strong {
  color: #374151;
}

.symbols-overview {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.symbols-overview h3 {
  margin: 0 0 1rem 0;
  color: #1e293b;
  font-weight: 600;
}

.symbols-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.symbol-item {
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 1rem;
  background: #f8fafc;
}

.symbol-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.symbol-kind {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  border-radius: 0.25rem;
  background: #e2e8f0;
  color: #475569;
}

.symbol-kind.class {
  background: #dbeafe;
  color: #1d4ed8;
}

.symbol-kind.function {
  background: #dcfce7;
  color: #166534;
}

.symbol-kind.method {
  background: #fef3c7;
  color: #92400e;
}

.symbol-location {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.75rem;
  color: #6b7280;
  margin-left: auto;
}

.symbol-docs {
  color: #6b7280;
  font-style: italic;
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: white;
  border-radius: 0.25rem;
  border-left: 3px solid #e2e8f0;
}

.symbol-children {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
}

.child-symbol {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

.symbols-more {
  text-align: center;
  color: #6b7280;
  font-style: italic;
  padding: 1rem;
}

.code-search {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.search-section {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.search-section h3 {
  margin: 0 0 1rem 0;
  color: #1e293b;
  font-weight: 600;
}

.pattern-results {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.pattern-results h3 {
  margin: 0 0 1rem 0;
  color: #1e293b;
  font-weight: 600;
}

.pattern-file {
  margin-bottom: 1.5rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  overflow: hidden;
}

.pattern-file h4 {
  margin: 0;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.pattern-matches {
  padding: 1rem;
}

.pattern-match {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background: #f8fafc;
  border-radius: 0.25rem;
}

.line-number {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 600;
  min-width: 80px;
}

.match-text {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 0.875rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
  overflow-x: auto;
  flex: 1;
}

.code-memories {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.code-memories h3 {
  margin: 0 0 1rem 0;
  color: #1e293b;
  font-weight: 600;
}

@media (max-width: 480px) {
  .app-nav button {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  .input-group {
    flex-direction: column;
    align-items: stretch;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .pattern-match {
    flex-direction: column;
    gap: 0.5rem;
  }

  .line-number {
    min-width: auto;
  }
}