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

:root {
  /* ── Brand palette ── */
  --dark-blue-100:   #15273d;   /* header, dark surfaces, headings */
  --light-blue-100:  #004aa1;   /* primary actions, links, accents */
  --light-blue-40:   #99b7d9;   /* borders, disabled, subtle accents */
  --yellow-100:      #eef13d;   /* highlight / warning accent */
  --red-100:         #d32117;   /* errors, destructive */
  --green-100:       #14bd4d;   /* success */
  --orange-100:      #ffab49;   /* secondary warning / pending */


  /* ── Derived tints ── */
  --blue-hover:      #003a80;   /* darker blue for hover */
  --blue-tint:       #e6edf6;   /* light-blue-100 @ ~10% — tinted bg */
  --charcoal:        #15273d;   /* body text now uses dark blue */
  --mid-grey:        #46586e;   /* secondary text (blue-grey) */
  --light-grey:      #f2f5f9;   /* page / panel backgrounds */
  --border:          #d3ddea;   /* borders */
  --white:           #ffffff;

  /* ── Status colors ── */
  --success-bg:  #e8f8ee;
  --success-fg:  #0d813a;
  --success-br:  #14bd4d;
  --error-bg:    #fbeae8;
  --error-fg:    #a11a12;
  --error-br:    #d32117;
  --info-bg:     #e6edf6;
  --info-fg:     #004aa1;
  --info-br:     #99b7d9;
  --warning-bg:  #fff4e6;
  --warning-fg:  #8a5410;
  --warning-br:  #ffab49;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--light-grey);
  font-family: 'Segoe UI', Arial, sans-serif;
  color: var(--charcoal);
  padding: 24px 16px;
}

/* ── DIALOG ── */
.dialog {
  position: relative;
  background: var(--white);
  border-radius: 4px;
  box-shadow: 0 2px 24px rgba(0,0,0,0.12);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
}


.lang-select {
  font-size: 0.85rem;
  padding: 4px 8px;
  border: none;
  border-radius: 6px;
  background: var(--white);
  color: var(--dark-blue-100);
  cursor: pointer;
  outline: none;
}

/* Language selector pinned to bottom-right of dialog */
.lang-select-corner {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  padding: 2px 8px;
  border: none;
  background: transparent;
  color: var(--mid-grey);
  cursor: pointer;
  outline: none;
  z-index: 10;
}

/* ── HEADER —- */
.dialog-header {
  background: var(--dark-blue-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
}

.dialog-header .brand-title {
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.dialog-header .logo {
  height: 28px;
  width: auto;
  object-fit: contain;
}



/* ── INFO AREA ── */
.info-area {
background: var(--light-grey);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  font-size: 0.88rem;
  color: var(--mid-grey);
  line-height: 1.5;
}

/* ── PHASE PANEL ── */
.phase { padding: 24px; }

.phase-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--charcoal);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.phase-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--light-blue-100);
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── FIELD GROUP ── */
.field-group { margin-bottom: 16px; }
.field-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--mid-grey);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#productCode {
  padding-left: 10px;
  font-weight: bold;
}

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

.input-row input[type="text"] {
  flex: 1;
  height: 42px;
  box-sizing: border-box;
  padding: 0 12px;           /* left/right breathing room */
  font-size: 1rem;           /* bigger, readable text */
  line-height: 42px;         /* vertically center text */
  border: 1px solid var(--light-blue-40);
  border-radius: 8px;
  outline: none;
  color: var(--dark-blue-100);
  background-color: var(--white);

  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input-row input[type="text"]:focus {
  border-color: var(--light-blue-100);
  box-shadow: 0 0 0 3px rgba(30, 41, 59, 0.12);
}

.input-row input[type="text"]:disabled {
  background-color: var(--light-grey);
  color:  var(--light-blue-40);
  cursor: not-allowed;
}

.input-row input[type="text"]::placeholder {
  color: var(--light-blue-40);
  font-size: 0.9rem;
}
/* ── BUTTONS ── */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 3px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, opacity 0.18s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-camera {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  flex-shrink: 0;
  background-color: var(--light-blue-100);
  color: var(--white);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25), 0 1px 2px rgba(0,0,0,0.15);
  transition: background-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.btn-camera:hover {
  background-color: var(--blue-hover);
  box-shadow: 0 4px 10px rgba(21,39,61,0.2);
}

.btn-camera:active {
  transform: scale(0.93);
  box-shadow: 0 1px 2px rgba(21,39,61,0.2);
}

.btn-camera:disabled {
  background-color: #93c5fd;   /* washed-out blue when disabled */
  color: #eff6ff;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-primary {
  background: var(--light-blue-100);
  color: var(--white);
  width: 100%;
  padding: 12px;
  font-size: 0.95rem;
  margin-top: 4px;
  letter-spacing: 0.3px;
}
.btn-primary:hover:not(:disabled) { background: var(--blue-hover); }

.btn-redeem {
  background: var(--dark-blue-100);
  font-weight: 700;
  color: var(--white);
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  margin-top: 8px;
  letter-spacing: 0.5px;
}
.btn-redeem:hover:not(:disabled) { background: #0e1c2e; }

/* ── MESSAGES ── */
.msg {
  border-radius: 3px;
  padding: 10px 14px;
  font-size: 0.88rem;
  margin-top: 10px;
  display: none;
  line-height: 1.45;
}
.msg.error   { display: block; background: var(--error-bg);   color: var(--error-fg);   border: 1px solid var(--error-br); }
.msg.success { display: block; background: var(--success-bg); color: var(--success-fg); border: 1px solid var(--success-br); }
.msg.info    { display: block; background: var(--info-bg);    color: var(--info-fg);    border: 1px solid var(--info-br); }

/* ── RESULT ROWS ── */
.result-row {
  display: none;
  background: var(--light-grey);
  border: 1px solid var(--border);
  border-left: 3px solid var(--light-blue-100);
  border-radius: 3px;
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 0.9rem;
  color: var(--mid-grey);
}
.result-row.visible { display: block; }
.result-row span { font-weight: 700; color: var(--dark-blue-100); }

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── SECTION HIDDEN ── */
.section-hidden { display: none; }

/* ── SUCCESS SCREEN ── */
#successScreen {
  display: none;
  padding: 32px 24px;
  text-align: center;
}

#successScreen h2 { color: var(--blue); font-size: 1.2rem; margin-bottom: 8px; font-weight: 700; }
#successScreen p  { color: var(--mid-grey); font-size: 0.92rem; margin-bottom: 6px; }
#successScreen .new-expiry {
  margin-top: 16px;
  background: var(--success-bg);
  border: 1px solid var(--success-br);
  border-radius: 3px;
  padding: 12px 18px;
  color: var(--success-fg);
  font-size: 1rem;
  font-weight: 600;
}

/* ── SPINNER ── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── FOOTER ── */
.dialog-footer {
  position: relative;
  border-top: 1px solid var(--border);
  background: var(--light-grey);
  padding: 12px 24px;
}

.dialog-footer nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.dialog-footer nav a {
  color: var(--mid-grey);       /* grey, not blue */
  text-decoration: none;        /* no underscore */
  font-size: 0.8rem;
  transition: color 0.18s;
}

.dialog-footer nav a:hover { color: var(--blue); }

/* ── CAMERA MODAL ── */
#cameraModal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(21, 39, 61, 0.8);
  z-index: 999;
  align-items: center;
  justify-content: center;
}
#cameraModal.open { display: flex; }

.camera-box {
  background: var(--white);
  border-radius: 4px;
  padding: 20px;
  width: 340px;
  max-width: 95vw;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
  border-top: 3px solid var(--light-blue-100);
}
.camera-box h3 {
  color: var(--light-blue-100);
  margin-bottom: 14px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
#cameraVideo {
  width: 100%;
  border-radius: 3px;
  background: #000;
  aspect-ratio: 1;
  object-fit: cover;
}
#cameraCanvas { display: none; }
.camera-actions { display: flex; gap: 10px; margin-top: 14px; justify-content: center; }
.btn-cancel { background: var(--light-grey); color: var(--charcoal); border: 1px solid var(--border); }
.btn-cancel:hover { background: var(--border); }