/* Four Legs Good - Volunteer PWA Styles */
/* Green Theme with 4LG Design System */

:root {
  /* 4LG Brand Colors */
  --amber: #C4753B;
  --teal: #2A7F7F;
  --charcoal: #2C2825;
  --cream: #F7F5F3;
  
  /* Volunteer App Accent - Green */
  --primary: #22804A;
  --primary-dark: #1A6339;
  --primary-light: #2E9D5C;
  
  /* Semantic Colors */
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  
  /* Surfaces */
  --background: var(--cream);
  --surface: #FFFFFF;
  --text: var(--charcoal);
  --text-light: #6B7280;
  --border: #E5E7EB;
  --shadow: rgba(44, 40, 37, 0.1);
  
  /* Behavior Button Colors */
  --behavior-green: #22C55E;
  --behavior-red: #EF4444;
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: var(--primary);
  color: white;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px var(--shadow);
}

.header h1 {
  font-size: 1.2rem;
  font-weight: 600;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  opacity: 0.9;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.status-dot.offline {
  background: var(--warning);
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.section {
  display: none;
}

.section.active {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Welcome Section */
.welcome-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 2px 8px var(--shadow);
}

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

.change-name-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: underline;
}

/* Home Grid - 2x2 */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1;
}

.home-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 20px;
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px var(--shadow);
  min-height: 140px;
}

.home-btn:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--shadow);
}

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

.btn-emoji {
  font-size: 3rem;
}

.btn-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  font-family: 'DM Sans', sans-serif;
}

/* Welcome Card */
.welcome-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 4px 12px var(--shadow);
}

.welcome-card h2 {
  font-size: 1.75rem;
  margin-bottom: 8px;
  color: var(--primary);
}

.welcome-card p {
  color: var(--text-light);
  margin-bottom: 24px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.input-group input {
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  text-align: center;
  transition: border-color 0.2s;
  font-family: 'DM Sans', sans-serif;
}

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

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

.module-header h2 {
  font-size: 1.2rem;
  color: var(--primary);
}

.back-btn {
  background: var(--border);
  border: none;
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 16px;
  font-family: 'DM Sans', sans-serif;
}

.back-btn:hover {
  background: #D1D5DB;
}

/* Buttons */
.btn {
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'DM Sans', sans-serif;
}

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

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

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

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

.btn-secondary:hover {
  background: #D1D5DB;
}

.btn-amber {
  background: var(--amber);
  color: white;
}

.btn-teal {
  background: var(--teal);
  color: white;
}

/* Scanner */
.scanner-container {
  position: relative;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 1;
  margin-bottom: 12px;
}

.scanner-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 3rem;
}

.scanner-placeholder p {
  font-size: 1rem;
  margin-top: 8px;
}

.scan-hint {
  text-align: center;
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

/* Activity Cards - Compact for 1.2 visible */
.activity-cards-container {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 80px;
}

.activity-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px var(--shadow);
  border-left: 5px solid var(--primary);
}

.card-top-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.card-photo {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  border: 3px solid var(--primary);
}

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

.card-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  font-family: 'Fraunces', serif;
}

.card-id {
  font-weight: 500;
  color: var(--text-light);
  font-size: 0.9rem;
}

.card-meta {
  font-size: 0.9rem;
  color: var(--text-light);
}

.card-timer {
  font-weight: 700;
  color: var(--primary);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

/* Card Action Buttons Row */
.card-actions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.card-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 10px;
  background: var(--background);
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'DM Sans', sans-serif;
}

.card-btn:hover:not(:disabled) {
  border-color: var(--primary);
}

.card-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.card-btn.has-content {
  border-color: var(--success);
  background: #ECFDF5;
}

/* Small V/P/B buttons */
.card-btn-small {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 1.1rem;
  flex: 0 0 auto;
}

/* Behavior button colors */
.behavior-btn {
  font-weight: 700;
}

.behavior-btn.behavior-green {
  background: var(--behavior-green);
  color: white;
  border-color: var(--behavior-green);
}

.behavior-btn.behavior-red {
  background: var(--behavior-red);
  color: white;
  border-color: var(--behavior-red);
}

/* Bathroom Section - Compact */
.card-bathroom-section {
  background: var(--background);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
}

.bathroom-row {
  margin-bottom: 12px;
}

.bathroom-row:last-child {
  margin-bottom: 0;
}

.bathroom-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.radio-pills {
  display: flex;
  gap: 8px;
}

.radio-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  flex: 1;
  text-align: center;
  font-family: 'DM Sans', sans-serif;
}

.radio-pill input[type="radio"] {
  display: none;
}

.radio-pill.selected,
.radio-pill:has(input:checked) {
  background: #D1FAE5;
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 700;
}

/* Defecate 2x2 Grid */
.defecate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* End Session Button */
.btn-end-session {
  width: 100%;
  padding: 14px 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}

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

/* Add Another Button */
.add-btn-container {
  padding: 8px 0 16px;
  display: flex;
  justify-content: center;
}

.add-btn {
  width: 100%;
  padding: 14px 20px;
  font-size: 1.1rem;
}

/* Search Section */
.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search-box input {
  flex: 1;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  font-family: 'DM Sans', sans-serif;
}

.search-box input:focus {
  border-color: var(--primary);
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.animal-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  gap: 14px;
  align-items: center;
  box-shadow: 0 2px 8px var(--shadow);
  cursor: pointer;
  transition: transform 0.2s;
  border-left: 4px solid var(--primary);
}

.animal-card:hover {
  transform: translateY(-2px);
}

.animal-card img {
  width: 70px;
  height: 70px;
  border-radius: 10px;
  object-fit: cover;
}

.animal-card .info h4 {
  font-size: 1.1rem;
  margin-bottom: 4px;
  color: var(--primary);
  font-family: 'Fraunces', serif;
}

.animal-card .info p {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Behavior Recorder */
.recorder-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 0;
}

.btn-record {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 6px 25px rgba(34, 128, 74, 0.4);
}

.btn-record:hover {
  transform: scale(1.05);
}

.btn-record.recording {
  background: var(--danger);
  animation: recordPulse 2s infinite;
}

@keyframes recordPulse {
  0%, 100% { box-shadow: 0 6px 25px rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 6px 40px rgba(239, 68, 68, 0.6); }
}

.record-icon {
  font-size: 2.8rem;
}

.record-text {
  font-size: 0.85rem;
  font-weight: 500;
}

/* Questions Panel */
.questions-panel {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px var(--shadow);
}

.questions-panel h3 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: var(--primary);
}

.questions-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.questions-list li {
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 10px 12px;
  background: var(--background);
  border-radius: 8px;
}

.q-num {
  display: inline-block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 0.75rem;
  border-radius: 50%;
  margin-right: 8px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--surface);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.modal-content h3 {
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 1.25rem;
}

.modal-animal-name {
  font-size: 1rem;
  color: var(--text-light);
  margin-bottom: 16px;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.modal-buttons .btn {
  flex: 1;
}

/* Recording Indicator */
.recording-indicator {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  color: var(--danger);
}

.recording-indicator.active {
  display: flex;
}

.recording-indicator .pulse {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.1); }
}

#recordingTime {
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.transcript-preview {
  margin-top: 16px;
  padding: 12px;
  background: var(--background);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--text-light);
  min-height: 40px;
}

/* Photo */
.photo-preview-container {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4/3;
}

#photoPreview, .captured-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Loading */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  z-index: 300;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Offline Queue */
.offline-queue {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--warning);
  color: white;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.offline-queue.visible {
  display: flex;
  gap: 8px;
}

/* Success Card */
.success-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 4px 12px var(--shadow);
}

.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  font-size: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.success-card h2 {
  font-size: 1.5rem;
  color: var(--success);
  margin-bottom: 16px;
}

/* QR Reader Override */
#qrReader video, #endQrReader video {
  border-radius: 16px;
}

#qrReader__dashboard_section,
#qrReader__dashboard_section_csr,
#qrReader__dashboard_section_swaplink,
#endQrReader__dashboard_section {
  display: none !important;
}

/* Responsive */
@media (max-width: 360px) {
  .home-btn {
    padding: 24px 16px;
    min-height: 120px;
  }
  
  .btn-emoji {
    font-size: 2.5rem;
  }
  
  .card-photo {
    width: 70px;
    height: 70px;
  }
}
