/* Four Legs Good - Dog Walker PWA Styles */
/* Red Theme */

:root {
  --primary: #C41E3A;
  --primary-dark: #9A1730;
  --primary-light: #E8394D;
  --secondary: #6B7280;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --background: #FEF7F8;
  --surface: #FFFFFF;
  --text: #1F2937;
  --text-light: #6B7280;
  --border: #E5E7EB;
  --shadow: rgba(196, 30, 58, 0.1);
}

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

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

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

/* Header */
.header {
  background: var(--primary);
  color: white;
  padding: 16px 20px;
  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.25rem;
  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: 20px;
}

.section {
  display: none;
}

.section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Welcome / Name Section */
.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;
}

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

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

.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-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #DC2626;
}

/* Scanner Section */
.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.walker-greeting {
  font-size: 1rem;
  color: var(--text-light);
}

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

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

#qrReader {
  width: 100%;
  height: 100%;
}

#qrReader video {
  border-radius: 16px;
}

.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;
}

/* Confirm Section */
.dog-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 4px 12px var(--shadow);
  margin-bottom: 20px;
}

.dog-photo {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary);
  margin-bottom: 16px;
}

.dog-card h2 {
  font-size: 1rem;
  color: var(--text-light);
  margin-bottom: 8px;
}

.dog-name {
  font-size: 1.75rem;
  color: var(--primary);
  margin-bottom: 8px;
}

.kennel-info {
  color: var(--text-light);
  font-size: 0.875rem;
}

.action-buttons {
  display: flex;
  gap: 12px;
}

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

/* Walking Section */
.walking-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.walking-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--success);
}

.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 1.5s infinite;
}

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

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

.walking-dog-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px var(--shadow);
  margin-bottom: 24px;
}

.walking-dog-photo {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  object-fit: cover;
}

.walking-dog-info h3 {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.walking-dog-info p {
  color: var(--text-light);
  font-size: 0.875rem;
}

/* Walk Actions */
.walk-actions {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px var(--shadow);
}

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

.media-buttons {
  display: flex;
  gap: 12px;
}

.media-btn {
  flex: 1;
  background: var(--background);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.media-btn:hover {
  border-color: var(--primary);
  background: #FEF7F8;
}

.media-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.media-icon {
  font-size: 1.5rem;
}

.media-label {
  font-weight: 600;
  font-size: 0.875rem;
}

.media-count {
  font-size: 0.75rem;
  color: var(--text-light);
}

.media-feedback {
  margin-top: 12px;
  font-size: 0.875rem;
  color: var(--success);
  text-align: center;
  min-height: 20px;
}

/* End Walk */
.end-walk-container {
  text-align: center;
}

.end-walk-hint {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 12px;
}

/* Success Section */
.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;
}

.walk-summary {
  background: var(--background);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}

.walk-summary p {
  margin-bottom: 8px;
  color: var(--text-light);
}

.walk-summary p:last-child {
  margin-bottom: 0;
}

/* 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: 20px;
  color: var(--primary);
}

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

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

/* Recording */
.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;
}

#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.875rem;
  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 {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.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); }
}

#loadingText {
  color: var(--text-light);
}

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

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

/* QR Reader Styles Override */
#qrReader__scan_region {
  background: transparent !important;
}

#qrReader__dashboard_section {
  display: none !important;
}

#qrReader__dashboard_section_csr {
  display: none !important;
}

#qrReader__dashboard_section_swaplink {
  display: none !important;
}

/* Responsive */
@media (max-width: 360px) {
  .header h1 {
    font-size: 1.1rem;
  }
  
  .dog-photo {
    width: 120px;
    height: 120px;
  }
  
  .walk-timer {
    font-size: 1.5rem;
  }
}

/* End Scan Section */
.end-scan-header {
  text-align: center;
  margin-bottom: 20px;
}

.end-scan-header h2 {
  color: var(--primary);
  margin-bottom: 8px;
}

.end-scan-header p {
  color: var(--text-light);
}

#endQrReader {
  width: 100%;
  height: 100%;
}

#endQrReader video {
  border-radius: 16px;
}
