/* ── Reset & base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}

/* ── Container & card ──────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 640px;
}

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  overflow: hidden;
}

.card-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.card-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.subtitle {
  font-size: .875rem;
  color: #64748b;
  margin-top: .25rem;
}

.card-body {
  padding: 1.5rem;
}

/* ── Upload zone ───────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.upload-icon {
  color: #94a3b8;
  margin-bottom: .75rem;
}

.upload-text {
  font-size: 1rem;
  margin-bottom: .25rem;
}

.upload-text a {
  color: #2563eb;
  text-decoration: none;
}

.upload-text a:hover {
  text-decoration: underline;
}

.upload-hint {
  font-size: .8rem;
  color: #94a3b8;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  padding: .65rem 1.25rem;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  width: 100%;
  margin-top: 1rem;
}

.btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.btn-secondary {
  background: #e2e8f0;
  color: #334155;
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-small {
  background: #e2e8f0;
  color: #334155;
  padding: .35rem .75rem;
  font-size: .8rem;
  border-radius: 6px;
  margin-left: .5rem;
}

.btn-small:hover {
  background: #cbd5e1;
}

/* ── Loading spinner ───────────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 2rem 0;
  color: #64748b;
}

.hidden { display: none !important; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto .75rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Error box ─────────────────────────────────────────────────── */
.error-box {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: .75rem 1rem;
  font-size: .875rem;
  margin-bottom: 1rem;
}

/* ── Section spacing ───────────────────────────────────────────── */
.section {
  margin-top: 1.5rem;
}

.section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: .75rem;
}

.help-text {
  font-size: .85rem;
  color: #64748b;
  margin-bottom: .75rem;
}

/* ── Captcha ───────────────────────────────────────────────────── */
.captcha-image-wrapper {
  text-align: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.captcha-image {
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.captcha-input-row {
  display: flex;
  gap: .5rem;
}

.input {
  flex: 1;
  padding: .65rem .85rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
  font-family: monospace;
  letter-spacing: .15em;
  outline: none;
  transition: border-color .15s;
}

.input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.captcha-input-row .btn {
  width: auto;
  margin-top: 0;
  white-space: nowrap;
}

.tries-info {
  font-size: .8rem;
  color: #94a3b8;
  margin-top: .5rem;
}

/* ── Progress log ──────────────────────────────────────────────── */
.log-container {
  max-height: 320px;
  overflow-y: auto;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: .75rem 1rem;
  font-size: .85rem;
  line-height: 1.6;
}

.log-entry {
  padding: .25rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.log-entry:last-child {
  border-bottom: none;
}

/* ── Credential card ───────────────────────────────────────────── */
.credential-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 1.25rem;
}

.cred-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}

.cred-label {
  font-size: .85rem;
  font-weight: 600;
  color: #166534;
}

.cred-value-group {
  display: flex;
  align-items: center;
}

.cred-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #15803d;
  background: #dcfce7;
  padding: .35rem .75rem;
  border-radius: 6px;
  letter-spacing: .05em;
  user-select: all;
}

.cred-hint {
  font-size: .8rem;
  color: #16a34a;
  margin-top: .75rem;
}

.cred-hint a {
  color: #2563eb;
  text-decoration: none;
}

.cred-hint a:hover {
  text-decoration: underline;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 480px) {
  body { padding: 1rem .5rem; }
  .card-header, .card-body { padding-left: 1rem; padding-right: 1rem; }
  .captcha-input-row { flex-direction: column; }
  .captcha-input-row .btn { width: 100%; }
}
