@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Satoshi:wght@400;500;700&display=swap');

:root {
  --color-bg: #0f0e0d;
  --color-bg-elevated: #1a1918;
  --color-surface: #242220;
  --color-surface-hover: #2e2b28;
  --color-text: #f5f2ed;
  --color-text-muted: #8a857d;
  --color-text-subtle: #5c5852;
  --color-accent: #c47d5c;
  --color-accent-hover: #d4936f;
  --color-accent-soft: rgba(196, 125, 92, 0.12);
  --color-border: #2e2b28;
  --color-border-hover: #3d3935;

  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;

  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-card:
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 24px 48px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-focus: 0 0 0 2px var(--color-accent-soft), 0 0 0 4px var(--color-accent);

  --transition-fast: 120ms ease-out;
  --transition-normal: 200ms ease-out;
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(196, 125, 92, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(196, 125, 92, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-accent);
  color: var(--color-bg);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 500;
  z-index: 1000;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-md);
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--space-lg);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@media (min-width: 768px) {
  .workspace {
    grid-template-columns: 1fr 340px;
    align-items: stretch;
  }
}

.preview-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  min-height: 0;
  overflow: hidden;
  padding: var(--space-lg);
  background: var(--color-bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.dual-preview {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  justify-content: center;
  align-items: center;
  flex: 1;
  min-height: 0;
}

.card-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  position: relative;
}

.preview-container {
  background: transparent;
  border-radius: var(--radius-md);
  padding: 0;
  transition: transform var(--transition-slow), box-shadow var(--transition-slow);
}

.preview-container:hover {
  transform: translateY(-2px);
}

#frontCanvas,
#backCanvas {
  max-width: 100%;
  max-height: calc((100vh - 8rem) / 2);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  overflow-y: auto;
  min-height: 0;
  padding-right: var(--space-xs);
}

.settings-section::-webkit-scrollbar {
  width: 4px;
}

.settings-section::-webkit-scrollbar-track {
  background: transparent;
}

.settings-section::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

.settings-section::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-hover);
}

.sidebar-header {
  flex-shrink: 0;
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-xs);
}

.sidebar-header h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  font-style: italic;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin: 0;
}

.setting-group {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  transition: border-color var(--transition-fast);
}

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

.setting-title {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.orientation-toggle,
.side-toggle {
  display: flex;
  gap: 2px;
  background: var(--color-bg);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

.orientation-btn,
.side-btn {
  flex: 1;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.orientation-btn:hover,
.side-btn:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.orientation-btn.active,
.side-btn.active {
  background: var(--color-accent);
  color: var(--color-bg);
  font-weight: 600;
}

.text-input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

input[type='text'],
input[type='url'] {
  width: 100%;
  padding: 10px 14px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--color-text);
  transition: all var(--transition-fast);
}

input[type='text']::placeholder,
input[type='url']::placeholder {
  color: var(--color-text-subtle);
}

input[type='text']:hover,
input[type='url']:hover {
  border-color: var(--color-border-hover);
}

input[type='text']:focus,
input[type='url']:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.color-picker-row input[type='color'] {
  width: 44px;
  height: 44px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.color-picker-row input[type='color']:hover {
  border-color: var(--color-border-hover);
  transform: scale(1.05);
}

.color-picker-row input[type='color']::-webkit-color-swatch-wrapper {
  padding: 3px;
}

.color-picker-row input[type='color']::-webkit-color-swatch {
  border-radius: calc(var(--radius-sm) - 4px);
  border: none;
}

.color-value {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.preset-colors {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  flex-wrap: wrap;
}

.preset-color {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.preset-color::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid transparent;
  border-radius: calc(var(--radius-sm) + 2px);
  transition: border-color var(--transition-fast);
}

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

.preset-color.active::after {
  border-color: var(--color-accent);
}

.preset-color[data-color='#ffffff'] {
  background: #ffffff;
}

.preset-color[data-color='#f3f4f6'] {
  background: #f3f4f6;
}

.preset-color[data-color='#1f2937'] {
  background: #1f2937;
}

.preset-color[data-color='#fef3c7'] {
  background: #fef3c7;
}

.preset-color[data-color='#dbeafe'] {
  background: #dbeafe;
}

.preset-color[data-color='#dcfce7'] {
  background: #dcfce7;
}

.icon-upload-row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  margin-bottom: var(--space-sm);
}

.file-upload-btn,
.generate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  background: var(--color-accent);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-bg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.file-upload-btn:hover,
.generate-btn:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}

.file-upload-btn:active,
.generate-btn:active {
  transform: translateY(0);
}

.clear-btn {
  padding: 10px 16px;
  background: transparent;
  border: 1px solid #ef4444;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: #ef4444;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.clear-btn:hover {
  background: #ef4444;
  color: white;
}

.icon-option-group {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.icon-option-group:last-child {
  margin-bottom: 0;
}

.option-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  min-width: 44px;
  flex-shrink: 0;
}

.btn-group {
  display: flex;
  gap: 2px;
  background: var(--color-bg);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  flex: 1;
}

.btn-group.mode-toggle {
  flex: none;
  width: 100%;
}

.icon-position-btn,
.icon-shape-btn,
.icon-border-btn,
.card-border-btn,
.top-band-btn,
.back-mode-btn {
  flex: 1;
  padding: 8px 10px;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-position-btn:hover,
.icon-shape-btn:hover,
.icon-border-btn:hover,
.card-border-btn:hover,
.top-band-btn:hover,
.back-mode-btn:hover {
  background: var(--color-surface);
  color: var(--color-text);
}

.icon-position-btn.active,
.icon-shape-btn.active,
.icon-border-btn.active,
.card-border-btn.active,
.top-band-btn.active,
.back-mode-btn.active {
  background: var(--color-accent);
  color: var(--color-bg);
  font-weight: 600;
}

.icon-border-btn[data-border='custom'] {
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-border-btn[data-border='custom'] input[type='color'] {
  width: 22px;
  height: 22px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}

.icon-border-btn[data-border='custom'] input[type='color']::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.icon-border-btn[data-border='custom'] input[type='color']::-webkit-color-swatch {
  border-radius: 2px;
  border: none;
}

.deco-option-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.deco-option-row:last-child {
  margin-bottom: 0;
}

.deco-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  min-width: 44px;
  flex-shrink: 0;
}

.deco-btn-group {
  display: flex;
  gap: 8px;
  flex: 1;
}

.deco-btn {
  flex: 1;
  height: 48px;
  padding: 6px;
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.deco-btn:hover {
  border-color: var(--color-border-hover);
  background: var(--color-surface);
}

.deco-btn.active {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.deco-preview {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.deco-card {
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}

.deco-card-border-black {
  box-shadow: inset 0 0 0 3px #1a1a1a;
}

.deco-card-border-white {
  background: #1a1a1a;
  box-shadow: inset 0 0 0 3px #ffffff;
}

.deco-card-band-black::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: #1a1a1a;
}

.deco-btn-picker {
  padding: 8px;
}

.deco-btn-picker input[type='color'] {
  width: 100%;
  height: 100%;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}

.deco-btn-picker input[type='color']::-webkit-color-swatch-wrapper {
  padding: 3px;
}

.deco-btn-picker input[type='color']::-webkit-color-swatch {
  border-radius: 3px;
  border: none;
}

input[type='range'] {
  flex: 1;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  appearance: none;
  cursor: pointer;
}

input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--color-accent);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 6px rgba(196, 125, 92, 0.4);
}

input[type='range']::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(196, 125, 92, 0.5);
}

input[type='range']::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--color-accent);
  border-radius: 50%;
  border: none;
  cursor: pointer;
}

.qr-input-row {
  display: flex;
  gap: var(--space-sm);
}

.qr-input-row input {
  flex: 1;
}

.qr-input-row + .qr-input-row {
  margin-top: var(--space-sm);
}

.output-options {
  display: flex;
  gap: var(--space-sm);
}

.output-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.output-btn:hover {
  background: var(--color-surface);
  border-color: var(--color-border);
}

.output-btn.active {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.output-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text);
}

.output-desc {
  font-size: 0.7rem;
  color: var(--color-text-muted);
}

.print-hint {
  margin-top: var(--space-sm);
  font-size: 0.7rem;
  color: var(--color-text-subtle);
  text-align: center;
}

.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: 14px var(--space-lg);
  background: linear-gradient(135deg, var(--color-accent) 0%, #b06d4a 100%);
  color: var(--color-bg);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.download-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(196, 125, 92, 0.35);
}

.download-btn:hover::before {
  transform: translateX(100%);
}

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

.download-btn svg {
  width: 18px;
  height: 18px;
}

.hint {
  font-size: 0.7rem;
  color: var(--color-text-subtle);
  margin-top: var(--space-xs);
}

.drop-zone {
  position: relative;
  transition: all var(--transition-fast);
}

.drop-zone.drag-over {
  background-color: var(--color-accent-soft);
  border-color: var(--color-accent);
}

.drop-zone.drag-over::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px dashed var(--color-accent);
  border-radius: inherit;
  pointer-events: none;
  animation: pulse 1s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.setting-group {
  animation: fadeSlideIn 0.4s ease backwards;
}

.setting-group:nth-child(1) { animation-delay: 0.05s; }
.setting-group:nth-child(2) { animation-delay: 0.1s; }
.setting-group:nth-child(3) { animation-delay: 0.15s; }
.setting-group:nth-child(4) { animation-delay: 0.2s; }
.setting-group:nth-child(5) { animation-delay: 0.25s; }
.setting-group:nth-child(6) { animation-delay: 0.3s; }
.setting-group:nth-child(7) { animation-delay: 0.35s; }

@media (max-width: 767px) {
  .container {
    padding: var(--space-md);
  }

  .preview-section {
    padding: var(--space-md);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.header,
.tagline,
.privacy-banner,
.privacy-icon,
.card-label,
.preview-controls,
.layout-grid,
.layout-btn,
.layout-preview,
.layout-preview-center,
.layout-preview-left,
.layout-preview-right,
.layout-preview-minimal,
.layout-preview-qr,
.lp-name,
.lp-name-large,
.lp-title,
.lp-contact,
.lp-text-area,
.lp-qr,
.layout-name,
.text-input-row,
.text-input-row input[type='text'],
.text-input-row input[type='color'],
.text-input-row input[type='color']::-webkit-color-swatch-wrapper,
.text-input-row input[type='color']::-webkit-color-swatch {
  display: none;
}
