/* ==========================================================================
   Sight POS web — shared styles
   Theme variables mirror zed-pos/app/globals.css (Flutter AppColors).
   Tailwind utilities come from the CDN; this file holds theme vars, the
   landing-page animations and the CustomButton / CustomTextField styles.
   ========================================================================== */

:root {
  --brand-blue: #0f172a;
  --brand-white: #ffffff;
  --primary: var(--brand-blue);
  --background: var(--brand-white);
  --foreground: var(--brand-blue);
  --surface: var(--brand-white);
  --on-primary: var(--brand-white);
  --on-surface: var(--brand-blue);
  --divider: color-mix(in srgb, var(--brand-blue) 10%, transparent);
  --font-app: "Tenor Sans", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --snap: cubic-bezier(0.2, 0.8, 0.2, 1);
}

html {
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100%;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-app);
}

/* Tailwind's `flex`/`block` utilities would otherwise beat the UA [hidden] rule */
[hidden] {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Small colour helpers (replace repeated inline color-mix() styles)
   -------------------------------------------------------------------------- */
.c-fg { color: var(--foreground); }
.c-primary { color: var(--primary); }
.c-bg { color: var(--background); }
.bg-page { background-color: var(--background); }
.bg-primary-solid { background-color: var(--primary); }
.bd { border-color: var(--divider); }
.divider-bg { background-color: var(--divider); }

.tm-45 { color: color-mix(in srgb, var(--foreground) 45%, transparent); }
.tm-50 { color: color-mix(in srgb, var(--foreground) 50%, transparent); }
.tm-55 { color: color-mix(in srgb, var(--foreground) 55%, transparent); }
.tm-60 { color: color-mix(in srgb, var(--foreground) 60%, transparent); }
.tm-68 { color: color-mix(in srgb, var(--foreground) 68%, transparent); }
.tm-70 { color: color-mix(in srgb, var(--foreground) 70%, transparent); }
.tm-78 { color: color-mix(in srgb, var(--foreground) 78%, transparent); }
.tm-80 { color: color-mix(in srgb, var(--foreground) 80%, transparent); }

.text-error { color: #dc2626; }

/* --------------------------------------------------------------------------
   Navbar
   -------------------------------------------------------------------------- */
.sight-nav {
  position: relative;
  width: 100%;
  background-color: var(--background);
  color: var(--foreground);
  border-bottom: 1px solid var(--divider);
  font-family: var(--font-app);
}

.sight-nav-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 50;
  overflow: hidden;
  max-height: 0;
  pointer-events: none;
  transition: max-height 220ms var(--snap);
}

.sight-nav-panel-inner {
  background-color: var(--background);
  border-bottom: 1px solid var(--divider);
  transform: translateY(-100%);
  transition: transform 220ms var(--snap);
  will-change: transform;
}

.sight-nav[data-open="true"] .sight-nav-panel {
  max-height: 280px;
  pointer-events: auto;
}

.sight-nav[data-open="true"] .sight-nav-panel-inner {
  transform: translateY(0);
}

.sight-nav-panel a {
  border-bottom: 1px solid var(--divider);
  color: var(--foreground);
}

.sight-nav-panel a:last-child {
  border-bottom: 0;
}

.sight-burger {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
}

.sight-burger-bar {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 1px;
  background-color: currentColor;
  transition: transform 200ms var(--snap), opacity 150ms ease-out;
  will-change: transform;
}

.sight-burger-bar:nth-child(2) {
  margin-top: 4px;
  margin-bottom: 4px;
}

.sight-nav[data-open="true"] .sight-burger-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.sight-nav[data-open="true"] .sight-burger-bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.sight-nav[data-open="true"] .sight-burger-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Landing page
   -------------------------------------------------------------------------- */
.landing-page {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes landing-float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes landing-pulse {
  0%, 100% { opacity: 0.45; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(1.05); }
}

.landing-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 700ms var(--ease-out),
    transform 700ms var(--ease-out);
}

.landing-reveal-visible {
  opacity: 1;
  transform: translateY(0);
}

.landing-card {
  transition:
    transform 280ms var(--ease-out),
    box-shadow 280ms var(--ease-out),
    border-color 280ms var(--ease-out),
    background-color 280ms var(--ease-out);
}

.landing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px color-mix(in srgb, var(--foreground) 10%, transparent);
}

.landing-hero-glow {
  animation: landing-pulse 8s ease-in-out infinite;
}

.landing-logo-float {
  animation: landing-float 5s ease-in-out infinite;
}

.ico {
  width: 1.25rem;
  height: 1.25rem;
}

.ico-sm .ico {
  width: 1rem;
  height: 1rem;
}

.icon-badge {
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 1rem;
  background-color: color-mix(in srgb, var(--foreground) 8%, transparent);
  color: var(--foreground);
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.group:hover .icon-badge {
  transform: scale(1.1);
}

.pill-outline {
  border: 1px solid var(--divider);
  color: color-mix(in srgb, var(--foreground) 78%, transparent);
}

.method-pill {
  border: 1px solid var(--divider);
  color: color-mix(in srgb, var(--foreground) 78%, transparent);
  transition: border-color 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.method-pill:hover {
  border-color: var(--foreground);
}

.role-tab {
  background-color: transparent;
  color: var(--foreground);
  cursor: pointer;
}

.role-tab.is-active {
  background-color: var(--primary);
  color: var(--background);
  transform: translateY(-1px);
}

.role-card {
  border-color: var(--divider);
  background-color: var(--background);
}

.role-card.is-active {
  border-color: var(--foreground);
  background-color: color-mix(in srgb, var(--foreground) 6%, transparent);
  transform: translateY(-6px);
}

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

/* --------------------------------------------------------------------------
   CustomButton  (Flutter CustomButton parity)
   -------------------------------------------------------------------------- */
.sight-btn-wrap {
  display: flex;
  justify-content: center;
}

.sight-btn-measure {
  position: absolute;
  visibility: hidden;
  pointer-events: none;
  white-space: nowrap;
  font-weight: 700;
  font-family: inherit;
}

.sight-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  font-weight: 700;
  font-family: inherit;
  outline: none;
  overflow: visible;
  transition:
    background-color 300ms cubic-bezier(0.65, 0, 0.35, 1),
    border-color 300ms cubic-bezier(0.65, 0, 0.35, 1),
    color 300ms cubic-bezier(0.65, 0, 0.35, 1),
    opacity 200ms ease;
}

.sight-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent);
  outline-offset: 2px;
}

.sight-btn-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  overflow: visible;
}

/* 24x24 Lottie host, scaled x2.2 like the Flutter button */
.sight-btn-spinner {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  overflow: visible;
  transform: scale(2.2);
  transform-origin: center center;
}

.sight-btn-spinner svg {
  display: block;
  width: 24px !important;
  height: 24px !important;
  overflow: visible;
}

/* CSS fallback shown only when lottie-web failed to load */
@keyframes custom-btn-blade-fade {
  0% { opacity: 1; }
  100% { opacity: 0.18; }
}

.sight-btn-blade {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.5px;
  height: 6px;
  margin-left: -1.25px;
  margin-top: -10px;
  border-radius: 1.25px;
  background-color: #000000;
  transform-origin: center 10px;
  animation: custom-btn-blade-fade 0.55s linear infinite;
  will-change: opacity;
}

/* --------------------------------------------------------------------------
   CustomTextField  (Flutter CustomTextField parity)
   -------------------------------------------------------------------------- */
.sight-tf {
  position: relative;
  width: 100%;
}

.sight-tf-label {
  position: absolute;
  left: 0;
  top: 22px;
  font-size: 16px;
  font-family: inherit;
  color: color-mix(in srgb, var(--primary) 30%, transparent);
  pointer-events: none;
  transition: top 150ms ease, font-size 150ms ease, color 150ms ease;
}

.sight-tf.is-float .sight-tf-label {
  top: 0;
  font-size: 12px;
}

.sight-tf.is-focused .sight-tf-label {
  color: var(--primary);
}

.sight-tf.has-error .sight-tf-label {
  color: #dc2626;
}

.sight-tf-field {
  position: relative;
  display: flex;
  align-items: center;
  padding-top: 1.25rem;
}

.sight-tf-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  background: transparent;
  color: var(--primary);
  font-size: 16px;
  font-family: inherit;
  padding: 8px 36px 8px 0;
  outline: none;
  border-radius: 0;
  cursor: text;
  transition: border-color 150ms ease, border-bottom-width 150ms ease;
}

.sight-tf.has-suffix .sight-tf-input {
  padding-right: 72px;
}

.sight-tf.is-focused .sight-tf-input {
  border-bottom: 2px solid var(--primary);
}

.sight-tf.has-error .sight-tf-input {
  border-bottom: 2px solid #dc2626;
}

.sight-tf.is-readonly .sight-tf-input {
  opacity: 0.7;
  cursor: default;
}

.sight-tf-suffix {
  position: absolute;
  right: 0;
  top: 50%;
  display: flex;
  align-items: center;
  padding-top: 0.625rem;
  transform: translateY(-50%);
}

.sight-tf-error {
  margin-top: 4px;
  font-size: 12px;
  color: #dc2626;
  font-family: inherit;
}

/* --------------------------------------------------------------------------
   Top-up page
   -------------------------------------------------------------------------- */
.text-link-btn {
  color: var(--primary);
  cursor: pointer;
  background: transparent;
  border: 0;
  transition: opacity 150ms ease;
}

.text-link-btn:hover {
  opacity: 0.7;
}

.text-link-btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.details-card {
  border-radius: 14px;
  padding: 1rem;
  background-color: color-mix(in srgb, var(--primary) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 15%, transparent);
  color: var(--primary);
}

.warning-box {
  margin-top: 1rem;
  border-radius: 0.75rem;
  padding: 0.75rem;
  background-color: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(180, 83, 9, 0.4);
}

.warning-box p {
  color: #78350f;
}

.pay-method {
  color: var(--primary);
  background-color: var(--background);
  border: 1.5px solid var(--divider);
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.pay-method.is-selected {
  background-color: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1.5px solid var(--primary);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 20%, transparent);
}

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

.pay-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.pay-radio {
  display: flex;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  box-sizing: border-box;
  border: 1.5px solid color-mix(in srgb, var(--primary) 35%, transparent);
}

.pay-method.is-selected .pay-radio {
  border: 4px solid var(--primary);
}

/* --------------------------------------------------------------------------
   MMPay checkout page
   -------------------------------------------------------------------------- */
.timer-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
}

.timer-badge.is-expired {
  background-color: color-mix(in srgb, #dc2626 10%, transparent);
  border: 1px solid color-mix(in srgb, #dc2626 30%, transparent);
}

.timer-badge .timer-value {
  color: var(--primary);
}

.timer-badge.is-expired .timer-value {
  color: #dc2626;
}

.qr-expired {
  opacity: 0.3;
  filter: grayscale(1);
}

.download-btn {
  background-color: var(--primary);
  color: #ffffff;
  border: 0;
  cursor: pointer;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: all 150ms ease;
}

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

.copy-btn {
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  transition: opacity 150ms ease;
}

.copy-btn:hover {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Legal documents.
   Zero-specificity fallbacks so server-rendered HTML looks right even
   without Tailwind utility classes; any utility class still wins.
   -------------------------------------------------------------------------- */
:where(.legal-content h1) {
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 700;
  color: var(--foreground);
}

:where(.legal-content h2) {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--divider);
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 700;
  color: var(--foreground);
}

:where(.legal-content h3) {
  margin-top: 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--foreground);
}

:where(.legal-content p) {
  margin-top: 1rem;
  font-size: 1rem;
  line-height: 1.625;
  color: color-mix(in srgb, var(--foreground) 78%, transparent);
}

:where(.legal-content ul) {
  margin-top: 1rem;
  padding-left: 1.25rem;
  list-style: disc;
  font-size: 1rem;
  line-height: 1.625;
  color: color-mix(in srgb, var(--foreground) 78%, transparent);
}

:where(.legal-content ul ul) {
  margin-top: 0.5rem;
  list-style: circle;
}

:where(.legal-content li + li) {
  margin-top: 0.625rem;
}

:where(.legal-content a) {
  color: var(--foreground);
  text-decoration: underline;
  text-underline-offset: 2px;
}

:where(.legal-content table) {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

:where(.legal-content th) {
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: var(--foreground);
  background-color: color-mix(in srgb, var(--foreground) 5%, transparent);
}

:where(.legal-content td) {
  padding: 0.75rem 1rem;
  vertical-align: top;
  line-height: 1.625;
  border-top: 1px solid var(--divider);
}
