/* ========================================
   Iso Gas Plant — Badge Generator Styles
   ======================================== */

:root {
  --navy: #0a1628;
  --navy-mid: #0f2a4a;
  --navy-light: #1a3d6b;
  --orange: #f47920;
  --orange-light: #ffa44e;
  --steel: #8a9bb5;
  --steel-light: #c5cfe0;
  --white: #ffffff;
  --off-white: #f0f2f6;
  --bg-gradient: linear-gradient(145deg, #0a1628 0%, #132a47 50%, #1a3d6b 100%);
  --card-bg: rgba(255, 255, 255, 0.06);
  --card-border: rgba(255, 255, 255, 0.1);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-gradient);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* ---- Screens ---- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(30px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* ---- Cards ---- */
.card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 32px 24px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.fade-in {
  animation: fadeSlideUp 0.5s ease forwards;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Logo Header ---- */
.logo-header {
  text-align: center;
  margin-bottom: 28px;
}

.logo-icon {
  width: 56px;
  height: 70px;
  margin-bottom: 8px;
}

.company-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--white), var(--steel-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.company-sub {
  font-size: 0.85rem;
  color: var(--steel);
  margin-top: 4px;
  letter-spacing: 0.3px;
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--steel);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
  color: var(--white);
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.form-group input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(244, 121, 32, 0.15);
}

/* ---- Buttons ---- */
.btn-primary {
  appearance: none;
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--orange), #e06410);
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
  box-shadow: 0 4px 15px rgba(244, 121, 32, 0.3);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  appearance: none;
  width: 100%;
  padding: 13px 20px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--steel-light);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s;
}

.btn-secondary:active {
  background: rgba(255, 255, 255, 0.05);
}

/* ---- Screen 2: Ready ---- */
.emoji-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 12px;
}

#screen-ready h2 {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 8px;
}

.hint-text {
  text-align: center;
  color: var(--steel);
  font-size: 0.85rem;
  margin-bottom: 8px;
  line-height: 1.5;
}

.privacy-note {
  text-align: center;
  color: rgba(130, 220, 150, 0.85);
  font-size: 0.75rem;
  margin-bottom: 18px;
  line-height: 1.4;
}

/* ---- Screen 3: Camera ---- */
.camera-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#cameraVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* mirror for selfie */
}

.oval-guide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.oval-outline {
  width: 200px;
  height: 260px;
  border: 3px dashed rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.35);
  animation: pulseBorder 2s ease-in-out infinite;
}

@keyframes pulseBorder {
  0%, 100% { border-color: rgba(255, 255, 255, 0.5); }
  50% { border-color: rgba(244, 121, 32, 0.8); }
}

.guide-text {
  color: var(--white);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 16px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.camera-controls {
  position: absolute;
  bottom: 40px;
  display: flex;
  justify-content: center;
}

.btn-capture {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid var(--white);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s;
}

.btn-capture:active {
  transform: scale(0.9);
}

.capture-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--white);
  transition: background 0.1s;
}

.btn-capture:active .capture-ring {
  background: var(--steel-light);
}

.btn-back-camera {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: var(--white);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Screen 4: Overlay ---- */
.overlay-workspace {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.overlay-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.overlay-hint {
  font-size: 0.8rem;
  color: var(--steel);
}

.photo-stage {
  position: relative;
  width: 280px;
  height: 360px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #111;
  box-shadow: var(--shadow);
  touch-action: none;
}

.photo-stage canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.draggable-overlay {
  position: absolute;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
  z-index: 2;
}

#hatOverlay {
  width: 160px;
  top: -10px;
  left: 60px;
}

#coverallOverlay {
  width: 240px;
  bottom: -20px;
  left: 20px;
  top: auto;
}

.overlay-buttons {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 280px;
}

.overlay-buttons .btn-secondary,
.overlay-buttons .btn-primary {
  flex: 1;
  margin-top: 0;
}

/* ---- Screen 5: Badge ---- */
.badge-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 380px;
  width: 100%;
}

.badge-heading {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
}

.badge-card {
  width: 100%;
  max-width: 340px;
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  color: #1a1a2e;
  position: relative;
}

.badge-top-stripe {
  height: 6px;
  background: linear-gradient(90deg, var(--orange), #e06410, var(--orange-light));
}

.badge-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 8px;
  background: var(--navy);
}

.badge-logo {
  width: 32px;
  height: 40px;
  flex-shrink: 0;
}

.badge-company-text {
  display: flex;
  flex-direction: column;
}

.badge-company-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--white);
  letter-spacing: 0.3px;
}

.badge-company-tagline {
  font-size: 0.6rem;
  color: var(--steel);
  letter-spacing: 0.5px;
}

.badge-body {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  align-items: flex-start;
}

.badge-photo-frame {
  width: 110px;
  height: 140px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--navy);
  background: #eee;
}

.badge-photo-frame canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.badge-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.badge-field {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.badge-label {
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--steel);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.badge-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
  word-wrap: break-word;
}

.badge-name-value {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy);
}

.badge-bottom {
  padding: 10px 18px 12px;
  border-top: 1px solid #e5e8ee;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.badge-barcode {
  display: flex;
  gap: 2px;
  height: 28px;
  align-items: stretch;
}

.badge-barcode .bar {
  width: 3px;
  background: var(--navy);
  border-radius: 1px;
}

.badge-barcode .bar.thin {
  width: 1.5px;
  background: var(--steel);
}

.badge-barcode .bar.thick {
  width: 4.5px;
}

.badge-access {
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--orange);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.badge-bottom-stripe {
  height: 6px;
  background: linear-gradient(90deg, var(--navy), var(--navy-light), var(--navy));
}

.badge-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}

.badge-actions .btn-primary,
.badge-actions .btn-secondary {
  flex: 1;
  margin-top: 0;
}

/* ---- Safe area (notch) ---- */
@supports (padding-top: env(safe-area-inset-top)) {
  .camera-container {
    padding-top: env(safe-area-inset-top);
  }
  .btn-back-camera {
    top: calc(16px + env(safe-area-inset-top));
  }
  .camera-controls {
    bottom: calc(40px + env(safe-area-inset-bottom));
  }
}

/* ---- Desktop preview ---- */
@media (min-width: 500px) {
  .badge-card {
    max-width: 360px;
  }
}
