/* Base Styles */
:root {
  --bg-primary: #0f0f13;
  --bg-secondary: #16161e;
  --bg-tertiary: #1c1c26;
  --text-primary: #f8f8f8;
  --text-secondary: #a0a0b0;
  --accent-primary: #9d4edd;
  --accent-secondary: #7b2cbf;
  --accent-tertiary: #5a189a;
  --glow-color: rgba(157, 78, 221, 0.5);
  --border-color: #2a2a35;
  --success-color: #4ade80;
  --warning-color: #facc15;
  --danger-color: #f87171;
  --info-color: #60a5fa;
  --card-bg: #1c1c26;
  --console-bg: #0d0d11;
  --header-height: 50px;
  --status-bar-height: 28px;
  --transition-speed: 0.2s;
  --border-radius: 6px;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  font-size: 14px;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
}

input, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
  width: 100%;
}

textarea {
  resize: vertical;
  min-height: 80px;
  font-family: var(--font-mono);
  font-size: 13px;
}

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

::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-tertiary);
}

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

/* Header Styles */
.header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  box-shadow: 0 0 10px var(--glow-color);
}

.logo-text {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator.online {
  background-color: var(--success-color);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.status-text {
  font-size: 12px;
  font-weight: 500;
}

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

/* Options Panel Styles */
.options-panel {
  width: 320px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-section {
  background-color: var(--bg-tertiary);
  border-radius: var(--border-radius);
  padding: 12px;
  border: 1px solid var(--border-color);
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Input Styles */
.input-group {
  margin-bottom: 12px;
}

.input-group.compact {
  margin-bottom: 8px;
}

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

.input-wrapper {
  background-color: var(--bg-secondary);
  border-radius: var(--border-radius);
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-wrapper:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 1px rgba(157, 78, 221, 0.2);
}

.help-text {
  color: var(--text-secondary);
  font-size: 11px;
  margin-top: 4px;
  display: block;
}

input[type="file"] {
  font-size: 12px;
  padding: 4px;
}

input[type="number"] {
  padding: 4px 8px;
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

/* Toggle Switch Styles */
.toggles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-group.compact label {
  font-size: 12px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-secondary);
  transition: .3s;
  border-radius: 34px;
  border: 1px solid var(--border-color);
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 2px;
  background-color: var(--text-secondary);
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-tertiary);
}

input:checked + .slider:before {
  transform: translateX(15px);
  background-color: white;
}

/* Button Styles */
.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--border-radius);
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s ease;
}

.btn svg {
  transition: transform 0.2s ease;
}

.btn:hover svg {
  transform: scale(1.1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
  color: white;
  box-shadow: 0 2px 8px rgba(157, 78, 221, 0.3);
  flex: 1;
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(157, 78, 221, 0.5);
  transform: translateY(-2px);
}

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

.btn-secondary:hover {
  background-color: var(--bg-secondary);
  border-color: var(--accent-primary);
}

.btn-small {
  padding: 4px 10px;
  font-size: 12px;
  background-color: var(--bg-tertiary);
  border-radius: 4px;
}

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

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

.btn-disabled:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--border-color);
  transform: none;
}

/* Console Panel Styles */
.console-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--console-bg);
  overflow: hidden;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.console-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
}

.console-actions {
  display: flex;
  gap: 8px;
}

.console-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.console-btn:hover {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

.console-content {
  flex: 1;
  padding: 12px 16px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 12px;
}

.log-entry {
  padding: 3px 0;
  display: flex;
  gap: 8px;
  line-height: 1.5;
}

.log-time {
  color: var(--text-secondary);
  white-space: nowrap;
}

.log-type {
  white-space: nowrap;
  font-weight: 500;
}

.log-entry.system .log-type {
  color: var(--accent-primary);
}

.log-entry.info .log-type {
  color: var(--info-color);
}

.log-entry.warning .log-type {
  color: var(--warning-color);
}

.log-entry.error .log-type {
  color: var(--danger-color);
}

.log-entry.success .log-type {
  color: var(--success-color);
}

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

.console-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.console-prompt {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-tertiary);
  border-radius: var(--border-radius);
  padding: 6px 12px;
  border: 1px solid var(--border-color);
}

.prompt-symbol {
  color: var(--accent-primary);
  font-weight: bold;
  font-family: var(--font-mono);
}

#console-input {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Status Bar Styles */
.status-bar {
  height: var(--status-bar-height);
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.status-item {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 16px;
}

.status-label {
  font-weight: 500;
}

.status-value {
  color: var(--text-primary);
}

/* Responsive Styles */
@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
  }
  
  .options-panel {
    width: 100%;
    height: 50%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .console-panel {
    height: 50%;
  }
}

@media (max-width: 480px) {
  .toggles-grid {
    grid-template-columns: 1fr;
  }
  
  .header-actions {
    gap: 8px;
  }
  
  .status-bar {
    overflow-x: auto;
    justify-content: space-between;
  }
  
  .status-item {
    margin-right: 8px;
    flex-shrink: 0;
  }
}

.file-input-wrapper {
  margin: 8px 0;
}

.file-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-label:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--accent-primary);
}

.file-label svg {
  color: var(--accent-primary);
}

input[type="file"] {
  display: none;
}

.send-toggle-group {
  margin-left: auto;
  padding-left: 20px;
}

#unload-tokens {
  margin-top: 8px;
  width: 100%;
  background-color: var(--bg-secondary);
  color: var(--danger-color);
  border: 1px solid var(--danger-color);
}

#unload-tokens:hover {
  background-color: var(--danger-color);
  color: white;
}