/* Mobile-first POS theme overrides. Notes: Documentation/Frontend/css/pos-mobile.md */

@keyframes pos-mobile-loader-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

body.pos-mobile {
  --bg-body: var(--color-white);
  --text: var(--color-dark);
  --color-primary: #89b1c5;
  --color-primary-hover: color-mix(in srgb, #89b1c5 85%, var(--color-dark));
  --color-primary-hover-border: color-mix(in srgb, #89b1c5 85%, var(--color-dark));
  --color-primary-alpha: color-mix(in srgb, #89b1c5 20%, transparent);
  background: var(--bg-body);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

body.pos-mobile a:not(.btn):not(.pos-mobile-nav__item):not(.pos-mobile-account__email-link) {
  color: #89b1c5;
}

.pos-mobile-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.pos-mobile .form-control {
  min-height: var(--input-height);
  font-size: 16px;
}

.pos-mobile-login {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: clamp(24px, 6vh, 56px) 20px calc(32px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  flex: 1;
}

.pos-mobile-login__logo {
  text-align: center;
  margin-bottom: clamp(20px, 4vh, 36px);
}

.pos-mobile-login__logo-img {
  width: auto;
  height: auto;
  max-width: min(72vw, 300px);
  max-height: 40vh;
  object-fit: contain;
}

.pos-mobile-login__logo-text {
  font-size: 1.5rem;
  font-weight: var(--font-weight-bold);
}

.pos-mobile-login__intro {
  margin-bottom: 24px;
}

.pos-mobile-login__intro h1 {
  font-size: 1.6rem;
  font-weight: var(--font-weight-bold);
  margin: 0;
}

.pos-mobile-login__intro p {
  margin: 4px 0 0;
  color: var(--text);
  opacity: 0.7;
}

.pos-mobile-login__renew {
  display: block;
  text-align: center;
  padding: 10px 12px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--color-danger-alpha);
  color: var(--color-danger);
  font-weight: 600;
  text-decoration: none;
}

.pos-mobile-field {
  margin-bottom: 16px;
}

.pos-mobile-field > label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.95rem;
}

.pos-mobile-field__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.pos-mobile-field__row label {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
}

.pos-mobile-field__aside {
  font-size: 0.85rem;
  white-space: nowrap;
}

.pos-mobile-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 22px;
  cursor: pointer;
}

.pos-mobile-check input {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.pos-mobile-login__submit {
  width: 100%;
  min-height: var(--button-min-height);
  border: none;
  border-radius: var(--radius);
  background: var(--color-primary);
  color: var(--text-inverse);
  font-size: 1.05rem;
  font-weight: var(--font-weight-bold);
  transition: background var(--transition-speed) ease;
}

.pos-mobile-login__submit:hover {
  background: var(--color-primary-hover);
}

.pos-mobile-login__signup {
  text-align: center;
  margin-top: 22px;
}

.pos-mobile-login__secondary {
  text-align: center;
  margin-top: 16px;
  font-size: 0.85rem;
  opacity: 0.8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pos-mobile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
}

.pos-mobile-topbar__brand {
  display: inline-flex;
  align-items: center;
}

.pos-mobile-topbar__logo {
  height: 32px;
  width: auto;
}

.pos-mobile-topbar__link {
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
  white-space: nowrap;
}

.pos-mobile-topbar__title {
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
  white-space: nowrap;
}

.pos-mobile-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 12px;
  text-align: center;
}

.pos-mobile-card__blue {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 0 24px 28px;
  --pos-card-light: color-mix(in srgb, var(--color-primary) 78%, white);
  --pos-card-arc: 25px;
  background-color: var(--pos-card-light);
  background-image:
    radial-gradient(ellipse 50% var(--pos-card-arc) at 50% 50%, var(--color-primary) 100%, transparent 100%),
    linear-gradient(to bottom, var(--color-primary) 50%, transparent 50%);
  border-radius: var(--radius-lg);
  color: var(--color-white);
  text-align: center;
}

.pos-mobile-card__qr {
  width: 240px;
  max-width: 100%;
  aspect-ratio: 1;
  margin: 0 auto;
  margin-top: -120px;
  padding: 40px;
  background: var(--color-white);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--color-primary), 0 0 0 7px var(--color-white), 0 0 0 15px var(--color-primary);
}

.pos-mobile-card__qr img {
  width: 100%;
  height: auto;
  display: block;
}

.pos-mobile-card__member {
  margin: 24px 0 0;
  font-size: 1rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-white);
}

.pos-mobile-card__promo {
  margin-top: 28px;
}

.pos-mobile-card__promo-heading {
  font-size: 1.1rem;
  margin: 0;
  color: var(--color-white);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pos-mobile-card__promo-highlight {
  font-size: 2.4rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-white);
  margin: 4px 0;
  line-height: 1.1;
}

.pos-mobile-card__promo-subtext {
  font-size: 1rem;
  margin: 0;
  color: var(--color-white);
}

.pos-mobile-pagehead {
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 8px;
}

.pos-mobile-pagehead__title {
  font-size: 1.4rem;
  font-weight: var(--font-weight-bold);
  margin: 0;
}

.pos-mobile-pagehead__title--center {
  text-align: center;
}

.pos-mobile-pagehead__hint {
  margin: 6px 0 0;
  text-align: center;
  opacity: 0.7;
  font-size: 0.9rem;
}

.pos-mobile-history {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 16px calc(88px + env(safe-area-inset-bottom, 0px));
}

.pos-mobile-history__item {
  background: var(--bg-surface);
  color: var(--text-inverse);
  border-radius: var(--radius);
  padding: 0 0 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.pos-mobile-history__location {
  margin: 0 0 10px;
  padding: 6px 12px;
  font-size: 1rem;
  border-radius: 0;
  background: var(--color-primary);
  color: var(--text-inverse);
}

.pos-mobile-history__details {
  background: var(--color-primary);
  color: var(--text-inverse);
  border: none;
}

.pos-mobile-history__details:hover {
  background: var(--color-primary-hover);
  color: var(--text-inverse);
}

.pos-mobile-history__item .row {
  padding: 0 12px;
}

.pos-mobile-history__empty {
  padding: 32px 0;
}

.pos-mobile-account {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 16px calc(88px + env(safe-area-inset-bottom, 0px));
}

.pos-mobile-account__card {
  background: var(--bg-surface);
  color: var(--text-inverse);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.pos-mobile-account__row--name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pos-mobile-account__name {
  font-size: 1.2rem;
  font-weight: var(--font-weight-bold);
}

.pos-mobile-account__edit {
  border: 1px solid var(--form-border);
  background: var(--bg-form);
  color: var(--text-inverse);
  border-radius: var(--radius);
  white-space: nowrap;
}

.pos-mobile-account__email {
  margin-top: 16px;
}

.pos-mobile-account__email-link {
  color: #000;
  text-decoration: none;
}

.pos-mobile-account__label {
  display: block;
  font-size: 0.8rem;
  opacity: 0.65;
  margin-bottom: 2px;
}

.pos-mobile-account__link {
  display: block;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--form-border);
}

.pos-mobile-account__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pos-mobile-account__logout,
.pos-mobile-account__delete {
  width: 100%;
  min-height: var(--button-min-height);
  border-radius: var(--radius);
  font-weight: var(--font-weight-bold);
}

.pos-mobile-account__logout {
  border: none;
  background: var(--color-primary);
  color: var(--text-inverse);
}

.pos-mobile-account__logout:hover {
  background: var(--color-primary-hover);
}

.pos-mobile-account__delete {
  border: 1px solid var(--color-danger);
  background: transparent;
  color: var(--color-danger);
}

.pos-mobile-confirm {
  background: var(--bg-surface);
  color: var(--text-inverse);
  border-radius: var(--radius-lg);
  border: none;
}

.pos-mobile-confirm .modal-body {
  padding: 24px 20px 8px;
  text-align: center;
}

.pos-mobile-confirm__heading {
  font-size: 1.15rem;
  font-weight: var(--font-weight-bold);
  margin: 0 0 8px;
}

.pos-mobile-confirm__body {
  margin: 0;
  opacity: 0.8;
}

.pos-mobile-confirm__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 20px 22px;
}

.pos-mobile-confirm__primary,
.pos-mobile-confirm__danger,
.pos-mobile-confirm__secondary {
  width: 100%;
  min-height: var(--button-min-height);
  border-radius: var(--radius);
  font-weight: var(--font-weight-bold);
}

.pos-mobile-confirm__primary {
  border: none;
  background: var(--color-primary);
  color: var(--text-inverse);
}

.pos-mobile-confirm__danger {
  border: none;
  background: var(--color-danger);
  color: var(--color-white);
}

.pos-mobile-confirm__secondary {
  border: 1px solid var(--form-border);
  background: transparent;
  color: var(--text-inverse);
}

.pos-mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg-surface);
  border-top: 1px solid color-mix(in srgb, var(--text-inverse) 10%, transparent);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: var(--z-fixed);
}

.pos-mobile-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 4px;
  min-height: 56px;
  color: var(--text-inverse);
  text-decoration: none;
  font-size: 0.8rem;
  opacity: 0.65;
  transition: opacity var(--transition-speed) ease;
}

.pos-mobile-nav__item i {
  font-size: 1.4rem;
  line-height: 1;
}

.pos-mobile-nav__item.is-active,
.pos-mobile-nav__item:active {
  opacity: 1;
  color: var(--color-primary);
}

.pos-mobile-loader {
  position: fixed;
  inset: 0;
  background: var(--bg-body);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: var(--z-toast);
}

.pos-mobile-loader[hidden] {
  display: none;
}

.pos-mobile-loader__logo {
  width: auto;
  height: auto;
  max-width: min(60vw, 240px);
  max-height: 30vh;
  object-fit: contain;
}

.pos-mobile-loader__logo-text {
  font-size: 1.5rem;
  font-weight: var(--font-weight-bold);
}

.pos-mobile-loader__text {
  font-size: 1.1rem;
  animation: pos-mobile-loader-pulse 1.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .pos-mobile-loader__text,
  .pos-mobile-login__submit,
  .pos-mobile-nav__item {
    transition: none;
    animation: none;
  }
}

@media (prefers-contrast: more) {
  .pos-mobile-field .form-control,
  .pos-mobile-account__edit,
  .pos-mobile-confirm__secondary,
  .pos-mobile-account__delete {
    border-width: 2px;
  }
}
