/* FACKHANDEL.se MVP — Split-Screen & Admin Stylesheet */
:root {
  --font-sans: "Saira Condensed", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Kund (Marinblå) */
  --cust-dark: #0B2E4A;
  --cust-light: #134E78;
  --cust-accent: #38BDF8;
  --cust-btn-bg: #FFFFFF;
  --cust-btn-fg: #0B2E4A;

  /* Fackhandlare (Skogsgrön + Bärnsten/Koppar) */
  --merch-dark: #0F3828;
  --merch-light: #1B5E42;
  --merch-accent: #F59E0B;
  --merch-accent-hover: #D97706;

  /* Neutraler */
  --bg-surface: #FFFFFF;
  --bg-muted: #F4F6F8;
  --text-main: #111827;
  --text-muted: #4B5563;
  --border-subtle: #D1D5DB;
  --danger: #B91C1C;
  --success: #15803D;

  --topbar-h: 52px;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  color: var(--text-main);
  background: #091E30;
  -webkit-font-smoothing: antialiased;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  padding: 0 20px;
  background: #071928;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.topbar-brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  color: #FFFFFF;
  text-decoration: none;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.brand-tagline {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.05rem;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 639px) {
  .topbar {
    padding: 0 12px;
  }

  .brand-tagline {
    display: none;
  }
}

.admin-link {
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.admin-link:hover {
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.08);
}

/* Split-screen 100dvh */
.split-stage {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr;
  height: calc(100dvh - var(--topbar-h));
  min-height: 540px;
}

@media (min-width: 768px) {
  .split-stage {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
  }
}

.split-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 24px;
  color: #FFFFFF;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.pane-customer {
  background: linear-gradient(155deg, var(--cust-dark) 0%, var(--cust-light) 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.pane-merchant {
  background: linear-gradient(155deg, var(--merch-dark) 0%, var(--merch-light) 100%);
}

@media (min-width: 768px) {
  .pane-customer {
    border-bottom: none;
    border-right: 1px solid rgba(255, 255, 255, 0.14);
  }
}

.pane-inner {
  max-width: 440px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.pane-badge {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-customer {
  background: rgba(56, 189, 248, 0.18);
  color: #BAE6FD;
  border: 1px solid rgba(56, 189, 248, 0.45);
}

.badge-merchant {
  background: rgba(245, 158, 11, 0.18);
  color: #FDE68A;
  border: 1px solid rgba(245, 158, 11, 0.55);
}

.counter-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 4px;
}

.counter-value {
  font-size: clamp(2.8rem, 6vw, 4.2rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: -0.01em;
}

.counter-label {
  font-size: 1.2rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
}

.pane-title {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  font-weight: 700;
  line-height: 1.1;
}

.pane-pitch {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.9);
}

.btn-primary {
  margin-top: 6px;
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 13px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-customer {
  background: var(--cust-btn-bg);
  color: var(--cust-btn-fg);
}

.btn-customer:hover {
  background: #E0F2FE;
}

.btn-merchant {
  background: var(--merch-accent);
  color: #111827;
}

.btn-merchant:hover {
  background: var(--merch-accent-hover);
  color: #FFFFFF;
}

/* Modal / Registration Drawer */
.modal-backdrop[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 17, 28, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
  overflow-y: auto;
}

.modal-dialog {
  background: var(--bg-surface);
  color: var(--text-main);
  width: 100%;
  max-width: 600px;
  max-height: 92dvh;
  overflow-y: auto;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 18px 22px;
  color: #FFFFFF;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
}

.modal-header.is-customer {
  background: linear-gradient(135deg, var(--cust-dark), var(--cust-light));
}

.modal-header.is-merchant {
  background: linear-gradient(135deg, var(--merch-dark), var(--merch-light));
}

.modal-header-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-title {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.1;
}

.modal-close {
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.role-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.role-tab {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.role-tab[aria-selected="true"] {
  color: var(--text-main);
  background: #FFFFFF;
  font-weight: 700;
}

.role-tab[data-switch-role="customer"][aria-selected="true"] {
  border-bottom-color: var(--cust-light);
}

.role-tab[data-switch-role="merchant"][aria-selected="true"] {
  border-bottom-color: var(--merch-accent);
}

.ref-banner {
  background: #EFF6FF;
  color: #1E3A8A;
  padding: 8px 22px;
  font-size: 1rem;
  border-bottom: 1px solid #BFDBFE;
}

/* Form */
.reg-form {
  padding: 20px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.honeypot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 520px) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

.field-label {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}

.req-mark {
  color: var(--danger);
}

.field-input,
.field-select {
  font-family: var(--font-sans);
  font-size: 1.08rem;
  padding: 9px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 7px;
  background: #FFFFFF;
  color: var(--text-main);
  width: 100%;
}

.field-input:focus,
.field-select:focus {
  outline: 2px solid var(--cust-light);
  border-color: var(--cust-light);
}

.collapse-toggle {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--cust-light);
  background: none;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  text-align: left;
}

.optional-fields {
  margin-top: 8px;
}

/* Dual Role Box */
.dual-box {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dual-box-merchant {
  background: #FFFBEB;
  border-color: #FDE68A;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 1.02rem;
  line-height: 1.3;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--cust-light);
}

.dual-subfields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
}

.dual-hint {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Invite Section */
.invite-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.invite-heading {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.invite-input-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 520px) {
  .invite-input-row {
    grid-template-columns: 1.6fr 1fr auto;
  }
}

.invite-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.invite-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #E0F2FE;
  color: #0C4A6E;
  border: 1px solid #7DD3FC;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.95rem;
  font-weight: 600;
}

.invite-chip.is-merchant {
  background: #FEF3C7;
  color: #78350F;
  border-color: #FCD34D;
}

.chip-remove {
  background: none;
  border: none;
  color: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0 2px;
  font-size: 1rem;
  line-height: 1;
}

.quick-share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-muted);
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
}

.share-btn:hover {
  background: #E5E7EB;
}

.btn-secondary {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: #FFFFFF;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: var(--bg-muted);
}

.form-error {
  background: #FEF2F2;
  color: var(--danger);
  border: 1px solid #FECACA;
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 1rem;
  font-weight: 600;
}

.form-actions {
  margin-top: 4px;
}

.btn-submit {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  padding: 12px 18px;
  border: none;
  border-radius: 8px;
  color: #FFFFFF;
  background: var(--cust-light);
  cursor: pointer;
}

.btn-submit.is-merchant {
  background: var(--merch-light);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Success View */
.reg-success {
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.reg-success[hidden] {
  display: none;
}

.success-icon {
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: #DCFCE7;
  color: var(--success);
  font-size: 1.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
}

.success-detail {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-muted);
}

.ref-share-card {
  width: 100%;
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ref-url-row {
  display: flex;
  gap: 8px;
}

.success-actions {
  margin-top: 6px;
}

/* Admin Page Styles */
.admin-body {
  background: #F3F4F6;
  min-height: 100dvh;
}

.admin-container {
  max-width: 1240px;
  margin: 24px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid var(--border-subtle);
  background: #FFFFFF;
  color: var(--text-main);
  cursor: pointer;
}

.filter-btn.is-active {
  background: var(--cust-dark);
  color: #FFFFFF;
  border-color: var(--cust-dark);
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #E5E7EB;
  white-space: nowrap;
}

.admin-table th {
  font-weight: 700;
  color: var(--text-muted);
  background: #F9FAFB;
}

.action-cell {
  display: flex;
  gap: 6px;
}

.btn-xs {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  background: #FFFFFF;
  cursor: pointer;
}

.btn-confirm {
  color: var(--success);
  border-color: #86EFAC;
  background: #F0FDF4;
}

.btn-stale {
  color: var(--danger);
  border-color: #FCA5A5;
  background: #FEF2F2;
}

.hvd-status-badge {
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: 7px;
  background: #F0FDF4;
  border: 1px solid #86EFAC;
  color: #14532D;
  font-size: 0.98rem;
  line-height: 1.3;
}

.hvd-status-badge.is-ef {
  background: #EFF6FF;
  border-color: #93C5FD;
  color: #1E3A8A;
}

.hvd-status-badge.is-warn {
  background: #FEF2F2;
  border-color: #FECACA;
  color: var(--danger);
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.catalog-item-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
