/* ─── Reset & Base ────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', Arial, sans-serif;
  background: #f5f5f5;
  color: #222;
  padding: 2rem 1.5rem;
  min-height: 100vh;
}

/* ─── Wrapper ─────────────────────────────────────────────────────── */
.wrapper {
  max-width: 960px;
  margin: 0 auto;
}

/* ─── Title ───────────────────────────────────────────────────────── */
h1 {
  text-align: center;
  font-size: 1.9rem;
  font-weight: 800;
  color: #111;
  margin-bottom: 1.75rem;
}

/* ─── Upload Section ──────────────────────────────────────────────── */
.upload-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.upload-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  width: 100%;
  max-width: 420px;
  border: 2px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #555;
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.upload-box:hover,
.upload-box-selected {
  border-color: #2563eb;
  color: #2563eb;
}

/* ─── Buttons ─────────────────────────────────────────────────────── */
.btn-primary {
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 1.75rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.btn-primary:disabled {
  background: #93c5fd;
  cursor: not-allowed;
}

.btn-ask {
  background: #16a34a;
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-ask:hover:not(:disabled) {
  background: #15803d;
}

.btn-ask:disabled {
  background: #86efac;
  cursor: not-allowed;
}

.btn-copy {
  background: #f3f4f6;
  color: #555;
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-copy:hover {
  background: #e5e7eb;
  color: #111;
}

.btn-copy.copied {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

.btn-clear {
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid #fca5a5;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-clear:hover {
  background: #fecaca;
}

/* ─── Card ────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
}

/* ─── Two Column Grid ─────────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}

/* ─── Image ───────────────────────────────────────────────────────── */
.result-img {
  width: 100%;
  border-radius: 6px;
  display: block;
}

/* ─── Info List ───────────────────────────────────────────────────── */
.info-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.info-label {
  font-weight: 700;
  color: #2563eb;
}

.info-achievements {
  padding-left: 1.2rem;
  color: #444;
  font-size: 0.85rem;
  line-height: 1.7;
}

/* ─── Q&A Input ───────────────────────────────────────────────────── */
.qa-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  font-family: inherit;
  color: #222;
  outline: none;
  transition: border-color 0.2s;
}

.qa-input:focus {
  border-color: #2563eb;
}

/* ─── Answer Box ──────────────────────────────────────────────────── */
.answer-box {
  border: 1px solid #d1d5db;
  border-left: 4px solid #2563eb;
  background: #f8faff;
  border-radius: 6px;
  padding: 0.9rem 1rem;
  font-size: 0.875rem;
  color: #333;
  line-height: 1.65;
  margin-top: 0.75rem;
}

/* ─── Section heading ─────────────────────────────────────────────── */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #111;
  margin-bottom: 0.75rem;
}

/* ─── Error Card ──────────────────────────────────────────────────── */
.error-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #fff5f5;
  border: 1px solid #fca5a5;
  border-left: 4px solid #dc2626;
  border-radius: 6px;
  padding: 0.9rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  max-width: 540px;
}

/* ─── Loading Overlay ─────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-overlay.hidden {
  display: none;
}

.loading-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 2rem 2.5rem;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.loading-text {
  font-weight: 700;
  color: #111;
  font-size: 0.95rem;
}

.loading-subtext {
  color: #888;
  font-size: 0.8rem;
}

/* ─── History Panel ───────────────────────────────────────────────── */
.history-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.25rem;
  margin-top: 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.history-panel.hidden {
  display: none;
}

.history-item {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.65rem;
  font-size: 0.83rem;
  background: #fafafa;
}

.history-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 0.35rem;
}

.history-celeb {
  font-weight: 700;
  color: #2563eb;
}

.history-question {
  color: #555;
  margin-bottom: 0.2rem;
}

.history-answer {
  color: #333;
  line-height: 1.55;
}

/* ─── Divider between form and answer ────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 0.75rem 0;
}