/* Compose UI partials */
@import url('./colors.css');
@import url('./ui.css');

/* color tokens moved to colors.css */

/* ----- Typography ----- */
:root {
  --font-family-sans: "Poppins", system-ui, sans-serif;
  --font-family-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

body {
  font-family: var(--font-family-sans);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-sans);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.info {
  color: var(--color-text-muted);
  font-weight: 100;
  font-family: Consolas, Monaco, 'Andale Mono WT', 'Andale Mono', 'Lucida Console', 'Lucida Sans Typewriter', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Liberation Mono', 'Nimbus Mono L', Monaco, 'Courier New', Courier, monospace;
  font-size: 0.75rem;
}

p {
  line-height: 1.7;
  color: var(--color-text-muted);
}

small {
  font-size: 0.8125rem;
  line-height: 1.4;
}

.nav-brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.nav-link {
  font-weight: 500;
}

/* ----- UI Primitives ----- */
:root {
  --radius-none: 0;
  --radius-2xs: 0.125rem;
  --radius-xs: 0.25rem;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  --radius: var(--radius-md);

  --shadow-xs: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(15 23 42 / 0.08), 0 1px 2px -1px rgb(15 23 42 / 0.12);
  --shadow-md: 0 4px 16px -6px rgb(15 23 42 / 0.18);
  --shadow-lg: 0 20px 45px -25px rgb(15 23 42 / 0.4);

  --transition-fast: 150ms ease-in-out;
  --transition-medium: 250ms ease-in-out;
  --transition-slow: 400ms ease;

  --ring-width: 2px;

  --layout-max: 80rem;
  --layout-narrow: 72rem;
  --container-padding: 1rem;
  --container-padding-md: 1.5rem;
  --container-padding-lg: 2rem;
}

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

html, body {
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--color-bg-dark);
  color: var(--color-foreground);
}

a {
  color: inherit;
  text-decoration: none;
}



.container {
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

@media (min-width: 640px) {
  .container {
    padding: 0 var(--container-padding-md);
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 var(--container-padding-lg);
  }
}

/* ----- Components ----- */
.brand-badge {
  width: 2rem;
  height: 2rem;
  background: var(--color-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon {
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.app-tabs {
  display: flex;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 2rem auto;
  max-width: min(var(--layout-narrow), calc(100% - 2rem));
  box-shadow: var(--shadow-md);
}

.app-tab {
  flex: 1;
  padding: 1rem 2rem;
  border: none;
  background: none;
  color: var(--color-muted-foreground);
  cursor: pointer;
  font-weight: 500;
  transition: all var(--transition-fast);
  border-bottom: 3px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-tab:hover {
  background: var(--color-accent);
  color: var(--color-foreground);
}

.app-tab.active {
  color: var(--color-primary);
  background: var(--color-bg-light);
  border-bottom-color: var(--color-primary);
}

.app-content {
  min-height: 70vh;
}

.app-footer {
  margin-top: auto;
}

.card {
  background-color: var(--color-bg);
  color: var(--color-card-foreground);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--color-border);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin: 0;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.card-header .card-actions {
  margin-bottom: 0;
}

.qr-studio-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  grid-auto-rows: minmax(0, auto);
}

@media (min-width: 768px) {
  .qr-studio-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .qr-studio-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.05fr) minmax(320px, 0.9fr);
  }
}

.qr-studio-grid > section {
  height: 100%;
}

.download-menu-panel {
  min-width: 180px;
}

@keyframes toast-fade-in {
  from {
    opacity: 0;
    transform: translate(-50%, -12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes toast-fade-out {
  from {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -12px) scale(0.98);
  }
}

.toast {
  position: fixed;
  inset-block-start: 2rem;
  inset-inline-start: 50%;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.95rem;
  line-height: 1.4;
  max-width: min(320px, calc(100vw - 2.5rem));
  z-index: 9999;
  transform: translateX(-50%);
}

.toast:popover-open {
  animation: toast-fade-in 160ms ease-out;
}

.toast.toast-hiding {
  animation: toast-fade-out 180ms ease-in forwards;
}

@media (prefers-reduced-motion: reduce) {
  .toast:popover-open,
  .toast.toast-hiding {
    animation-duration: 1ms;
  }
}

/* ----- Utility Helpers ----- */
.flex { display: flex; }
.grid { display: grid; }
.hidden { display: none !important; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-3 > * + * { margin-left: 0.75rem; }
.space-x-4 > * + * { margin-left: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.text-center { text-align: center; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-1 { margin-top: 0.25rem; }
.empty-state-icon {
  width: 4rem;
  height: 4rem;
  color: var(--color-muted-foreground);
  display: block;
  margin: 0 auto 1rem auto;
}
.qr-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.qr-modal-content {
  position: relative;
  background: var(--color-card);
  color: var(--color-card-foreground);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.qr-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-muted-foreground);
}

.qr-modal-close:hover {
  color: var(--color-foreground);
}

.qr-modal-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: var(--color-background);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  width: min(360px, calc(100vw - 4rem));
  max-width: 100%;
}

.qr-modal-actions {
  display: flex;
  justify-content: flex-end;
}

.qr-modal-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
}

/* ----- Range Slider Styling ----- */
input[type="range"].slider {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

/* Track styling */
input[type="range"].slider::-webkit-slider-runnable-track {
  background: var(--color-border);
  height: 0.5rem;
  border-radius: 0.5rem;
}

input[type="range"].slider::-moz-range-track {
  background: var(--color-border);
  height: 0.5rem;
  border-radius: 0.5rem;
}

/* Thumb styling */
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--color-card);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  margin-top: -0.375rem;
}

input[type="range"].slider::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--color-card);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

/* Focus and hover states */
input[type="range"].slider:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--color-ring);
}

input[type="range"].slider:focus::-moz-range-thumb {
  box-shadow: 0 0 0 3px var(--color-ring);
}

input[type="range"].slider:hover::-webkit-slider-thumb {
  transform: scale(1.1);
}

input[type="range"].slider:hover::-moz-range-thumb {
  transform: scale(1.1);
}
