@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #0f172a;
  --bg-gradient: radial-gradient(circle at top left, #1e293b, #0f172a);
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  background: var(--bg);
  background-image: var(--bg-gradient);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.navbar {
  width: 100%;
  padding: 20px 40px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.container {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 20px;
  display: grid;
  gap: 24px;
  width: 100%;
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 28px;
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 24px -1px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 8px 32px -1px rgba(0, 0, 0, 0.3);
}

h1, h2, h3 {
  margin-top: 0;
  color: var(--text-main);
  font-weight: 600;
}

h2 {
  font-size: 20px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

p {
  color: var(--text-muted);
  line-height: 1.6;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
  align-items: flex-start;
}

input[type="file"] {
  padding: 16px;
  border: 2px dashed var(--card-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
  width: 100%;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

input[type="file"]::file-selector-button {
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 10px 18px;
  border-radius: 8px;
  margin-right: 16px;
  cursor: pointer;
  transition: background 0.2s;
  font-weight: 500;
}

input[type="file"]::file-selector-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

input[type="file"]:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.02);
}

button, .button {
  border: 0;
  background: var(--accent);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: background 0.2s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button:hover, .button:hover {
  background: var(--accent-hover);
}

button:active, .button:active {
  transform: scale(0.98);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.button-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.hint {
  font-size: 13px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

th, td {
  text-align: left;
  border-bottom: 1px solid var(--card-border);
  padding: 14px 16px;
  font-size: 14px;
  vertical-align: middle;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.5px;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

td a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

td a:hover {
  text-decoration: underline;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status.queued {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.status.running {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.status.done {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status.error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.flash-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.flash {
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.flash.success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
}

.flash.error {
  background: var(--error-bg);
  color: var(--error);
  border-color: rgba(239, 68, 68, 0.3);
}

.hidden {
  display: none !important;
}

pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px;
  overflow-x: auto;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.5;
}

/* Detail page grid layout */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.detail-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-item strong {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.detail-item span {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-main);
}

/* Classification Grid */
.classification-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.classification-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: 1 1 auto;
  min-width: 180px;
  transition: transform 0.2s, background 0.2s;
}

.classification-card:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
}

.classification-card .label {
  color: var(--text-main);
  font-weight: 500;
  font-size: 14px;
}

.classification-card .count {
  background: var(--accent);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 13px;
}

.usage-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 16px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 150px;
}

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

.usage-card .value {
  color: var(--text-main);
  font-weight: 600;
  font-size: 18px;
}
