/* ══════════════════════════════════════════════
   QR Code Generator — Styles
   ══════════════════════════════════════════════ */

.qr-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Top Bar ── */
#qr-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
}

#qr-topbar .topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  text-decoration: none;
  transition: opacity .2s;
}
.nav-brand:hover { opacity: .8; }
.nav-sep { color: var(--text-muted); font-size: 18px; }

#qr-topbar h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Layout ── */
.qr-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  gap: 0;
}

.qr-controls {
  width: 420px;
  min-width: 360px;
  overflow-y: auto;
  padding: 20px;
  border-right: 1px solid var(--border);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.qr-preview-section {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Control Cards ── */
.control-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.control-card h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-row {
  display: flex;
  gap: 12px;
}
.form-row > .form-group { flex: 1; }

.control-card .form-group {
  margin-bottom: 10px;
}

.control-card .form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}

.control-card select,
.control-card input[type="text"],
.control-card input[type="number"],
.control-card input[type="url"] {
  width: 100%;
  padding: 7px 10px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}

.control-card select:focus,
.control-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

/* Color input */
.color-input-wrap {
  display: flex;
  gap: 6px;
  align-items: center;
}

.color-input-wrap input[type="color"] {
  width: 36px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-base);
  cursor: pointer;
}

.color-input-wrap input[type="text"] {
  flex: 1;
}

/* Checkbox */
.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px !important;
  color: var(--text-secondary) !important;
}

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

.gradient-options {
  padding-top: 8px;
}

/* Big generate button */
.btn-lg {
  width: 100%;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  justify-content: center;
  border-radius: var(--radius-lg);
}

/* ── Preview Card ── */
.preview-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.preview-header h2 {
  font-size: 14px;
  font-weight: 600;
}

.qr-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 350px;
  padding: 24px;
  background: repeating-conic-gradient(
    var(--bg-elevated) 0% 25%, var(--bg-base) 0% 50%
  ) 50% / 16px 16px;
}

.qr-preview img,
.qr-preview svg {
  max-width: 100%;
  max-height: 400px;
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}

.qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}
.qr-placeholder p { font-size: 14px; }

.preview-actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
}

/* ── Saved Cards ── */
.saved-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.saved-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}
.saved-header h2 { font-size: 14px; font-weight: 600; }

.saved-list {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.saved-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
}

.saved-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all .2s;
  cursor: pointer;
}
.saved-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(88,166,255,.15);
}
.saved-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 4px;
  background: #fff;
}
.saved-item .saved-name {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

/* ── Generating animation ── */
.qr-preview.loading::after {
  content: '';
  position: absolute;
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .qr-layout {
    flex-direction: column;
  }
  .qr-controls {
    width: 100%;
    min-width: 0;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 50vh;
  }
}
