/* ====================================================
   ESSR QR - Stylesheet
   ==================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --border: #E5E3DE;
  --text: #1F1E1B;
  --text-soft: #6B6862;
  --text-mute: #9A968D;
  --accent: #1F1E1B;
  --accent-hover: #3A3935;
  --info-bg: #EEF4FA;
  --info-text: #2A5680;
  --warn-bg: #FAF1E0;
  --warn-text: #7A5610;
  --error-bg: #FAE9E7;
  --error-text: #9C2E22;
  --success: #1F7A4F;
  --shadow: 0 1px 3px rgba(0,0,0,0.04);
  --radius: 10px;
  --radius-lg: 14px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
}

.container { max-width: 980px; margin: 0 auto; padding: 0 20px; }

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.header .container { display: flex; justify-content: space-between; align-items: center; }
.logo {
  font-weight: 600;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.logo span { color: var(--text-mute); font-weight: 400; }
.header nav a {
  color: var(--text-soft);
  text-decoration: none;
  margin-left: 20px;
  font-size: 14px;
}
.header nav a:hover { color: var(--text); }

/* Hero */
.hero { text-align: center; padding: 48px 0 32px; }
.hero h1 { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 10px; }
.hero p { color: var(--text-soft); font-size: 16px; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 720px) { .grid { grid-template-columns: 1fr; } }

/* Dropzone */
.dropzone {
  background: var(--bg);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s;
  margin-bottom: 14px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dropzone:hover { border-color: var(--text-mute); background: #F4F2EE; }
.dropzone.is-dragover { border-color: var(--info-text); background: var(--info-bg); }
.dropzone svg { color: var(--text-mute); margin: 0 auto 10px; display: block; }
.dz-title { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.dz-sub { font-size: 12px; color: var(--text-mute); }
#preview-img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 6px;
  display: block;
  margin: 0 auto 8px;
}
#preview-name { font-size: 13px; font-weight: 500; word-break: break-all; }

/* Buttons */
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { background: var(--text-mute); cursor: not-allowed; opacity: 0.6; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-secondary:hover { background: var(--bg); border-color: var(--text-mute); }

.btn-link {
  background: none;
  border: none;
  color: var(--info-text);
  font-size: 13px;
  cursor: pointer;
  margin-top: 12px;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#btn-clear {
  margin-top: 8px;
  font-size: 11px;
  padding: 4px 10px;
}

.info-text {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-mute);
  text-align: center;
}

/* Result Box */
.result-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}
.result-empty {
  text-align: center;
  color: var(--text-mute);
}
.result-empty svg { margin: 0 auto 10px; display: block; }
.result-empty p { font-size: 13px; }

#qrcode {
  background: white;
  padding: 14px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
#qrcode img, #qrcode canvas { display: block; }

.result-url {
  font-size: 13px;
  font-family: ui-monospace, "SF Mono", monospace;
  color: var(--info-text);
  word-break: break-all;
  margin-bottom: 4px;
  text-align: center;
}
.result-info {
  font-size: 11px;
  color: var(--text-mute);
  text-align: center;
  margin-bottom: 12px;
}
.action-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Spinner */
.spinner {
  width: 32px; height: 32px;
  border: 2.5px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Content sections */
.content-section { padding: 32px 0; }
.content-section h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}
.content-section ol { padding-left: 22px; }
.content-section li { margin-bottom: 8px; color: var(--text-soft); }
.content-section details {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.content-section summary {
  cursor: pointer;
  font-weight: 500;
  font-size: 15px;
}
.content-section details p {
  margin-top: 8px;
  color: var(--text-soft);
  font-size: 14px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  margin-top: 40px;
  color: var(--text-mute);
  font-size: 13px;
  text-align: center;
}

/* View page */
.view-page { background: var(--bg); }
.image-viewer {
  margin: 32px 0 16px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}
.image-viewer img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: var(--radius);
  display: block;
  margin: 0 auto;
}
.meta-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 24px;
  padding: 0 4px;
  flex-wrap: wrap;
}
.meta-link {
  color: var(--info-text);
  text-decoration: none;
  margin-left: auto;
  font-weight: 500;
}
.meta-link:hover { text-decoration: underline; }

.cta-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  margin-bottom: 32px;
}
.cta-strip p {
  margin-bottom: 12px;
  color: var(--text-soft);
}
.cta-strip .btn-primary { max-width: 240px; margin: 0 auto; }

.error-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  margin: 40px auto;
  max-width: 480px;
  box-shadow: var(--shadow);
}
.error-card svg { color: var(--text-mute); margin: 0 auto 16px; display: block; }
.error-card h2 { margin-bottom: 8px; font-size: 20px; }
.error-card p { color: var(--text-soft); margin-bottom: 20px; }
.error-card .btn-primary { max-width: 200px; margin: 0 auto; display: inline-block; text-decoration: none; text-align: center; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 100;
  animation: toastIn 0.2s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }
