/* Arlington Junk Removal — Business App */
/* Dark theme, mobile-first */

:root {
  --bg: #111111;
  --surface: #1a1a1a;
  --surface-2: #222222;
  --surface-3: #2a2a2a;
  --border: #333333;
  --text: #f0f0f0;
  --text-dim: #999999;
  --orange: #e8621e;
  --orange-dim: #c4520f;
  --green: #22c55e;
  --green-dim: #16a34a;
  --yellow: #eab308;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

/* ---- PIN Screen ---- */
.pin-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  gap: 24px;
  padding: 24px;
}
.pin-screen h1 { font-size: 1.5rem; color: var(--orange); }
.pin-input {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  font-size: 2rem;
  letter-spacing: 12px;
  text-align: center;
  width: 200px;
  color: var(--text);
}
.pin-input:focus { border-color: var(--orange); }
.pin-error { color: var(--red); font-size: 0.875rem; }

/* ---- App Shell ---- */
.app { display: none; flex-direction: column; min-height: 100dvh; }
.app.active { display: flex; }

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header h1 { font-size: 1.125rem; font-weight: 700; }
.header-actions { display: flex; gap: 8px; }

/* Bottom Nav */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
}
.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  font-size: 0.625rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.active { color: var(--orange); }

/* Main content */
.main { flex: 1; padding: 16px 16px 80px; }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.card-title { font-weight: 600; font-size: 1rem; }

/* ---- Status Badges ---- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-quoted { background: var(--blue); color: white; }
.badge-scheduled { background: var(--yellow); color: #000; }
.badge-confirmed { background: var(--orange); color: white; }
.badge-in_progress { background: var(--orange-dim); color: white; }
.badge-completed { background: var(--green); color: white; }
.badge-cancelled { background: var(--red); color: white; }
.badge-pending { background: var(--yellow); color: #000; }
.badge-sent { background: var(--blue); color: white; }
.badge-paid { background: var(--green); color: white; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--orange); color: white; }
.btn-primary:hover { background: var(--orange-dim); text-decoration: none; }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: var(--green-dim); text-decoration: none; }
.btn-outline {
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-outline:hover { border-color: var(--text-dim); text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn-danger { background: var(--red); color: white; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: 0.9375rem;
}
.form-input:focus { border-color: var(--orange); }
select.form-input { appearance: none; cursor: pointer; }

/* ---- Section Headers ---- */
.section-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.section-subtitle {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

/* ---- Today View ---- */
.date-header {
  font-size: 0.875rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.job-card { cursor: pointer; transition: border-color 0.2s; }
.job-card:hover { border-color: var(--orange); }
.job-meta {
  display: flex;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 6px;
}
.job-price { color: var(--green); font-weight: 600; }

/* ---- Calendar View ---- */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}
.cal-header {
  font-size: 0.7rem;
  color: var(--text-dim);
  padding: 8px 0;
  font-weight: 600;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  position: relative;
}
.cal-day:hover { background: var(--surface-2); }
.cal-day.today { background: var(--surface-3); font-weight: 700; }
.cal-day.has-jobs::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  position: absolute;
  bottom: 4px;
}
.cal-day.empty { cursor: default; }
.cal-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.cal-month { font-weight: 600; }

/* ---- Job Detail ---- */
.detail-section { margin-bottom: 20px; }
.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.detail-label { color: var(--text-dim); }
.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  font-size: 0.875rem;
  cursor: pointer;
  margin-bottom: 12px;
}
.back-btn:hover { color: var(--text); }

/* ---- Filter Bar ---- */
.filter-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  white-space: nowrap;
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  transition: all 0.2s;
}
.filter-chip.active {
  background: var(--orange);
  border-color: var(--orange);
  color: white;
}

/* ---- Chat Page ---- */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--bg);
}
.chat-header {
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.chat-header h1 { font-size: 1.125rem; }
.chat-header p { font-size: 0.8rem; color: var(--text-dim); }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9375rem;
  line-height: 1.5;
  animation: msgIn 0.2s ease-out;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg-ai {
  background: var(--surface-2);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.msg-user {
  background: var(--orange);
  color: white;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.msg-system {
  background: var(--green);
  color: white;
  align-self: center;
  text-align: center;
  font-size: 0.875rem;
  border-radius: var(--radius);
}
.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.chat-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 10px 18px;
  color: var(--text);
  font-size: 0.9375rem;
}
.chat-input:focus { border-color: var(--orange); }
.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--orange);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
}
.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: typing 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* ---- Invoice Page ---- */
.invoice-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 20px;
}
.invoice-amount {
  font-size: 3rem;
  font-weight: 700;
  color: var(--green);
}
.invoice-status { font-size: 1.25rem; }
.invoice-details {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  text-align: left;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.3; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px 20px max(24px, env(safe-area-inset-bottom));
  width: 100%;
  max-width: 480px;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ---- Utilities ---- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 0.8rem; }
.text-green { color: var(--green); }
.text-orange { color: var(--orange); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* Google font import */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');
