/* ============================================================
   Clean, modern, mobile-friendly styles — no external dependencies
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #ffffff;
  --color-text: #1f2937;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-error: #dc2626;
  --color-border: #e5e7eb;
  --color-muted: #6b7280;
  --radius: 0.5rem;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  --max-width: 720px;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  padding: 1rem;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

/* ========== LAYOUT ========== */
.page {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3rem;
  padding: 2rem 0;
}

/* ========== HERO ========== */
.hero {
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.tagline {
  font-size: 1.25rem;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
}

.description {
  font-size: 1rem;
  max-width: 36rem;
  margin: 0 auto;
}

/* ========== QR SECTION ========== */
.qr-section {
  background: #f9fafb;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.qr-section h2 {
  margin-bottom: 1.5rem;
  font-size: 1.75rem;
}

/* ========== ALERT ========== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.alert-error {
  background: #fef2f2;
  color: var(--color-error);
  border: 1px solid #fecaca;
}

/* ========== FORM ========== */
.qr-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="file"] {
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border 0.2s;
}

.form-group input[type="text"]:focus,
.form-group input[type="file"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.hint {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  align-self: flex-start;
}

.btn-primary:hover {
  background-color: var(--color-primary-hover);
}

/* ========== RESULT ========== */
.qr-result {
  margin-top: 2rem;
  text-align: center;
}

.qr-image {
  max-width: 280px;
  width: 100%;
  height: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.btn-download {
  display: inline-block;
  background-color: #059669;
  color: #fff;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s;
}

.btn-download:hover {
  background-color: #047857;
}

/* ========== FOOTER ========== */
.footer {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-muted);
  padding: 2rem 0 0;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 540px) {
  .hero h1 {
    font-size: 2rem;
  }
  .tagline {
    font-size: 1.1rem;
  }
  .qr-section {
    padding: 1.5rem;
  }
}

/* ========== UTILITIES ========== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* ========== CLAIM PAGE ========== */
.claim-page {
  max-width: 380px;
  margin: 2rem auto;
  background: var(--color-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.claim-handle {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin: 0 0 0.25rem;
}

.claim-heading {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
}

.claim-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.claim-option-icon {
  flex-shrink: 0;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--color-bg);
  border-radius: 50%;
  border: 1px solid var(--color-border);
}

.claim-option-body {
  flex: 1;
  min-width: 0;
}

.claim-option-label {
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.claim-option-desc {
  color: var(--color-muted);
  font-size: 0.875rem;
  margin: 0 0 0.5rem;
}

.claim-qr-img {
  display: flex;
  justify-content: center;
  margin: 0.5rem 0;
}

.claim-qr-img img {
  max-width: 240px;
  width: 100%;
  height: auto;
  border-radius: 0.25rem;
}

.claim-redeemed-note {
  color: var(--color-error);
  font-size: 0.875rem;
  font-weight: 500;
  margin: 0.5rem 0;
}

.claim-code {
  font-size: 0.875rem;
  color: var(--color-text);
  margin: 0.25rem 0;
}

.claim-code .mono {
  font-size: 0.9375rem;
}

.claim-delivery-platform {
  text-transform: uppercase;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--color-primary);
  margin: 0 0 0.25rem;
}

.claim-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  color: var(--color-text);
  font-size: 0.8125rem;
  margin-top: 0.25rem;
}

.claim-copy-btn:hover {
  background: var(--color-border);
}

.claim-copy-feedback {
  font-size: 0.75rem;
  color: var(--color-primary);
}

.claim-no-delivery {
  color: var(--color-muted);
  font-size: 0.875rem;
  margin: 0.25rem 0;
}

.claim-message {
  text-align: center;
  font-size: 1rem;
  margin: 1rem 0;
}

.claim-message--muted {
  color: var(--color-muted);
}

.claim-message--error {
  color: var(--color-error);
}

.claim-footer-note {
  font-size: 0.75rem;
  color: var(--color-muted);
  margin: 1rem 0 0;
}

/* ========== REDEMPTION PAGE ========== */
.redeem-card {
  max-width: 380px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.redeem-card--success {
  border-color: #059669;
}

.redeem-card__code-id {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.redeem-card__title {
  font-size: 1.25rem;
  margin: 0.5rem 0;
}

.redeem-form {
  margin-top: 1rem;
}

.redeem-form fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.redeem-label {
  display: block;
  text-align: left;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.redeem-input {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.redeem-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background-color: #059669;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
}

.redeem-btn:hover:not(:disabled) {
  background-color: #047857;
}

.redeem-btn:disabled,
.redeem-form fieldset:disabled .redeem-btn {
  opacity: 0.6;
  cursor: not-allowed;
}

.redeem-footnote {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 0.5rem;
}

/* ========== ADMIN PAGE ========== */
.admin-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.admin-container h1 {
  margin-bottom: 1.5rem;
}

.admin-section {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.admin-section h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.admin-flash-container {
  margin-bottom: 1.5rem;
}

.alert-success {
  background-color: #f0fdf4;
  color: #065f46;
  border: 1px solid #86efac;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.admin-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.admin-form select,
.admin-form textarea,
.admin-form input[type="password"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
}

.admin-btn-primary {
  align-self: flex-start;
  background-color: var(--color-primary);
  color: white;
  padding: 0.5rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.admin-btn-primary:hover {
  background-color: var(--color-primary-hover);
}

.admin-empty-state {
  color: var(--color-muted);
  font-style: italic;
}

.admin-footnote {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-top: 1px solid var(--color-border);
}

.admin-table th {
  font-weight: 600;
  color: var(--color-muted);
  white-space: nowrap;
}

.admin-actions-cell {
  white-space: nowrap;
}

.admin-inline-form {
  display: inline-block;
  margin-right: 0.5rem;
}

.admin-badge {
  display: inline-block;
  padding: 0.2em 0.6em;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
}

.admin-badge--redeemed {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.admin-badge--issued {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.admin-when {
  color: var(--color-muted);
  margin-top: 0.25rem;
  display: inline-block;
}

.admin-btn-approve {
  background-color: #15803d;
  color: white;
  border: 1px solid #166534;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.825rem;
  cursor: pointer;
}

.admin-btn-approve:hover {
  background-color: #166534;
}

.admin-btn-reject {
  background: transparent;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.825rem;
  cursor: pointer;
}

.admin-btn-reject:hover {
  background-color: #f9fafb;
  color: #1f2937;
}

.admin-passcode-status {
  margin-bottom: 1rem;
}
