/* TechnoFun 4.0 ID Badge Generator — Stylesheet */

:root {
  --bg-dark: #0A0A0D;
  --bg-card: #121217;
  --bg-card-hover: #181820;
  --bg-input: #15151B;
  --border-subtle: #242430;
  --border-focus: #7C5CFF;
  
  --violet-primary: #6D4AFF;
  --violet-light: #9D7BFF;
  --violet-glow: rgba(109, 74, 255, 0.4);
  --violet-deep: #3B1E8C;
  
  --text-white: #FFFFFF;
  --text-primary: #F0F0F5;
  --text-secondary: #A0A0B0;
  --text-muted: #6E6E7A;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Poppins', sans-serif;
  --font-condensed: 'Anton', sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Container */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 20px 40px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-badge {
  background: linear-gradient(135deg, var(--violet-light), var(--violet-primary));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  letter-spacing: 1px;
  box-shadow: 0 0 16px var(--violet-glow);
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-style: italic;
  font-size: 26px;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #FFF 40%, var(--violet-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.pill-btn {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.pill-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-white);
  border-color: var(--violet-primary);
}

.pill-btn.active {
  background: var(--violet-primary);
  color: #fff;
  border-color: var(--violet-primary);
  box-shadow: 0 0 12px var(--violet-glow);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

/* Main Workspace */
.main-workspace {
  display: grid;
  grid-template-columns: minmax(290px, 350px) 1fr;
  gap: 32px;
  align-items: start;
  flex: 1;
}

/* Left Column: Preview */
.preview-section {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preview-card-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 330px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
  cursor: grab;
  touch-action: none;
  background-color: #0A0A0D;
}

.canvas-wrapper:active {
  cursor: grabbing;
}

#badgeCanvas {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.canvas-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Photo Quick Tools */
.photo-controls-bar {
  width: 100%;
  max-width: 330px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.zoom-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 170px;
}

.zoom-group input[type="range"] {
  flex: 1;
  accent-color: var(--violet-primary);
  height: 6px;
  border-radius: 3px;
  background: #242430;
}

.zoom-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--violet-light);
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--violet-primary);
  color: #fff;
}

.nudge-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.nudge-mid {
  display: flex;
  gap: 2px;
}

.nudge-btn {
  width: 22px;
  height: 22px;
  font-size: 9px;
  padding: 0;
}

.reset-icon-btn {
  font-size: 8px;
  color: var(--violet-light);
}

.flip-reset-group {
  display: flex;
  gap: 6px;
}

.preview-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hint-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--violet-primary);
  display: inline-block;
}

/* Reference Comparison Panel */
.ref-compare-panel {
  background: var(--bg-card);
  border: 1px solid var(--violet-primary);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 10px 40px rgba(109, 74, 255, 0.2);
}

.ref-compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.ref-compare-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--violet-light);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.close-btn:hover {
  color: #fff;
}

.compare-modes {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 8px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.tab-btn.active {
  background: var(--violet-deep);
  color: var(--violet-light);
}

.compare-view {
  display: none;
}

.compare-view.active {
  display: block;
}

#sideBySideView {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#sideBySideView.active {
  display: grid;
}

.compare-col h4 {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-align: center;
}

.img-frame {
  aspect-ratio: 2 / 3;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.img-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.overlay-slider-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-subtle);
}

.overlay-ref {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.overlay-gen-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  border-right: 2px solid var(--violet-light);
  box-shadow: 2px 0 10px rgba(109, 74, 255, 0.6);
}

.overlay-gen {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.overlay-range {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  accent-color: var(--violet-primary);
}

.overlay-help {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

.diff-canvas {
  width: 100%;
  aspect-ratio: 2 / 3;
  display: block;
  background: #000;
  border-radius: var(--radius-sm);
}

.diff-stats {
  font-size: 11px;
  color: var(--violet-light);
  margin-top: 8px;
  text-align: center;
  font-family: monospace;
}

/* Right Column: Form */
.form-section {
  display: flex;
  flex-direction: column;
}

.badge-form {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: 0.3px;
}

.required {
  color: var(--violet-light);
}

.optional {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.char-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.security-badge {
  font-size: 11px;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Segmented Control */
.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.segment-option {
  position: relative;
  cursor: pointer;
}

.segment-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment-pill {
  display: block;
  text-align: center;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: calc(var(--radius-md) - 4px);
  transition: all 0.2s ease;
  user-select: none;
}

.segment-option input[type="radio"]:checked + .segment-pill {
  background: linear-gradient(135deg, var(--violet-primary), #5433d9);
  color: #fff;
  box-shadow: 0 2px 10px var(--violet-glow);
}

.segment-option:focus-within .segment-pill {
  outline: 2px solid var(--violet-light);
}

/* Inputs */
.text-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px;
  color: #fff;
  font-family: var(--font-sans);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.text-input:focus {
  outline: none;
  border-color: var(--violet-light);
  box-shadow: 0 0 0 3px rgba(109, 74, 255, 0.25);
}

.input-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Chips Grid */
.chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-white);
  border-color: var(--violet-primary);
}

.chip.active {
  background: var(--violet-deep);
  border-color: var(--violet-light);
  color: #fff;
  box-shadow: 0 0 10px rgba(109, 74, 255, 0.3);
}

.title-input-row {
  display: flex;
  gap: 8px;
}

.quick-title-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.title-pill {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.15s ease;
}

.title-pill:hover {
  background: var(--bg-card-hover);
  color: #fff;
  border-color: var(--violet-primary);
}

.title-pill.active {
  background: var(--violet-deep);
  border-color: var(--violet-light);
  color: #fff;
  box-shadow: 0 0 10px rgba(109, 74, 255, 0.35);
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-input);
  transition: all 0.2s ease;
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--violet-light);
  background: rgba(109, 74, 255, 0.05);
}

.dropzone:focus-visible {
  outline: 2px solid var(--violet-light);
}

.file-input-hidden {
  display: none;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.dropzone-icon {
  color: var(--violet-light);
}

.dropzone-title {
  font-size: 13px;
  color: var(--text-primary);
}

.dropzone-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Fine-tune Sliders */
.fine-tune-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tune-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tune-row label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 110px;
}

.tune-row input[type="range"] {
  flex: 1;
  accent-color: var(--violet-primary);
  height: 5px;
}

/* Export Settings */
.export-box {
  margin-top: 10px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.export-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkbox-custom {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--violet-primary);
  border-color: var(--violet-primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '✓';
  color: #fff;
  font-size: 12px;
  font-weight: bold;
}

.checkbox-label:focus-within .checkbox-custom {
  outline: 2px solid var(--violet-light);
}

/* Action Buttons */
.action-buttons-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--violet-primary), #4e29cc);
  color: #fff;
  box-shadow: 0 4px 20px var(--violet-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--violet-light), var(--violet-primary));
  box-shadow: 0 6px 24px rgba(109, 74, 255, 0.6);
  transform: translateY(-1px);
}

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

.btn-lg {
  padding: 14px 20px;
}

.btn-text-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.btn-title {
  font-size: 15px;
  font-weight: 700;
}

.btn-subtitle {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.85;
}

.secondary-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.select-input {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.select-input:focus {
  outline: none;
  border-color: var(--violet-light);
}

.btn-secondary {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 10px 16px;
  font-size: 13px;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--violet-primary);
  color: #fff;
}

/* Caption Box */
.caption-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.caption-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.caption-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.caption-content {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
}

/* Mobile Sticky Bar */
.mobile-sticky-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: rgba(10, 10, 13, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  z-index: 100;
}

.btn-full {
  width: 100%;
  padding: 14px;
}

/* Footer */
.app-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-privacy {
  font-size: 11px;
  color: #555562;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #181822;
  border: 1px solid var(--violet-primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 200;
  max-width: 90vw;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive Breakpoints */
@media (max-width: 960px) {
  .main-workspace {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .preview-section {
    position: static;
  }
  
  .preview-card-wrap {
    max-width: 350px;
    margin: 0 auto;
  }
}

@media (max-width: 600px) {
  .app-container {
    padding: 12px 14px 80px;
  }
  
  .badge-form {
    padding: 18px 14px;
    gap: 18px;
  }
  
  .mobile-sticky-bar {
    display: block;
  }
  
  .brand-title {
    font-size: 22px;
  }
}

