* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  min-height: 100vh;
  padding: 16px;
}
.app {
  max-width: 1000px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  body { padding: 12px; }
}

/* Form */
.form-section {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  border: 1px solid rgba(255,255,255,0.3);
}
.form-section h1 {
  font-size: 22px;
  margin-bottom: 24px;
  color: #1a1a2e;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-error {
  background: #fff0f0;
  color: #c1121f;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid #ffc8c8;
  margin-bottom: 18px;
  display: none;
  text-align: center;
}
.form-error.show { display: block; }
.form-section h1::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 22px;
  background: #e63946;
  border-radius: 2px;
}
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #444;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input[type="text"]:focus,
.form-group input[type="tel"]:focus {
  border-color: #e63946;
  box-shadow: 0 0 0 3px rgba(230,57,70,0.12);
}
.form-group input[type="tel"] {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 17px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input[type="file"] {
  width: 100%;
  padding: 6px 0;
  font-size: 14px;
}
.upload-thumbs {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.upload-preview {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid #e0e0e0;
  display: none;
  background: #f8f8f8;
}
.upload-preview.show { display: block; }
.btn {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s, box-shadow 0.2s;
  margin-top: 10px;
}
.btn:active { transform: scale(0.97); }
.btn-generate {
  background: linear-gradient(135deg, #e63946, #c1121f);
  color: #fff;
  box-shadow: 0 4px 16px rgba(230,57,70,0.3);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Checkbox */
.checkbox-group { margin-bottom: 12px; }
.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-transform: none !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  color: #333 !important;
  letter-spacing: 0 !important;
  padding: 8px 0;
}
.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #e63946;
  cursor: pointer;
  flex-shrink: 0;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a1a2e;
  color: #fff;
  padding: 14px 28px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 999;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.page-ref {
  position: fixed;
  bottom: 10px;
  left: 14px;
  font-size: 7px;
  color: rgba(255,255,255,0.03);
  letter-spacing: 0.5px;
  user-select: none;
  pointer-events: none;
  z-index: 1;
}

/* Badge */
.preview-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.badge-wrapper {
  position: relative;
}
.badge {
  width: 340px;
  background: #fff;
  border-radius: 28px;
  padding: 0;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  text-align: center;
  position: relative;
  border: 1px solid #e8e8e8;
}
.badge-inner {
  margin: 10px;
  border: 2px solid #e63946;
  border-radius: 20px;
  overflow: hidden;
}
@media (max-width: 768px) {
  .badge { width: 100%; max-width: 360px; }
}

.badge-header {
  padding: 22px 24px 14px;
}
.badge-company {
  font-size: 20px;
  font-weight: 900;
  color: #e63946;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  min-height: 24px;
  word-break: break-word;
}
.badge-certified {
  font-size: 12px;
  font-weight: 800;
  color: #e63946;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-top: 6px;
  min-height: 16px;
}
.badge-header-line {
  width: 50px;
  height: 3px;
  background: #e63946;
  margin: 12px auto 0;
  border-radius: 2px;
}

.badge-content {
  padding: 18px 24px 16px;
}

.badge-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 12px;
  align-items: center;
}
.badge-photo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #e63946;
}
.badge-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.badge-photo .placeholder {
  color: #bbb;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-logo {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 16px;
  overflow: hidden;
  background: #f9f9f9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border: 1px solid #eee;
}
.badge-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.badge-logo .placeholder {
  color: #bbb;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-name {
  font-size: 21px;
  font-weight: 800;
  color: #222;
  margin-bottom: 2px;
  min-height: 28px;
  word-break: break-word;
  letter-spacing: 0.5px;
}
.badge-job {
  font-size: 14px;
  font-weight: 600;
  color: #999;
  margin-bottom: 0;
  min-height: 20px;
  word-break: break-word;
}

.badge-qr-section {
  border-top: 1px solid #eee;
  margin: 18px -24px 0;
  padding: 14px 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  background: #fafafa;
}
.badge-qr {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80px;
}
.badge-qr img {
  width: 88px;
  height: 88px;
  image-rendering: pixelated;
}
.badge-qr-info {
  text-align: left;
  font-size: 10px;
  color: #aaa;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-qr-info strong {
  color: #888;
  font-size: 11px;
}

.badge-placeholder-text {
  color: #ccc;
  font-size: 12px;
  padding: 6px 0;
}
