/* ═══════════════════════════════════════════════
   UNESPAR QR Generator — inspired by QRCode Monkey
   Brand: azul #003d72, verde #007b3e
   ═══════════════════════════════════════════════ */

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

:root {
  --blue:      #003d72;
  --blue-mid:  #005099;
  --blue-lt:   #e8f0fb;
  --green:     #007b3e;
  --green-lt:  #e5f5ec;
  --border:    #dde2ea;
  --bg:        #f0f2f7;
  --white:     #ffffff;
  --text:      #1a1a2e;
  --muted:     #6b7280;
  --radius:    10px;
  --shadow:    0 2px 14px rgba(0,0,0,.08);
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ════════════════ HEADER ════════════════ */
header {
  background: var(--blue);
  color: #fff;
  padding: .9rem 1.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: .8rem;
}

.header-brand img {
  height: 44px;
  width: auto;
  background: #fff;
  border-radius: 6px;
  padding: 3px 6px;
  object-fit: contain;
}

.header-brand span {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.header-sub {
  font-size: .78rem;
  opacity: .7;
}

/* ════════════════ APP WRAPPER ════════════════ */
.app-wrapper {
  display: grid;
  grid-template-columns: 90px 1fr 1fr;
  grid-template-rows: 1fr;
  min-height: calc(100vh - 60px - 42px);
  gap: 0;
}

/* ════════════════ TYPE NAV ════════════════ */
.type-nav {
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: .6rem 0;
  gap: 2px;
}

.type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: .65rem .3rem;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  margin: 0 6px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  transition: background .15s, color .15s;
  text-align: center;
  line-height: 1.2;
}

.type-btn .icon { font-size: 1.3rem; line-height: 1; }

.type-btn:hover {
  background: var(--blue-lt);
  color: var(--blue);
}

.type-btn.active {
  background: var(--blue-lt);
  color: var(--blue);
  position: relative;
}

.type-btn.active::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--blue);
  border-radius: 0 3px 3px 0;
}

/* ════════════════ OPTIONS PANEL ════════════════ */
.options-panel {
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 1.2rem 1.4rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  background: #fafbfd;
}

.section-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .8rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.section-title.sub {
  margin-top: .9rem;
  font-size: .75rem;
  color: var(--muted);
}

.step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* content forms */
.content-form { display: none; flex-direction: column; gap: .55rem; }
.content-form.active { display: flex; }

label {
  font-size: .8rem;
  font-weight: 600;
  color: #444;
}

input[type="url"],
input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: .5rem .75rem;
  font-size: .9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  outline: none;
  resize: vertical;
  transition: border-color .2s, box-shadow .2s;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,61,114,.1);
}

.check-label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-weight: 500;
  cursor: pointer;
}

/* colors */
.color-row {
  display: flex;
  gap: 1rem;
}

.color-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: .5rem;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  padding: 4px 8px 4px 4px;
  background: var(--white);
  transition: border-color .2s;
}

.color-input-wrap:focus-within { border-color: var(--blue); }

input[type="color"] {
  width: 32px; height: 32px;
  border: none;
  border-radius: 5px;
  padding: 0;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}

.color-hex {
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  font-size: .85rem !important;
  font-family: monospace;
  width: 70px;
  font-weight: 600;
}

/* logo options */
.logo-options {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}

.logo-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .7rem;
  width: 96px;
  text-align: center;
  transition: border-color .15s, background .15s;
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
}

.logo-opt input[type="radio"] { display: none; }

.logo-opt img {
  width: 64px; height: 64px;
  object-fit: contain;
}

.no-logo-icon {
  width: 64px; height: 64px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.logo-opt:hover { border-color: var(--blue-mid); }

.logo-opt.active {
  border-color: var(--blue);
  background: var(--blue-lt);
  color: var(--blue);
}

.hint {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .4rem;
}

/* shapes */
.shape-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.shape-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
  padding: .5rem .4rem;
  width: 64px;
  font-size: .7rem;
  font-weight: 600;
  color: var(--muted);
  transition: border-color .15s, color .15s, background .15s;
}

.shape-btn svg {
  width: 36px; height: 36px;
  fill: currentColor;
}

.shape-btn:hover {
  border-color: var(--blue-mid);
  color: var(--blue-mid);
}

.shape-btn.active {
  border-color: var(--blue);
  background: var(--blue-lt);
  color: var(--blue);
}

/* quality */
.quality-row {
  display: flex;
  align-items: center;
  gap: .7rem;
}

.q-label {
  font-size: .78rem;
  color: var(--muted);
  white-space: nowrap;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--blue);
  cursor: pointer;
}

.quality-value {
  text-align: center;
  font-size: .82rem;
  color: var(--muted);
  margin-top: .4rem;
}

/* create button */
.btn-create {
  display: block;
  width: 100%;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: .85rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .1s;
  letter-spacing: .02em;
}

.btn-create:hover  { background: var(--blue-mid); }
.btn-create:active { transform: scale(.98); }

/* ════════════════ PREVIEW PANEL ════════════════ */
.preview-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem 1.5rem;
  gap: 1.2rem;
  overflow-y: auto;
}

.preview-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 380px;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .8rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.placeholder-icon {
  font-size: 5rem;
  line-height: 1;
  opacity: .25;
}

#qr-output canvas,
#qr-output svg {
  border-radius: 8px;
  max-width: 100%;
}

/* download buttons */
.download-btns {
  display: flex;
  gap: .8rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 380px;
}

.btn-dl {
  flex: 1;
  min-width: 120px;
  border: none;
  border-radius: 8px;
  padding: .7rem 1rem;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
}

.btn-dl:hover  { opacity: .88; }
.btn-dl:active { transform: scale(.97); }

.btn-dl.png { background: var(--blue); color: #fff; }
.btn-dl.svg { background: var(--green); color: #fff; }

/* encoded preview */
.encoded-preview {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .7rem 1rem;
  font-size: .78rem;
  color: var(--muted);
  word-break: break-all;
  width: 100%;
  max-width: 380px;
  line-height: 1.5;
}

.encoded-preview strong { color: var(--blue); }

/* ════════════════ FOOTER ════════════════ */
footer {
  background: var(--blue);
  color: rgba(255,255,255,.65);
  text-align: center;
  padding: .75rem 1rem;
  font-size: .78rem;
}

/* ════════════════ RESPONSIVE ════════════════ */
@media (max-width: 900px) {
  .app-wrapper {
    grid-template-columns: 72px 1fr;
    grid-template-rows: auto auto;
  }
  .preview-panel {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 560px) {
  .app-wrapper {
    grid-template-columns: 1fr;
  }
  .type-nav {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--border);
    justify-content: center;
  }
  .type-btn.active::after { display: none; }
  header { justify-content: center; text-align: center; }
}
