/* buttons.css - Enhanced Button Styles with Proper Specificity */

/* CRITICAL: Target ALL buttons within widget, not just .btn class */
/* This ensures parent site styles can't override ANY button */

/* Base styles for ALL buttons in widget */
#smartfence-embed-root button,
#smartfence-embed-root input[type="button"],
#smartfence-embed-root input[type="submit"],
#sf-chat-container button,
#sf-chat-container input[type="button"],
#sf-chat-container input[type="submit"] {
  /* Reset parent site styles */
  text-transform: none;
  letter-spacing: normal;
  word-spacing: normal;
  font-style: normal;
  background-image: none;
  text-decoration: none;
  line-height: 1.5;
  font-family: var(--font-family);
}

/* Base Button Styles - Use element+class selectors for higher specificity */
#smartfence-embed-root button.btn,
#smartfence-embed-root a.btn,
#smartfence-embed-root input[type="button"].btn,
#smartfence-embed-root input[type="submit"].btn,
#sf-chat-container button.btn,
#sf-chat-container a.btn,
#sf-chat-container input[type="button"].btn,
#sf-chat-container input[type="submit"].btn { 
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  font-family: var(--font-family);
  background-image: none;
  text-transform: none;
  line-height: 1.5;
  letter-spacing: normal;
  word-spacing: normal;
  font-style: normal;
}

#smartfence-embed-root button.btn:hover,
#smartfence-embed-root a.btn:hover,
#sf-chat-container button.btn:hover,
#sf-chat-container a.btn:hover { 
  transform: translateY(-1px);
}

#smartfence-embed-root button.btn:active,
#smartfence-embed-root a.btn:active,
#sf-chat-container button.btn:active,
#sf-chat-container a.btn:active { 
  transform: translateY(0);
}

/* Primary Send Button */
#smartfence-embed-root button.btn-primary,
#sf-chat-container button.btn-primary { 
  background-color: var(--primary-color);
  color: white;
  padding: 0.75rem;
  min-width: 3rem;
  min-height: 3rem;
  border: 2px solid var(--primary-color);
  box-shadow: 0 3px 12px rgba(37, 99, 235, 0.25);
  background-image: none;
  text-transform: none;
}

#smartfence-embed-root button.btn-primary:hover,
#sf-chat-container button.btn-primary:hover { 
  background-color: white;
  color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
  border-color: var(--primary-color);
}

#smartfence-embed-root button.btn-primary:disabled,
#sf-chat-container button.btn-primary:disabled { 
  background: var(--text-light);
  cursor: not-allowed;
  transform: none;
  opacity: 0.6;
  box-shadow: none;
  border-color: var(--text-light);
}

/* New Chat Button */
#smartfence-embed-root button.btn-secondary,
#sf-chat-container button.btn-secondary { 
  background-color: var(--primary-color);
  color: white;
  border: 2px solid var(--primary-color);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
  transition: all 0.3s ease;
  background-image: none;
  text-transform: none;
}

#smartfence-embed-root button.btn-secondary:hover,
#sf-chat-container button.btn-secondary:hover { 
  background-color: white;
  color: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

#smartfence-embed-root button.btn-secondary:active,
#sf-chat-container button.btn-secondary:active { 
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

/* Voice Button */
#smartfence-embed-root button.btn-voice,
#sf-chat-container button.btn-voice { 
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-tertiary));
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  padding: 0.75rem;
  min-width: 3rem;
  min-height: 3rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-transform: none;
}

#smartfence-embed-root button.btn-voice:hover,
#sf-chat-container button.btn-voice:hover { 
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.3);
}

#smartfence-embed-root button.btn-voice.recording,
#smartfence-embed-root button.btn-voice.listening,
#sf-chat-container button.btn-voice.recording,
#sf-chat-container button.btn-voice.listening { 
  background-color: var(--danger-color);
  color: white;
  border-color: var(--danger-color);
  animation: pulse 1.5s infinite;
}

/* Submit Button */
#smartfence-embed-root button.btn-submit,
#sf-chat-container button.btn-submit { 
  background-color: var(--primary-color);
  color: white;
  border: 2px solid var(--primary-color);
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-image: none;
  text-transform: none;
}

#smartfence-embed-root button.btn-submit:hover,
#sf-chat-container button.btn-submit:hover { 
  background-color: white;
  color: var(--primary-color);
  border-color: var(--primary-color);
}

#smartfence-embed-root button.btn-submit:active,
#sf-chat-container button.btn-submit:active { 
  transform: translateY(1px);
}

#smartfence-embed-root button.btn-submit:disabled,
#sf-chat-container button.btn-submit:disabled { 
  opacity: 0.6;
  cursor: not-allowed;
}

#smartfence-embed-root button.btn-submit:disabled:hover,
#sf-chat-container button.btn-submit:disabled:hover { 
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Submit Number Button */
#smartfence-embed-root button.submit-number-btn { 
  background-color: var(--primary-color);
  color: white;
  border: 2px solid var(--primary-color);
  border-radius: var(--border-radius-sm);
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  background-image: none;
  text-transform: none;
}

#smartfence-embed-root button.submit-number-btn:hover { 
  background-color: white;
  color: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

/* Quick Actions Container */
#smartfence-embed-root .quick-actions,
#sf-chat-container .quick-actions { 
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: none;
  flex-wrap: nowrap;
  position: relative;
  z-index: 9999;
  overflow: visible;
}

#smartfence-embed-root .quick-actions::-webkit-scrollbar,
#sf-chat-container .quick-actions::-webkit-scrollbar { 
  display: none;
}

/* Quick Action Buttons - CRITICAL: These don't have .btn class! */
#smartfence-embed-root button.quick-action,
#sf-chat-container button.quick-action { 
  background-color: var(--primary-color);
  border: 2px solid var(--primary-color);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--border-radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  font-weight: 600;
  flex-shrink: 0;
  position: relative;
  z-index: 9999;
  background-image: none;
  text-transform: none;
  line-height: 1.5;
  letter-spacing: normal;
  word-spacing: normal;
  font-style: normal;
  text-decoration: none;
}

#smartfence-embed-root button.quick-action:hover,
#sf-chat-container button.quick-action:hover { 
  background-color: white;
  color: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  z-index: 99999;
}

#smartfence-embed-root button.quick-action i { 
  font-size: 0.875rem;
  margin-right: 0.25rem;
}

/* Focus States */
#smartfence-embed-root button.btn:focus,
#sf-chat-container button.btn:focus { 
  outline: 3px solid rgba(37, 99, 235, 0.3);
  outline-offset: 2px;
}

#smartfence-embed-root button.btn:focus:not(:focus-visible),
#sf-chat-container button.btn:focus:not(:focus-visible) { 
  outline: none;
}

/* Animations */
#smartfence-embed-root button.btn-primary.has-content,
#sf-chat-container button.btn-primary.has-content { 
  animation: subtle-pulse 2s infinite;
}

@keyframes subtle-pulse {
  0% { 
    box-shadow: 0 3px 12px rgba(37, 99, 235, 0.25);
  }
  50% { 
    box-shadow: 0 3px 12px rgba(37, 99, 235, 0.35), 0 0 20px rgba(37, 99, 235, 0.15);
  }
  100% { 
    box-shadow: 0 3px 12px rgba(37, 99, 235, 0.25);
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  #smartfence-embed-root button.btn-primary,
  #smartfence-embed-root button.btn-voice { 
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0.625rem;
  }
  
  #smartfence-embed-root button.btn-secondary { 
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    flex-shrink: 1;
  }
  
  #smartfence-embed-root .desktop-only { 
    display: none;
  }
  
  #smartfence-embed-root .btn-secondary .btn-text { 
    font-size: 0.75rem;
    font-weight: 600;
  }
}

@media (max-width: 480px) {
  #smartfence-embed-root button.btn-primary,
  #smartfence-embed-root button.btn-voice { 
    padding: 0.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
  }
  
  #smartfence-embed-root button.btn { 
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
  
  #smartfence-embed-root .btn-secondary .btn-text { 
    font-size: 0.7rem;
  }
}

#smartfence-embed-root .desktop-only { 
  display: inline;
}