/* CSC Web Frontend — Styles */
:root {
  --bg: #0f1419;
  --surface: #1a1f2e;
  --surface-hover: #232939;
  --border: #2d3548;
  --text: #e6e8eb;
  --text-dim: #8b95a5;
  --accent: #4fc3f7;
  --accent-hover: #29b6f6;
  --critical: #ff5252;
  --high: #ff9800;
  --medium: #ffc107;
  --low: #4fc3f7;
  --info: #78909c;
  --success: #66bb6a;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}
header h1 { font-size: 1.5rem; color: var(--accent); }
header .subtitle { color: var(--text-dim); font-weight: 400; font-size: 0.9rem; }

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-logout {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 4px;
  cursor: pointer;
}
.btn-logout:hover {
  border-color: var(--critical);
  color: var(--critical);
}

/* Status indicator */
.status-indicator {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--text-dim);
}
.status-indicator.ready { background: var(--success); color: #000; }
.status-indicator.warning { background: var(--medium); color: #000; }
.status-indicator.error { background: var(--critical); color: #fff; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card h2 { font-size: 1.1rem; margin-bottom: 0.75rem; color: var(--accent); }

.hidden { display: none !important; }

/* Tabs */
.tab-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}
.tab {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.tab:hover { border-color: var(--accent); color: var(--text); }
.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

/* Forms */
.scan-form { margin-top: 0.5rem; }
.form-group { margin-bottom: 0.75rem; }
.form-group label { display: block; font-size: 0.8rem; color: var(--text-dim); margin-bottom: 0.25rem; }
input[type="text"], input[type="password"], select {
  width: 100%; padding: 0.5rem 0.75rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: 4px;
  color: var(--text); font-size: 0.9rem;
}
input:focus, select:focus { outline: none; border-color: var(--accent); }

.form-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 0.75rem; }
.form-row .form-group { flex: 1; min-width: 150px; }
.checkbox-row { gap: 1.5rem; }

.checkbox { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; cursor: pointer; }

details { margin-bottom: 0.75rem; }
summary { cursor: pointer; font-size: 0.85rem; color: var(--text-dim); padding: 0.25rem 0; }
details[open] summary { color: var(--accent); }
details > *:not(summary) { padding-top: 0.5rem; }

button, .btn-secondary {
  padding: 0.5rem 1.25rem; border: none; border-radius: 4px;
  font-size: 0.9rem; cursor: pointer; transition: background 0.15s;
}
.scan-btn {
  background: var(--accent); color: var(--bg); font-weight: 600; width: 100%; margin-top: 0.5rem;
}
.scan-btn:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface-hover); color: var(--text); border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(79, 195, 247, 0.05);
}
.drop-zone p { margin: 0.25rem 0; }
.drop-zone .dim { font-size: 0.8rem; color: var(--text-dim); }

#file-info {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--bg);
  border-radius: 4px;
  font-size: 0.85rem;
}

.upload-buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  justify-content: center;
}

.btn-small {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

#zip-progress {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--bg);
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--accent);
  text-align: center;
}

/* Queue status */
#queue-status {
  padding: 0.75rem 1.25rem;
}
.queue-info {
  font-size: 0.85rem;
  color: var(--text-dim);
}
.queue-info span {
  color: var(--accent);
  font-weight: 600;
}

/* Progress */
#progress-bar-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
#progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}
#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 4px;
  transition: width 0.3s ease;
}
#progress-text {
  min-width: 4rem;
  text-align: right;
  font-weight: 600;
  color: var(--accent);
}

#progress-log {
  font-family: monospace; font-size: 0.8rem; color: var(--text-dim);
  max-height: 200px; overflow-y: auto;
}
#progress-log .event { padding: 0.2rem 0; }
#progress-log .event.error { color: var(--critical); }
#progress-log .event.warning { color: var(--medium); }

/* Summary cards */
.summary-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.summary-card {
  flex: 1; min-width: 120px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.75rem; text-align: center;
}
.summary-card .value { font-size: 1.5rem; font-weight: 700; }
.summary-card .label { font-size: 0.75rem; color: var(--text-dim); }

/* Severity badges */
.severity-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.badge {
  padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
}
.badge.CRITICAL { background: var(--critical); color: #fff; }
.badge.HIGH { background: var(--high); color: #000; }
.badge.MEDIUM { background: var(--medium); color: #000; }
.badge.LOW { background: var(--low); color: #000; }
.badge.INFO { background: var(--info); color: #fff; }

/* Toolbar */
.toolbar { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }

/* Findings table */
#findings-table {
  width: 100%; border-collapse: collapse; font-size: 0.82rem;
}
#findings-table th, #findings-table td {
  padding: 0.5rem 0.6rem; text-align: left; border-bottom: 1px solid var(--border);
}
#findings-table th {
  color: var(--text-dim); font-weight: 600; font-size: 0.75rem; text-transform: uppercase;
  position: sticky; top: 0; background: var(--surface);
}
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--accent); }

#findings-table tr:hover { background: var(--surface-hover); }
#findings-table tr.detail-row { background: var(--bg); }
#findings-table tr.detail-row td { padding: 0.75rem 1rem; font-size: 0.8rem; }
.detail-content { max-width: 900px; }
.detail-content pre {
  background: var(--surface); padding: 0.5rem; border-radius: 4px;
  overflow-x: auto; font-size: 0.78rem; margin: 0.25rem 0;
}
.detail-content dt { color: var(--text-dim); font-size: 0.75rem; margin-top: 0.4rem; }
.detail-content dd { margin-left: 0; margin-bottom: 0.2rem; }

/* Utilities */
.utility-bar { display: flex; gap: 0.5rem; align-items: flex-start; flex-wrap: wrap; }
#utility-output {
  width: 100%; font-family: monospace; font-size: 0.8rem; padding: 0.5rem;
  background: var(--bg); border-radius: 4px; margin-top: 0.5rem;
}
