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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.container {
  background: white;
  padding: 2.5rem;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 560px;
}

h1 {
  font-size: 2rem;
  color: #1a1a2e;
  text-align: center;
  margin-bottom: 0.4rem;
}

.subtitle {
  text-align: center;
  color: #888;
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

/* SECTION */
.section {
  margin-bottom: 1.6rem;
}

.section > label {
  display: block;
  font-weight: 600;
  color: #333;
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
}

/* TEXT INPUT */
input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border 0.2s;
}

input[type="text"]:focus {
  border-color: #4f46e5;
}

/* COLOR ROW */
.color-row {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.color-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #555;
}

input[type="color"] {
  width: 48px;
  height: 48px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  padding: 2px;
  background: none;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  margin-top: 8px;
  accent-color: #4f46e5;
}

/* STYLE GRID */
.style-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.style-card {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.75rem 0.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.8rem;
  color: #555;
}

.style-card:hover {
  border-color: #a5b4fc;
  background: #f5f3ff;
}

.style-card.selected {
  border-color: #4f46e5;
  background: #eef2ff;
  color: #4f46e5;
  font-weight: 600;
}

/* STYLE PREVIEWS */
.style-preview {
  width: 40px;
  height: 40px;
  margin: 0 auto 0.4rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.style-preview::before,
.style-preview::after,
.square-preview,
.rounded-preview,
.dots-preview,
.classy-preview,
.classy-rounded-preview,
.extra-rounded-preview {
  content: '';
}

/* Each preview style uses box-shadow trick */
.square-preview {
  background:
    conic-gradient(#4f46e5 0deg 360deg);
  clip-path: polygon(0 0, 70% 0, 70% 30%, 30% 30%, 30% 70%, 70% 70%, 70% 100%, 0 100%);
  border-radius: 0;
  background: #4f46e5;
}

.rounded-preview {
  background: #4f46e5;
  border-radius: 6px;
}

.dots-preview {
  background: radial-gradient(circle, #4f46e5 60%, transparent 60%);
  border-radius: 50%;
}

.classy-preview {
  background: #4f46e5;
  clip-path: polygon(0 15%, 15% 0, 85% 0, 100% 15%, 100% 85%, 85% 100%, 15% 100%, 0 85%);
}

.classy-rounded-preview {
  background: #4f46e5;
  border-radius: 8px 0 8px 0;
}

.extra-rounded-preview {
  background: #4f46e5;
  border-radius: 50% 10px 50% 10px;
}

/* UPLOAD */
.upload-area {
  border: 2px dashed #c7d2fe;
  border-radius: 10px;
  padding: 1.2rem;
  text-align: center;
  cursor: pointer;
  color: #6366f1;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.upload-area:hover {
  background: #eef2ff;
}

#logo-preview-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

#logo-preview {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.remove-btn {
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}

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

.logo-size-row {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: #555;
}

.logo-size-row input[type="range"] {
  width: 100%;
  margin-top: 0.4rem;
  accent-color: #4f46e5;
}

/* QR SIZE */
input[type="range"] {
  width: 100%;
  margin-top: 0.4rem;
  accent-color: #4f46e5;
}

/* ERROR CORRECTION */
.ec-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ec-btn {
  flex: 1;
  padding: 0.5rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  color: #555;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 70px;
}

.ec-btn:hover {
  border-color: #a5b4fc;
  background: #f5f3ff;
}

.ec-btn.selected {
  border-color: #4f46e5;
  background: #eef2ff;
  color: #4f46e5;
  font-weight: 600;
}

/* TOOLTIP */
.tooltip {
  position: relative;
  cursor: help;
  color: #6366f1;
  font-size: 0.85rem;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 220px;
  background: #1a1a2e;
  color: white;
  text-align: center;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.2s;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* ERROR */
.error {
  color: #dc2626;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  min-height: 1.2rem;
  text-align: center;
}

/* GENERATE BUTTON */
.generate-btn {
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  margin-bottom: 1.5rem;
}

.generate-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

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

/* QR OUTPUT */
.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: #f8fafc;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
}

.hidden {
  display: none !important;
}

/* DOWNLOAD BUTTONS */
.download-row {
  display: flex;
  gap: 0.75rem;
}

.dl-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.dl-btn:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.png-btn { background: #6366f1; color: white; }
.svg-btn { background: #0ea5e9; color: white; }
.jpg-btn { background: #10b981; color: white; }

/* RESPONSIVE */
@media (max-width: 480px) {
  .container {
    padding: 1.5rem;
  }

  .style-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ec-row {
    flex-direction: column;
  }

  h1 {
    font-size: 1.6rem;
  }
}
