/* Farm Assistant - Floating Chat Widget */

#farm-assistant {
  position: fixed !important;
  bottom: 20px !important;
  right: 20px !important;
  z-index: 100000 !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.assistant-container {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid rgba(96, 165, 250, 0.3);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  width: 380px;
  max-height: 700px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  overflow: hidden;
}

.assistant-container.minimized {
  max-height: 60px;
}

.assistant-container.minimized .assistant-body {
  display: none;
}

.assistant-mascot-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  padding: 4px;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.assistant-container.minimized .assistant-mascot-thumb {
  display: block;
}

.assistant-container:not(.minimized) .assistant-mascot-thumb {
  display: none;
}

.assistant-header {
  background: rgba(96, 165, 250, 0.1);
  border-bottom: 1px solid rgba(96, 165, 250, 0.2);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
  user-select: none;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.assistant-icon {
  display: none;
  font-size: 1.5rem;
}

.header-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.header-text strong {
  color: #f8fafc;
  font-size: 1rem;
}

.header-text small {
  color: #94a3b8;
  font-size: 0.75rem;
}

.minimize-btn {
  background: rgba(148, 163, 184, 0.2);
  border: none;
  color: #f8fafc;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.minimize-btn:hover {
  background: rgba(148, 163, 184, 0.3);
  transform: scale(1.05);
}

.minimize-icon {
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 1;
}

.assistant-body {
  display: flex;
  flex-direction: column;
  height: 640px;
  overflow: hidden;
}

.assistant-container.minimized .assistant-body {
  display: none;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(96, 165, 250, 0.3);
  border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(96, 165, 250, 0.5);
}

/* Mascot welcome section */
.mascot-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 12px;
  margin-bottom: 1rem;
  text-align: center;
}

.mascot-image {
  width: 90%;
  max-width: 320px;
  height: auto;
  object-fit: contain;
  margin-bottom: 1rem;
  border-radius: 16px;
  padding: 0.5rem;
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.6), 0 0 60px rgba(16, 185, 129, 0.3);
}

.welcome-text {
  color: #f8fafc;
}

.welcome-text strong {
  display: block;
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  color: #60a5fa;
}

.welcome-text .love-to-help {
  color: #10b981;
  font-size: 1rem;
  margin-top: -0.5rem;
}

.welcome-text ul {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0;
  text-align: left;
  display: inline-block;
}

.welcome-text li {
  padding: 0.25rem 0;
  color: #cbd5e1;
  font-size: 0.875rem;
}

.welcome-text li::before {
  content: "→ ";
  color: #60a5fa;
  font-weight: bold;
}

.message {
  display: flex;
  gap: 0.75rem;
  animation: fadeIn 0.3s ease;
}

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

.message-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 50%;
  color: white;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.user-message .message-avatar {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.message-content {
  flex: 1;
  background: rgba(30, 41, 59, 0.8);
  padding: 0.875rem;
  border-radius: 12px;
  color: #f8fafc;
  font-size: 0.875rem;
  line-height: 1.5;
}

.user-message .message-content {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.assistant-message .message-content {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.message-content strong {
  color: #60a5fa;
}

.message-content ul {
  margin: 0.5rem 0 0 0;
  padding-left: 1.25rem;
}

.message-content li {
  margin: 0.25rem 0;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.action-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.action-btn.primary {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.action-btn.primary:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.chat-input-container {
  padding: 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  display: flex;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.8);
}

#assistantInput {
  flex: 1;
  background: rgba(30, 41, 59, 0.8);
  border: 2px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: #f8fafc;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
}

#assistantInput:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#assistantInput::placeholder {
  color: #64748b;
}

.send-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 1.25rem;
  font-weight: bold;
}

.send-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.send-btn:active {
  transform: translateY(0);
}

/* Voice button */
.voice-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 1.25rem;
}

.voice-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.voice-btn:active {
  transform: translateY(0);
}

.voice-btn.listening {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
}

.voice-icon {
  display: block;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  #farm-assistant {
    bottom: 10px;
    right: 10px;
    left: 10px;
  }

  .assistant-container {
    width: 100%;
    max-width: 100%;
  }
}

/* Tablet optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
  .assistant-container {
    width: 360px;
  }
}

/* Desktop large screens */
@media (min-width: 1400px) {
  .assistant-container {
    width: 420px;
    max-height: 700px;
  }

  .assistant-body {
    height: 640px;
  }
}

/* Accessibility */
.send-btn:focus,
.minimize-btn:focus,
.action-btn:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Loading state */
.message-content.loading::after {
  content: '...';
  animation: ellipsis 1.5s infinite;
}

@keyframes ellipsis {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Info Popup Styles - Child-Friendly Large Display */
#assistant-info-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999999 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

#assistant-info-popup .popup-content {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 24px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  border: 3px solid #10b981;
}

.popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(239, 68, 68, 0.2);
  border: none;
  color: #ef4444;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.popup-close:hover {
  background: rgba(239, 68, 68, 0.3);
  transform: scale(1.1);
}

.popup-header {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  padding: 24px 32px;
  border-radius: 21px 21px 0 0;
  color: white !important;
}

.popup-header h2 {
  margin: 0;
  color: white !important;
  font-size: 32px;
  font-weight: bold;
  text-align: center;
}

.popup-body {
  padding: 32px;
}

/* Big Info Display */
.big-info {
  display: flex;
  gap: 24px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.info-item {
  text-align: center;
  background: rgba(96, 165, 250, 0.1);
  padding: 24px;
  border-radius: 16px;
  min-width: 200px;
}

.info-icon {
  font-size: 64px;
  margin-bottom: 12px;
}

.info-label {
  color: #94a3b8;
  font-size: 20px;
  margin-bottom: 8px;
  font-weight: 600;
}

.info-value {
  color: #f8fafc;
  font-size: 48px;
  font-weight: bold;
}

.status-message {
  text-align: center;
  padding: 16px;
  border-radius: 12px;
  font-size: 24px;
  font-weight: bold;
  margin-top: 16px;
}

.status-message.success {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.status-message.warning {
  background: rgba(251, 146, 60, 0.2);
  color: #fb923c;
}

.status-message.ok {
  background: rgba(96, 165, 250, 0.2);
  color: #60a5fa;
}

/* Harvest List Display */
.harvest-list, .location-list, .crop-info {
  text-align: center;
  padding: 24px;
}

.harvest-icon, .location-icon, .crop-icon {
  font-size: 80px;
  margin-bottom: 20px;
}

.harvest-text, .location-text, .crop-text {
  color: #f8fafc;
}

.harvest-message, .location-message, .crop-message {
  font-size: 28px;
  margin-bottom: 16px;
  color: #94a3b8;
}

.harvest-crops, .crop-details {
  font-size: 36px;
  font-weight: bold;
  color: #10b981;
  margin-bottom: 16px;
  line-height: 1.3;
}

.harvest-count, .crop-locations {
  font-size: 24px;
  color: #cbd5e1;
}

.location-item {
  font-size: 28px;
  margin: 12px 0;
  color: #f8fafc;
}

.location-hint {
  font-size: 20px;
  color: #fbbf24;
  margin-top: 20px;
  font-style: italic;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.popup-fadeout {
  animation: fadeOut 0.3s ease;
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Joke/Riddle Display */
.joke-display {
  text-align: center;
  padding: 2rem;
}

.joke-icon {
  font-size: 80px;
  margin-bottom: 1.5rem;
}

.joke-text {
  color: #f8fafc;
}

.joke-question {
  font-size: 28px;
  font-weight: bold;
  color: #fbbf24;
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

.joke-answer {
  font-size: 32px;
  font-weight: bold;
  color: #10b981;
  margin-top: 1rem;
  line-height: 1.3;
}

/* Example Query Buttons */
.example-queries {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.example-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.example-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.example-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
}

/* Large Popup Overlay for Jokes, Riddles, and Fun Facts */
.assistant-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 2rem;
  animation: fadeIn 0.3s ease;
  opacity: 1;
  transition: opacity 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.assistant-popup {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 3px solid rgba(96, 165, 250, 0.4);
  border-radius: 24px;
  padding: 3rem;
  width: 66.666vw;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
  animation: popupSlideLeft 0.4s ease;
  margin-right: 450px;
}

@keyframes popupSlideLeft {
  from {
    transform: translateX(-50px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.assistant-popup-header {
  font-size: 32px;
  font-weight: bold;
  color: #ffffff;
  text-align: center;
  margin-bottom: 2rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.assistant-popup-content {
  color: #f8fafc;
  font-size: 20px;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.assistant-popup-close {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.assistant-popup-close:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5);
}

/* Scrollbar for popup content */
.assistant-popup::-webkit-scrollbar {
  width: 10px;
}

.assistant-popup::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 5px;
}

.assistant-popup::-webkit-scrollbar-thumb {
  background: rgba(96, 165, 250, 0.4);
  border-radius: 5px;
}

.assistant-popup::-webkit-scrollbar-thumb:hover {
  background: rgba(96, 165, 250, 0.6);
}

/* Joke/Riddle Display Styles */
.joke-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 1rem;
}

.joke-icon {
  font-size: 80px;
  line-height: 1;
  animation: bounce 1s ease infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.joke-text {
  width: 100%;
  text-align: center;
}

.joke-question {
  font-size: 28px;
  color: #fbbf24;
  font-weight: 600;
  margin: 0 0 1.5rem 0;
  line-height: 1.4;
}

.joke-answer {
  font-size: 24px;
  color: #10b981;
  font-weight: 500;
  margin: 0;
  line-height: 1.4;
}

/* Big Info Display (Weather, etc.) */
.big-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.info-icon {
  font-size: 64px;
  line-height: 1;
}

.info-label {
  font-size: 18px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

.info-value {
  font-size: 48px;
  font-weight: bold;
  color: #60a5fa;
  line-height: 1;
}

.status-message {
  text-align: center;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-size: 22px;
  font-weight: 600;
  margin-top: 1rem;
}

.status-message.success {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 2px solid rgba(16, 185, 129, 0.4);
}

.status-message.warning {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  border: 2px solid rgba(251, 191, 36, 0.4);
}

.status-message.ok {
  background: rgba(96, 165, 250, 0.2);
  color: #60a5fa;
  border: 2px solid rgba(96, 165, 250, 0.4);
}
