/* ReceiveRight — Base CSS: Reset, Variables, Typography */
/* Design System: Light Mode Default, Inter font, glove-friendly sizing */

/* ── CSS VARIABLES ── */
:root {
  /* Colors */
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* Brand */
  --primary: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;

  /* Status */
  --success: #22c55e;
  --success-bg: #f0fdf4;
  --success-border: #86efac;
  --warning: #f59e0b;
  --warning-dark: #d97706;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  /* Text */
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-light: #9ca3af;

  /* Role colors */
  --operator: #3b82f6;
  --operator-bg: #eff6ff;
  --operator-text: #1d4ed8;
  --supervisor: #f59e0b;
  --supervisor-bg: #fffbeb;
  --supervisor-text: #b45309;
  --manager: #7c3aed;
  --manager-bg: #f5f3ff;
  --manager-text: #6d28d9;
  --director: #0d9488;
  --director-bg: #f0fdfa;
  --director-text: #0f766e;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  /* Radii */
  --radius: 11px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --text-xs: 10px;
  --text-sm: 11px;
  --text-base: 13px;
  --text-lg: 15px;
  --text-xl: 18px;
  --text-2xl: 22px;
  --text-3xl: 28px;

  /* Touch targets — glove-friendly */
  --touch-min: 44px;
  --pin-key: 68px;
}

/* ── RESET ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--bg);
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── TYPOGRAPHY ── */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-base); }

p {
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-secondary);
}

small {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

strong {
  font-weight: 700;
}

/* ── LINKS ── */
a {
  color: var(--primary);
  text-decoration: none;
}

/* ── LISTS ── */
ul, ol {
  list-style: none;
}

/* ── IMAGES ── */
img {
  max-width: 100%;
  display: block;
}

/* ── INPUTS ── */
input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: transparent;
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

/* ── APP SHELL ── */
#app {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ── SCREEN CONTAINER ── */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: flex;
}

/* ── STATUS BAR ── */
.status-bar {
  background: var(--border-light);
  padding: 8px 16px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.status-time { color: var(--text); }
.status-icons { color: var(--text-secondary); font-size: 10px; }

/* ── SYNC INDICATOR ── */
.sync-indicator {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: var(--primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
  z-index: 1000;
}
.sync-indicator.syncing {
  transform: scaleX(1);
  animation: sync-pulse 1.5s ease-in-out infinite;
}
@keyframes sync-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── TOAST NOTIFICATION ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 448px;
}

.toast {
  background: var(--text);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s ease;
  text-align: center;
}

.toast.success { background: #16a34a; }
.toast.warning { background: var(--warning-dark); }
.toast.error { background: var(--danger); }
.toast.billing { background: #1e40af; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── OFFLINE BANNER ── */
.offline-banner {
  background: var(--warning-bg);
  border-bottom: 1px solid var(--warning-border);
  padding: 8px 16px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--supervisor-text);
  text-align: center;
  display: none;
}

.offline-banner.visible {
  display: block;
}

/* ── CONTENT AREA ── */
.content {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  flex: 1;
}

/* ── ROLE BAR ── */
.role-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.role-bar-operator {
  background: var(--operator-bg);
  color: var(--operator-text);
  border-bottom: 1px solid rgba(59,130,246,0.15);
}

.role-bar-supervisor {
  background: var(--supervisor-bg);
  color: var(--supervisor-text);
  border-bottom: 1px solid rgba(245,158,11,0.2);
}

.role-bar-manager {
  background: var(--manager-bg);
  color: var(--manager-text);
  border-bottom: 1px solid rgba(124,58,237,0.15);
}

.role-bar-director {
  background: var(--director-bg);
  color: var(--director-text);
  border-bottom: 1px solid rgba(13,148,136,0.15);
}

.role-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* ── UTILITY CLASSES ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.visible { display: block !important; }

/* ── MONOSPACE ── */
.mono { font-family: 'Courier New', monospace; }

/* ── DARK MODE SUPPORT (available in settings) ── */
@media (prefers-color-scheme: dark) {
  body.dark-mode-auto {
    --bg: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --border-light: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-light: #475569;
    --primary-light: #1e3a5f;
    --success-bg: #052e16;
    --success-border: #166534;
    --warning-bg: #451a03;
    --warning-border: #92400e;
    --danger-bg: #450a0a;
    --danger-border: #991b1b;
    --operator-bg: #1e3a5f;
    --supervisor-bg: #451a03;
    --manager-bg: #2e1065;
    --director-bg: #042f2e;
  }
}
