/* Back button header for edit pages */
.header-back {
  display: flex;
  align-items: center;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #556bb4;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: #0a4a7a;
  transform: translateY(-1px);
}

.back-btn span {
  font-size: 16px;
  font-weight: bold;
}

.wide { width:100%; max-width: 1200px; }
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

/* Design and Preview Side-by-Side Layout */
.design-preview-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

@media (max-width: 768px) {
  .design-preview-container {
    grid-template-columns: 1fr;
  }
}

/* Preview Status Container */
.preview-status-container {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* Form Header & Progress */
.form-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.form-header .sub {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 18px 0;
  line-height: 1.4;
}

.progress-indicator {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  position: relative;
}

.progress-indicator::before {
  content: '';
  position: absolute;
  top: 16px;
  left: 20px;
  right: 20px;
  height: 2px;
  background: var(--border);
  z-index: 1;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  background: var(--bg);
  padding: 0 8px;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  transition: all 0.3s ease;
}

.step-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
}

.progress-step.active .step-number {
  background: var(--primary);
  color: white;
}

.progress-step.completed .step-number {
  background: #10b981;
  color: white;
}

.progress-step.completed .step-label,
.progress-step.active .step-label {
  color: var(--text);
}

/* Form Sections */
.form-section {
  margin-bottom: 32px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafbfc;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.section-badge {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-badge:not(.optional) {
  background: #fef3c7;
  color: #92400e;
}

.section-badge.optional {
  background: #e0e7ff;
  color: #3730a3;
}

.section-badge.required {
  background: #f89292;
  color: rgb(119, 6, 6);
}

/* Collapsible Sections */
.collapsible .section-header {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.collapsible .section-header:hover {
  background-color: #f8f9fa;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-icon {
  font-size: 12px;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.section-content {
  padding-top: 16px;
}

/* Tags Input */
.tags-input-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tags-display {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 32px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  order: 2;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.tag-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  padding: 0;
  margin-left: 4px;
  opacity: 0.8;
}

.tag-remove:hover {
  opacity: 1;
}

.tag-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  order: 1;
}

.tag-input-row .input {
  flex: 3;
  min-width: 500px;
}

.tag-input-row .color-picker {
  width: 250px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}

.tag-input-row .btn {
  white-space: nowrap;
  min-width: 50px;
  height: 32px;
  padding: 4px 6px;
  font-size: 10px;
}

/* Tag input group with dropdown */
.tag-input-group {
  position: relative;
  flex: 3;
  min-width: 500px;
}

.existing-tags-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
}

.dropdown-content {
  padding: 4px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.dropdown-item:hover {
  background-color: #f8f9fa;
}

.dropdown-item .tag-preview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  color: white;
  margin-right: 8px;
}

.existing-tags-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.hint-text {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Tag editing in editQR.html */
.tags-edit-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8f9fa;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tags-edit-container .tag-input-row {
  gap: 12px;
}

.tags-edit-container .tag-input-row .input {
  flex: 4;
  min-width: 250px;
}

.tags-edit-container .tag-input-row .btn {
  min-width: 35px;
  padding: 8px 10px;
  font-size: 12px;
}

.edit-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.edit-actions .save-btn,
.edit-actions .cancel-btn {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 6px;
}

.no-tags {
  color: var(--muted);
  font-style: italic;
}

/* Inline tag editor for editQR.html */
.inline-tag-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8f9fa;
  width: 450px;
  align-self: flex-start;
}

.inline-tag-editor .tag-input-row {
  gap: 8px;
}

.inline-tag-editor .tag-input-row .input {
  flex: 3;
  min-width: 300px;
}

.inline-tag-editor .tag-input-row .color-picker {
  width: 200px;
  height: 32px;
}

.inline-tag-editor .tag-input-row .btn {
  min-width: 40px;
  padding: 6px 8px;
  font-size: 11px;
}

.inline-tag-editor .tags-display {
  min-height: 24px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: white;
}

.section-description {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.4;
}

/* Enhanced Input Labels */
.input-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
}

.label-text {
  flex: 1;
}

.label-required {
  color: #dc2626;
  font-weight: 600;
}

.label-optional {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

/* Input with Prefix */
.input-with-prefix {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
  overflow: hidden;
}

.input-prefix {
  padding: 12px 14px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 14px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
}

.input-with-prefix .input {
  border: none;
  border-radius: 0;
  flex: 1;
}

.input-with-prefix .input:focus {
  box-shadow: none;
}

/* Input Groups for inline layouts */
.input-group {
  flex: 1;
}

.input-group .input-label {
  font-size: 13px;
  margin-bottom: 4px;
}

.input-group .help {
  font-size: 11px;
  margin-top: 2px;
}

.row-inline { 
  display: flex; 
  gap: 16px; 
}

.row-inline .input, 
.row-inline select { 
  flex: 1; 
}

/* Design Grid */
.design-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.design-group {
  display: flex;
  flex-direction: column;
}

.design-group .input-label {
  margin-bottom: 8px;
}

/* Color Inputs */
.color-inputs {
  display: flex;
  gap: 12px;
}

.color-input {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.color-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.color-picker {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
}

.color-value {
  font-size: 11px;
  color: var(--muted);
  font-family: monospace;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Logo Upload */
.logo-upload-area {
  margin-bottom: 8px;
}

.logo-upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: #fafbfc;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 120px;
}

.logo-upload-box:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

.logo-upload-box.drag-over {
  border-color: var(--primary);
  background: #f0f9ff;
}

.upload-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.upload-text {
  text-align: center;
}

.upload-title {
  display: block;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

.upload-subtitle {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.logo-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

.logo-preview img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: contain;
  border: 1px solid var(--border);
}

.logo-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.btn-remove-logo {
  width: 24px;
  height: 24px;
  border: none;
  background: #fee2e2;
  color: #dc2626;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.2s ease;
}

.btn-remove-logo:hover {
  background: #fecaca;
}

.logo-size-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.logo-size-control input {
  width: 60px;
  padding: 4px 6px;
  font-size: 13px;
}

/* Form Actions */
.form-actions {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.btn-primary {
  background: var(--primary);
  color: white;
  font-weight: 600;
  padding: 14px 20px;
  font-size: 15px;
}

.btn-primary:hover {
  background: var(--primary-600);
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-icon {
  margin-right: 6px;
}

.form-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.note-icon {
  font-size: 14px;
}

/* Enhanced Preview Card */
.preview-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  background: #fff;
  padding: 20px;
}

/* Inline Editing Styles */
.info-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editable-field {
  flex: 1;
}

.edit-btn {
  background: none;
  border: none;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.2s ease;
  font-size: 12px;
  flex-shrink: 0;
  align-self: center;
}

.edit-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
  align-items: center;
  align-self: center;
}

.edit-btn:hover {
  opacity: 1;
  background: #f1f3f4;
}

.edit-input {
  flex: 1;
  padding: 6px 8px;
  border: 2px solid var(--primary);
  border-radius: 6px;
  font-size: inherit;
  font-family: inherit;
  background: #fff;
  min-width: 120px;
}

.edit-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(11, 61, 145, 0.2);
}

.save-btn,
.cancel-btn {
  padding: 6px 8px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin: 0;
}

.save-btn {
  background: #10b981;
  color: white;
}

.save-btn:hover:not(:disabled) {
  background: #059669;
}

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

.cancel-btn:hover {
  background: #dc2626;
}

.save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.preview-header h2 {
  margin: 0;
  font-size: 16px;
  color: var(--text);
  font-weight: 600;
}

.preview-status {
  display: flex;
  align-items: center;
}

.status-indicator {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-indicator:not(.error) {
  background: #d1fae5;
  color: #065f46;
}

.status-indicator.error {
  background: #fee2e2;
  color: #dc2626;
}

.preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--border);
  border-radius: 12px;
  height: 280px;
  background: #fafbfc;
  margin-bottom: 16px;
  position: relative;
}

.qr-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-container img,
.qr-svg-container {
  width: 240px;
  height: 240px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.qr-svg-container svg {
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

.qr-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.preview-status {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
}

.preview-status .status-indicator {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #d1fae5;
  color: #065f46;
}

.preview-status .status-indicator.error {
  background: #fee2e2;
  color: #dc2626;
}

.preview-status .status-indicator.loading {
  background: #fef3c7;
  color: #92400e;
}

.qr-container:hover .qr-overlay {
  opacity: 1;
}

.scan-hint {
  color: white;
  font-weight: 500;
  font-size: 14px;
}

.preview-info {
  margin-bottom: 16px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
}

.info-item:last-child {
  border-bottom: none;
}

.info-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.info-value {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  font-family: monospace;
}

.preview-actions {
  text-align: center;
}

.preview-actions .btn {
  width: 100%;
  margin-bottom: 8px;
}

.download-format-selector {
  margin-bottom: 12px;
}

.download-format-selector .input-label {
  font-size: 13px;
  margin-bottom: 6px;
  text-align: left;
}

.download-format-selector .input {
  width: 100%;
  font-size: 13px;
}

/* Enhanced Help Text */
.help {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* Input Validation */
.input.error {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.input.error:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.error-message {
  color: #dc2626;
  font-size: 12px;
  margin-top: 4px;
  font-weight: 500;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
  .design-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .grid {
    gap: 16px;
  }
  
  .design-grid {
    grid-template-columns: 1fr;
  }
  
  .row-inline {
    flex-direction: column;
    gap: 8px;
  }
  
  .color-inputs {
    flex-direction: column;
    gap: 8px;
  }
  
  .progress-indicator {
    margin-top: 12px;
  }
  
  .step-label {
    font-size: 11px;
  }
  
  .qr-container img,
  .qr-svg-container {
    width: 200px;
    height: 200px;
  }
  
  .preview-box {
    height: 240px;
  }
}
