/*
 BookLens CSS
 Mobile-first, bright, minimalist. Font: Inter.
*/
:root{
  --bg:#f4f5fb;
  --panel:#ffffff;
  --muted:#6b7280;
  --text:#111827;
  --primary:#22c55e; /* soft green */
  --primary-soft:#dcfce7;
  --primary-strong:#16a34a;
  --accent:#38bdf8;  /* soft blue */
  --border:#e5e7eb;
  --shadow-soft:0 18px 45px rgba(15,23,42,0.08);
}
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:radial-gradient(circle at top, #eef2ff 0, #f9fafb 45%, #f4f5fb 100%);
  color:var(--text);
}

.app-header{
  position:sticky;
  top:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 16px;
  background:rgba(255,255,255,0.9);
  backdrop-filter:blur(12px);
  border-bottom:1px solid rgba(229,231,235,0.8);
  z-index:10;
}
.brand{ display:flex; gap:10px; align-items:center; }
.brand .logo{
  width:28px;
  height:28px;
  border-radius:999px;
  background:conic-gradient(from 160deg, #22c55e, #38bdf8, #a855f7, #22c55e);
  box-shadow:0 8px 18px rgba(56,189,248,0.35);
}
.app-header h1{ font-size:18px; margin:0; font-weight:700; letter-spacing:0.2px; color:#0f172a; }

.container{
  padding:20px 16px 24px;
  max-width:900px;
  margin:0 auto;
  display:flex;
  align-items:stretch;
  justify-content:center;
}
.panel{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:18px;
  padding:18px 16px 18px;
  box-shadow:var(--shadow-soft);
}
.stack{ display:flex; flex-direction:column; gap:12px; }
.center{ display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; }
.row{ display:flex; align-items:center; gap:8px; }

button{
  appearance:none;
  border-radius:999px;
  padding:12px 16px;
  font-weight:600;
  font-size:14px;
  line-height:1;
  border:1px solid rgba(148,163,184,0.4);
  background:#f9fafb;
  color:#0f172a;
  cursor:pointer;
  transition:
    background .16s ease,
    border-color .16s ease,
    box-shadow .16s ease,
    transform .04s ease;
}
button.primary{
  background:linear-gradient(135deg, var(--primary), var(--accent));
  color:#f9fafb;
  border-color:transparent;
  box-shadow:0 14px 30px rgba(34,197,94,0.35);
}
button.secondary{
  background:#ffffff;
  color:#0f172a;
  border-color:rgba(148,163,184,0.7);
}
button.tiny-btn{
  padding:8px 10px;
  font-size:12px;
  border-radius:999px;
  background:#f3f4f6;
  border-color:rgba(156,163,175,0.7);
  color:#111827;
}
button:hover{
  box-shadow:0 10px 25px rgba(15,23,42,0.08);
  transform:translateY(-1px);
}
button:active{
  transform:translateY(0);
  box-shadow:0 4px 12px rgba(15,23,42,0.1);
}
button:disabled{
  opacity:.6;
  cursor:not-allowed;
  box-shadow:none;
}
button.link{
  background:transparent;
  border:0;
  color:var(--muted);
  padding:6px 10px;
}

.reco-btn{
  width:100%;
  text-align:left;
  background:#f9fafb;
  border:1px solid var(--border);
  padding:12px 14px;
  border-radius:14px;
}
.reco-btn:hover{
  background:#f3f4ff;
  border-color:#c7d2fe;
}

.input{
  width:100%;
  padding:11px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#f9fafb;
  color:var(--text);
  font-size:14px;
}
.label{ font-size:12px; color:#4b5563; font-weight:500; }
.helper{ font-size:12px; color:var(--muted); }

.uploader{
  border-radius:18px;
  padding:18px 16px 16px;
  background:#f9fafb;
  border:1px solid #e5e7eb;
  box-shadow:0 14px 40px rgba(15,23,42,0.05);
}
.uploader input[type=file]{ width:100%; }
.capture{ display:flex; gap:10px; flex-wrap:wrap; }
.capture input[type=file]{ flex:1; }

/* Drag & drop zone */
.upload-shell{ display:flex; flex-direction:column; gap:10px; }
.upload-header-title{ font-size:16px; font-weight:600; color:#0f172a; }
.upload-header-sub{ font-size:13px; color:#6b7280; }
.dropzone{
  border-radius:16px;
  border:1px dashed #cbd5f5;
  background:#eef2ff;
  padding:16px 14px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  gap:6px;
}
.dropzone-icon{
  width:36px;
  height:36px;
  border-radius:999px;
  background:rgba(59,130,246,0.06);
  display:flex;
  align-items:center;
  justify-content:center;
  color:#2563eb;
  font-size:18px;
}
.dropzone strong{ color:#111827; font-size:13px; }
.dropzone small{ font-size:12px; color:#6b7280; }
.dropzone.drag-over{
  border-color:#22c55e;
  background:#ecfdf3;
}

.upload-actions{ display:flex; flex-direction:column; gap:8px; margin-top:8px; }
.pill-row{ display:flex; flex-wrap:wrap; gap:8px; }
.pill{
  font-size:12px;
  border-radius:999px;
  padding:6px 10px;
  background:#e5f9f0;
  color:#047857;
}

.upload-preview{
  margin-top:10px;
  border-radius:14px;
  border:1px dashed #e5e7eb;
  padding:10px;
  background:#ffffff;
  display:flex;
  gap:10px;
  align-items:center;
}
.upload-preview.hidden{ display:none; }
.upload-preview-img{
  width:72px;
  height:72px;
  border-radius:12px;
  object-fit:cover;
  background:#e5e7eb;
}
.upload-preview-meta{ display:flex; flex-direction:column; gap:4px; }
.upload-preview-name{ font-size:13px; font-weight:500; color:#111827; word-break:break-all; }
.upload-preview-size{ font-size:12px; color:#6b7280; }

.result{ display:flex; flex-direction:column; gap:12px; }
.book-title{ font-size:18px; font-weight:700; }
.stars{ color:#fbbf24; }
.reco-list{ display:flex; flex-direction:column; gap:8px; }
.reco-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  background:#f9fafb;
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px;
}
.reco-item button{ padding:8px 10px; }

.loading{
  position:fixed;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:12px;
  background:rgba(15,23,42,0.28);
  backdrop-filter:blur(7px);
  z-index:20;
}
.loading.hidden{ display:none; }
.spinner{
  width:38px;
  height:38px;
  border-radius:50%;
  border:3px solid #e5e7eb;
  border-top-color:var(--primary);
  animation:spin 0.9s linear infinite;
}
@keyframes spin{ to{ transform:rotate(360deg);} }

.toast{
  position:fixed;
  left:50%;
  transform:translateX(-50%);
  bottom:20px;
  background:#111827;
  padding:10px 12px;
  border:1px solid rgba(55,65,81,0.8);
  border-radius:999px;
  color:#f9fafb;
  z-index:30;
  font-size:13px;
}
.toast.hidden{ display:none; }

/* Modal */
.modal-host{ position:fixed; inset:0; z-index:40; }
.modal-backdrop{ position:absolute; inset:0; background:rgba(15,23,42,0.35); backdrop-filter: blur(4px); }
.modal{
  position:absolute;
  left:50%;
  top:50%;
  transform: translate(-50%, -50%);
  width:min(92vw, 520px);
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:18px;
  padding:18px;
  box-shadow:0 22px 60px rgba(15,23,42,0.25);
}

.footer-space{ height:40px; }

/* Responsive tweaks */
@media (min-width:720px){
  .container{ padding:26px 20px 32px; }
  .panel{ padding:22px 20px 22px; }
}
