/* TipTracker - Tip & Overtime Compliance Tracker */
:root {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #10b981;
  --danger: #dc2626;
  --warning: #f59e0b;
  --success: #059669;
  --bg: #f9fafb;
  --surface: #ffffff;
  --text: #111827;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111827;
    --surface: #1f2937;
    --text: #f9fafb;
    --text-secondary: #9ca3af;
    --border: #374151;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.3);
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 72px;
}

#app {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  margin-bottom: 16px;
}

.header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
}

.header-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.card-value {
  font-size: 1.75rem;
  font-weight: 700;
}

/* Status colors */
.status-green { color: var(--success); border-left: 4px solid var(--success); }
.status-yellow { color: var(--warning); border-left: 4px solid var(--warning); }
.status-red { color: var(--danger); border-left: 4px solid var(--danger); }

/* Compliance cards grid */
.compliance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.compliance-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.15s;
}

.compliance-card:active { transform: scale(0.97); }

.compliance-card .count {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.compliance-card .label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Quick action buttons */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:active { transform: scale(0.97); }

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

.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 6px 0 env(safe-area-inset-bottom, 6px);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 0.65rem;
  cursor: pointer;
  text-decoration: none;
  min-width: 56px;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

/* Forms */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5,150,105,0.15);
}

/* Inline input for batch entry */
.inline-input {
  width: 80px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  text-align: right;
  background: var(--surface);
  color: var(--text);
}

.inline-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Employee list */
.employee-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.1s;
}

.employee-item:active { background: var(--bg); }

.employee-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.employee-role {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-danger {
  background: #fef2f2;
  color: var(--danger);
}

.badge-success {
  background: #ecfdf5;
  color: var(--success);
}

.badge-warning {
  background: #fffbeb;
  color: #92400e;
}

.badge-inactive {
  background: var(--border);
  color: var(--text-secondary);
}

@media (prefers-color-scheme: dark) {
  .badge-danger { background: #450a0a; }
  .badge-success { background: #022c22; }
  .badge-warning { background: #451a03; }
  .badge-inactive { background: #374151; }
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border: none;
  background: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Batch entry row */
.entry-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.entry-row:last-child { border-bottom: none; }

.entry-inputs {
  display: flex;
  gap: 6px;
}

.entry-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.entry-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.progress-green { background: var(--success); }
.progress-yellow { background: var(--warning); }
.progress-red { background: var(--danger); }

/* Running totals */
.running-total {
  position: sticky;
  bottom: 72px;
  background: var(--surface);
  border-top: 2px solid var(--primary);
  padding: 12px 16px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.running-total .total-amount {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

/* Report cards */
.report-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.report-card h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.report-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.9rem;
}

.report-row .label { color: var(--text-secondary); }
.report-row .value { font-weight: 600; }

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border);
  border-radius: 24px;
  transition: background 0.2s;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }

/* FAB */
.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.fab:active { transform: scale(0.9); }

/* Modal / Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  font-size: 1.1rem;
  margin-bottom: 16px;
}

/* Date picker */
.date-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.date-picker input {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
}

.date-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Settings */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.setting-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.setting-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Export buttons row */
.export-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

/* Print styles */
@media print {
  .bottom-nav, .fab, .quick-actions, .btn, .header, .tabs { display: none !important; }
  body { padding-bottom: 0; }
  .card, .report-card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}

/* Responsive */
@media (min-width: 768px) {
  .compliance-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Section title */
.section-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 16px 0 8px;
  color: var(--text);
}

/* Occupation code dropdown */
.code-select {
  position: relative;
}

.code-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
}

.code-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: var(--shadow-lg);
}

.code-option {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.code-option:hover,
.code-option:focus {
  background: var(--bg);
}

.code-option:last-child { border-bottom: none; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* Flex helpers */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.text-center { text-align: center; }
.text-sm { font-size: 0.8rem; }
.text-muted { color: var(--text-secondary); }
.fw-bold { font-weight: 700; }
.hidden { display: none !important; }
