/* ClearNextAI — UK Edition Styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-light: #eef2ff;
  --accent: #10b981;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --white: #ffffff;
  --error: #dc2626;
  --success: #16a34a;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* LAYOUT */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* HEADER */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.hero h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.02em;
}

.hero .sub {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 4px;
}

/* CARD */
.card {
  background: var(--white);
  border-radius: 16px;
  padding: 28px;
  border: 1.5px solid var(--border);
  box-shadow: 0 1px 8px rgba(0,0,0,0.04);
}

/* FORM ELEMENTS */
.label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
  margin-top: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background: white;
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.select:focus { border-color: var(--brand); }

.textarea {
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border 0.2s;
  line-height: 1.6;
  color: var(--text);
  background: white;
  margin-top: 6px;
}

.textarea:focus { border-color: var(--brand); }

/* BUTTONS */
.primary-btn {
  display: inline-block;
  padding: 13px 28px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  margin-top: 16px;
  box-shadow: 0 4px 12px rgba(79,70,229,0.3);
}

.primary-btn:hover { background: var(--brand-dark); transform: translateY(-1px); }

.secondary-btn {
  display: inline-block;
  padding: 9px 18px;
  background: white;
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.secondary-btn:hover { border-color: var(--brand); color: var(--brand); }

/* STATES */
.loading {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
}

.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--error);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-top: 12px;
}

.hidden { display: none !important; }

/* RESULTS */
.results { margin-top: 28px; }

.result-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.result-block {
  background: var(--bg);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.result-block h2 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.result-block p, .result-block li {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
}

.result-block ul {
  padding-left: 18px;
}

.result-block ul li {
  margin-bottom: 6px;
}

/* PRIORITY ITEMS */
.priority-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.priority-item:last-child { border-bottom: none; }

.priority-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 800;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.priority-content h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 3px;
}

.priority-content p {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ACTION ITEMS */
.action-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.action-item:last-child { border-bottom: none; }

.action-item::before {
  content: '→';
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* CONFIDENCE */
.confidence-wrap { text-align: center; }

.confidence-score {
  font-size: 3rem;
  font-weight: 800;
  color: var(--brand);
  margin: 8px 0;
}

.confidence-note {
  font-size: 0.8rem;
  color: var(--muted);
}

/* HISTORY */
.history-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 20px;
  align-items: start;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 600px;
  overflow-y: auto;
}

.history-item {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  width: 100%;
}

.history-item:hover { border-color: var(--brand); }

.history-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.8rem;
}

.history-item p {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-item small {
  font-size: 0.7rem;
  color: #9ca3af;
  display: block;
  margin-top: 6px;
}

.history-detail {
  font-size: 0.875rem;
}

/* RESPONSIVE */
@media (max-width: 640px) {
  .history-grid { grid-template-columns: 1fr; }
  .hero { flex-direction: column; }
  .card { padding: 20px; }
}
