/* ===== CSS Variables ===== */
:root[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --accent: #e5a00c;
  --accent-hover: #f0b73a;
  --accent-light: rgba(229, 160, 12, 0.1);
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #ca8a04;

  /* Glass effect */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: rgba(0, 0, 0, 0.1);
  --glass-blur: 20px;
}

:root[data-theme="dark"] {
  --bg-primary: #0a0a0f;
  --bg-secondary: #141419;
  --text-primary: #f5f5f5;
  --text-secondary: #b8b8b8;
  --text-muted: #787878;
  --accent: #e5a00c;
  --accent-hover: #f0b73a;
  --accent-light: rgba(229, 160, 12, 0.15);
  --success: #3dd68c;
  --danger: #ff6b6b;
  --warning: #ffc93c;

  /* Glass effect */
  --glass-bg: rgba(20, 20, 25, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: rgba(0, 0, 0, 0.3);
  --glass-blur: 20px;
}

/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Animated gradient background */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 20% 50%, rgba(229, 160, 12, 0.15) 0%, transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(124, 58, 237, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 40% 20%, rgba(37, 99, 235, 0.1) 0%, transparent 50%);
  animation: gradientShift 20s ease infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes gradientShift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(5%, 5%) rotate(120deg); }
  66% { transform: translate(-5%, 5%) rotate(240deg); }
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Liquid Glass Card Effect ===== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 8px 32px var(--glass-shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transition: left 0.5s;
}

.glass-card:hover::before {
  left: 100%;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 48px var(--glass-shadow);
  border-color: rgba(229, 160, 12, 0.3);
}

.glass-card-inner {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
}

/* ===== Header ===== */
.glass-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 16px var(--glass-shadow);
}

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

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

.logo-icon {
  color: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.logo-text {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.logo-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

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

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
  transform: scale(1.05);
}

/* ===== Main Content ===== */
.main-content {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  flex: 1;
}

/* ===== Sidebar ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: fit-content;
  position: sticky;
  top: 100px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.nav-item:hover {
  background: var(--accent-light);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(229, 160, 12, 0.3);
}

.nav-item svg {
  flex-shrink: 0;
}

/* ===== Stats Card ===== */
.stats-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ===== Content Area ===== */
.content-area {
  min-height: 600px;
}

.panel-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

/* ===== Dashboard ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.dashboard-card {
  padding: 24px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--glass-border);
}

.card-header svg {
  color: var(--accent);
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.badge {
  background: var(--accent-light);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.list-item {
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  transition: all 0.2s;
  cursor: pointer;
}

.list-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent);
  transform: translateX(4px);
}

.item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.item-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.running {
  background: rgba(61, 214, 140, 0.2);
  color: var(--success);
}

.status-badge.completed {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
}

.status-badge.pending {
  background: rgba(255, 193, 7, 0.2);
  color: var(--warning);
}

.verdict-badge {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent);
}

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

.status-dot.active {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-dot.inactive {
  background: var(--text-muted);
}

.agent-icon {
  font-size: 16px;
}

.model-name {
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 11px;
}

/* ===== Assistant Panel ===== */
.assistant-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pause-control {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.pause-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.pause-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.pause-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.pending-count {
  font-size: 13px;
  color: var(--text-muted);
}

.action-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.action-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.action-btn.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
}

.input-card {
  padding: 24px;
}

.analysis-input {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  transition: all 0.2s;
}

.analysis-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

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

.input-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.domain-select {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.domain-select:hover {
  border-color: var(--accent);
}

.domain-select:focus {
  outline: none;
  border-color: var(--accent);
}

.run-btn {
  padding: 12px 32px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(229, 160, 12, 0.3);
}

.run-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(229, 160, 12, 0.4);
}

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

/* ===== Process Card ===== */
.process-card {
  padding: 24px;
}

.process-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.process-stage {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.process-status {
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 12px;
  background: var(--accent-light);
}

.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: 4px;
  transition: width 0.3s ease;
  box-shadow: 0 0 12px rgba(229, 160, 12, 0.5);
}

.process-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.detail-icon {
  font-size: 18px;
}

/* ===== Debate Rounds ===== */
.debate-rounds {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.debate-round {
  padding: 20px;
}

.debate-round.hidden {
  display: none;
}

.round-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.round-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.round-number {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 12px;
  background: var(--accent-light);
}

.round-role {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.confidence-bar {
  position: relative;
  width: 120px;
  height: 24px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  overflow: hidden;
}

.confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), #3dd68c);
  transition: width 0.3s ease;
}

.confidence-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.round-position {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.round-arguments {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-border);
}

.arguments-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.argument-item {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.argument-marker {
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}

.view-history-btn {
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed var(--glass-border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.view-history-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* ===== Verdict Card ===== */
.verdict-card {
  padding: 24px;
}

.verdict-card.accent-border {
  border-color: var(--accent);
  box-shadow: 0 8px 32px rgba(229, 160, 12, 0.2);
}

.verdict-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.verdict-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.verdict-result {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.verdict-confidence {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--text-secondary);
}

.confidence-badge {
  font-size: 18px;
  font-weight: 700;
  color: var(--success);
}

/* ===== Placeholder ===== */
.placeholder-page {
  padding: 60px 40px;
  text-align: center;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.placeholder-text {
  font-size: 16px;
  color: var(--text-muted);
  margin-top: 16px;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .header-content {
    padding: 12px 16px;
  }

  .logo-subtitle {
    display: none;
  }

  .main-content {
    padding: 16px;
    gap: 16px;
  }

  .panel-title {
    font-size: 24px;
  }
}
