/* © 2026 allabutiker.se – Alla rättigheter förbehållna. */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  background: #f4f5f7;
  color: #1a1a2e;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ── Login ───────────────────────────────────────────────── */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-box {
  background: #fff;
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
}

.login-box h1 {
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.login-sub {
  color: #666;
  margin-bottom: 28px;
}

/* ── Header ──────────────────────────────────────────────── */

.admin-header {
  background: #1a1a2e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.admin-logo {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logged-in-as {
  font-size: 0.85rem;
  opacity: .7;
}

/* ── Main ────────────────────────────────────────────────── */

.admin-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Card ────────────────────────────────────────────────── */

.card {
  background: #fff;
  border-radius: 12px;
  padding: 28px 28px 32px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 20px;
}

/* ── Form ────────────────────────────────────────────────── */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }

label { font-size: 0.85rem; font-weight: 600; color: #444; }
.hint { font-weight: 400; color: #888; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="time"],
textarea {
  border: 1.5px solid #ddd;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color .15s;
  width: 100%;
}

input:focus, textarea:focus {
  outline: none;
  border-color: #1a1a2e;
}

input[readonly] {
  background: #f4f5f7;
  color: #666;
  cursor: default;
}

textarea { resize: vertical; }

.days-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.day-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 400;
  color: #333;
  cursor: pointer;
}

.day-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

.demo-field { margin-top: 8px; }

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* ── Offer List ──────────────────────────────────────────── */

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.offer-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
}

.offer-row:last-child { border-bottom: none; }
.offer-row.is-demo { opacity: .65; }
.offer-row.is-inactive { opacity: .45; }

.offer-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.offer-info strong { font-size: 0.95rem; }

.badge-demo {
  display: inline-block;
  background: #f0e6ff;
  color: #7c3aed;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  width: fit-content;
}

.badge-food-rescue {
  display: inline-block;
  background: #8a5010;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  width: fit-content;
}

.inactive-section {
  margin-top: 20px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 0 16px;
  background: #f9f9f9;
}

.inactive-section-header {
  font-size: 0.75rem;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 0 0;
  margin-bottom: -4px;
}

.inactive-section .offer-row:last-child { border-bottom: none; }

.demo-section {
  margin-top: 20px;
  border: 1px solid #e9d5ff;
  border-radius: 10px;
  padding: 0 16px;
  background: #faf5ff;
}

.demo-section-header {
  font-size: 0.75rem;
  font-weight: 700;
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 0 0;
  margin-bottom: -4px;
}

.demo-section .offer-row:last-child { border-bottom: none; }

.offer-deal { font-size: 0.9rem; color: #333; }
.offer-meta { font-size: 0.8rem; color: #888; }

.offer-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Buttons ─────────────────────────────────────────────── */

.btn-primary {
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}

.btn-primary:hover { opacity: .85; }
.btn-primary:disabled { opacity: .5; cursor: default; }

.btn-secondary {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,.4);
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color .15s;
}

.btn-secondary:hover { border-color: #fff; }

.btn-ghost {
  background: transparent;
  color: #1a1a2e;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color .15s;
}

.btn-ghost:hover { border-color: #1a1a2e; }

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1.5px solid;
  font-weight: 600;
  white-space: nowrap;
}

.btn-edit {
  color: #1a1a2e;
  border-color: #ccc;
  background: #fff;
}

.btn-edit:hover { border-color: #1a1a2e; }

.btn-delete {
  color: #c0392b;
  border-color: #f5cac7;
  background: #fff;
}

.btn-delete:hover { background: #fdf0ef; }

.btn-toggle {
  color: #1e6f3e;
  border-color: #b7e4c7;
  background: #fff;
}

.btn-toggle:hover { background: #e8f7ed; }

.is-inactive .btn-toggle {
  color: #888;
  border-color: #ddd;
}

.is-inactive .btn-toggle:hover { background: #f0f0f0; }

/* ── Messages ────────────────────────────────────────────── */

.error-msg {
  color: #c0392b;
  background: #fdf0ef;
  border: 1px solid #f5cac7;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  margin-top: 12px;
}

.success-msg {
  color: #1e6f3e;
  background: #e8f7ed;
  border: 1px solid #b7e4c7;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  margin-top: 12px;
}

.loading, .empty { color: #888; padding: 20px 0; text-align: center; }

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .card { padding: 20px 16px 24px; }
  .admin-main { padding: 16px 12px 40px; }
  .form-actions { flex-direction: column; }
}

/* ── MFA ─────────────────────────────────────────────────── */
.mfa-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 100;
}
.mfa-modal {
  background: #fff; border-radius: 12px;
  padding: 36px 32px; width: 100%; max-width: 420px;
  box-shadow: 0 8px 40px rgba(0,0,0,.15);
}
.mfa-modal h2 { font-size: 1.1rem; margin-bottom: 16px; }
.mfa-qr-wrap { display: flex; justify-content: center; margin: 20px 0; }
.mfa-qr-wrap img { width: 180px; height: 180px; border: 1px solid #eee; border-radius: 8px; }
.mfa-secret {
  display: block; font-family: monospace; font-size: .9rem;
  letter-spacing: .05em; background: #f4f5f7;
  padding: 8px 12px; border-radius: 6px; word-break: break-all;
}
.mfa-modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.mfa-status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
