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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f5f7fa;
  color: #333;
}

/* Pages */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* Login Page */
.login-container {
  max-width: 400px;
  margin: 100px auto;
  padding: 40px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.login-container h1 {
  text-align: center;
  margin-bottom: 30px;
  color: #2c3e50;
}

/* Navbar */
.navbar {
  background: #2c3e50;
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: bold;
}

.nav-menu {
  display: flex;
  gap: 2rem;
}

.nav-link {
  color: #ecf0f1;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background 0.3s;
}

.nav-link:hover {
  background: rgba(255,255,255,0.1);
}

.nav-link.active {
  background: rgba(255,255,255,0.2);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2rem;
}

/* Tab Content */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

/* Cards */
.card {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  margin-bottom: 2rem;
}

.card h3 {
  margin-bottom: 1rem;
  color: #2c3e50;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #555;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.input-field {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s;
}

.btn-primary {
  background: #3498db;
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-secondary {
  background: #95a5a6;
  color: white;
  margin-left: 0.5rem;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.btn-success {
  background: #27ae60;
  color: white;
}

.btn-warning {
  background: #f39c12;
  color: white;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: #ecf0f1;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

th {
  font-weight: 600;
  color: #2c3e50;
}

tbody tr:hover {
  background: #f8f9fa;
}

/* Model List */
.model-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.model-info {
  flex: 1;
}

.model-name {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0.25rem;
}

.model-details {
  font-size: 0.9rem;
  color: #7f8c8d;
}

.model-actions {
  display: flex;
  gap: 0.5rem;
}

/* Pull Model Form */
.pull-model-form {
  display: flex;
  gap: 1rem;
}

.pull-model-form input {
  flex: 1;
}

/* Progress Bar */
.progress-container {
  margin: 1rem 0;
}

.progress-bar {
  width: 100%;
  height: 30px;
  background: #ecf0f1;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3498db, #2ecc71);
  transition: width 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.progress-text {
  margin-top: 0.5rem;
  color: #7f8c8d;
  font-size: 0.9rem;
}

/* Messages */
.error-message {
  color: #e74c3c;
  margin-top: 1rem;
  padding: 0.75rem;
  background: #fadbd8;
  border-radius: 4px;
  display: none;
}

.error-message.show {
  display: block;
}

.success-message {
  color: #27ae60;
  margin-top: 1rem;
  padding: 0.75rem;
  background: #d4edda;
  border-radius: 4px;
  display: none;
}

.success-message.show {
  display: block;
}

/* Status Indicators */
.status-online {
  color: #27ae60;
  font-weight: bold;
}

.status-offline {
  color: #e74c3c;
  font-weight: bold;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge-active {
  background: #d4edda;
  color: #27ae60;
}

.badge-inactive {
  background: #f8d7da;
  color: #e74c3c;
}

.badge-admin {
  background: #cce5ff;
  color: #004085;
}

.badge-user {
  background: #e2e3e5;
  color: #383d41;
}

/* API Key Display */
.api-key-display {
  font-family: 'Courier New', monospace;
  background: #f8f9fa;
  padding: 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
  word-break: break-all;
}

/* Code Block */
pre {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
}

code {
  font-family: 'Courier New', monospace;
}

/* Loading */
.loading {
  text-align: center;
  padding: 2rem;
  color: #7f8c8d;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: #7f8c8d;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Chat Playground */
.playground-header {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 600px;
  padding: 0;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.empty-chat-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  
  .playground-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .chat-container {
    height: 500px;
  }
  
  .chat-input-container {
    flex-direction: column;
  }
  
  .chat-input-container .btn {
    width: 100%;
  }
  height: 100%;
  color: #7f8c8d;
}

.empty-chat-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.chat-message {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  animation: fadeIn 0.3s ease-in;
}

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

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.message-avatar.user {
  background: #3498db;
  color: white;
}

.message-avatar.assistant {
  background: #2ecc71;
  color: white;
}

.message-content {
  flex: 1;
  background: white;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.6;
}

.message-content p {
  margin: 0 0 0.5rem 0;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content code {
  background: #f4f4f4;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.message-content pre {
  background: #2c3e50;
  color: #ecf0f1;
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 0.5rem 0;
}

.message-loading {
  display: inline-block;
}

.message-loading::after {
  content: '...';
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%, 100% {
    content: '...';
  }
}

.chat-input-container {
  padding: 1rem;
  background: white;
  border-top: 1px solid #e0e0e0;
  display: flex;
  gap: 1rem;
}

.chat-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  resize: none;
  min-height: 60px;
}

.chat-input:focus {
  outline: none;
  border-color: #3498db;
}

.chat-input-container .btn {
  align-self: flex-end;
  min-width: 100px;
}

.message-role {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 1rem;
  }
  
  .nav-menu {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }
  
  .tab-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .pull-model-form {
    flex-direction: column;
  }
  
  table {
    font-size: 0.9rem;
  }
  
  th, td {
    padding: 0.5rem;
  }
}

/* Workflow Builder */
.workflow-components-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.component-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.components-container {
  min-height: 200px;
}

.empty-components {
  text-align: center;
  padding: 3rem;
  color: #7f8c8d;
}

.workflow-component {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 1rem;
  margin-bottom: 1rem;
  position: relative;
}

.component-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.component-type-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: #3498db;
  color: white;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.component-actions {
  display: flex;
  gap: 0.5rem;
}

.component-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.component-body input,
.component-body textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
}

.component-body textarea {
  min-height: 100px;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
}

.workflow-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.workflow-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.workflow-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.webhook-url-display {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.webhook-url-display code {
  flex: 1;
  background: #f4f4f4;
  padding: 0.5rem;
  border-radius: 4px;
  word-break: break-all;
}

.execution-item {
  padding: 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  margin-bottom: 0.75rem;
  background: #f8f9fa;
}

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

.execution-data {
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  background: white;
  padding: 0.75rem;
  border-radius: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
}

