/* base.css - Reset, variables, typography, layout */

:root {
  --bg: #F4EDE3;
  --bg-card: #FFFDF8;
  --bg-dark: #1a1a1a;
  --bg-dark-2: #252525;
  --bg-dark-3: #2e2e2e;
  --text: #1a1a1a;
  --text-light: #F4EDE3;
  --text-muted: #999;
  --text-muted-dark: #777;
  --border: #e0d8cc;
  --border-dark: #333;
  --green: #2d8a4e;
  --green-hover: #258040;
  --red: #dc2626;
  --blue: #3b82f6;
  --cash-green: #22c55e;
  --purple: #a855f7;
  --orange: #f59e0b;
  --teal: #14b8a6;
  --gray: #6b7280;
  --radius: 14px;
  --radius-sm: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.1);
  --transition: 0.15s ease;
  --sidebar-w: 72px;
  --sidebar-w-expanded: 220px;

  /* Product colors */
  --color-30: #EBCFBE;
  --color-50: #DDD4F0;
  --color-70: #D7E8D9;
  --color-90: #D7E3F2;
  --color-100: #EEDFB6;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  font-family: -apple-system, 'SF Pro Display', 'Helvetica Neue', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
}

/* App shell layout */
.app {
  display: flex;
  height: 100%;
  overflow: hidden;
}

#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-left: var(--sidebar-w);
  transition: margin-left var(--transition);
}

.view {
  display: none;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.view.active {
  display: flex;
  flex-direction: column;
}

/* ======================== */
/* Shared components        */
/* ======================== */

/* Stat cards */
.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  flex: 1;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted-dark);
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
}

/* Transaction list (shared) */
.tx-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 20px;
}

.tx-card {
  background: var(--bg-card);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
}

.tx-time {
  font-size: 14px;
  color: var(--text-muted-dark);
  font-weight: 600;
  min-width: 46px;
  font-family: 'SF Mono', 'Menlo', monospace;
}

.tx-info { flex: 1; min-width: 0; }

.tx-desc {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-id {
  font-size: 11px;
  color: var(--text-muted-dark);
  font-family: 'SF Mono', 'Menlo', monospace;
}

.tx-payment-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  color: #fff;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.tx-payment-badge.card { background: var(--blue); }
.tx-payment-badge.cash { background: var(--cash-green); }
.tx-payment-badge.gift_card { background: var(--purple); }
.tx-payment-badge.online { background: var(--orange); }

.tx-amount {
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
  min-width: 56px;
  text-align: right;
}

.tx-reprint {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  font-size: 16px;
  cursor: pointer;
  min-width: 38px;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  color: var(--text-muted-dark);
}
.tx-reprint:active { background: var(--border); }

/* Section title */
.section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted-dark);
  margin-bottom: 12px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted-dark);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 16px; }

/* Loading spinner */
.loading-spinner {
  display: flex;
  justify-content: center;
  padding: 60px;
}

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fade-in 0.3s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Diff display (shared) */
.diff-display {
  padding: 24px;
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.diff-display.balanced {
  background: #f0fdf4;
  border: 2px solid var(--green);
}
.diff-display.mismatch {
  background: #fef2f2;
  border: 2px solid var(--red);
}
.diff-display.neutral {
  background: var(--bg-card);
  border: 2px solid var(--border);
}

.diff-icon { font-size: 40px; margin-bottom: 8px; }
.diff-text {
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.diff-details {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-muted-dark);
}

/* Print */
@media print {
  .sidebar, .view:not(.print-target), #main-content { display: none !important; }
  body { background: #fff; overflow: visible; }
  .view.print-target {
    display: block !important;
    padding: 0;
    overflow: visible;
  }
}

/* Responsive */
@media (max-width: 1023px) {
  .stats-row { flex-wrap: wrap; }
  .stat-card { flex: 1 1 45%; min-width: 0; }
}

@media (max-width: 480px) {
  html, body { font-size: 14px; }
  .stat-card .stat-value { font-size: 24px; }
  .stat-card { padding: 14px; }
  .stats-row { gap: 8px; }
}
