/* RetailTill — global stylesheet
   Variable system, resets, shared components.
   Other stylesheets (pos.css, owner.css, print.css) reference these variables. */

:root {
  /* Spacing — base-8 */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-6: 48px;
  --space-8: 64px;

  /* Radius */
  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.05);

  /* Transition */
  --transition: 200ms ease;
  --transition-slow: 350ms ease;

  /* Type */
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  2rem;

  /* Colors */
  --color-primary: #4f8eff;
  --color-primary-dark: #3b76e0;
  --color-primary-light: #eef4ff;
  --color-accent:  #4f8eff;
  --color-success: #10b981;
  --color-success-light: #d1fae5;
  --color-danger:  #dc2626;
  --color-danger-light: #fee2e2;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-info:    #3b82f6;
  --color-bg:      #f6f7fb;
  --color-surface: #ffffff;
  --color-border:  #e5e7eb;
  --color-border-strong: #d1d5db;
  --color-text:    #0f172a;
  --color-text-muted: #64748b;
  --color-sidebar: #0f172a;
  --color-sidebar-text: #cbd5e1;
  --color-sidebar-active: #1e293b;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html, body { overflow-x: hidden; max-width: 100vw; }
html { font-family: var(--font-main); -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-main);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button { cursor: pointer; background: none; border: 0; }
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Utility */
.muted { color: var(--color-text-muted); }
.small { font-size: var(--text-sm); }
.xsmall { font-size: var(--text-xs); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.flex { display: flex; align-items: center; }
.flex-col { display: flex; flex-direction: column; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.spacer { flex: 1; }
.hidden, [hidden] { display: none !important; }
.cookie-banner[hidden] { display: none; }

/* Forms */
label {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"],
input[type="tel"], select, textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px; /* prevents iOS zoom */
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 44px;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79,142,255,0.18);
}
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted); border-radius: var(--radius);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: 10px 18px;
  font-weight: 600;
  font-size: var(--text-base);
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  min-height: 44px;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: var(--text-sm); min-height: 36px; }
.btn-lg { padding: 14px 22px; font-size: var(--text-lg); min-height: 52px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); }
.btn-success { background: var(--color-success); color: #fff; border-color: var(--color-success); }
.btn-success:hover { background: #059669; border-color: #059669; }
.btn-danger { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-outline { background: transparent; border-color: var(--color-border-strong); color: var(--color-text); }
.btn-outline:hover { background: var(--color-bg); }
.btn-ghost { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-bg); color: var(--color-text); }

/* Cards / panels */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-3);
}
.panel {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-3);
}

/* Alerts */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}
.alert-error   { background: var(--color-danger-light);  color: #991b1b; }
.alert-success { background: var(--color-success-light); color: #065f46; }
.alert-info    { background: var(--color-primary-light); color: #1e40af; }
.alert-warning { background: var(--color-warning-light); color: #92400e; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--color-border);
  color: var(--color-text);
}
.badge-primary { background: var(--color-primary-light); color: #1e40af; }
.badge-success { background: var(--color-success-light); color: #065f46; }
.badge-danger  { background: var(--color-danger-light);  color: #991b1b; }
.badge-warning { background: var(--color-warning-light); color: #92400e; }
.badge-muted   { background: #e2e8f0; color: var(--color-text-muted); }

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th, .table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.table th {
  background: #f8fafc;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.025em;
}
.table tbody tr:hover { background: #f8fafc; }
.table-actions { display: flex; align-items: center; gap: 6px; }

/* Public nav */
.public-nav {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 0; z-index: 100;
}
.public-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--color-text);
}
.brand i { color: var(--color-primary); }
.public-nav nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Public footer */
.public-footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: var(--space-6) var(--space-3) var(--space-3);
  margin-top: var(--space-8);
}
.public-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  align-items: start;
}
.public-footer .brand { color: #fff; }
.footer-col h4 { color: #fff; margin-bottom: var(--space-1); font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.05em; }
.footer-col a { display: block; color: #cbd5e1; padding: 4px 0; font-size: var(--text-sm); }
.footer-col a:hover { color: #fff; }
.public-footer-bottom {
  max-width: 1200px;
  margin: var(--space-4) auto 0;
  padding-top: var(--space-2);
  border-top: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-xs);
}

/* Auth pages */
.auth-page { background: linear-gradient(135deg, #eef4ff 0%, #f6f7fb 100%); }
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3);
}
.auth-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4);
  width: 100%;
  max-width: 760px;
}
.auth-card.narrow { max-width: 420px; }
.auth-brand {
  text-align: center;
  margin-bottom: var(--space-3);
}
.auth-brand i {
  font-size: 2.5rem;
  color: var(--color-primary);
  margin-bottom: var(--space-1);
}
.auth-brand h1 {
  font-size: var(--text-2xl);
  margin-bottom: 4px;
}
.auth-brand p { color: var(--color-text-muted); font-size: var(--text-sm); }

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  align-items: start;
}
.auth-method {
  background: var(--color-bg);
  border-radius: var(--radius);
  padding: var(--space-3);
}
.auth-method h2 {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}
.forgot-link {
  display: inline-block;
  margin-top: var(--space-1);
  text-align: center;
  width: 100%;
}
.forgot-msg { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); text-align: center; }

.pin-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.pin-dots span {
  width: 16px; height: 16px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-border-strong);
  background: var(--color-surface);
  transition: background var(--transition), border-color var(--transition);
}
.pin-dots span.filled {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-1);
}
.pin-key {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  font-size: var(--text-xl);
  font-weight: 600;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: background var(--transition), transform var(--transition);
}
.pin-key:hover { background: var(--color-primary-light); }
.pin-key:active { transform: scale(0.96); }
.pin-clear { color: var(--color-danger); }
.pin-back  { color: var(--color-text-muted); }

.auth-footer {
  text-align: center;
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.auth-footer a { color: var(--color-text-muted); }

@media (max-width: 640px) {
  .auth-grid { grid-template-columns: 1fr; }
  .auth-card { padding: var(--space-3); }
}

/* Cookie banner */
.cookie-banner {
  position: fixed;
  bottom: var(--space-2);
  left: var(--space-2);
  right: var(--space-2);
  max-width: 720px;
  margin: 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2) var(--space-3);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: var(--text-sm);
}
.cookie-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-wrap: nowrap;
}
.cookie-banner[hidden] { display: none; }

/* Toasts */
.toast-container {
  position: fixed;
  top: var(--space-2);
  right: var(--space-2);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-1);
  z-index: 9999;
  max-width: 360px;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  background: var(--color-surface);
  border-left: 4px solid var(--color-primary);
  padding: 12px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  animation: toast-in 300ms ease;
}
.toast.toast-success { border-left-color: var(--color-success); }
.toast.toast-error   { border-left-color: var(--color-danger); }
.toast.toast-info    { border-left-color: var(--color-info); }
.toast.fade-out { opacity: 0; transition: opacity 200ms ease; }
@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8000;
  padding: var(--space-2);
}
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in 300ms ease-out;
}
.modal.modal-lg { max-width: 720px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.modal-header h2 { font-size: var(--text-lg); font-weight: 600; }
.modal-close {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: var(--color-text-muted);
}
.modal-close:hover { background: var(--color-bg); color: var(--color-text); }
.modal-body { padding: var(--space-3); }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--color-border);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Empty state */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-1);
  min-height: 180px;
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--space-3);
}
.empty-state i {
  font-size: 2rem;
  color: var(--color-border-strong);
}
.empty-state .empty-msg { font-size: 0.95rem; font-weight: 500; }
.empty-state .empty-sub { font-size: 0.85rem; }

/* Public content layout */
.content-wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-3);
}
.content-wrap h1 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-2);
}
.content-wrap h2 {
  font-size: var(--text-xl);
  margin-top: var(--space-4);
  margin-bottom: var(--space-2);
}
.content-wrap h3 { font-size: var(--text-lg); margin-top: var(--space-2); margin-bottom: var(--space-1); }
.content-wrap p { margin-bottom: var(--space-2); }
.content-wrap ul, .content-wrap ol { margin: 0 0 var(--space-2) var(--space-3); }
.content-wrap li { margin-bottom: 4px; }

.answer-summary {
  background: var(--color-primary-light);
  border-left: 4px solid var(--color-primary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  margin-bottom: var(--space-3);
}
.answer-summary p { margin: 0; }

.faq-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
}
.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.faq-item summary::after {
  content: "+";
  font-size: 1.5rem;
  color: var(--color-text-muted);
}
.faq-item[open] summary::after { content: "−"; }
.faq-item p { margin-top: var(--space-2); }

.ad-slot {
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: var(--text-sm);
  margin: var(--space-3) auto;
  border-radius: var(--radius);
}
.ad-leaderboard { width: 100%; max-width: 728px; height: 90px; }
.ad-rect { width: 300px; height: 250px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
