/* ============================================================
   SpotBot — Stylesheet
   Mobile-first, clean, friendly design
   ============================================================ */

:root {
  --blue-900: #1a365d;
  --blue-700: #2b6cb0;
  --blue-500: #4299e1;
  --blue-100: #ebf8ff;
  --green-500: #48bb78;
  --green-100: #f0fff4;
  --red-500: #fc8181;
  --red-600: #e53e3e;
  --red-100: #fff5f5;
  --yellow-400: #ecc94b;
  --gray-50: #f7fafc;
  --gray-100: #edf2f7;
  --gray-200: #e2e8f0;
  --gray-500: #a0aec0;
  --gray-700: #4a5568;
  --gray-900: #1a202c;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 32px;
}

/* ---- Header ---- */

.header {
  text-align: center;
  padding: 24px 0 8px;
}

.header .logo {
  width: 112px;
  height: 112px;
  margin: 0 auto 8px;
}

.header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--blue-700);
  letter-spacing: -0.5px;
}

.header .tagline {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 2px;
}

/* ---- Back button ---- */

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--blue-700);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 8px;
}

/* ---- View titles ---- */

.view-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--gray-900);
}

.view-subtitle {
  font-size: 0.9rem;
  color: var(--gray-500);
  margin: -12px 0 16px;
}

/* ---- Kid selector grid ---- */

.kid-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.kid-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px;
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.kid-btn:active {
  transform: scale(0.97);
  border-color: var(--blue-500);
  box-shadow: var(--shadow-lg);
}

.kid-btn .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--blue-100);
  color: var(--blue-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.kid-btn .name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gray-900);
}

/* ---- Chore cards ---- */

.chore-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chore-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.chore-card:active {
  transform: scale(0.98);
  border-color: var(--blue-500);
}

.chore-card.completed {
  border-color: var(--green-500);
  background: var(--green-100);
}

.chore-card .chore-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chore-card .chore-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.chore-card .chore-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--gray-100);
  color: var(--gray-700);
}

.chore-card.completed .chore-badge {
  background: var(--green-500);
  color: white;
}

.chore-card .progress-bar {
  margin-top: 12px;
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}

.chore-card .progress-fill {
  height: 100%;
  background: var(--blue-500);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.chore-card.completed .progress-fill {
  background: var(--green-500);
}

/* ---- Chore list (task items) ---- */

.chore-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.chore-item:active {
  transform: scale(0.98);
  border-color: var(--blue-500);
}

.chore-item.completed {
  border-color: var(--green-500);
}

.chore-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.chore-icon.done {
  background: var(--green-500);
  color: white;
}

.chore-icon.pending {
  background: var(--gray-200);
  color: var(--gray-500);
}

.chore-icon.failed {
  background: var(--red-500);
  color: white;
}

.chore-icon.queued {
  background: var(--gray-200);
  color: var(--gray-700);
}

.chore-icon.processing {
  background: var(--yellow-400);
  color: white;
  animation: pulse-processing 1.5s ease-in-out infinite;
}

@keyframes pulse-processing {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.92); }
}

.chore-info {
  flex: 1;
}

.chore-info .cp-name {
  font-weight: 600;
  font-size: 1rem;
}

.chore-info .cp-status {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 2px;
}

.pending-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--blue-700);
}

.chore-ref-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.chore-arrow {
  color: var(--gray-500);
  font-size: 1.1rem;
}

/* ---- Submit view ---- */

.submit-section {
  text-align: center;
}

.reference-box {
  background: var(--blue-100);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}

.reference-box .ref-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--blue-700);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reference-box img {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  border-radius: 8px;
}

.photo-upload-area {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 32px 16px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 16px;
}

.photo-upload-area:hover,
.photo-upload-area.has-photo {
  border-color: var(--blue-500);
  background: var(--blue-100);
}

.photo-upload-area .upload-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.photo-upload-area .upload-text {
  font-size: 0.95rem;
  color: var(--gray-700);
}

.photo-upload-area .upload-hint {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.photo-preview {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 8px;
  margin-bottom: 16px;
}

.submit-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--blue-700);
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.submit-btn:active {
  transform: scale(0.98);
}

.submit-btn:disabled {
  background: var(--gray-200);
  color: var(--gray-500);
  cursor: not-allowed;
}

/* ---- Loading / analyzing ---- */

.analyzing {
  text-align: center;
  padding: 48px 16px;
}

.analyzing .spinner {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  animation: spin 2s linear infinite;
}

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

.analyzing .analyzing-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--blue-700);
}

.analyzing .analyzing-hint {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ---- Result ---- */

.result-card {
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
}

.result-card.pass {
  background: var(--green-100);
  border: 2px solid var(--green-500);
}

.result-card.fail {
  background: var(--red-100);
  border: 2px solid var(--red-500);
}

.result-card.error {
  background: var(--gray-100);
  border: 2px solid var(--gray-500);
}

.result-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}

.result-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.result-card.pass .result-title { color: #276749; }
.result-card.fail .result-title { color: var(--red-600); }

.result-feedback {
  font-size: 0.95rem;
  color: var(--gray-700);
  line-height: 1.5;
}

.result-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.result-actions button {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.btn-retry {
  background: var(--blue-700);
  color: white;
}

.btn-back {
  background: var(--gray-200);
  color: var(--gray-700);
}

/* ---- Hidden views ---- */

.view {
  display: none;
}

.view.active {
  display: block;
}

/* ---- Empty state ---- */

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--gray-500);
}

.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

/* ---- Admin styles (admin.html has its own extras) ---- */

.admin-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--gray-100);
}

.admin-table th {
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

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

.badge.pass { background: var(--green-100); color: #276749; }
.badge.fail { background: var(--red-100); color: var(--red-600); }
.badge.pending { background: var(--gray-100); color: var(--gray-700); }

.btn-sm {
  padding: 4px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: white;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-sm:hover {
  background: var(--gray-100);
}

/* ---- Utilities ---- */

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.85rem; }

/* ---- Admin-specific ---- */

.admin-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.admin-nav button {
  padding: 8px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  background: white;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.admin-nav button.active {
  border-color: var(--blue-700);
  background: var(--blue-100);
  color: var(--blue-700);
}

.submission-photo-thumb {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
}

.ref-upload-form {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.ref-upload-form input[type="file"] {
  font-size: 0.85rem;
}

/* ---- Push notification banner ---- */

.push-banner-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--blue-700);
  font-weight: 600;
  text-align: center;
}

.push-banner-buttons {
  display: flex;
  gap: 8px;
}

.push-banner-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.push-banner-btn.enable {
  background: var(--blue-700);
  color: white;
}

.push-banner-btn.dismiss {
  background: transparent;
  color: var(--gray-500);
}
