/* ==================================================
   QR Code Generator — Component Styles
   Cards / Forms / Buttons / Tabs / Tool Layout / etc.
   Shared across all tool pages
   ================================================== */

/* ---------- Card ---------- */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

/* ---------- Tool Wrapper (left/right grid) ---------- */
.tool-wrapper,
.tool {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin: 32px 0 48px;
  align-items: start;
}

@media(max-width:768px) {
  .tool-wrapper,
  .tool {
    grid-template-columns: 1fr;
  }
}

/* ---------- Tabs ---------- */
.tabs,
.scanner-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.tab,
.scanner-tab {
  flex: 1;
  min-width: fit-content;
  padding: 8px 14px;
  text-align: center;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.tab:hover,
.scanner-tab:hover {
  color: var(--text);
}

.tab.active,
.scanner-tab.active {
  background: var(--bg);
  color: var(--primary);
  box-shadow: var(--shadow);
}

/* ---------- Form Inputs ---------- */
.input-group {
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.input-group input,
.input-group textarea,
.input-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color .15s;
  font-family: inherit;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.input-group textarea {
  min-height: 80px;
  resize: vertical;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Custom select arrow */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* ---------- Text Input / Help Text ---------- */
.text-input textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-family: monospace;
  color: var(--text);
  background: var(--bg-secondary);
  resize: vertical;
  line-height: 1.6;
}

.text-input textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.help-text {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: .875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid transparent;
}

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

.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
}

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

.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  filter: brightness(.95);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(.95);
}

.btn-group {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: #fff;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  opacity: 0;
  transition: all .3s;
  pointer-events: none;
  z-index: 999;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Preview Area ---------- */
.preview-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 20px;
  gap: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
}

.preview-placeholder {
  text-align: center;
  color: var(--text-muted);
}

.preview-placeholder svg {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
  opacity: .4;
}

#qrContainer {
  width: 260px;
  height: 260px;
  border-radius: 8px;
  overflow: hidden;
  display: none;
  margin: 0 auto;
}

#qrContainer canvas,
#qrContainer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ---------- Customize Controls ---------- */
.customize-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.color-input {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-input label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

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

.size-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.size-control label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.size-control input {
  flex: 1;
}

.size-control span {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text);
  min-width: 30px;
  text-align: right;
}

.logo-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
}

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

.logo-upload input[type="file"] {
  display: none;
}

.logo-upload label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.logo-upload.has-logo {
  border-color: var(--success);
  background: var(--success-light);
}

.logo-preview {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 4px;
  display: none;
}

.logo-preview.show {
  display: block;
}

.logo-remove {
  display: none;
  font-size: .75rem;
  color: #dc2626;
  cursor: pointer;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: transparent;
  border: 1px solid #fca5a5;
}

.logo-remove:hover {
  background: #fef2f2;
}

/* ---------- SEO Section ---------- */
.seo-section {
  padding: 40px 0;
  border-top: 1px solid var(--border);
}

.seo-section h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.seo-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 18px 0 6px;
}

.seo-section p,
.seo-section li {
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.7;
}

.seo-section ul {
  margin-left: 20px;
  margin-bottom: 14px;
}

.seo-section li {
  margin-bottom: 6px;
}


/* ---------- Table (Blog articles) ---------- */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: .9rem;
}

.content table thead tr {
  background: var(--primary);
  color: #fff;
}

.content table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: .85rem;
}

.content table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.content table tbody tr:nth-child(even) {
  background: var(--bg-secondary);
}

.content table tbody tr:hover {
  background: var(--primary-light);
}

/* ---------- FAQ ---------- */
.faq {
  border-top: 1px solid var(--border);
  padding: 32px 0 40px;
}

.faq h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.faq-q {
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-q:hover {
  color: var(--primary);
}

.faq-a {
  padding-top: 8px;
  font-size: .85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  display: none;
}

.faq-a.open {
  display: block;
}

/* ---------- Upload Zone (Bulk / Scanner) ---------- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  transition: all .2s;
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.drag {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-zone svg {
  width: 40px;
  height: 40px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.upload-zone p {
  color: var(--text-secondary);
  font-size: .85rem;
}

.upload-zone .or {
  font-size: .75rem;
  color: var(--text-muted);
  margin: 6px 0;
}

#csvFile,
#imgFile {
  display: none;
}

/* ---------- Progress Bar ---------- */
.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  margin-top: 12px;
  overflow: hidden;
  display: none;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width .3s;
  width: 0;
}

/* ---------- Results Grid (Bulk) ---------- */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(180px,1fr));
  gap: 16px;
  margin-top: 20px;
}

.result-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.result-item canvas {
  max-width: 100%;
  height: auto;
}

.result-label {
  font-size: .75rem;
  color: var(--text-secondary);
  margin-top: 8px;
  word-break: break-all;
}

.result-item .download-link {
  display: inline-block;
  font-size: .75rem;
  color: var(--primary);
  margin-top: 6px;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- Scanner-Specific ---------- */
#cameraView {
  width: 100%;
  max-height: 360px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#cameraView video {
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: cover;
}

.camera-placeholder {
  color: #fff;
  text-align: center;
  padding: 80px 20px;
  opacity: .6;
}

.result-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  min-height: 60px;
  word-break: break-all;
  font-size: .9rem;
  color: var(--text);
}

.result-box .type-badge {
  display: inline-block;
  padding: 3px 10px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 600;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.result-box .decoded-text {
  font-family: monospace;
  font-size: .9rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.result-box .action-btn {
  margin-top: 10px;
}

.scan-status {
  text-align: center;
  font-size: .85rem;
  color: var(--text-secondary);
  margin-top: 10px;
}

/* ---------- CTA Box (Blog pages) ---------- */
.cta-box {
  background: var(--bg);
  border: 2px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
  margin: 24px 0;
}

.cta-box p {
  margin-bottom: 10px;
  color: var(--text);
}

.cta-box a {
  display: inline-block;
  padding: 10px 24px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
