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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 30px;
}

header h1 {
  color: #1a73e8;
  margin-bottom: 5px;
}

.subtitle {
  color: #666;
}

/* Sections */
section {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

section h2 {
  color: #333;
  margin-bottom: 15px;
  font-size: 1.2rem;
  border-bottom: 2px solid #1a73e8;
  padding-bottom: 8px;
}

/* Form styles */
.input-group {
  margin-bottom: 15px;
}

.input-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  resize: vertical;
  font-family: inherit;
}

textarea:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

/* Button styles */
button {
  background-color: #1a73e8;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s;
}

button:hover {
  background-color: #1557b0;
}

button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.btn-loader {
  margin-left: 8px;
}

/* Result section */
.result-content {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 400px;
  overflow-y: auto;
}

.result-meta {
  margin-top: 10px;
  font-size: 12px;
  color: #666;
}

/* Error section */
.error-section {
  background: #fef2f2;
  border-left: 4px solid #ef4444;
}

.error-content {
  color: #dc2626;
}

/* History section */
.history-list {
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.history-item:hover {
  background-color: #f3f4f6;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.history-item-time {
  font-size: 12px;
  color: #666;
}

.history-item-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
}

.history-item-status.success {
  background: #dcfce7;
  color: #166534;
}

.history-item-status.error {
  background: #fef2f2;
  color: #dc2626;
}

.history-item-prompt {
  font-size: 14px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-meta {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
}

/* Logs section */
.logs-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.logs-filter select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.logs-filter button {
  padding: 8px 16px;
}

.logs-list {
  max-height: 400px;
  overflow-y: auto;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 12px;
}

.log-entry {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  display: flex;
  gap: 10px;
}

.log-entry:last-child {
  border-bottom: none;
}

.log-time {
  color: #888;
  white-space: nowrap;
}

.log-level {
  font-weight: bold;
  text-transform: uppercase;
  min-width: 50px;
}

.log-level.info {
  color: #1a73e8;
}
.log-level.warn {
  color: #f59e0b;
}
.log-level.error {
  color: #ef4444;
}
.log-level.debug {
  color: #8b5cf6;
}

.log-message {
  flex: 1;
  word-break: break-word;
}

.log-type {
  color: #666;
  font-style: italic;
}

/* Empty message */
.empty-message {
  color: #888;
  text-align: center;
  padding: 20px;
}

/* Loading message */
.loading-message {
  color: #666;
  text-align: center;
  padding: 40px 20px;
}

/* Error message in modal */
.error-message {
  color: #dc2626;
  text-align: center;
  padding: 20px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 8px;
  padding: 20px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
}

.modal-close:hover {
  color: #333;
  background: none;
}

.modal-content h3 {
  margin-bottom: 15px;
  color: #333;
}

.detail-section {
  margin-bottom: 15px;
}

.detail-section h4 {
  font-size: 14px;
  color: #666;
  margin-bottom: 5px;
}

.detail-section pre {
  background: #f8f9fa;
  padding: 10px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 12px;
}

/* Loading indicator */
.loading {
  opacity: 0.7;
  pointer-events: none;
}
