/* ═══════════════════════════════════════════════════════════════
   QRixle — Linear Minimalism & Split-Screen Bento Grid
   Theme: Ultra-clean dark/subtle glass canvas, 1px hairline borders,
   monochrome hierarchy, precise typography, smooth micro-interactions.
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & Variables ────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden],
.qr-state[hidden],
.form-panel[hidden] {
  display: none !important;
}

:root {
  /* Linear Dark Palette */
  --bg-main: #090a0f;
  --bg-surface: #10121a;
  --bg-surface-elevated: #161924;
  --bg-surface-subtle: rgba(255, 255, 255, 0.02);
  --bg-hover: rgba(255, 255, 255, 0.05);

  /* Hairline Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: #5e6ad2;
  --border-hover: rgba(255, 255, 255, 0.16);

  /* Typography Colors */
  --text-primary: #f0f2f5;
  --text-secondary: #8a8f98;
  --text-muted: #575b66;

  /* Accents */
  --brand: #5e6ad2;
  --brand-hover: #6e7bf2;
  --brand-glow: rgba(94, 106, 210, 0.25);
  --accent-green: #30d158;
  --accent-red: #eb5757;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Shadow & Transitions */
  --shadow-bento: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.45);
  --transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(94, 106, 210, 0.12), transparent 70%),
    radial-gradient(circle at 100% 100%, rgba(255, 255, 255, 0.015), transparent 40%);
}

/* ── Header ──────────────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(9, 10, 15, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.85rem 1.5rem;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

.logo-icon img {
  border-radius: 4px;
}

.logo-text {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.tagline {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* ── Bento Grid Main Layout ──────────────────────────────────── */
.main-container {
  flex: 1;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.25rem;
  max-width: 1280px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  width: 100%;
  align-items: start;
}

@media (max-width: 960px) {
  .main-container {
    grid-template-columns: 1fr;
    margin: 1.25rem auto;
  }
}

/* ── Bento Cards ─────────────────────────────────────────────── */
.bento-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-bento);
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition);
}

.bento-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

.panel {
  padding: 1.75rem;
}

.panel-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-title::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--brand);
}

/* ── Bento Pills / Segmented Control Tabs ────────────────────── */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.35rem;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.tab {
  flex: 1 1 auto;
  padding: 0.5rem 0.8rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.tab.active {
  color: #fff;
  background: var(--bg-surface-elevated);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* ── Form Inputs ─────────────────────────────────────────────── */
.form-panels {
  margin-bottom: 1.75rem;
}

.form-panel {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.field-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.required {
  color: var(--accent-red);
}

.field-input {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  width: 100%;
  padding: 0.75rem 0.95rem;
  color: var(--text-primary);
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
  resize: vertical;
}

.field-input:hover {
  border-color: var(--border-hover);
}

.field-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
  background: var(--bg-surface-subtle);
}

.field-input::placeholder {
  color: var(--text-muted);
}

textarea.field-input {
  min-height: 100px;
  line-height: 1.6;
}

.field-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a8f98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.5rem;
}

.char-counter {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-align: right;
}

.password-wrap {
  position: relative;
  display: flex;
}

.password-wrap .field-input {
  padding-right: 3rem;
}

.btn-toggle-pass {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-toggle-pass:hover {
  color: var(--text-primary);
}

/* Social Media Input Styling */
.social-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}

.social-input-wrap:hover {
  border-color: var(--border-hover);
}

.social-input-wrap:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
  background: var(--bg-surface-subtle);
}

.social-prefix {
  padding: 0.75rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-right: 1px solid var(--border-subtle);
  user-select: none;
  white-space: nowrap;
}

.social-input-wrap .field-input {
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.social-input-wrap .field-input:focus {
  box-shadow: none;
  background: transparent;
}

/* ── Options Bento Sub-grid ───────────────────────────────────── */
.options-section {
  margin-top: 1.25rem;
  margin-bottom: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 580px) {
  .options-grid {
    grid-template-columns: 1fr;
  }
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* Color picker in Linear style */
.color-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.45rem 0.75rem;
  transition: var(--transition);
}

.color-wrap:hover {
  border-color: var(--border-hover);
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0;
  cursor: pointer;
  background: none;
  appearance: none;
  -webkit-appearance: none;
}

.color-swatch::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-swatch::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.color-hex {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ── Buttons (Linear-style Glow & Pill Accent) ────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.85rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  color: #fff;
  background: linear-gradient(180deg, #6875e5 0%, #525ec9 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 16px var(--brand-glow);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.btn-primary:hover {
  background: linear-gradient(180deg, #7481f0 0%, #5e6ad2 100%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 24px var(--brand-glow);
  transform: translateY(-1px);
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
}

/* ── Right Panel: QR Output Stage ─────────────────────────────── */
.panel-output {
  display: flex;
  flex-direction: column;
}

.qr-stage {
  min-height: 380px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-subtle);
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 80%), var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  padding: 2rem;
}

.qr-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  text-align: center;
  width: 100%;
}

/* Idle State */
.idle-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--text-muted);
}

.idle-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  line-height: 1.6;
}

/* Loading Spinner */
.spinner {
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

/* Error State */
.error-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(235, 87, 87, 0.12);
  border: 1px solid rgba(235, 87, 87, 0.3);
  color: var(--accent-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 700;
}

.error-text {
  font-size: 0.85rem;
  color: var(--accent-red);
  max-width: 280px;
  line-height: 1.4;
}

/* Result Preview Box */
.qr-frame {
  border-radius: var(--radius-md);
  background: #ffffff;
  padding: 1.25rem;
  display: inline-flex;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.qr-frame img {
  display: block;
  image-rendering: pixelated;
  border-radius: 4px;
}

.result-meta {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.result-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.share-notice {
  font-size: 0.75rem;
  font-family: var(--font-sans);
  color: var(--accent-green);
  text-align: center;
  margin-top: 0.5rem;
  padding: 0.45rem 0.85rem;
  background: rgba(48, 209, 88, 0.08);
  border: 1px solid rgba(48, 209, 88, 0.2);
  border-radius: var(--radius-sm);
  display: inline-block;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-actions .btn-primary {
  max-width: 240px;
}

/* ── Rate Notice & Footer ─────────────────────────────────────── */
.rate-notice {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.rate-notice::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
}

.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-main);
  text-align: center;
  padding: 1.25rem 2rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.footer-link {
  text-decoration: none;
}

.footer-link:hover {
  color: var(--text-primary);
}

/* Accessibility */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}