/* ============================================================
   QR Forge — styles.css
   Aesthetic: Dark industrial precision tool
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,400&family=Syne:wght@400;600;700;800&display=swap');

/* ---- TOKENS ---- */
:root {
  --bg:        #0d0e11;
  --surface:   #13151a;
  --surface2:  #1c1f27;
  --border:    #272b36;
  --border2:   #3a3f4e;
  --text:      #e8eaf0;
  --text-mute: #7a8099;
  --text-dim:  #4e5568;
  --accent:    #5b8cff;
  --accent2:   #a78bfa;
  --good:      #4ade80;
  --warn:      #fb923c;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --font-mono: 'DM Mono', 'Courier New', monospace;
  --font-head: 'Syne', sans-serif;
  --shadow:    0 4px 24px rgba(0,0,0,.45);
  --glow:      0 0 24px rgba(91,140,255,.18);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* subtle grid texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(91,140,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91,140,255,.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ---- HEADER ---- */
header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(13,14,17,.9);
  backdrop-filter: blur(12px);
}

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

.logo-icon {
  font-size: 22px;
  filter: drop-shadow(0 0 8px var(--accent));
}

.logo-text {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}

.logo-text em {
  font-style: normal;
  color: var(--accent);
}

.header-tagline {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ---- MAIN LAYOUT ---- */
main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 0;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
  gap: 32px;
}

/* ---- PREVIEW COLUMN ---- */
.preview-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  position: sticky;
  top: 24px;
  align-self: start;
}

.preview-wrap {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow), var(--glow);
  overflow: hidden;
}

.preview-wrap::before {
  content: 'PREVIEW';
  position: absolute;
  top: 12px;
  left: 16px;
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--text-dim);
}

#qrCanvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  image-rendering: pixelated;
}

.scan-warning {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(251,146,60,.12);
  border: 1px solid rgba(251,146,60,.3);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--warn);
  letter-spacing: 0.3px;
}

.export-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 520px;
}

.copy-feedback {
  font-size: 12px;
  color: var(--good);
  opacity: 0;
  transition: opacity .3s;
  letter-spacing: 1px;
}

.copy-feedback.show { opacity: 1; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s ease;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  flex: 1;
  justify-content: center;
}
.btn-primary:hover { background: #7aaaff; box-shadow: 0 0 20px rgba(91,140,255,.4); }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border2);
  flex: 1;
  justify-content: center;
}
.btn-secondary:hover { background: var(--border); }

.btn-ghost {
  background: transparent;
  color: var(--text-mute);
  border: 1px solid var(--border);
  font-size: 12px;
  padding: 8px 14px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border2); }

/* ---- CONTROLS COLUMN ---- */
.controls-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---- PANELS ---- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s;
}

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

.panel[open] { border-color: var(--border2); }

.panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  transition: background .15s;
}
.panel-header::-webkit-details-marker { display: none; }
.panel-header:hover { background: var(--surface2); }

.panel-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  opacity: 0.7;
  letter-spacing: 1px;
}

.chevron {
  margin-left: auto;
  color: var(--text-dim);
  transition: transform .25s ease;
  flex-shrink: 0;
}

.panel[open] .chevron { transform: rotate(180deg); }

.panel-body {
  padding: 16px 18px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---- FORM FIELDS ---- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.field-label {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-mute);
}

input[type="text"],
input[type="number"],
select,
.hex-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 9px 11px;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  width: 100%;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
.hex-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,140,255,.12);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8099' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
}

select option {
  background: var(--surface2);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* ---- COLOR ROW ---- */
.color-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

input[type="color"] {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface2);
  cursor: pointer;
  padding: 3px;
  flex-shrink: 0;
}

/* ---- RANGE INPUTS ---- */
input[type="range"] {
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border2);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(91,140,255,.2);
  transition: box-shadow .18s;
}

input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 5px rgba(91,140,255,.35);
}

.range-val {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.5px;
  text-align: right;
}

/* ---- UPLOAD AREA ---- */
.upload-area {
  position: relative;
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: border-color .2s, background .2s;
  cursor: pointer;
  overflow: hidden;
}

.upload-area:hover {
  border-color: var(--accent);
  background: rgba(91,140,255,.05);
}

.upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.upload-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-mute);
  font-size: 12px;
  letter-spacing: 0.5px;
  pointer-events: none;
}

.upload-hint svg { opacity: 0.5; }

.upload-preview {
  pointer-events: none;
}

.upload-preview img {
  max-width: 80px;
  max-height: 80px;
  object-fit: contain;
  border-radius: 6px;
}

/* ---- FOOTER ---- */
footer {
  position: relative;
  z-index: 1;
  padding: 16px 32px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  text-align: center;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 1024px) {
  main {
    grid-template-columns: 1fr;
    padding: 20px 16px;
    gap: 20px;
  }

  .preview-col {
    position: static;
  }

  .preview-wrap {
    max-width: 100%;
  }

  .export-actions {
    max-width: 100%;
  }
}

@media (max-width: 600px) {
  header { padding: 14px 16px; }
  .header-tagline { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---- ANIMATIONS ---- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel {
  animation: fadeIn .3s ease both;
}

.panel:nth-child(1) { animation-delay: .05s; }
.panel:nth-child(2) { animation-delay: .10s; }
.panel:nth-child(3) { animation-delay: .15s; }
.panel:nth-child(4) { animation-delay: .20s; }
.panel:nth-child(5) { animation-delay: .25s; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
