/**
 * MCP Modal Redesigned - Styles
 * Scalable layout for 100s of MCP servers
 */

/* ============================================================================
   LAYOUT STRUCTURE
   ============================================================================ */

.mcp-redesigned-layout {
  display: flex;
  height: 70vh;
  min-height: 500px;
}

/* Sidebar */
.mcp-sidebar {
  width: 250px;
  border-right: 1px solid #e9ecef;
  background: #f8f9fa;
  overflow-y: auto;
  padding: 16px;
  flex-shrink: 0;
}

.mcp-sidebar-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

/* Main Content */
.mcp-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 20px;
}

.mcp-toolbar {
  flex-shrink: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid #e9ecef;
  margin-bottom: 16px;
}

.mcp-servers-container {
  flex: 1;
  overflow-y: auto;
  padding-right: 8px;
}

/* ============================================================================
   SIDEBAR COMPONENTS
   ============================================================================ */

.mcp-sidebar-section {
  margin-bottom: 24px;
}

.mcp-sidebar-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #6c757d;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.mcp-sidebar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  color: #495057;
  text-decoration: none;
  font-size: 14px;
}

.mcp-sidebar-item:hover {
  background: #e9ecef;
  color: #212529;
  text-decoration: none;
}

.mcp-sidebar-item.active {
  background: #007bff;
  color: white;
}

.mcp-sidebar-item .badge {
  font-size: 11px;
  padding: 2px 6px;
}

.mcp-sidebar-item.active .badge {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white;
}

/* ============================================================================
   TOOLBAR COMPONENTS
   ============================================================================ */

.mcp-search-bar {
  position: relative;
}

.mcp-search-bar .bi-search {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #6c757d;
  pointer-events: none;
}

.mcp-search-bar input {
  padding-left: 40px;
  height: 44px;
  font-size: 15px;
  border: 2px solid #e9ecef;
  transition: border-color 0.2s;
}

.mcp-search-bar input:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.mcp-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mcp-view-toggle {
  flex-shrink: 0;
}

/* ============================================================================
   SERVER DISPLAY - CARD VIEW
   ============================================================================ */

.mcp-servers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.mcp-server-card {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 16px;
  background: white;
  transition: all 0.2s;
  animation: fadeIn 0.3s ease-out;
}

.mcp-server-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #007bff;
}

.mcp-server-card.enabled {
  border-left: 4px solid #28a745;
}

.mcp-server-card.disabled {
  opacity: 0.85;
}

.mcp-server-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
}

.mcp-server-title {
  flex: 1;
}

.mcp-server-name {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mcp-server-description {
  font-size: 13px;
  color: #6c757d;
  margin-bottom: 12px;
  line-height: 1.4;
}

.mcp-server-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0;
}

.mcp-server-meta .badge {
  font-size: 11px;
  padding: 3px 8px;
}

/* ============================================================================
   SERVER DISPLAY - LIST VIEW
   ============================================================================ */

.mcp-servers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mcp-server-list-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  background: white;
  transition: all 0.2s;
  gap: 16px;
}

.mcp-server-list-item:hover {
  background: #f8f9fa;
  border-color: #007bff;
}

.mcp-server-list-info {
  flex: 1;
  min-width: 200px;
}

.mcp-server-list-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.mcp-server-list-desc {
  font-size: 12px;
  color: #6c757d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mcp-server-list-stats {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: #6c757d;
  flex-shrink: 0;
}

/* ============================================================================
   SERVER DISPLAY - TABLE VIEW
   ============================================================================ */

.mcp-servers-table {
  width: 100%;
  background: white;
}

.mcp-servers-table th {
  background: #f8f9fa;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: #6c757d;
  padding: 12px;
  border-bottom: 2px solid #dee2e6;
}

.mcp-servers-table td {
  padding: 12px;
  border-bottom: 1px solid #e9ecef;
  vertical-align: middle;
}

.mcp-servers-table tbody tr:hover {
  background: #f8f9fa;
}

.mcp-servers-table td small {
  display: block;
  margin-top: 2px;
}

/* ============================================================================
   PAGINATION
   ============================================================================ */

.mcp-pagination {
  padding-top: 16px;
  border-top: 1px solid #e9ecef;
}

/* ============================================================================
   FILTER CHIPS
   ============================================================================ */

.mcp-filter-chips {
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
}

.mcp-filter-chips .badge {
  cursor: pointer;
  transition: all 0.2s;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
}

.mcp-filter-chips .badge:hover {
  background: #0056b3 !important;
  transform: translateY(-1px);
}

.mcp-filter-chips .badge .bi-x {
  font-size: 16px;
  font-weight: bold;
}

.mcp-filter-chips a {
  font-size: 13px;
}

.mcp-filter-chips a:hover {
  color: #0056b3 !important;
  text-decoration: underline !important;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

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

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
  .mcp-redesigned-layout {
    flex-direction: column;
  }

  .mcp-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e9ecef;
    max-height: 200px;
  }

  .mcp-servers-grid {
    grid-template-columns: 1fr;
  }

  .mcp-toolbar {
    padding: 12px;
  }

  .mcp-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .mcp-view-toggle {
    justify-content: center;
  }

  .mcp-server-list-item {
    flex-wrap: wrap;
  }

  .mcp-server-list-stats {
    width: 100%;
    justify-content: space-around;
  }
}

@media (max-width: 576px) {
  .mcp-sidebar {
    max-height: 150px;
    padding: 8px;
  }

  .mcp-sidebar-item {
    font-size: 13px;
    padding: 6px 10px;
  }

  .mcp-content {
    padding: 12px;
  }

  .mcp-search-bar input {
    height: 40px;
    font-size: 14px;
  }

  .mcp-server-card {
    padding: 12px;
  }
}

/* ============================================================================
   SCROLLBAR STYLING
   ============================================================================ */

.mcp-sidebar::-webkit-scrollbar,
.mcp-servers-container::-webkit-scrollbar {
  width: 8px;
}

.mcp-sidebar::-webkit-scrollbar-track,
.mcp-servers-container::-webkit-scrollbar-track {
  background: transparent;
}

.mcp-sidebar::-webkit-scrollbar-thumb,
.mcp-servers-container::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 4px;
}

.mcp-sidebar::-webkit-scrollbar-thumb:hover,
.mcp-servers-container::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

.mcp-servers-count {
  font-size: 14px;
  color: #6c757d;
}

.mcp-servers-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e9ecef;
}

/* Form switch sizing */
.mcp-server-card .form-check-input {
  width: 2.5rem;
  height: 1.25rem;
  cursor: pointer;
}

.mcp-server-list-item .form-check-input {
  width: 2.25rem;
  height: 1.125rem;
  cursor: pointer;
}

/* Tool section (keep existing styles) */
.mcp-server-card .border-top {
  margin-top: 12px;
  padding-top: 12px;
}

/* Empty state */
.mcp-servers-container .bi-inbox {
  opacity: 0.5;
}

/* Loading state */
.mcp-servers-container .spinner-border {
  width: 3rem;
  height: 3rem;
}
