/* ==========================================================================
   Pinkoi Packaging Vote App — styles
   Palette restricted to: Brand Navy, Brand Coral, Supporting Sky Blue,
   Supporting Yellow, Black, Light Gray, Dark Gray, White.
   Brand Navy is the app's main background/canvas color; Brand Coral is the
   primary accent (CTAs, selection highlights, celebratory copy). White is
   used for surfaces (cards, modals, form fields) that sit on top of navy.
   ========================================================================== */

:root {
  --navy: #14314f;
  --coral: #de8579;
  --sky: #78bfda;
  --yellow: #f5e96a;
  --black: #1a1a1a;
  --gray-light: #d9d6d1;
  --gray-dark: #6e6e6e;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--navy);
  color: var(--white);
  font-family: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 48px;
}

.screen.active {
  display: flex;
}

/* ---------- Top bar controls ---------- */

.top-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 20;
  pointer-events: none;
}

.top-bar > * {
  pointer-events: auto;
}

.lang-toggle {
  display: flex;
  border: 2px solid var(--navy);
  border-radius: 999px;
  overflow: hidden;
  background: var(--white);
}

.lang-toggle button {
  border: none;
  background: var(--white);
  color: var(--navy);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 16px;
  cursor: pointer;
}

.lang-toggle button.active {
  background: var(--navy);
  color: var(--white);
}

.admin-button {
  border: 2px solid var(--gray-dark);
  background: var(--white);
  color: var(--gray-dark);
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.7;
}

.admin-button:hover {
  opacity: 1;
}

/* ---------- Logo ---------- */

.logo {
  display: block;
  margin: 0 auto 16px auto;
  max-height: 100px;
  max-width: 300px;
  object-fit: contain;
}

.logo-small {
  max-height: 60px;
}

/* ---------- Vote screen ---------- */

#screen-vote h1 {
  color: var(--white);
  font-size: 28px;
  margin: 4px 0 2px 0;
  text-align: center;
}

#screen-vote .subtitle {
  color: var(--gray-light);
  font-size: 16px;
  margin-bottom: 20px;
  text-align: center;
}

.vote-cards {
  display: flex;
  gap: 40px;
  width: 100%;
  max-width: 980px;
  justify-content: center;
}

.vote-card {
  flex: 1;
  max-width: 420px;
  background: var(--white);
  border-radius: 20px;
  border: 6px solid var(--gray-light);
  cursor: pointer;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.vote-card:active {
  transform: scale(0.97);
}

.vote-card.option-a {
  border-color: var(--sky);
}

.vote-card.option-b {
  border-color: var(--yellow);
}

.vote-card img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 12px;
  margin-bottom: 12px;
}

.vote-card .card-label {
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
}

/* ---------- Email screen ---------- */

#screen-email .picked-label {
  color: var(--gray-light);
  font-size: 16px;
  margin-bottom: 6px;
}

#screen-email .picked-choice {
  color: var(--coral);
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 20px;
}

.vote-results {
  width: 100%;
  max-width: 480px;
  background: var(--white);
  border-radius: 16px;
  padding: 14px 20px;
  margin-bottom: 20px;
}

.vote-results-title {
  color: var(--navy);
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  margin-bottom: 10px;
}

.result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.result-row:last-child {
  margin-bottom: 0;
}

.result-label {
  width: 64px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
}

.result-bar {
  flex: 1;
  height: 14px;
  background: var(--gray-light);
  border-radius: 999px;
  overflow: hidden;
}

.result-bar-fill {
  height: 100%;
  border-radius: 999px;
  width: 0%;
  transition: width 0.4s ease;
}

.result-bar-fill.option-a {
  background: var(--sky);
}

.result-bar-fill.option-b {
  background: var(--yellow);
}

.result-percent {
  width: 84px;
  flex-shrink: 0;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-dark);
}

.vote-results.is-empty .result-row {
  opacity: 0.5;
}

.email-form {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.email-form label {
  font-size: 15px;
  color: var(--white);
}

.email-form input[type="email"] {
  font-size: 20px;
  padding: 14px 16px;
  border: 2px solid var(--gray-light);
  border-radius: 12px;
  outline: none;
}

.email-form input[type="email"]:focus {
  border-color: var(--coral);
}

.email-form .consent {
  font-size: 13px;
  color: var(--gray-light);
}

.email-form .error {
  color: var(--coral);
  font-size: 14px;
  min-height: 18px;
}

.form-buttons {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

/* ---------- Buttons ---------- */

.btn {
  font-size: 17px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--coral);
  color: var(--white);
}

.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border: 2px solid var(--navy);
}

.btn-danger {
  background: var(--white);
  color: var(--coral);
  border: 2px solid var(--coral);
}

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

/* ---------- Thank-you screen ---------- */

#screen-thankyou h1 {
  color: var(--coral);
  font-size: 34px;
  margin: 8px 0 4px 0;
}

#screen-thankyou .message {
  color: var(--white);
  font-size: 17px;
  max-width: 560px;
  text-align: center;
  margin-bottom: 24px;
}

.qr-row {
  display: flex;
  gap: 28px;
  margin-bottom: 20px;
}

.qr-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.qr-item img {
  width: 120px;
  height: 120px;
  border: 2px solid var(--gray-light);
  border-radius: 12px;
  object-fit: contain;
  background: var(--white);
}

.qr-item span {
  font-size: 13px;
  color: var(--gray-light);
}

.followus-label {
  color: var(--white);
  font-weight: 700;
  margin-bottom: 12px;
}

/* ---------- Orientation lock ---------- */

#rotate-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--navy);
  color: var(--white);
  z-index: 999;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 22px;
  padding: 32px;
}

@media (orientation: portrait) {
  #rotate-overlay {
    display: flex;
  }
}

/* ---------- Private browsing banner ---------- */

#private-browsing-banner {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--coral);
  color: var(--white);
  text-align: center;
  font-size: 14px;
  padding: 8px 12px;
  z-index: 900;
}

#private-browsing-banner.visible {
  display: block;
}

/* ---------- Modal overlay ---------- */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 49, 79, 0.55);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: 20px;
  padding: 32px;
  width: 90%;
  max-width: 460px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal h2 {
  color: var(--navy);
  margin-top: 0;
}

/* ---------- Admin passcode keypad ---------- */

.passcode-display {
  font-size: 32px;
  letter-spacing: 12px;
  text-align: center;
  color: var(--navy);
  margin: 16px 0;
  min-height: 40px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.keypad button {
  font-size: 22px;
  padding: 16px 0;
  border-radius: 12px;
  border: 2px solid var(--gray-light);
  background: var(--white);
  color: var(--navy);
  cursor: pointer;
}

.keypad button:active {
  background: var(--gray-light);
}

.passcode-error {
  color: var(--coral);
  text-align: center;
  min-height: 20px;
  font-size: 14px;
}

/* ---------- Admin dashboard ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 24px 0;
}

.stat-box {
  background: var(--white);
  border: 2px solid var(--gray-light);
  border-radius: 12px;
  padding: 12px 16px;
  text-align: center;
}

.stat-box .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--navy);
}

.stat-box .stat-label {
  font-size: 13px;
  color: var(--gray-dark);
}

.admin-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-actions .btn {
  width: 100%;
}

.admin-message {
  margin-top: 12px;
  font-size: 14px;
  text-align: center;
  min-height: 20px;
  color: var(--navy);
}
