/* Visual TOM MCP Server - Test Interface Styles */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --danger-color: #dc2626;
  --danger-hover: #b91c1c;
  --success-color: #16a34a;
  --warning-color: #d97706;
  --bg-color: #f8fafc;
  --bg-dark: #1e293b;
  --border-color: #e2e8f0;
  --text-color: #334155;
  --text-muted: #64748b;
  --sidebar-width: 300px;
  --header-height: 80px;
  --response-height: 250px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: white;
  border-bottom: 1px solid var(--border-color);
  min-height: var(--header-height);
  flex-wrap: wrap;
  gap: 1rem;
}

.header-title {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.header-title h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--bg-dark);
}

.version {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.connection-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.api-key-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.api-key-group label {
  font-weight: 500;
  white-space: nowrap;
}

.api-key-group input {
  width: 280px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.875rem;
}

.api-key-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-color);
  border-radius: 6px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.status-indicator.connected {
  background-color: var(--success-color);
  box-shadow: 0 0 8px var(--success-color);
}

.status-indicator.connecting {
  background-color: var(--warning-color);
  animation: pulse 1s ease-in-out infinite;
}

.status-indicator.error {
  background-color: var(--danger-color);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Buttons */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

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

.btn-secondary:hover:not(:disabled) {
  background-color: var(--border-color);
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--danger-hover);
}

.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.btn-icon {
  padding: 0.5rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
}

.btn-icon:hover {
  background: var(--bg-color);
}

/* Main Content */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Tools Sidebar */
.tools-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: white;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.sidebar-header input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.875rem;
}

.sidebar-header input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.sidebar-header input:disabled {
  background-color: var(--bg-color);
}

.tools-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.tool-item {
  padding: 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 0.25rem;
  transition: background-color 0.15s;
}

.tool-item:hover {
  background-color: var(--bg-color);
}

.tool-item.selected {
  background-color: rgba(37, 99, 235, 0.1);
  border-left: 3px solid var(--primary-color);
}

.tool-item-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-color);
  word-break: break-word;
}

.tool-item-method {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  margin-right: 0.5rem;
}

.method-get {
  background-color: #dbeafe;
  color: #1d4ed8;
}
.method-post {
  background-color: #dcfce7;
  color: #16a34a;
}
.method-put {
  background-color: #fef3c7;
  color: #d97706;
}
.method-delete {
  background-color: #fee2e2;
  color: #dc2626;
}
.method-patch {
  background-color: #f3e8ff;
  color: #9333ea;
}

/* Tool Panel */
.tool-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: white;
}

.tool-details {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  overflow-y: auto;
  max-height: 200px;
}

.tool-details h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tool-details .description {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.tool-details .path-info {
  font-family: monospace;
  font-size: 0.8rem;
  background: var(--bg-color);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  color: var(--text-muted);
}

.tool-form-container {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.tool-form-container h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Form Fields */
.form-field {
  margin-bottom: 1rem;
}

.form-field label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.form-field label .required {
  color: var(--danger-color);
  margin-left: 0.25rem;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: inherit;
}

.form-field textarea {
  min-height: 80px;
  resize: vertical;
  font-family: monospace;
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-field .field-description {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-field .field-type {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: monospace;
  margin-left: 0.5rem;
}

.form-field-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-field-checkbox input {
  width: auto;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

/* Response Area */
.response-area {
  height: var(--response-height);
  min-height: var(--response-height);
  background: var(--bg-dark);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
}

.response-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #334155;
}

.response-header h3 {
  font-size: 0.875rem;
  font-weight: 500;
}

.response-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#responseTime {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.response-output {
  flex: 1;
  padding: 1rem;
  overflow: auto;
  font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.response-output.error {
  background-color: rgba(220, 38, 38, 0.1);
  border-left: 3px solid var(--danger-color);
}

.response-output.success {
  border-left: 3px solid var(--success-color);
}

/* Placeholder Text */
.placeholder-text {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: 2rem;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: calc(var(--response-height) + 1rem);
  right: 1rem;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-error {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger-color);
}

.toast-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
}

.toast-close:hover {
  opacity: 1;
}

/* Nested Object/Array Fields */
.nested-fields {
  margin-left: 1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border-color);
  margin-top: 0.5rem;
}

.array-item {
  position: relative;
  padding: 0.75rem;
  background: var(--bg-color);
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.array-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.array-item-index {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.btn-remove-item {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  color: var(--danger-color);
}

.btn-remove-item:hover {
  background: #fee2e2;
}

.btn-add-item {
  margin-top: 0.5rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.response-output::-webkit-scrollbar-thumb {
  background: #475569;
}

.response-output::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Responsive */
@media (max-width: 1024px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .connection-controls {
    width: 100%;
  }

  .api-key-group input {
    flex: 1;
    min-width: 200px;
  }
}

@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
  }

  .tools-sidebar {
    width: 100%;
    min-width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  :root {
    --response-height: 200px;
  }
}
