/* ============================================================
   QR WIZYTÓWKI — PROFESSIONAL B&W DESIGN
   Clean, minimal, luxury aesthetic
   ============================================================ */

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

:root {
  --white: #ffffff;
  --off-white: #f7f7f7;
  --light: #efefef;
  --mid: #d0d0d0;
  --muted: #999999;
  --dark-mid: #555555;
  --dark: #222222;
  --black: #0d0d0d;

  --bg: #f4f4f4;
  --surface: #ffffff;
  --border: #e0e0e0;
  --border-strong: #b0b0b0;

  --accent: #0d0d0d;
  --accent-inv: #ffffff;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--black);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ─────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  height: 60px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--black);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  font-size: 1rem;
  color: var(--black);
  letter-spacing: -0.02em;
  font-weight: 500;
}

.logo-text strong {
  font-weight: 800;
}

.nav-pills {
  display: flex;
  gap: 2px;
}

.nav-pill {
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-pill:hover {
  color: var(--black);
  background: var(--light);
}

.nav-pill.active {
  color: var(--black);
  background: var(--light);
  border-color: var(--border);
  font-weight: 600;
}

/* ── MAIN ────────────────────────────────────────────────────── */
.main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 3.5rem 2.5rem 6rem;
}

/* ── HERO ────────────────────────────────────────────────────── */
.hero {
  margin-bottom: 3rem;
}

.hero-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--black);
  margin-bottom: 0.5rem;
}

.gradient-text {
  color: var(--black);
  display: inline;
  position: relative;
}

.gradient-text::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--black);
  border-radius: 2px;
}

.hero-sub {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 400;
}

/* ── LAYOUT ──────────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
  align-items: start;
}

/* ── CARD ────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.card-icon {
  font-size: 1.25rem;
  width: 40px;
  height: 40px;
  background: var(--off-white);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 2px;
  letter-spacing: -0.01em;
}

.card-desc {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── FORM ────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--dark-mid);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.form-input {
  background: var(--off-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--black);
  font-family: inherit;
  font-size: 0.88rem;
  transition: all 0.15s;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-input::placeholder {
  color: var(--mid);
}

.form-input:focus {
  border-color: var(--black);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.form-input:hover:not(:focus) {
  border-color: var(--border-strong);
  background: var(--white);
}

/* ── QR STYLE SECTION ────────────────────────────────────────── */
.qr-style-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--dark-mid);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 1rem;
}

.style-options {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.style-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.color-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.color-preset {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.color-preset:hover {
  transform: scale(1.12);
}

.color-preset.active {
  outline: 2px solid var(--black);
  outline-offset: 2px;
  transform: scale(1.08);
}

.size-slider-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.size-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
}

.size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--black);
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}

.size-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.size-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--dark-mid);
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── BUTTONS ─────────────────────────────────────────────────── */
.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.btn-primary {
  background: var(--black);
  color: var(--white);
  flex: 1;
}

.btn-primary:hover {
  background: var(--dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.btn-primary:active {
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--off-white);
  color: var(--black);
  border: 1px solid var(--border);
  flex: 1;
}

.btn-secondary:hover {
  background: var(--light);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--black);
  border-color: var(--border-strong);
  background: var(--off-white);
}

.btn-danger {
  background: transparent;
  color: #c00;
  border: 1px solid #e0c0c0;
}

.btn-danger:hover {
  background: #fff0f0;
  border-color: #c00;
}

/* ── QR PREVIEW ──────────────────────────────────────────────── */
.preview-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 1rem;
  text-align: center;
}

.placeholder-qr {
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 0.25;
  }

  50% {
    opacity: 0.5;
  }
}

.placeholder-text {
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 220px;
  line-height: 1.6;
}

.qr-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.qr-result canvas,
.qr-result #qrCanvas img,
.qr-result #qrCanvas svg {
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--border);
  max-width: 100%;
  display: block;
  animation: fadeIn 0.3s ease;
}

#qrCanvas {
  display: flex;
  justify-content: center;
  align-items: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.98);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.qr-contact-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: center;
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--off-white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.contact-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.contact-detail {
  font-size: 0.775rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.contact-detail svg {
  flex-shrink: 0;
  opacity: 0.5;
}

.qr-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.qr-actions .btn:last-child {
  grid-column: 1 / -1;
}

/* ── COMPATIBILITY BADGES ────────────────────────────────────── */
.compat-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.badge-apple {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

.badge-android {
  background: var(--off-white);
  color: var(--dark);
}

.badge-text {
  font-size: 0.68rem;
  color: var(--muted);
}

/* ── INSTRUCTIONS ────────────────────────────────────────────── */
.steps {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.step-num {
  width: 24px;
  height: 24px;
  min-width: 24px;
  background: var(--black);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--white);
}

.step-text {
  font-size: 0.85rem;
  color: var(--dark-mid);
  padding-top: 3px;
  line-height: 1.5;
}

.step-text strong {
  color: var(--black);
}

/* ── SAVED GRID ──────────────────────────────────────────────── */
.saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.saved-card-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.875rem;
  transition: all 0.2s;
  animation: fadeIn 0.3s ease;
}

.saved-card-item:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.saved-card-item img {
  border-radius: 8px;
  max-width: 180px;
  width: 100%;
  border: 1px solid var(--border);
}

.saved-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.01em;
}

.saved-card-company {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

.saved-card-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.4;
}

.empty-state p {
  color: var(--muted);
  line-height: 1.8;
  font-size: 0.9rem;
}

/* ── TOAST ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--black);
  color: var(--white);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  z-index: 9999;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
  opacity: 0;
  pointer-events: none;
  letter-spacing: 0.01em;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ── DIVIDER ─────────────────────────────────────────────────── */
hr {
  border: none;
  border-top: 1px solid var(--border);
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .preview-column {
    order: -1;
  }
}

@media (max-width: 640px) {
  .header {
    padding: 0 1.25rem;
  }

  .main {
    padding: 2rem 1.25rem 4rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group.full-width {
    grid-column: 1;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .nav-pills {
    display: none;
  }

  .card {
    padding: 1.25rem;
  }
}

/* ── PRINT ───────────────────────────────────────────────────── */
@media print {
  body {
    background: white;
  }

  .header,
  .form-card,
  .instructions-card,
  .compat-badges,
  .qr-actions,
  .form-actions {
    display: none !important;
  }

  .preview-card {
    border: none;
    box-shadow: none;
  }
}