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

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 2rem;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
}

.nav-item:hover {
  background: var(--bg-input);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary);
  color: white;
}

.nav-item.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Main Content */
.main {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
}

.header {
  margin-bottom: 2rem;
}

.header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.header p {
  color: var(--text-muted);
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.card h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Form */
.input-group {
  display: flex;
  gap: 0.75rem;
}

.input-group input {
  flex: 1;
  padding: 0.875rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  color: var(--text);
  font-size: 1rem;
}

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

.input-group input::placeholder {
  color: var(--text-muted);
}

.input-group button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.input-group button:hover {
  background: var(--primary-dark);
}

.input-group button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Active Scan */
.scan-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.btn-cancel {
  padding: 0.5rem 1rem;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.scan-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.scan-url {
  color: var(--primary);
  font-weight: 500;
}

.scan-status {
  color: var(--warning);
  font-size: 0.875rem;
}

.progress-bar {
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  text-align: center;
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.logs {
  margin-top: 1rem;
  background: var(--bg);
  border-radius: 0.5rem;
  padding: 1rem;
  max-height: 200px;
  overflow-y: auto;
}

.logs-content {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
}

/* History */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg);
  border-radius: 0.5rem;
  border: 1px solid var(--border);
}

.history-item-info {
  flex: 1;
}

.history-item-url {
  font-weight: 500;
  margin-bottom: 0.25rem;
  word-break: break-all;
}

.history-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

.btn-view {
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
}

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

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-completed {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
}

.status-running {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.status-failed {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* Responsive */
@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    padding: 1rem;
    align-items: center;
  }

  .nav {
    flex-direction: row;
    flex: 1;
    justify-content: center;
  }

  .sidebar-footer {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  .main {
    padding: 1rem;
  }

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