/* /root/mcp-server/public/css/components.css */

.card {
  background-color: var(--bg-card);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--glass-shadow);
  transition: all var(--transition-normal);
  min-width: 0;
}

a.card {
  color: var(--text-primary);
  text-decoration: none;
}

.card:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-glow);
  transform: translateY(-2px);
}

@media (hover: none) {
  .card:hover {
    transform: none;
  }
  .stat-card:hover {
    transform: none;
  }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0;
}

.card-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.stat-card {
  background-color: var(--bg-card);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(12px);
  box-shadow: var(--glass-shadow);
  transition: all var(--transition-normal);
  border-top: 3px solid transparent;
  border-image: var(--accent-gradient) 1;
  border-image-slice: 1 0 0 0;
}

.stat-card:hover {
  background-color: var(--bg-card-hover);
  transform: translateY(-2px);
}

.stat-card.danger {
  border-image: linear-gradient(135deg, #ef4444, #b91c1c) 1;
}
.stat-card.warning {
  border-image: linear-gradient(135deg, #f59e0b, #b45309) 1;
}
.stat-card.success {
  border-image: linear-gradient(135deg, #10b981, #047857) 1;
}

.btn {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(6, 182, 212, 0.8);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.1);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 14px;
  color: var(--text-primary);
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover td {
  background-color: rgba(99, 102, 241, 0.05);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr.destructive td {
  color: var(--accent-amber);
}
.data-table tbody tr.error td {
  color: var(--accent-red);
}

.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
}

.badge-admin {
  background-color: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.badge-user {
  background-color: rgba(6, 182, 212, 0.2);
  color: #67e8f9;
  border: 1px solid rgba(6, 182, 212, 0.3);
}
.badge-success {
  background-color: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-error {
  background-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-warning {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 20px;
}
@media (max-width: 640px) {
  .workflow-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}
.workflow-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}
.workflow-card h2 {
  font-size: 18px;
  color: var(--text-primary);
}
.workflow-description {
  color: var(--text-secondary);
  min-height: 48px;
}
.workflow-steps {
  color: var(--text-secondary);
  padding-left: 18px;
  flex: 1;
}
.workflow-steps li {
  margin-bottom: 6px;
}
.project-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  align-items: center;
}
@media (max-width: 640px) {
  .project-form {
    grid-template-columns: 1fr;
  }
}
.project-card h2 {
  font-size: 18px;
  margin-bottom: 6px;
}
.project-card p {
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.connection-url,
.connection-json {
  margin: 12px 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  overflow: auto;
  color: #c4b5fd;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.security-check h2 {
  font-size: 16px;
  text-transform: capitalize;
  margin-bottom: 8px;
}
.security-check p {
  color: var(--text-secondary);
}
.security-check.pass {
  border-left: 3px solid var(--accent-green);
}
.security-check.warning {
  border-left: 3px solid var(--accent-amber);
}
.security-check.fail {
  border-left: 3px solid var(--accent-red);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--transition-fast);
}

.modal {
  background-color: var(--bg-secondary);
  border: var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp var(--transition-normal);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
  .modal {
    padding: 20px;
    border-radius: var(--radius-lg);
    width: 95%;
    max-height: 85vh;
  }
}

@media (max-width: 480px) {
  .modal {
    padding: 16px;
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 80vh;
    animation: slideUpModal 0.3s ease;
  }

  .modal-overlay {
    align-items: flex-end;
  }
}

@keyframes slideUpModal {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.input-group {
  margin-bottom: 16px;
}

.input-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

.input-field {
  width: 100%;
  padding: 10px 14px;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.input-field:focus {
  border-color: var(--accent-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 768px) {
  .toast-container {
    top: auto;
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .toast {
    max-width: none;
  }
}

.toast {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  background-color: var(--bg-secondary);
  border: var(--glass-border);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  animation: slideInRight var(--transition-normal);
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
}

.toast.success {
  border-left: 3px solid var(--accent-green);
}
.toast.error {
  border-left: 3px solid var(--accent-red);
}
.toast.info {
  border-left: 3px solid var(--accent-cyan);
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring circle {
  transition: stroke-dashoffset 0.5s ease;
}

.progress-bar {
  height: 8px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
  width: 100%;
}

.progress-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent-gradient);
  transition: width 0.5s ease;
  animation: progressFill 1s ease-out;
}

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--radius-sm);
}

.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}

.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-bar .input-field {
  max-width: 240px;
}

@media (max-width: 768px) {
  .filter-bar {
    gap: 8px;
  }
  .filter-bar .input-field {
    max-width: none;
    flex: 1 1 calc(50% - 4px);
    min-width: 120px;
  }
}

@media (max-width: 480px) {
  .filter-bar .input-field {
    flex: 1 1 100%;
  }
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-dot.offline {
  background-color: var(--accent-red);
}

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.15) 0%, transparent 50%), var(--bg-primary);
  padding: 20px;
}

.login-card {
  max-width: 420px;
  width: 100%;
  background-color: var(--bg-card);
  padding: 40px;
  border-radius: var(--radius-xl);
  border: var(--glass-border);
  box-shadow:
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 40px rgba(99, 102, 241, 0.1);
  text-align: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: slideUp 0.5s ease;
}

.login-brand {
  margin-bottom: 16px;
}
.login-brand svg {
  width: 56px;
  height: 56px;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-form {
  text-align: left;
}

.login-footer {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Button variants */
.btn-full {
  width: 100%;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

@media (max-width: 768px) {
  .btn {
    padding: 12px 20px;
    font-size: 14px;
  }
  .btn-sm {
    padding: 8px 14px;
    font-size: 13px;
  }
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.input-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: block;
}

select.input-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Toast exit animation */
.toast-exit {
  animation: slideOutRight 0.3s ease forwards;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 0 0 0 8px;
  line-height: 1;
}

.toast-close:hover {
  color: var(--text-primary);
}

.toast.warning {
  border-left: 3px solid var(--accent-amber);
}

@keyframes slideOutRight {
  to {
    opacity: 0;
    transform: translateX(30px);
  }
}

/* Live badge */
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  background-color: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse 2s infinite;
}

/* Modal description */
.modal-description {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
}

/* Page subtitle */
.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* Data table wrapper for scrolling */
.table-wrapper {
  max-width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: var(--glass-border);
  background: var(--bg-card);
  -webkit-overflow-scrolling: touch;
}

/* A few legacy administration views place a table directly inside a card.
   Keep their horizontal scroll local on narrow devices too. */
.card:has(> .data-table) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .data-table thead th {
    padding: 10px 12px;
    font-size: 11px;
    white-space: nowrap;
  }

  .data-table tbody td {
    padding: 10px 12px;
    font-size: 13px;
  }

  .data-table {
    min-width: 600px;
  }
}

/* Scope pills */
.scope-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: 'Inter', monospace;
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-primary);
  border: 1px solid rgba(99, 102, 241, 0.2);
  margin: 1px 2px;
}

/* Row slide-in animation */
.row-new {
  animation: slideUp 0.3s ease;
}

/* Legacy and specialist administration pages remain routable during the
   compatibility window but are not part of the default navigation. */
.admin-nav {
  display: none !important;
}

/* AI connection onboarding */
.connect-readiness {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 14px 18px;
  margin-bottom: 20px;
  border: var(--glass-border);
  border-radius: var(--radius-md);
}
.connect-readiness.is-ready {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.55);
}
.connect-readiness.is-warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.55);
}
.connect-readiness span {
  color: var(--text-secondary);
}
.connect-flow,
.connect-platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.connect-flow > div {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}
.connect-flow strong,
.connect-flow span {
  display: block;
}
.connect-flow span {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 5px;
}
.connect-platform {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.connect-platform h2 {
  margin-bottom: 0;
}
.connect-platform .badge,
.connect-platform .btn {
  width: fit-content;
}
.connect-platform .btn {
  margin-top: auto;
}
.connect-steps {
  padding-left: 20px;
  color: var(--text-secondary);
}
.connect-steps li {
  margin: 8px 0;
}
.connect-code {
  margin: 2px 0 8px;
}
.connect-code {
  min-width: 0;
}
.connect-code .connection-json {
  max-width: 100%;
  max-height: 280px;
  overflow: auto;
  font-size: 12px;
}
.connection-url {
  max-width: 100%;
  overflow-wrap: anywhere;
}
.connect-warning {
  padding: 10px 12px;
  border-left: 3px solid var(--accent-amber);
  background: rgba(245, 158, 11, 0.1);
  color: var(--text-secondary);
  font-size: 13px;
}
.section-title {
  margin: 28px 0 14px;
}
.connect-faq li {
  margin: 8px 0;
}
@media (max-width: 700px) {
  .connect-readiness {
    flex-direction: column;
    gap: 5px;
  }
}

/* Form grid for operations page */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  align-items: end;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Responsive text helpers */
.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

/* List items for operations page */
.list-item {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 14px;
}

.list-item:last-child {
  border-bottom: none;
}

/* Section card spacing */
.card + .card {
  margin-top: 20px;
}

/* Responsive connect platform grid */
@media (max-width: 768px) {
  .connect-platform-grid {
    grid-template-columns: 1fr;
  }

  .connect-flow {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .connect-flow {
    grid-template-columns: 1fr;
  }
}

/* OAuth tabs responsive */
@media (max-width: 640px) {
  .oauth-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .oauth-tab {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* Scopes grid responsive */
@media (max-width: 480px) {
  .scopes-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Connection JSON responsive */
@media (max-width: 768px) {
  .connection-json {
    font-size: 11px;
    max-height: 200px;
  }
}

/* Page animation */
.main-content > *:first-child {
  animation: fadeInUp 0.25s ease-out;
}

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