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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

/* Header */
header {
  background: #1a1a2e;
  color: #fff;
  padding: 1rem 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.3rem;
  font-weight: 600;
}

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

/* Buttons */
.btn {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.85;
}

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

.btn-primary {
  background: #4361ee;
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid #fff;
  color: #fff;
}

.btn-sm {
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  border-color: #ccc;
  color: #666;
}

/* Login */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  background: #fff;
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-card h1 {
  font-size: 1.8rem;
  margin-bottom: 0.2rem;
}

.login-card .subtitle {
  color: #666;
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1rem;
  text-align: left;
}

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

.form-group input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: #4361ee;
}

.login-card .btn {
  width: 100%;
  margin-top: 1rem;
  padding: 0.75rem;
}

.error-msg {
  color: #e63946;
  font-size: 0.85rem;
  margin-top: 0.8rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #e0e0e0;
}

.tab {
  padding: 0.7rem 1.5rem;
  background: none;
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
}

.tab.active {
  color: #4361ee;
  border-bottom-color: #4361ee;
}

.tab:hover {
  color: #4361ee;
}

/* Search */
.search-section {
  background: #fff;
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
}

.tab-content {
  display: none;
}

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

.input-row {
  display: flex;
  gap: 0.8rem;
}

.input-row input {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
}

.input-row input:focus {
  outline: none;
  border-color: #4361ee;
}

.options-row {
  margin-top: 1rem;
  padding-top: 0.8rem;
  border-top: 1px solid #eee;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: #555;
  cursor: pointer;
}

.toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Result */
.result-area {
  background: #fff;
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
}

.result-area h3 {
  margin-bottom: 1rem;
  font-size: 1rem;
  color: #333;
}

.result-card {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 1rem;
}

.result-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f5f5f5;
}

.result-row:last-child {
  border-bottom: none;
}

.result-row .label {
  font-weight: 500;
  font-size: 0.85rem;
  color: #666;
  min-width: 70px;
}

.result-row .value {
  font-size: 0.9rem;
  word-break: break-all;
}

.result-extra {
  margin-top: 0.8rem;
  font-size: 0.85rem;
  color: #666;
  white-space: pre-wrap;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-queued {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-processing {
  background: #fef3c7;
  color: #b45309;
}

.badge-finish {
  background: #d1fae5;
  color: #065f46;
}

.badge-failed {
  background: #fee2e2;
  color: #b91c1c;
}

/* History */
.history-section {
  background: #fff;
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

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

.history-header h3 {
  font-size: 1rem;
}

.history-list {
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.8rem;
  border: 1px solid #f0f0f0;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background 0.15s;
}

.history-item:hover {
  background: #f8f9fa;
}

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

.history-item .query {
  font-weight: 500;
  font-size: 0.9rem;
}

.history-item .meta {
  font-size: 0.75rem;
  color: #888;
}

.empty-state {
  text-align: center;
  color: #999;
  padding: 1.5rem;
  font-size: 0.9rem;
}

/* Queue Status */
.queue-status-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.queue-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem;
}

.queue-card h4 {
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

.queue-card .queue-name {
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 0.8rem;
  font-family: monospace;
}

.queue-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.queue-stats .stat {
  font-size: 0.8rem;
  color: #555;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
  .header-content {
    padding: 0;
  }

  header h1 {
    font-size: 1.1rem;
  }

  .input-row {
    flex-direction: column;
  }

  .tabs {
    overflow-x: auto;
  }
}
